我正在製作一個接收32位輸入和7位控制輸入的組件。這是什麼成分做的是,它着眼於S的最後2位和'sra'在VHDL中不工作
- S = 00,但它留下了INP
- S = 01邏輯移位,它邏輯右移上INP
- S = 10,但它確實算術右移在InP上
- S = 11,但它確實在InP上向右旋轉
中位移的量/數由S的前5位例如決定如果S=0001001
,那麼輸入必須邏輯移位d右2個地方。以下是我的代碼。
的問題在「SRA」,其中以下錯誤表明了未來發現經營者「SRA」的「0」的定義,不能確定爲「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工作正常。儘管如此,如果我把該代碼,它顯示語法錯誤。 –