NivaarExam PrepOfficial exam papers ↗

22-Elec-A4 Digital Systems and Computers · December 2013

Question 4 of 6: Synchronous Up/Down Counter with T Flip-Flops

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

Notes on this paper

Paper format. National Exams, December 2013 — 07-Elec-A4 Digital Systems & Computers. Three hours, closed book (one approved Casio or Sharp calculator). Six questions are printed; any five constitute a complete exam and every question is worth 12 marks, with the per-part split printed in the marking scheme on page 1 (Q1 and Q5 are 3+3+3+3; Q2 is 4+4+4; Q3 and Q6 are 6+6; Q4 is 8+2+2). An excitation table for the RS/JK/T/D flip-flops and a table of 22 basic Boolean identities are supplied on the last page. All six questions are solved below, because this set is a study resource rather than a timed sitting.

Reference texts.

Notation used throughout. A prime and an overbar both denote complement: \(\overline{A}\) in the mathematics, A′ in the figures, where SVG text cannot carry an overbar. The variable order in every K-map is the order printed in the question, with the leftmost variable as the most significant bit, so minterm and maxterm indices match the question's numbering exactly.

Question 4: Synchronous Up/Down Counter with T Flip-Flops (12 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. Three T flip-flops holding the state \(ABC\) (\(A\) most significant) and two inputs:

InputsRequired behaviourStates used
\(E=0\)hold the present state, whatever \(X\) isall eight
\(E=1,\ X=1\)000 → 001 → 010 → 011 → 100 → 000 (modulo-5 up)0, 1, 2, 3, 4
\(E=1,\ X=0\)111 → 110 → 101 → 100 → 011 → 111 (modulo-5 down)7, 6, 5, 4, 3

Find. Minimum two-level SoP excitation equations \(T_A\), \(T_B\), \(T_C\), and a justified determination of whether each count direction recovers from the states its own sequence never visits.

Approach. Exploit the fact that a T flip-flop toggles exactly when its present and next state differ, so \(T = Q \oplus Q^{+}\). Then notice the structural symmetry between the two sequences — the down sequence is the bit-by-bit complement of the up sequence — which collapses the design onto a single modulo-5 up counter and makes the algebra far shorter than a raw thirty-two-row excitation table.

(a) Excitation equations (8 marks)

  1. Deal with the enable. When \(E=0\) no flip-flop may change, and a T flip-flop holds precisely when its T input is 0. Every excitation equation therefore has \(E\) as a common factor: \(T_i = E \cdot g_i(X,A,B,C)\). This one observation removes \(E\) from the K-mapping entirely.
  2. Spot the complement symmetry. Write the two sequences one above the other: $$\begin{aligned} \text{up}\ (X{=}1):&\quad 000 \to 001 \to 010 \to 011 \to 100 \to 000 \\ \text{down}\ (X{=}0):&\quad 111 \to 110 \to 101 \to 100 \to 011 \to 111 \end{aligned}$$ Each down state is the bit-complement of the up state in the same position. Since \(T = Q \oplus Q^{+}\) and complementing both \(Q\) and \(Q^{+}\) leaves their exclusive-OR unchanged, the T values for corresponding states are identical. Define the transformed state bits $$a = A \oplus \overline{X}, \qquad b = B \oplus \overline{X}, \qquad c = C \oplus \overline{X}$$ so that \(abc\) equals \(ABC\) when \(X=1\) and its complement when \(X=0\). Both required behaviours are now the single modulo-5 up count on \(abc\).
  3. Build the reduced excitation table. With \(T = Q \oplus Q^{+}\) applied to the five used states (the other three are don't cares, to be exploited):
    \(abc\)next\(T_a\)\(T_b\)\(T_c\)
    000001001
    001010011
    010011001
    011100111
    100000100
    101, 110, 111unusedddd
  4. Minimise the three transformed excitations. \(T_c\) is 1 on all four cells with \(a=0\) and 0 at \(abc=100\); assigning the three don't cares to 0 gives the single literal \(T_c = \overline{a}\). \(T_b\) is 1 exactly where \(c=1\) among the used states and 0 wherever \(c=0\), so assigning the don't cares to follow \(c\) gives \(T_b = c\). \(T_a\) is 1 at 011 and 100 only; taking the don't cares as 1 merges 101, 110, 111 with 100 to give the single literal \(a\), and 011 is picked up by \(bc\): $$T_a = a + bc, \qquad T_b = c, \qquad T_c = \overline{a}$$
  5. Substitute the transformation back. Note \(a = A \oplus \overline{X} = AX + \overline{A}\,\overline{X}\) (the coincidence of \(A\) and \(X\)) and correspondingly \(\overline{a} = A \oplus X = A\overline{X} + \overline{A}X\). Expanding the products — every cross term contains \(X\overline{X}=0\) and vanishes — gives the minimum two-level SoP forms: $$\boxed{\;\begin{aligned} T_A &= E\,(AX + \overline{A}\,\overline{X} + BCX + \overline{B}\,\overline{C}\,\overline{X}) \\ T_B &= E\,(CX + \overline{C}\,\overline{X}) \\ T_C &= E\,(A\overline{X} + \overline{A}X) \end{aligned}\;}$$ That is eight product terms in total (four, two and two), and \(T_B\) and \(T_C\) are just \(E\!\cdot\!\overline{(C \oplus X)}\) and \(E\!\cdot\!(A \oplus X)\) written out at two levels as the question demands.

Simulating these equations over all thirty-two combinations of \(E\), \(X\) and the eight states reproduces both required sequences exactly and holds the state for every state when \(E=0\), which is the complete correctness check for part (a).

Q4(a) three T flip-flops driven by minimum 2-level SoP excitation logic2-level SoP excitation logicTA = E(AX + A'X' + BCX + B'C'X')TB = E(CX + C'X')TC = E(AX' + A'X)EXT-FF ATQCLKTAAT-FF BTQCLKTBBT-FF CTQCLKTCCstate feedback A, B, C
Figure 4.1 — the datapath: one shared block of two-level SoP logic drives the three T inputs, with the state fed back and the common clock omitted for clarity.

(b) Is the count-up self-starting? (2 marks)

A counter is self-starting if, from every state including those its intended sequence never uses, it reaches the main cycle in a finite number of clocks. Because part (a) resolved the don't cares in favour of minimal logic, the behaviour in the three unused states was decided implicitly and must now be read back out of the equations rather than assumed.

  1. Reduce the equations for \(X=1\). Substituting \(X=1,\ E=1\) collapses them to \(T_A = A + BC\), \(T_B = C\), \(T_C = \overline{A}\).
  2. Evaluate the three unused states. Applying \(Q^{+} = Q \oplus T\) bit by bit:
    State \(ABC\)\(T_A\)\(T_B\)\(T_C\)Next stateIn the cycle?
    101110011yes
    110100010yes
    111110001yes
  3. Conclude. All three unused states enter the main count within a single clock, and none of them forms a closed sub-cycle: $$\boxed{\text{the count-up is self-starting; worst-case recovery is one clock}}$$
Q4(b) count-up state diagram (E = 1, X = 1)000001010011100101110111unused states (red)solid ring = the required count sequence
Figure 4.2 — count-up state diagram for \(E=1,\ X=1\). Black: the required modulo-5 ring. Red: the three unused states, each of which drops straight into the ring.

(c) Is the count-down self-starting? (2 marks)

  1. Reduce the equations for \(X=0\). Substituting \(X=0,\ E=1\) gives \(T_A = \overline{A} + \overline{B}\,\overline{C}\), \(T_B = \overline{C}\), \(T_C = A\) — the exact complement-duals of the count-up forms, as the symmetry of part (a) guarantees.
  2. Evaluate the three unused states (here 000, 001 and 010, since the down sequence uses 3 through 7):
    State \(ABC\)\(T_A\)\(T_B\)\(T_C\)Next stateIn the cycle?
    000110110yes
    001100101yes
    010110100yes
  3. Conclude. Again every unused state joins the ring on the next clock edge: $$\boxed{\text{the count-down is also self-starting; worst-case recovery is one clock}}$$ This is not a coincidence: the complement transformation maps the unused up-states \(\{101,110,111\}\) onto the unused down-states \(\{010,001,000\}\) and preserves the recovery behaviour, so proving part (b) proves part (c).
Q4(c) count-down state diagram (E = 1, X = 0)111110101100011000001010unused states (red)solid ring = the required count sequence
Figure 4.3 — count-down state diagram for \(E=1,\ X=0\). Compare with Figure 4.2: it is the same diagram with every state label complemented.
QuantityResult
\(T_A\)\(E(AX + \overline{A}\,\overline{X} + BCX + \overline{B}\,\overline{C}\,\overline{X})\)
\(T_B\)\(E(CX + \overline{C}\,\overline{X})\)
\(T_C\)\(E(A\overline{X} + \overline{A}X)\)
Total product terms8 (4 + 2 + 2)
(b) count-up self-starting?yes — 101→011, 110→010, 111→001 (one clock)
(c) count-down self-starting?yes — 000→110, 001→101, 010→100 (one clock)

Check: the don't-care assignment is a design decision, and it is the one being graded in parts (b) and (c). The three unused states were assigned in part (a) purely to minimise the logic, exactly as the question's "minimum 2-level SoP" instruction demands. A different assignment would give different — and possibly non-self-starting — behaviour from those states, so the self-start property here is a consequence of the minimisation that had to be checked, not an assumption. Had a lock-up been found, the standard remedy is to un-minimise: force one or more don't cares to the value that steers the offending state back into the ring, accepting an extra product term.