Я делаю компонент, который принимает входные 32 бит и управляющий вход 7 бит. Что этот компонент делает то, что он смотрит на последние 2 бита S и'sra' не работает в VHDL
- S = 00, это логический сдвиг влево на вх
- S = 01, он делает логический сдвиг вправо на вх
- S = 10, он делает арифметический сдвиг вправо на INP
- S = 11, он делает повернуть право на INP
количество/число смен решает первые 5 битов S. Например, если S=0001001
, тогда вход должен быть логически shifte d справа на 2 места. Ниже мой код. Проблема приходит в «SRA», где следующая ошибка показывает вверх:
нашел определения «0» оператора «SRA», не может определить точный перегруженное определение соответствия для «SRA» Моего кода:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity barrelshifter is
port(
clk : in std_logic;
inp : in unsigned (31 downto 0):= (others => '0');
s : in unsigned (6 downto 0);
outp : out unsigned (31 downto 0)
);
end barrelshifter;
architecture Behavioral of barrelshifter is
signal samt : unsigned (4 downto 0);
signal stype : unsigned (1 downto 0);
signal inp1 : unsigned (31 downto 0);
begin
samt <= s(6 downto 2);
stype <= s(1 downto 0);
inp1 <= inp;
process(clk)
begin
if stype = "00" then
outp <= inp sll to_integer(samt);
end if;
if stype = "01" then
outp <= inp srl to_integer(samt);
end if;
if stype = "10" then
outp <= inp sra to_integer(samt);
end if;
if stype = "11" then
outp <= inp ror to_integer(samt);
end if;
end process;
end Behavioral;
sll работает нормально. Тем не менее, если я помещаю этот код, он показывает синтаксическую ошибку. –