|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
写一个状态机次态转移的组合逻辑,其中有含有nextstate = nextstate;的代码,请大家帮忙看下,是否会产生latch?如果是的话,需要怎么改进?谢谢
always @ (state,nextstate,state_tran_1,state_tran_2) begin
case (state)
3'b000 : nextstate = 3'b001;
3'b001 : if (state_tran_1 == 1'b1) begin
nextstate = 3'b010;
end
else begin
nextstate = nextstate;
end
3'b010 : if (state_tran_2 == 1'b1) begin
nextstate = 3'b011;
end
else begin
nextstate = nextstate;
end
3'b011 : if (state_tran_1 == 1'b1) begin
nextstate = 3'b100;
end
else begin
nextstate = nextstate;
end
3'b100 : if (state_tran_2 == 1'b1) begin
nextstate = 3'b001;
end
else begin
nextstate = nextstate;
end
default: nextstate = 3'b000;
endcase
end |
|