Well, to put it plainly, I really suck at vhdl. I need to program a 16 bit b
arrelshifter with the following specifactions:
-> shifts left, inserts zeros on the right -- realized with command sll
-> S is a 4 bit input signal that dictates the amount of places the 16 bit s
ignal needs to shift.
I had the following:
but that doesn't work thanks to the command integer(S) and sll. I tried all
kinds of loops, but my java experience is probably making me do all kinds of
weird things with the syntax. Please help me out!
arrelshifter with the following specifactions:
-> shifts left, inserts zeros on the right -- realized with command sll
-> S is a 4 bit input signal that dictates the amount of places the 16 bit s
ignal needs to shift.
I had the following:
Code:
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
entity b16 IS
PORT (
DIN: in STD_LOGIC_VECTOR(15 downto 0); -- input
S: in STD_LOGIC_VECTOR (3 downto 0); -- Shift amount, 0-15
DOUT: out STD_LOGIC_VECTOR(15 downto 0) -- output
);
END b16;
architecture b16_arch of b16 is
FUNCTION shift (DIN:std_logic_vector; S:std_logic_vector) RETURN std_logic_
vector IS
VARIABLE x : std_logic_vector(15 downto 0);
BEGIN
x := DIN;
x sll integer(S);
RETURN x;
END shift;
BEGIN
DOUT <=conv(DIN,S);
END b16_arch;
but that doesn't work thanks to the command integer(S) and sll. I tried all
kinds of loops, but my java experience is probably making me do all kinds of
weird things with the syntax. Please help me out!