Forum Discussion
Altera_Forum
Honored Contributor
16 years agoThe relation of LED outputs and states of your state machine isn't shown in your post, but I simply assume, that the state machine is caught in an illegal state. If you read the Quartus Software Handbook chapter about state machines thorougly, you'll notice, that
default: state_next<=idel; doesn't work for illegal states. You have define safe state machine encoding to handle illegal states, e.g. by a synthesis attribute.reg state_next /* synthesis syn_encoding = "safe" */ Generally, there are two possibly reasons, why a state machine can reach an illegal state (= an undefined bit coding of the state variable): 1. The input clock has glitches or temporary short periods, that cause a timing violation in the state machine logic 2. An input signal to the state machine is changing unrelated to the state machine clock and cause a timing violation. All unrelated input signals must be synchronized before being processed in the state machine. To understand, why unrelated input signals can cause illegal states, you should consider, that the input signal is fed through combinational logic to the state variable registers, but each bit of the state machine is treated individually. Due to a setup or hold time violation, individual bits can react inconsistently on the event (one bit "sees" the event, the other doesn't).