newcpu
Member level 4
In order to avoid latch when coding with verilog, we add "else C<=C" as following:
always @(posedge clk)
begin
if(A==1'b0)
C<=B;
else
C<=C;
end
But for combinational logic, the following code gets problems of timing loop. by the way, C has been assigned to registers before. Could you tell me what is the problem and how to solve it? Thanks a lot.
always @(A or B)
begin
if(A==1'b0)
C<=B;
else
C<=C;
end
always @(posedge clk)
begin
if(A==1'b0)
C<=B;
else
C<=C;
end
But for combinational logic, the following code gets problems of timing loop. by the way, C has been assigned to registers before. Could you tell me what is the problem and how to solve it? Thanks a lot.
always @(A or B)
begin
if(A==1'b0)
C<=B;
else
C<=C;
end