I got this error message
Code:
# ** Error: 16bitshift.vhd(17): Illegal type conversion from std_logic_vector to integer (array to numeric).
# ** Error: 16bitshift.vhd(19): No feasible entries for infix operator "sll".
# ** Error: 16bitshift.vhd(19): Bad right hand side (infix expression) in variable assignment.
# ** Error: 16bitshift.vhd(23): Unknown identifier 'conv'.
# ** Error: 16bitshift.vhd(24): VHDL Compiler exiting
while executing this code
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);
VARIABLE y : integer range 0 to 15;
BEGIN
y := integer(S);
x := DIN;
x := x sll y;
RETURN x;
END shift;
BEGIN
DOUT <=conv(DIN,S);
END b16_arch;
So, i got two question for you
1. How do I convert S into an integer?
2. How do I use the operand sll properly? Doing a loop with sll in it S times? Or can I do x sll 5 for example? and how do I get the result into the variable?
thanks for your reply
Bookmarks