NivaarExam PrepOfficial exam papers ↗

25-Comp-A2 Digital Systems Design · May 2016

Question 4 of 6: 4-Bit Synchronous Counter with Count-Enable

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

Notes on this paper

98-Comp-A2, Digital Systems Design — National Exams, May 2016. Closed-book, 3 hours; six 20-mark questions, FIVE constitute a complete exam (all six answered below as a complete study resource).

Reference texts: Mano & Ciletti, Digital Design, 6th ed. — VHDL/digital-design concepts, PAL implementation, variable-entered maps, synchronous counter design, and memory/interfacing, covering Questions 1–5; Patterson & Hennessy, Computer Organization and Design, 6th ed. — interrupt-driven I/O, covering Question 6.

Question 4: 4-Bit Synchronous Counter with Count-Enable (20 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. Four positive-edge-triggered JK flip-flops labelled $Q_3$ (MSB) down to $Q_0$ (LSB); required binary up-count sequence $0000\to0001\to\cdots\to1111\to0000\ldots$; part (b) adds a level-sensitive COUNT ENABLE input CTE.

Find. (a) The $J,K$ excitation equations and circuit for the 4-bit synchronous up-counter; (b) the modification that holds the count when CTE is LOW.

Approach. Read each flip-flop's required toggle condition directly off the binary count sequence (a bit toggles exactly when every less-significant bit is already 1 — the same carry-chain condition as a ripple-carry adder), translate "toggle / hold" into $J{=}K{=}1$ / $J{=}K{=}0$ per the JK excitation rule, then AND every $J,K$ pair with CTE so CTE$=0$ forces hold on all four flip-flops simultaneously.

  1. Part (a) — $Q_0$ (LSB) toggles every clock. The LSB of a binary up-count flips at every single step ($0\to1\to0\to1\ldots$), which is the permanent-toggle JK condition: $$J_0=K_0=\boxed{1}$$
  2. $Q_1$ toggles only when $Q_0=1$. Checking the 16-row state table, $Q_1$ flips exactly on the transitions out of every state where $Q_0=1$ and holds whenever $Q_0=0$ — both toggle and hold rows match $Q_0$ exactly: $$J_1=K_1=\boxed{Q_0}$$
  3. $Q_2$ toggles only when $Q_0=Q_1=1$ (first carry condition), $Q_3$ toggles only when $Q_0=Q_1=Q_2=1$ (second carry condition). These are the standard ripple-carry AND-chain: $$J_2=K_2=\boxed{Q_0\cdot Q_1},\qquad J_3=K_3=\boxed{Q_0\cdot Q_1\cdot Q_2}$$ Two AND gates ($Q_0Q_1$ for stage 2, and that output ANDed again with $Q_2$ for stage 3) are the only combinational logic the base counter needs.
  4. Part (b) — gate every $J,K$ with CTE. CTE must force $J=K=0$ (hold) on every flip-flop simultaneously when LOW, and reduce exactly to the part-(a) equations when HIGH — ANDing CTE onto each excitation input does both: $$J_0=K_0=\text{CTE},\quad J_1=K_1=Q_0\cdot\text{CTE},\quad J_2=K_2=Q_0Q_1\cdot\text{CTE},\quad J_3=K_3=\boxed{Q_0Q_1Q_2\cdot\text{CTE}}$$ $Q_0\cdot\text{CTE}$ and $Q_0Q_1\cdot\text{CTE}$ each need one new 2-input AND gate; the existing $Q_0Q_1Q_2$ chain gets a third AND stage with CTE. Because holding sets $J=K=0$ on all four flip-flops together, the count freezes at whatever state it was in, and the very next CTE-HIGH edge continues the sequence from that same state with no state skipped or repeated.
JK-FF 0 J 0 K Q0 JK-FF 1 J 1 K Q1 JK-FF 2 J 2 K Q2 JK-FF 3 J 3 K 1 (Hi) 1 (Hi) Q0→J1 AND Q0Q1 → J2,K2 AND (Q0Q1)·Q2 → J3,K3 CLK
Fig. Q4 — 4-bit synchronous up-counter: $J_0{=}K_0{=}1$ (tied high); $J_1{=}K_1{=}Q_0$; $J_2{=}K_2{=}Q_0Q_1$ (one AND gate); $J_3{=}K_3{=}Q_0Q_1Q_2$ (a second AND gate cascaded from the first). Part (b): AND CTE into every excitation input (not shown separately — same one-AND-gate-per-stage pattern as Q0Q1/Q0Q1Q2, with CTE as a third input to the two existing AND gates and a direct wire to $J_0,K_0$).
Final Results — Question 4
Flip-flopPart (a) equationsPart (b) equations (with CTE)
$Q_0$ (LSB)$J_0=K_0=1$$J_0=K_0=\text{CTE}$
$Q_1$$J_1=K_1=Q_0$$J_1=K_1=Q_0\cdot\text{CTE}$
$Q_2$$J_2=K_2=Q_0Q_1$$J_2=K_2=Q_0Q_1\cdot\text{CTE}$
$Q_3$ (MSB)$J_3=K_3=Q_0Q_1Q_2$$J_3=K_3=Q_0Q_1Q_2\cdot\text{CTE}$
Extra gates for (b)2 AND gates (direct CTE wire to $Q_0$'s FF, no gate needed there)