Altera_Forum
Honored Contributor
9 years agoShift constant by variable amount
For some reason, I can't get this to work. I want to logically shift left the 8-bit number 1 (x"01") by a variable amount (named counter between 0 and 7) and store as an inverted std_logic_vector. Nothing I try is working with the compiler.
None of these work and I've tried many additional variants and conversions: leds_w <= NOT (STD_LOGIC_VECTOR(2 ** counter)); leds_w <= NOT (STD_LOGIC_VECTOR(1 SLL TO_INTEGER(counter))); leds_w <= NOT (STD_LOGIC_VECTOR(shift_left(x"01", counter))); I have 1164 and numeric_std libraries referenced. counter is currently type unsigned, but I can change that if necessary. Help! Steve