If statement 如何在VHDL中正确嵌套if语句 过程(位1,位2,j) 开始 如果j='1',则 如果(位1='1'和位2='1'),则 你的if语句不是问题所在。编译器可能对if块的嵌套深度有实际限制,但该限制肯定比3级略高

If statement 如何在VHDL中正确嵌套if语句 过程(位1,位2,j) 开始 如果j='1',则 如果(位1='1'和位2='1'),则 你的if语句不是问题所在。编译器可能对if块的嵌套深度有实际限制,但该限制肯定比3级略高,if-statement,nested,vhdl,If Statement,Nested,Vhdl,正如Martin提到的,您引用了一个名为“g”的信号,该信号用作组合逻辑的输入,但未列在灵敏度列表中。这通常被报告为警告,而不是错误。在它所处的状态下,当“g”上有事件时,大多数模拟器不会执行该进程。这可能会导致未初始化的值。请根据if嵌套缩进代码。此处,流程敏感度列表中仅缺少流程g。 process (bit1,bit2,j) begin if j = '1' then if (bit1 = '1' and bit2 = '1') then V <= '1' xor g; bit3 &

正如Martin提到的,您引用了一个名为“g”的信号,该信号用作组合逻辑的输入,但未列在灵敏度列表中。这通常被报告为警告,而不是错误。在它所处的状态下,当“g”上有事件时,大多数模拟器不会执行该进程。这可能会导致未初始化的值。

请根据if嵌套缩进代码。此处,流程敏感度列表中仅缺少流程
g
process (bit1,bit2,j)
begin
if j = '1' then

if (bit1 = '1' and bit2 = '1') then
V <= '1' xor g;
bit3 <= '1' xor g;
elsif (bit1 = '1' and bit2 = '0') then
V <= '0' xor g;
bit3 <= '0' xor g;
elsif (bit1 = '0' and bit2 = '0') then
V <= '1' xor g;
bit3 <= '1' xor g;
elsif (bit1 = '0' and bit2 = '1') then
V <= '0' xor g;
bit3 <= '0' xor g;
end if;

else

if j = '0' then

if (bit1 = '1' and bit2 = '1') then
V <= '0' xor g;
bit3 <= '0' xor g;
elsif (bit1 = '1' and bit2 = '0') then
V <= '1' xor g;
bit3 <= '1' xor g;
elsif (bit1 = '0' and bit2 = '0') then
V <= '0' xor g;
bit3 <= '0' xor g;
elsif (bit1 = '0' and bit2 = '1') then
V <= '1' xor g;
bit3 <= '1' xor g;
end if;

end if;

end if;

end process;