Friday, February 15, 2013

VHDL shifters (reference)

This post is just for my personal reference later and likely will be of no interest to anyone.

I am writing this here because I consistently mess these up.

To shift a logic vector left (throwing away top bit):

counter(15 downto 0) <= counter(14 downto 0) & '0';

To shift a logic vector right (throwing away bottom bit):

counter(15 downto 0) <= '0' & counter(15 downto 1);

No comments:

Post a Comment