I am trying to bitshift a std_logic_vector, but no matter what I try, I always get an error.
I I have tried to use srl and also shift_right, which I read is safer to use. Both of them are not accepted by the compiler or at least I am making a syntax error, that I can't find. I also tried to cast the result to std_logic_vector.
library IEEE;
use IEEE.std_logic_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity EXAMPLE is
port(
VOL_LEVEL : in integer range 1 to 10; -- from AUDIO_VOL
LED_OUT : out std_logic_vector(9 downto 0)
);
end entity EXAMPLE;
architecture BEHAVIOUR of EXAMPLE is
type STATES is (S_SET_VOL);
signal STATE, NEXT_STATE : STATES;
EXAMPLE: process(VOL_LEVEL)
begin
case STATE is
when S_SET_VOL =>
LED_OUT <= ("1111111111") srl (10-VOL_LEVEL) after 2 ns;
-- Type error resolving infix expression "srl" as type ieee.std_logic_1164.STD_LOGIC_VECTOR.
LED_OUT <= shift_right(unsigned("1111111111"), 10-VOL_LEVEL) after 2 ns;
-- No feasible entries for subprogram "SHIFT_RIGHT".
LED_OUT <= std_logic_vector(shift_right(unsigned("1111111111"), 10-VOL_LEVEL)) after 2 ns;
-- Type conversion (to UNSIGNED) cannot have string literal operand.
end process EXAMPLE;
end BEHAVIOUR;