← ProblemsCircuits / Building Larger Circuits
FSM: the complete timer controller
5%fsmfsm-designtimersNow combine the two previous FSMs into the timer's complete control FSM. The datapath (shift register, counters) is not part of this exercise — done_counting and ack arrive as plain inputs, and the FSM produces only control outputs. All outputs are Moore (functions of the current state). reset is synchronous and returns the FSM to the search state.
The control sequence:
- Search — watch
datafor the serial pattern1101(same partial-match rules as the recognizer exercise). All outputs are 0. - Shift — starting the cycle after the edge that samples the pattern's final
1, assertshift_enafor exactly 4 cycles (the datapath would capture the delay value during these cycles).datais ignored by the FSM during this phase. - Count — deassert
shift_ena, assertcounting. Stay here until a clock edge wheredone_counting = 1. - Done — deassert
counting, assertdone. Stay here until a clock edge whereack = 1, then return to Search and start over.
At most one of shift_ena, counting, done is 1 at any time. done_counting and ack have no effect outside their respective phases, and data has no effect outside the search phase.
Registers power up to 0; encode your states so the FSM powers up in the initial search state.