我有一个关于在 if 语句中使用 for 循环的问题。if 语句在流程语句中。问题是当我执行这部分代码时,for循环被执行但只执行一次,而不管B的值如何。我什至尝试输入显式值并忽略B,但循环只执行一次。我错过了什么吗?
该代码是 ALU 行为模型的一部分,用于在不使用 sll 的情况下应用逻辑左移。
elsif ALU_Control = "100" then
-- implement shift logic left by B units
if (B > X"00000000") then
-- Use value of B input as the shift position
shift_value := TO_INTEGER(UNSIGNED(B));
-- concatenate a 0 to end of A
for index in 0 to shift_value loop
temp_A := (A(30 downto 0) & '0');
end loop;
ALU_out <= temp_A(31 downto 0) after 100 ps;
else
ALU_out <= A after 100 ps;
end if;