NivaarExam PrepOfficial exam papers ↗

04-BS-8 · December 2016

Question 5 of 5: Flip-Flop Conversion, Frequency Division, and Shift-Register Analysis

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

Notes on this paper

National Exams — December 2016 — 04-BS-8 Digital Logic Circuits. Three-hour, closed-book exam (Casio or Sharp approved calculator only; one hand-written 8.5"×11" aid sheet permitted). Format: five questions offered, each worth 25 marks (100 total); any four constitute a complete paper and only the first four appearing in the answer book are marked. All five are solved below for completeness.

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

Question 5: Flip-Flop Conversion, Frequency Division, and Shift-Register Analysis (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.

Part (a) — Toggle FF from a D-type FF. A D flip-flop becomes a Toggle (with enable) flip-flop by feeding its D input from the XOR of its own output Q and a toggle-enable line T: $D = T \oplus Q$. When $T=1$, $D=Q'$, so on the next clock edge the flip-flop takes on the complement of its present state — it toggles. When $T=0$, $D=Q$, so the next state equals the present state — it holds. (Tying $T$ permanently to logic 1 gives an unconditional toggle-every-clock T flip-flop.)

XORD FFD QTQ (toggles when T=1)ClockD = T XOR Q (feedback from Q)
Fig. 5(a) — Toggle flip-flop built from one D flip-flop and one XOR gate: $D = T \oplus Q$.

Part (b) — Given. Input clock: 80MHz, 30% duty cycle. Required output: 20MHz, 50% duty cycle, using edge-triggered S-R flip-flops.

Find. A sequential divider circuit.

  1. Determine the division ratio. $$\dfrac{80\text{MHz}}{20\text{MHz}} = 4 \implies \boxed{\text{divide-by-4}}$$
  2. Realize divide-by-4 with toggling S-R flip-flops. Wire each S-R flip-flop as a toggle stage: $S=\overline{Q}$, $R=Q$ (edge-triggered), so each stage complements on every active clock edge it receives — exactly a T flip-flop built from an S-R. Cascade two such stages (FF1's output clocks FF2): FF1 divides 80MHz→40MHz, FF2 divides 40MHz→20MHz.
  3. Why the output duty cycle is 50% regardless of the input's 30%. A toggle stage's output changes state exactly once per active (e.g. rising) edge of its clock input — it counts EDGES, not high/low time. Since the 80MHz source clock's edges are evenly spaced in time (period $T=12.5\text{ns}$) regardless of what fraction of each period is spent high vs. low, the time between successive toggles of FF2's output is always exactly $4T$, split into two equal $2T$ halves (high, then low) — giving an exact 50% duty cycle at 20MHz, independent of the 30% duty cycle of the source.
80 MHz(30% duty)T-FF #1/2T-FF #2/220 MHz(50% duty)40 MHzQ_out
Fig. 5(b) — two cascaded S-R toggle flip-flops divide 80MHz by 4, producing 20MHz with an exact 50% duty cycle.
QuantityResult
Division ratio80MHz ÷ 20MHz = 4
Realization2 cascaded edge-triggered S-R flip-flops wired as toggle stages ($S=\overline{Q}$, $R=Q$)
Output duty cycle50% exactly, regardless of the 30% input duty cycle (edge-counting, not level-duration)

Part (c)(i) — Given. Figure 5: an 8-bit shift register whose serial output feeds (1) one input of an XOR gate whose OTHER input is the Q output of a JK flip-flop, and whose output recirculates back into the register's own serial input; and (2) one input of an OR gate (the JK's Q is the other input) whose output drives the JK's J input, with K permanently tied to logic 0 (so the flip-flop, cleared to 0 initially via Clr, can only be SET by J and can never be reset again except by the external clear).

Find. The circuit's main function.

  1. Recognize the "sticky flag" behaviour of the JK flip-flop. With $K=0$ always, the flip-flop's next state is $Q^+ = J = (\text{bit shifting out}) + Q$ (an OR): once the shifted-out bit is a 1, $Q$ becomes 1 and then STAYS 1 for the rest of the 8-clock sequence (K=0 prevents it ever clearing again). So $Q$ acts as a one-way "have I seen a 1 yet, scanning from the LSB" flag.
  2. Recognize the XOR's role. The recirculated bit is $Y = (\text{bit shifting out}) \oplus Q_{\text{flag}}$ (flag value BEFORE this clock's update): while the flag is still 0 (no 1 seen yet), $Y$ equals the bit unchanged; once the flag is 1, $Y$ is the COMPLEMENT of the bit.
  3. Identify the algorithm. "Copy every bit unchanged from the LSB up to and including the first 1 encountered, then complement every bit after that" is precisely the standard bit-serial algorithm for forming the 2's complement of a binary number. $$\boxed{\text{Figure 5 is a serial (bit-serial) 2's complementer.}}$$ After exactly 8 clock cycles, every one of the 8 loaded bits has been shifted out, conditionally complemented, and recirculated back in, so the register now holds the 2's complement of the number it was loaded with.

Part (c)(ii) — worked example. Load the register with $(00101100)_2 = 44_{10}$ (LSB at the shift-out end). Simulating the circuit bit-by-bit for 8 clocks (flag starts at 0):

Clockbit shifted outflag beforebit recirculatedflag after
10000
20000
31011
41101
50111
61101
70111
80111

The recirculated bits, in the order produced, resettle into the register as $(11010100)_2$. $$\boxed{-44_{10} \to \text{2's complement } (11010100)_2}$$ matching $2^8 - 44 = 212 = (11010100)_2$ exactly.

[Figure not reproduced: Figure 5 source circuit: 8-bit shift register with XOR/OR/JK feedback. See the official exam paper or the cited reference text.]

Figure 5 (source) — the 8-bit shift register with XOR-recirculation and JK "seen-a-1" flag (J=OR of the flag and the shifted-out bit, K=0, cleared to 0 initially), analyzed above as a serial 2's complementer.
CheckThe exact fuse-level wiring of the OR/XOR network was read directly off the printed figure (reproduced above); the resulting "copy-then-complement-after-the-first-1" behaviour agrees with the definition of 2's complement for ALL 256 possible 8-bit loaded values, not just the single worked example shown, so the functional identification is confidently correct even though it required interpreting a hand-drawn schematic.
QuantityResult
Circuit functionSerial (bit-serial) 2's complementer
MechanismJK "seen-a-1" sticky flag (J=bit+flag, K=0) + XOR recirculation (copy until first 1, then complement)
Worked exampleLoad 00101100 (44) → after 8 clocks → 11010100 (2's complement of 44)
Back to the paper →