Question 5 of 5: Flip-Flop Conversion, Frequency Division and Serial 2’s-Complement
Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)
Notes on this paper
National Exams — December 2017 — 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/FPGA architectures, flip-flop conversion, sequential design, arithmetic circuits; Floyd, Digital Fundamentals (11th ed., Pearson) — decoders, number systems, flip-flop characteristic tables, counters.
Question 5: Flip-Flop Conversion, Frequency Division and Serial 2’s-Complement (25 marks)
Given. (a) a JK flip-flop and unlimited logic gates. (b) a 60MHz, 25%-duty clock. (c) an 8-bit number pre-loaded into an 8-bit shift register.
Find. (a) a Toggle-flip-flop circuit; (b) a 15MHz, 50%-duty generator plus its timing diagram; (c) a shift-register-based 2’s-complement converter.
Approach. (a) Use the JK characteristic table directly — J=K=1 always toggles. (b) An edge-triggered toggle flip-flop halves frequency AND always outputs exactly 50% duty regardless of its input’s duty cycle, because only the edge spacing (not the pulse width) of the driving clock matters; cascade two such stages for a divide-by-4. (c) Realize the standard “copy bits up to and including the first 1, then complement every bit after it” 2’s-complement algorithm as a rotate-through-XOR shift register gated by a one-shot “seen a 1 yet” flag.
Part (a) — Toggle from JK. The JK characteristic table gives Q+=Qn when J=K=0 (hold) and Q+=Qn′ when J=K=1 (toggle). Tying the J and K inputs together to a single control line T therefore needs no additional gate at all — just a wire junction: $$\boxed{J=K=T:\ T=0\Rightarrow\text{hold},\ T=1\Rightarrow\text{toggle every clock}}$$ For an unconditional toggle flip-flop (as this part asks for), tie J=K=1 permanently (Fig. Q5a). Verified against the native JK table for all 4 (T,Q) combinations.
Part (b) — divide-by-4 chain. Configure each D flip-flop as a toggle stage (D tied to its own Q′, i.e. D-FF wired exactly like the T-FF of part a). The key fact: an edge-triggered flip-flop only cares WHEN its clock crosses the triggering edge, not how long the clock stays high — so even though the 60MHz input is high for only 25% of each 16.667 ns period, its positive edges are still exactly 16.667 ns apart. The first toggle stage (Qa) therefore produces a perfectly even 30MHz, 50%-duty square wave; a second toggle stage clocked by Qa halves it again to $$\boxed{60\text{MHz}/4 = 15\text{MHz, exactly 50\% duty}}$$ (edge times: 0, 16.667, 33.333, … ns, independent of the input duty cycle).
Part (c) — shift-register 2’s complement. The standard rule “scan from the LSB, copy bits unchanged up to and including the first 1, then complement every bit after it” is realized with one extra “sticky-one” flag flip-flop: each clock, let bit = the register’s current LSB (Q0); output bit = bit ⊕ flag (using flag’s value BEFORE this clock, so the first 1 itself is passed through unchanged); then update flag’s D input to flag + bit (it latches permanently high the cycle after the first 1 appears). Rotating that output bit back into the MSB end of the register while every other bit shifts one place towards the LSB means that after exactly 8 clock cycles — one full rotation — the register holds the 2’s complement of the original number, exactly as the question specifies. $$\boxed{\text{bit}_{out}=Q_0 \oplus \text{flag},\quad \text{flag}^+=\text{flag}+Q_0}$$ verified against 9 test values (including 0, 128, 255) by simulating all 8 rotations and comparing to 256−N mod 256.
Fig. Q5(a) — Toggle flip-flop: J and K tied together to T (unconditional toggle shown with T permanently high).
Fig. Q5(b) — two divide-by-2 stages turn the 60MHz/25%-duty clock into a 15MHz/50%-duty output; each stage’s edges stay evenly spaced regardless of duty cycle.
Fig. Q5(c) — 8-bit rotate-through-XOR shift register: the LSB is XORed with a sticky-one flag and rotated back into the MSB; after 8 clocks the register holds the 2’s complement.