M
Marty
Guest
will this code infer a latch?
Always @(posedge clk or negedge rst)
if (!rst)
x <= 1'b0;
else if (load_en)
x <= x_in;
I don't like this code, but, that's the way the VHDL is written that
I'm converting to Verilog - no else for the load_en "if" statement.
In the VHDL version, I guess synthesis infers the feedback from x (q)
to x (d) via a MUX (I've not seen any latches in these cases). I
ASSUME it will do the same for the Verilog version. Will it? I plan
to perform a little experiment, but can't get to that at the moment
because somebody broke our synthesis scripts. It's always something!
To be complete, here is the VHDL:
process (clk, rst)
begin
if (rst = '0') then
x <= '0';
elsif (clk'event and clk = '1') then
if (load_en = '1') then
x <= x_in;
end if;
end if;
end process;
Thanks.
Always @(posedge clk or negedge rst)
if (!rst)
x <= 1'b0;
else if (load_en)
x <= x_in;
I don't like this code, but, that's the way the VHDL is written that
I'm converting to Verilog - no else for the load_en "if" statement.
In the VHDL version, I guess synthesis infers the feedback from x (q)
to x (d) via a MUX (I've not seen any latches in these cases). I
ASSUME it will do the same for the Verilog version. Will it? I plan
to perform a little experiment, but can't get to that at the moment
because somebody broke our synthesis scripts. It's always something!
To be complete, here is the VHDL:
process (clk, rst)
begin
if (rst = '0') then
x <= '0';
elsif (clk'event and clk = '1') then
if (load_en = '1') then
x <= x_in;
end if;
end if;
end process;
Thanks.