process (Rdlenth,WrAddr_En,RdAddr_En,MRd_En,MWr_En,lm_Ackn)
begin
next_state<=cur_state;
case cur_state is
when idle=>
if(xxxx) then
next_state<=busy;
else
。。。。。。
endif;
。。。。。。
End process;
if case不全会产生latch
代码1
always @(enable or ina or inb)
begin
if(enable)
begin
data_out = ina;
end
else
begin
data_out = inb;
end
end
代码2
input [3:0] data_in;
always @(data_in)
begin
case(data_in)
0 : out1 = 1'b1;
1,3 : out2 = 1'b1;
2,4,5,6,7 : out3 = 1'b1;
default : out4 = 1'b1;
endcase
end
当然是下面一个更容易产生LATCH啦。其实,对于下面的情况,如out1而言,只是类似于if(data_in == 0) out1 = 1'b1;如果在default里面,把out1,out2,out3都描述一下就不会产生LATCH了。