# Lesson 24 Flashcards — Finite State Machines I

Click a question to reveal the answer.

<div data-flashcards data-deck="b2l24"></div>

<details>
<summary><strong>1. What distinguishes sequential from combinational logic?</strong></summary>
<div class="card-answer"><p>Combinational output depends only on <em>current inputs</em>. Sequential output depends on inputs <strong>and on history</strong>, so it requires memory.</p></div>
</details>

<details>
<summary><strong>2. Give an everyday example of sequential behavior.</strong></summary>
<div class="card-answer"><p>A garage door button: pressing it opens or closes the door depending on where the door already is. The same input produces different outputs.</p></div>
</details>

<details>
<summary><strong>3. What are the five elements of a finite state machine?</strong></summary>
<div class="card-answer"><p><strong>States</strong> (the situations the system can be in), <strong>inputs</strong>, <strong>transitions</strong> (rules taking state + input to a next state), <strong>outputs</strong>, and the <strong>initial state</strong> — where the machine starts, usually forced by a reset.</p></div>
</details>

<details>
<summary><strong>4. In what sense is the state the memory?</strong></summary>
<div class="card-answer"><p>The state captures everything the machine needs to know about the past. Given the current state and the current input, nothing else about the history matters.</p></div>
</details>

<details>
<summary><strong>5. What is the difference between a Moore and a Mealy machine?</strong></summary>
<div class="card-answer"><p><strong>Moore</strong> output depends only on the state, and is written inside the state bubble. <strong>Mealy</strong> output depends on state <em>and</em> current input, and is written on the transition arrow.</p></div>
</details>

<details>
<summary><strong>6. Project 2 has one output of each kind. Which is which?</strong></summary>
<div class="card-answer"><p>The <strong>telemetry voltage on DAC1 is Moore</strong> — 0.8 / 1.6 / 2.4 V, one per state, and nothing else changes it. <strong>FIRE is Mealy</strong> — it needs all four of these on the same tick: the machine in <strong>LOCK</strong>, the operator's pickle <span class="math notranslate nohighlight">\(P\)</span>, the target inside the envelope <span class="math notranslate nohighlight">\(E\)</span>, and the master arm plug <span class="math notranslate nohighlight">\(M\)</span>. So it belongs on the arrow, not in the bubble.</p></div>
</details>

<details>
<summary><strong>7. Which type generally needs fewer states?</strong></summary>
<div class="card-answer"><p>Mealy, because the output can vary with the input without requiring a separate state. Moore is simpler to reason about and verify.</p></div>
</details>

<details>
<summary><strong>8. What must be true of every state in a transition diagram?</strong></summary>
<div class="card-answer"><p>It must have a defined transition for <strong>every possible input</strong>. An undefined transition is a bug.</p></div>
</details>

<details>
<summary><strong>9. How many rows does a transition table have?</strong></summary>
<div class="card-answer"><p>One per <strong>(state, input) pair</strong>. Three states with a two-valued input gives 6 rows; four states with a two-valued input gives 8. Count them before you start. (That count is over the machine's <em>states</em>. Once the states are encoded in bits — Lesson 25 — you count over all <span class="math notranslate nohighlight">\(2^{\text{state bits} + \text{input bits}}\)</span> codes instead, including the unused ones: the three-state machine then has 8 rows, not 6.)</p></div>
</details>

<details>
<summary><strong>10. Give three engineering examples of FSMs.</strong></summary>
<div class="card-answer"><p>Traffic lights, vending machines, elevator controllers, communication protocols, and weapon system modes (safe/searching/locked/engaged) — where the transitions are safety-critical.</p></div>
</details>
