所以,我正在为 MIPS 架构开发一个 ALU,我正在尝试进行左移和右移,以便 ALU 可以移动任意数量的位。
我的想法是将移位值转换为整数并选择将出现在结果中的条目部分(整数存储在 X 中),但 Quartus 不接受变量值,只接受常量。
我能做些什么来做到这一点?(案例在 "WHEN "1000" =>..." 和 "WHEN "1001" =>..." 行)
谢谢。
PROCESS ( ALU_ctl, Ainput, Binput, X )
BEGIN
-- Select ALU operation
--ALU_output_mux <= X"00000000"; --padrao
CASE ALU_ctl IS
WHEN "1000" => ALU_output_mux(31 DOWNTO X) <= (Ainput( 31-X DOWNTO 0 ));
WHEN "1001" => ALU_output_mux(31-X DOWNTO 0) <= (Ainput( 31 DOWNTO X ));
WHEN OTHERS => ALU_output_mux <= X"00000000";
END CASE;
END PROCESS;