Reachable states are the codes the reset state can walk to along defined arcs. Every other code the flops can hold is unreachable in normal operation.
Three sources produce them: codes the encoding never assigns, power-up values before reset asserts, and single-event upsets that flip a state bit. Synthesis may also trim logic for codes it proves unreachable, which changes nothing functionally but removes any accidental safety net.
Invalid codes are the bit patterns with no state assigned. Fewer state bits mean fewer places to hide; one-hot pays for its speed with many invalid codes.
4 states in 2 bits (binary): 2^2 - 4 = 4 - 4 = 0 invalid codes
4 states in 4 bits (one-hot): 2^4 - 4 = 16 - 4 = 12 invalid codes
5 states in 3 bits (binary): 2^3 - 5 = 8 - 5 = 3 invalid codesEvery technique steers invalid codes back to a safe state, usually the reset state. They differ in what they cost and what faults they catch.
Technique | What it adds | Catches |
|---|---|---|
Default arc | A | Any invalid code, in both simulation and gates. |
Reset | A reset line to the state flops | Power-up values, but only while reset is asserted. |
Validity check | A one-hot legality test with a recovery arc | Multi-hot codes explicitly, at the price of a checker. |
The sketch below is illustrative and does not run: it shows the default-arc pattern used through this topic.
// not-run: illustrative sketch, no testbench in this lesson
always_comb begin
next = state;
case (state)
IDLE: if (go) next = WORK;
WORK: if (fin) next = DONE;
DONE: next = IDLE;
default: next = IDLE; // every invalid code recovers
endcase
endReset alone is not recovery: it fixes power-up but never fires on an in-flight upset. Recovery must live in the next-state logic so it acts every cycle.
An in-flight bit flip to an all-zero or multi-hot code. Reset already finished long ago, so only the next-state default can steer the machine home.
Yes, if upsets or uninitialised flops are in the fault model. All four codes are valid, so a flipped bit lands on a wrong but legal state and the design must tolerate that separately.