Home › Practice › RTL Design › Metro gate
Metro gate
EasyRTLsequentialfsm
A metro gate is locked. A coin unlocks it, and when someone pushes through, it locks again.
Concept first. A state machine is a circuit with a few named states, and rules for what makes it move from one to another. Draw first, then code: two circles, Locked and Unlocked, and arrows labelled with the input that makes each move. Ask for each state: which inputs matter here, and which are ignored? (Pushing a locked gate does nothing. What does a coin do to an unlocked gate?)
What to build.
- Inputs
clk,rst,coin,push. Outputlocked(1 = locked). rstis synchronous and makes the gate locked.- Locked and
coin: becomes unlocked.pushis ignored while locked. - Unlocked and
push: becomes locked.coinis ignored while unlocked. Otherwise the state holds.
No install and no sign-up needed. You write your answer in the editor and Nishkam checks it.