NivaarExam PrepOfficial exam papers ↗

23-Mechatronics-A3 Digital Logic and Embedded Systems · December 2018

Question 2 of 6: Synchronous 3-bit JK-flip-flop counter

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

Notes on this paper

Paper: National Exams, December 2018 — 16-Mex-A3 Digital Systems & Computers. Closed-book, 3-hour paper (approved Casio/Sharp calculator only). Candidates normally answer 5 of 6 questions; full worked solutions to all six are given below, whichever five a candidate chose.

Reference texts: M. M. Mano & M. D. Ciletti, Digital Design (6th ed.) — Boolean algebra and gate-level design (Ch. 2), combinational logic (Ch. 4), synchronous sequential logic, state tables and counters (Ch. 5), programmable logic (PAL/PLA, Ch. 7); C. Hamacher, Z. Vranesic, S. Zaky & N. Manjikian, Computer Organization and Embedded Systems (6th ed.) — CPU/memory/bus architecture, registers, addressing; Motorola/Freescale, M68HC11 Reference Manual — big-endian byte storage, stack push/pull, port-based I/O (the questions below use Motorola-style conventions throughout, as stated on the paper).

Reading the question. Q1’s function $g$ is printed with an overline whose exact grouping is partly ambiguous. This solution adopts the literal reading $g=\big(\overline{(A+B)\cdot\bar C}+B\bar C D\big)\cdot E\cdot(A+B)$, i.e. the complement bar covers the whole term $(A+B)\cdot\bar C$; every gate network below is verified by truth table against this reading. Per the instruction on the paper, none of the three realisations in (c)–(e) apply Boolean simplification to $g$ itself — they translate the expression as written, gate-for-gate.

Question 2: Synchronous 3-bit JK-flip-flop counter [6+3+3 = 12]

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. Target cycle (written $Q_AQ_BQ_C$): $000\to010\to100\to101\to011\to001\to000\ (\text{repeat})$ — 6 of the 8 possible states are used; $110$ and $111$ never occur by design and are don't-cares. Flip-flop excitation table (from the reference sheet): $Q\to Q^+{=}0$: $J{=}0,K{=}X$; $Q\to Q^+{=}1$: $J{=}1,K{=}X$; $Q{=}1\to Q^+{=}0$: $J{=}X,K{=}1$; $Q{=}1\to Q^+{=}1$: $J{=}X,K{=}0$.

Find. The state diagram, the full JK excitation table, minimised $J,K$ equations, the wired circuit, self-starting behaviour, and an 8-pulse timing diagram.

Approach. Standard synchronous design: draw the state diagram → tabulate present/next state → back out each flip-flop's required $J,K$ from the excitation table → K-map (with the two unused states as don't-cares) to minimise $J,K$ → wire the flip-flops and combinational logic → verify self-starting by evaluating the don't-care states with the chosen equations → simulate the timing.

000010100101011001110111Q_AQ_BQ_C — solid arrows: designed 6-state cycledashed arrows: unused states 110, 111 (don’t-care) both re-enter the cycle in 1 clock → self-starting
Fig. 2(a)-i — state transition diagram: the designed 6-state cycle (solid) and the two unused states (dashed, evaluated in part (b)).
  1. State transition table with flip-flop inputs. For each of the 6 used transitions, read $J,K$ per bit off the excitation table above:
    $Q_AQ_BQ_C$$Q_A^+Q_B^+Q_C^+$$J_AK_A$$J_BK_B$$J_CK_C$
    0000100,X1,X0,X
    0101001,XX,10,X
    100101X,00,X1,X
    101011X,11,XX,0
    0110010,XX,1X,0
    0010000,X0,XX,1
    110, 111unused — all six J/K entries are don't-care (X)
  2. K-map minimisation. Plotting each $J,K$ column over $A,B,C$ with the unused rows as don't-cares gives, after grouping: $$J_A=B\bar C,\quad K_A=C,\qquad J_B=A\odot C=AC+\bar A\bar C,\quad K_B=1,\qquad J_C=A,\quad K_C=\bar A\bar B.$$
  3. Wire the circuit. Three JK flip-flops share a common clock and asynchronous $\overline{CLR}$. $K_A=Q_C$ and $J_C=Q_A$ are direct feedback wires; $J_A=Q_B\bar Q_C$ and $K_C=\bar Q_A\bar Q_B$ each need one 2-input gate; $J_B$ needs an XNOR (or AND-OR pair) of $Q_A,Q_C$; $K_B$ is tied permanently HIGH.
J-logicB·C̄FF A(MSB)J-logicA⊙CFF BK-logicĀ·ƁFF C(LSB)JQ_AK=CJQ_BK=1KQ_CJ=Q_AQ_B,Q_CQ_A,Q_CQ_A,Q_BCLK, CLR̄CLK, CLR̄CLK, CLR̄
Fig. 2(a)-ii — final circuit: three JK flip-flops with the combinational $J/K$ logic derived above.

(b) Self-starting check. Evaluating the same $J,K$ equations at the two unused states (this is the only way to know where the don't-cares actually send the counter, since a K-map leaves that undefined until equations are chosen):

Unused stateNext state (from the equations above)In the 6-state cycle?
110101Yes
111001Yes

Both unused states feed directly back into the valid cycle after a single clock pulse. $\boxed{\text{The counter is self-starting}}$ — no separate lock-up loop exists among $\{110,111\}$, so power-on noise or a glitch that lands the counter in an unused state recovers automatically within one clock cycle.

(c) Timing diagram. With $\overline{CLR}$ released just before $t=0$, all flip-flops are cleared, so the state at $t=0$ is $000$. Each rising CLK edge thereafter advances one step along the cycle:

CLKQ_A (MSB)Q_BQ_C (LSB)1234567t=0 (state 000, after CLR̄ released)state after each rising edge: 010,100,101,011,001,000,010,100
Fig. 2(c) — CLK, $Q_A$, $Q_B$, $Q_C$ for 8 clock pulses, starting from $t=0=000$.
QuantityResult
$J_A,K_A$$\boxed{J_A=B\bar C,\ K_A=C}$
$J_B,K_B$$\boxed{J_B=A\odot C,\ K_B=1}$
$J_C,K_C$$\boxed{J_C=A,\ K_C=\bar A\bar B}$
Self-starting?$\boxed{\text{Yes}}$ — $110\to101$, $111\to001$
State sequence over 8 pulses$\boxed{010,100,101,011,001,000,010,100}$