我正在制作一个接收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工作正常。尽管如此,如果我把该代码,它显示语法错误。 –