← ProblemsCircuits / Building Larger Circuits

FSM: one-hot logic equations

5%fsmfsm-design

Given a version of the timer controller FSM with a one-hot state encoding, derive (some of) its next-state and output equations by inspection. This is a purely combinational exercise: the current 10-bit state vector is an input.

The FSM (same as the timer controller):

StateTransitionsMeaning
Sd=1S1, d=0Ssearch: nothing seen
S1d=1S11, d=0Sseen 1
S11d=1S11, d=0S110seen 11
S110d=1B0, d=0Sseen 110
B0B1 (always)shift cycle 1
B1B2 (always)shift cycle 2
B2B3 (always)shift cycle 3
B3Count (always)shift cycle 4
Countdone_counting=1Wait, else Countcounting
Waitack=1S, else Waitdone, awaiting ack

Outputs: shift_ena in B0B3; counting in Count; done in Wait.

One-hot encoding — state bit i corresponds to: S=0, S1=1, S11=2, S110=3, B0=4, B1=5, B2=6, B3=7, Count=8, Wait=9.

Write the equations for B3_next, S_next, S1_next, Count_next, Wait_next (the next-state bits for those five states) and for done, counting, shift_ena.

Derivation rule (important): each next-state bit is the OR, over every arrow into that state, of (source state bit AND arrow condition); each output is the OR of the state bits where it is asserted. Use exactly these equations — the grader drives arbitrary state vectors, including non-one-hot ones, so any "simplification" that relies on the one-hot assumption in another way will mismatch.