debug:state machine losing else

 

state_0 : if( cnt  == 7)                     state_next = state_1;
 //        else                               state_next = state_0;

此处若losing else

则会发生critical error,

无论cnt是否到7,都会直接跳转到state_1, 从而导致state_0错误。

modelsim仿真并未测试出错误,但FPGA上电实测必然出错。

小心。

 

正常情况下,state_current是register,state_next只是中间过渡的LUT;

错误情况下,state_next将变成锁存器,LDCE(vivado),严重危害电路时序。