MIPS上的左移逻辑和右移逻辑

MIPS上的左移逻辑和右移逻辑,mips,vhdl,Mips,Vhdl,有人能告诉我这是MIPS上左移位逻辑(sll)和右移位逻辑(srl)的正确代码吗 IEEE库; 使用IEEE.STD_LOGIC_1164.all; 使用IEEE.STD_LOGIC_ARITH.all; 使用IEEE.STD_LOGIC_UNSIGNED.all; ----如果正在实例化,请取消对以下库声明的注释 ----此代码中的任何Xilinx原语。 --UNISIM图书馆; --使用UNISIM.VComponents.all; 实体ALU是 端口(RdData1:std_逻辑_向量(3

有人能告诉我这是MIPS上左移位逻辑(sll)和右移位逻辑(srl)的正确代码吗

IEEE库;
使用IEEE.STD_LOGIC_1164.all;
使用IEEE.STD_LOGIC_ARITH.all;
使用IEEE.STD_LOGIC_UNSIGNED.all;
----如果正在实例化,请取消对以下库声明的注释
----此代码中的任何Xilinx原语。
--UNISIM图书馆;
--使用UNISIM.VComponents.all;
实体ALU是
端口(RdData1:std_逻辑_向量(31到0);
RdData2:std_逻辑_向量中(31向下至0);
FAddr:标准逻辑向量(15到0);
ALUSrc:标准逻辑中;
在标准逻辑向量(2到0)中--S-a marit lungimea lui-ALUOP
Y:输出标准逻辑向量(31到0);
末端ALU;
ALU的体系结构是
信号SEAddr:std_逻辑_向量(31向下至0);
信号OP2:std_逻辑_向量(31向下至0);
开始

上述代码中的SEAddr(15向下到0)被声明为
std\u逻辑向量(31向下到0)
对于SRL,
RdData1
用作
RdData1(1到31)
。这将创建一个空值 范围,这将导致刀具警告

必须将其更正为
RdData1(31降为1)


这里可以看到SLL和SRL的指令定义。

我需要在mips上实现右移逻辑和左移逻辑,alu是执行此操作还是必须制作移位寄存器?alu显然是实现此操作的地方,但您需要包括移位量(SHMT)因此,右移或左移的数量是可变的,而不仅仅是您当前代码中的一个。我所需要的是将我的数字移动为1,这就是为什么我的SHMT不包括在内。有人知道上面的CTRL代码中是否正确实现了SLR和SLL吗?
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_ARITH.all;
use IEEE.STD_LOGIC_UNSIGNED.all;

---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
-- library UNISIM;
-- use UNISIM.VComponents.all;

entity ALU is
  port (RdData1 : in  std_logic_vector (31 downto 0);
        RdData2 : in  std_logic_vector (31 downto 0);
        FAddr   : in  std_logic_vector (15 downto 0);
        ALUSrc  : in  std_logic;
        ALUOP   : in  std_logic_vector (2 downto 0);  --S-a marit lungimea lui ALUOP
        Y       : out std_logic_vector (31 downto 0));
end ALU;

architecture Behavioral of ALU is

  signal SEAddr : std_logic_vector(31 downto 0);
  signal OP2    : std_logic_vector(31 downto 0);

begin

  SEAddr(15 downto 0)  <= FAddr(15 downto 0);
  SEAddr(31 downto 16) <= x"0000" when FAddr(15) = '0' else x"FFFF";

  OP2 <= RdData2 when ALUSrc = '0' else SEAddr;

  with ALUOP select
    Y <= RdData1 + OP2 when "000",               --S-a marit lungimea lui ALUOP
         RdData1 - OP2              when "001",  --S-a marit lungimea lui ALUOP
         RdData1 and OP2            when "010",  --S-a marit lungimea lui ALUOP
         RdData1 or OP2             when "011",  --S-a marit lungimea lui ALUOP
         RdData1(30 downto 0) & "0" when "100",  --sll ,
         "0" & RdData1(1 downto 31) when "101",  --srl ,
         RdData1                    when others;

end Behavioral;
entity ctrl is
Port ( OP : in  STD_LOGIC_VECTOR (5 downto 0);
       Funct : in  STD_LOGIC_VECTOR (5 downto 0);
       ALUSrc : out  STD_LOGIC;
       ALUOP : out  STD_LOGIC_VECTOR (2 downto 0);--S-a marit lungimea lui ALUOP 
       MemWr : out  STD_LOGIC;
       Mem2Reg : out  STD_LOGIC;
       RegWr : out  STD_LOGIC;
       RegDest : out  STD_LOGIC);
end ctrl;

architecture Behavioral of ctrl is
signal OPCIntrn :   std_logic_vector(6 downto 0);
signal temp         :   std_logic_vector(7 downto 0); 

begin
with OP select
OPCIntrn (6) <= '0' when "000000",
    '1' when others;

with OP select
OPCIntrn (5 downto 0) <= Funct when "000000",
OP when others;

with OPCIntrn select
temp <=         b"0_000_0_0_1_1" when b"010_0000",  --add
        b"0_001_0_0_1_1" when b"010_0010",   --sub
        b"0_010_0_0_1_1" when b"010_0100",   --and
        b"0_011_0_0_1_1" when b"010_0101",   --or
        b"1_000_0_1_1_0" when b"110_0011",   --lw
        b"0_100_0_0_1_1" when b"000_0000",   --sll
        b"0_101_0_0_1_1" when b"000_0010",   --sll
        b"1_000_1_0_0_0" when b"110_1011",   --sw
        b"0_000_0_0_0_0" when others;


RegDest <= temp(0);
RegWr <= temp(1);
Mem2Reg <= temp(2);
MemWr <= temp(3);
ALUOP (2 downto 0) <= temp(6 downto 4);  
ALUSrc <= temp(7);


end Behavioral;