algorithm - VHDL - Shift operation of N times with concatenation -


i know how can shift operation in vhdl if have 2 inputs, 1 input, data1 number (std_logic_vector), , second input data2 represents number of times want shift first input. example, if must shift left 1 time, code is

outalu <= '0' & data1(n-1 downto 1); 

if shift data2 times, right writing:

for in 0 data2 loop   outalu <= '0' & data1(n-1 downto 1);   data1 <= outalu end loop; 

is right? must define signals , assign these signals data1 , data2? thank help

what seek barrel-shifter. can this:

outalu <= std_logic_vector(shift_left(unsigned(data1),  to_integer(unsigned(data2)))); -- shift left outalu <= std_logic_vector(shift_left(unsigned(data1),  to_integer(unsigned(data2)))); -- shift right outalu <= std_logic_vector(shift_left(  signed(data1),  to_integer(unsigned(data2)))); -- arithmetic shift left outalu <= std_logic_vector(shift_left(  signed(data1),  to_integer(unsigned(data2)))); -- arithmetic shift right 

this implies use ieee.numeric_std.all' , thatdata1anddata2` std_logic_vector, casts.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -