假设我有两个名为reg_operand1和reg_operand2的寄存器。对于他们两个,我都有一个适当的写使能信号。在我读到的某个地方,我应该为每个寄存器分配单独的过程,如下所示:
process(CLK, RESET)
begin
if (RESET = '1') then
reg_operand1 <= (others => '0');
elsif (CLK'event and CLK = '1') then
if reg_operand1_we='1' then
reg_operand1 <= DI;
end if;
end if;
end process;
process(CLK, RESET)
begin
if (RESET = '1') then
reg_operand2 <= (others => '0');
elsif (CLK'event and CLK = '1') then
if reg_operand2_we='1' then
reg_operand2 <= DI;
end if;
end if;
end process;
但是,如果我将这些流程合并到其中会发生什么?合成的电路会不一样吗?另外,如果我在合并过程中的 if 语句之间放置“elsif”怎么办?合成器会在电路中插入多路复用器吗?谢谢!
process(CLK, RESET)
begin
if (RESET = '1') then
reg_operand1 <= (others => '0');
reg_operand2 <= (others => '0');
elsif (CLK'event and CLK = '1') then
if reg_operand1_we='1' then
reg_operand1 <= DI;
end if;
if reg_operand2_we='1' then
reg_operand2 <= DI;
end if;
end if;
end process;