Data_Int<='0' & Data_Int(7 downto 1); --if shift then shift it right
How is concatenation used to shift a position? I thought there is a shift right operator in VHDL. Can someone please explain this to me?
Suppose
Data_Int : std_vector(10 downto 0);
-- and Data_Int 开发者_运维技巧has "1010010011"
Thank you very much.
The shift operators (sll, srl, sla, sra, rol, and ror) are not provided in VHDL-87, so you'll see a lot of code explicitly shifting using concatenation and partial arrays. A more universal method of writing your above shift (which would work with various array sizes) would be:
Data_Shift <= '0' & Data_Int(data_Int'left downto Data_Int'right+1);
The concatenation provides a shift since you're dropping one bit (bit 0 in this case) and replacing it on the high-order side with something else (a logical zero here, although you could also shift in a logical 1, sign-extend, etc).
精彩评论