Nivaar Exam Prep

04-BS-8 Digital Logic Circuits · December 2015

Question 4 of 5: EVEN/ODD Parity-Tracking FSM

Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer) · Last updated

Notes on this paper

Reference texts: Mano & Ciletti, Digital Design (6th ed., Pearson) — Boolean minimization, PAL/PLA/FPGA architectures, flip-flop conversion, sequential design, arithmetic circuits; Floyd, Digital Fundamentals (11th ed., Pearson) — decoders, number systems, flip-flop characteristic tables, counters.

Question 4: EVEN/ODD Parity-Tracking FSM (25 marks)

Question text not reproduced: the examination questions are © Engineers and Geoscientists BC. Open the official past paper (linked at the top of this page) to read the question, then follow the worked solution below.

Given. Synchronous inputs RESET (async clear), ENABLE, SERIAL_DATA; outputs EVEN, ODD must track the running parity of 1s seen while ENABLE was asserted, since the last RESET.

Find. (a) State diagram and table; (b) minimum flip-flop count, next-state equations, and the FSM circuit.

Approach. Only two conditions can ever be true — "even number of 1s counted so far" or "odd" — so a single-bit Moore machine suffices; toggle that bit only when ENABLE is asserted and SERIAL_DATA=1, hold it otherwise, and force it to the EVEN state on RESET.

  1. Part (a) — states and table. Two states are necessary and sufficient: $S_0$ (EVEN, $Q{=}0$) and $S_1$ (ODD, $Q{=}1$), with $S_0$ the reset state (0 ones seen is even). A transition occurs only when $\text{ENABLE}\cdot\text{SERIAL\_DATA}=1$ (a counted "1" bit flips the parity); otherwise the state holds.
Present stateENSDNext stateEVENODD
$S_0$ (Q=0)0x$S_0$10
$S_0$ (Q=0)10$S_0$10
$S_0$ (Q=0)11$S_1$10
$S_1$ (Q=1)0x$S_1$01
$S_1$ (Q=1)10$S_1$01
$S_1$ (Q=1)11$S_0$01
S0 / EVENQ=0S1 / ODDQ=1EN.SD=1EN.SD=1EN'+SD'EN'+SD'RESET (async) forces state to S0/EVEN from either state.
Moore state diagram: EVEN/ODD toggles only on a counted 1-bit ($\text{EN}\cdot\text{SD}{=}1$); RESET (not shown as an edge, applies asynchronously from any state) forces $S_0$.
  1. Part (b) — minimum flip-flops and next-state equation. One D flip-flop is the minimum (2 states $\Rightarrow \lceil\log_2 2\rceil=1$ bit). From the state table, $Q^+ = 1$ exactly on rows where a toggle occurs, i.e. whenever $\text{EN}\cdot\text{SD}=1$ and the current $Q$ differs from the next $Q$ — which is precisely the toggle relation $Q^+=Q\oplus(\text{EN}\cdot\text{SD})$. Wiring: an AND gate combines ENABLE and SERIAL\_DATA, an XOR gate combines that product with the flip-flop's own $Q$ output (fed back), and the XOR output drives $D$; RESET ties directly to the flip-flop's asynchronous clear. Outputs are combinational: $\text{ODD}=Q$, $\text{EVEN}=\overline{Q}$ (one inverter).
ENABLESERIAL_DATAANDXORD Flip-FlopCLR=RESETDQ (feedback)Q = ODDEVEN = Q'
Minimum FSM hardware: 1 D flip-flop, 1 AND gate, 1 XOR gate (feedback from Q), 1 inverter for EVEN.
QuantityResult
States / flip-flops2 states, 1 D flip-flop (minimum)
Next-state equation$D = Q\oplus(\text{EN}\cdot\text{SD})$
Outputs$\text{ODD}=Q,\ \text{EVEN}=\overline{Q}$
Gate count1 AND + 1 XOR + 1 NOT (+ 1 D-FF)