NivaarExam PrepOfficial exam papers ↗

22-Elec-A4 Digital Systems and Computers · May 2018

Question 3 of 6: RS + T flip-flop state machine

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

Notes on this paper

National Exams — May 2018 · 16-Elec-A4 Digital Systems & Computers. Closed book, 3 hours. Six questions, 12 marks each; the rubric requires any five, but all six are solved here as a study resource. Approved Casio/Sharp calculator permitted. A Boolean-identity table and the flip-flop excitation table are supplied with the paper (reproduced where used).

Reference texts. M. M. Mano & M. D. Ciletti, Digital Design (6th ed.) — number systems, Boolean minimization, sequential logic; J. F. Wakerly, Digital Design: Principles and Practices (5th ed.) — counters, registers, PLDs; C. Hamacher, Z. Vranesic, S. Zaky & N. Manjikian, Computer Organization and Embedded Systems (6th ed.) — parallel I/O, handshaking, memory-mapped ports; Motorola M68HC11 Reference Manual — port addressing and instruction set.

Question 3: RS + T flip-flop state machine (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. Two negative-edge-triggered flip-flops: flip-flop A is an RS type with outputs $Q_A,\overline{Q}_A$; flip-flop B is a T type with outputs $Q_B,\overline{Q}_B$. Reading the gate network from the figure (three 2-input ANDs, two 2-input ORs, and the clock inverter), the input equations are $R_A=X\,Q_A$, $S_A=X\,\overline{Q}_A$, $T_B=\overline{Q}_A\,(X+Q_B)$ and the output $Y=Q_A+Q_B$.

Find. (a) those four expressions; (b) the state-transition table over present state $(Q_A,Q_B)$ and input $X$; (c) the state diagram; (d) the Moore/Mealy classification with justification.

Approach. Apply each flip-flop's characteristic equation — RS gives $Q_A^+=S_A+\overline{R}_A Q_A$, T gives $Q_B^+=T_B\oplus Q_B$ — to all four present states under $X=0$ and $X=1$, then read the output and inspect its dependence on $X$.

  1. (a) Input/output equations (from the schematic): $$R_A=X\cdot Q_A,\quad S_A=X\cdot\overline{Q}_A,\quad T_B=\overline{Q}_A\,(X+Q_B),\quad Y=Q_A+Q_B.$$ Note $R_A S_A=X Q_A\cdot X\overline{Q}_A=0$ always, so the RS forbidden state never occurs.
  2. Simplify the next-state of A. Substituting into $Q_A^+=S_A+\overline{R}_A Q_A$: for $X=0$, $R_A=S_A=0\Rightarrow Q_A^+=Q_A$ (hold); for $X=1$, $Q_A^+=\overline{Q}_A+\overline{Q_A}\,Q_A=\overline{Q}_A$ (toggle). So $X$ acts as a "toggle $Q_A$" command.
  3. Next-state of B. $Q_B^+=T_B\oplus Q_B=\big[\overline{Q}_A(X+Q_B)\big]\oplus Q_B$. For $X=1$, $T_B=\overline{Q}_A$; for $X=0$, $T_B=\overline{Q}_A Q_B$.
  4. (b) Evaluate all eight (state, input) combinations and the Moore output $Y=Q_A+Q_B$.
(b) State transition table — next state $(Q_A^{+}Q_B^{+})$ and output
$Q_A Q_B$$X=0\;\to\;Q_A^{+}Q_B^{+}$$X=1\;\to\;Q_A^{+}Q_B^{+}$$Y$
0 00 01 10
0 10 01 01
1 01 00 01
1 11 10 11
QA QB=00Y=0QA QB=11Y=1QA QB=01Y=1QA QB=10Y=1X=0X=1X=0X=1X=0X=1X=0X=1Moore machine: output Y labels the state, not the arc
(c) State diagram. Each state is labelled with its output $Y$ (Moore); arcs are labelled with the input $X$ that causes the transition.
  1. (d) Moore or Mealy? The output is $Y=Q_A+Q_B$, a function of the present state only — $X$ does not appear. Confirming from the table, both entries of every row share the same $Y$. Therefore this is a Moore machine: the output is associated with the state, and it changes only after a clock edge moves the machine to a new state, never combinationally with $X$.
Question 3 — summary
ItemResult
$Q_A^{+}$hold on $X=0$, toggle on $X=1$ ($=\,X\oplus Q_A$)
$Q_B^{+}$$\big[\overline{Q}_A(X+Q_B)\big]\oplus Q_B$
Output$Y=Q_A+Q_B$ (state-only)
Machine typeMoore