Level 3 — ProductionCombinational Circuits

Combinational Circuits

45 minutes60 marksprintable — key stays hidden on paper

Level: 3 — Production (from-scratch derivations, explain-out-loud) Time limit: 45 minutes Total marks: 60

Instructions: Show all working. Derive expressions from first principles unless a form is given. Use \oplus for XOR, X\overline{X} for NOT. Marks are shown per part.


Question 1 — Full Adder & Ripple-Carry Timing (10 marks)

(a) From the truth table, derive the sum-of-products expressions for the sum SS and carry-out CoutC_{out} of a full adder in terms of inputs AA, BB, CinC_{in}. Simplify SS to XOR form and CoutC_{out} to a 3-term minimal SOP. (4)

(b) A single full adder has a sum delay of 3 gate delays and a carry delay of 2 gate delays. For an n=4n=4 bit ripple-carry adder, derive the worst-case delay to a stable output (the final sum bit). Show the critical path reasoning. (4)

(c) State one structural reason ripple-carry becomes unattractive as nn grows, and name the alternative. (2)


Question 2 — Carry-Lookahead Derivation (12 marks)

(a) Define the generate GiG_i and propagate PiP_i signals for bit ii in terms of AiA_i, BiB_i. (2)

(b) Starting from Ci+1=Gi+PiCiC_{i+1} = G_i + P_i C_i, derive the fully expanded expression for C3C_3 (the carry into bit 3) in terms of G0,G1,G2,P0,P1,P2G_0, G_1, G_2, P_0, P_1, P_2 and C0C_0. (5)

(c) Explain why the carry-lookahead adder achieves O(1)O(1) carry-generation depth (in terms of gate levels), and state the practical cost that grows with nn. (3)

(d) Compute C3C_3 given: A=10112A = 1011_2, B=01102B = 0110_2, C0=0C_0 = 0 (bit 0 is LSB). Show Gi,PiG_i, P_i then evaluate. (2)


Question 3 — Multiplexer as Universal Logic (10 marks)

(a) Write the output expression of a 4:1 MUX with select lines S1S0S_1 S_0 and data inputs D0..D3D_0..D_3. (2)

(b) Implement the 3-variable function F(A,B,C)=m(1,2,4,7)F(A,B,C) = \sum m(1,2,4,7) using a single 4:1 MUX with A,BA, B as the select lines. Derive each data-input value (D0..D3D_0..D_3) as a function of CC (or constant). Show your working. (6)

(c) Explain in one or two sentences why an nn-select MUX can implement any function of its select variables. (2)


Question 4 — Comparator & Priority Encoder (10 marks)

(a) Derive the three outputs of a 1-bit comparator (A>BA>B, A=BA=B, A<BA<B) as Boolean expressions of A,BA, B. (3)

(b) For a 2-bit magnitude comparator (A=A1A0A = A_1A_0, B=B1B0B=B_1B_0), derive the equality output E=(A=B)E = (A=B) and the greater-than output A>BA>B. (4)

(c) Give the truth table (inputs D3D2D1D0D_3 D_2 D_1 D_0, outputs Y1Y0Y_1 Y_0, valid VV) for a 4-to-2 priority encoder where D3D_3 has highest priority, and write Y1Y_1 as a Boolean expression. (3)


Question 5 — Static Hazard Elimination (10 marks)

(a) Define a static-1 hazard. Explain the physical mechanism that causes it. (3)

(b) Consider F=AC+ABF = \overline{A}\,C + A\,B. Draw/describe the K-map (variables A,B,CA,B,C) and identify the specific input transition that produces a static-1 hazard. (4)

(c) Add the redundant consensus term that removes the hazard, and state the general rule for hazard-free two-level SOP design. (3)


Question 6 — Combinational Multiplier & Subtractor (8 marks)

(a) For a 2×22\times2 unsigned array multiplier with inputs A=A1A0A = A_1A_0, B=B1B0B = B_1B_0, derive the four partial-product bits and the resulting 4-bit product P3P2P1P0P_3P_2P_1P_0 expressions (you may use half/full adders in the description). (5)

(b) Show how a full adder + an XOR gate per bit converts an nn-bit ripple-carry adder into a two's-complement subtractor computing ABA - B. State what C0C_0 must be set to and why. (3)

Answer keyMark scheme & solutions

Question 1 (10)

(a) Truth table SOP: S=ABCin+ABCin+ABCin+ABCin=ABCinS = \overline{A}\,\overline{B}\,C_{in} + \overline{A}B\overline{C_{in}} + A\overline{B}\,\overline{C_{in}} + ABC_{in} = A \oplus B \oplus C_{in} (2 — 1 for SOP, 1 for XOR reduction) Cout=AB+BCin+ACinC_{out} = AB + BC_{in} + AC_{in} (2 — minimal 3-term SOP; the majority function)

(b) Critical path: C0C_0 enters FA0. Carry ripples FA0→FA1→FA2→FA3, each stage adding carry delay (2). After the final carry into FA3 is stable, the last sum bit needs sum delay (3).

  • Carry through 4 stages: but sum S3S_3 depends on carry-in to stage 3, i.e. C3C_3, which is produced by 3 carry propagations from C0C_0.
  • Delay =3×(carry delay)+(sum delay)=3×2+3=9= 3 \times (\text{carry delay}) + (\text{sum delay}) = 3\times 2 + 3 = 9 gate delays. (4) (Accept: (n1)×2+3=9(n-1)\times 2 + 3 = 9 for n=4n=4.)

(c) Delay grows linearly O(n)O(n) with bit-width because each carry must ripple sequentially → slow for wide adders. Alternative: carry-lookahead adder (also accept carry-select/carry-save). (2)


Question 2 (12)

(a) Gi=AiBiG_i = A_i B_i (carry generated), Pi=AiBiP_i = A_i \oplus B_i (or Ai+BiA_i + B_i for propagate; either accepted). (2)

(b) Unrolling Ci+1=Gi+PiCiC_{i+1}=G_i+P_iC_i:

  • C1=G0+P0C0C_1 = G_0 + P_0 C_0
  • C2=G1+P1C1=G1+P1G0+P1P0C0C_2 = G_1 + P_1 C_1 = G_1 + P_1 G_0 + P_1 P_0 C_0
  • C3=G2+P2C2=G2+P2G1+P2P1G0+P2P1P0C0C_3 = G_2 + P_2 C_2 = G_2 + P_2 G_1 + P_2 P_1 G_0 + P_2 P_1 P_0 C_0 (5 — 1 per correct term expansion)

(c) Each carry CiC_i is expressed as a two-level SOP (AND-OR) directly from G,P,C0G,P,C_0, so every carry is produced in 2 gate levels regardless of nn — constant depth. Practical cost: fan-in and number of gates (product terms) grows with nn, limiting full lookahead to small groups (hence hierarchical/block CLA). (3)

(d) A=1011A=1011, B=0110B=0110 → bits (LSB first): A0=1,A1=1,A2=0,A3=1A_0=1,A_1=1,A_2=0,A_3=1; B0=0,B1=1,B2=1,B3=0B_0=0,B_1=1,B_2=1,B_3=0.

  • G0=A0B0=10=0G_0=A_0B_0=1\cdot0=0, P0=10=1P_0=1\oplus0=1
  • G1=11=1G_1=1\cdot1=1, P1=11=0P_1=1\oplus1=0
  • G2=01=0G_2=0\cdot1=0, P2=01=1P_2=0\oplus1=1 C3=G2+P2G1+P2P1G0+P2P1P0C0=0+(1)(1)+(1)(0)(0)+(1)(0)(1)(0)=1C_3 = G_2 + P_2 G_1 + P_2 P_1 G_0 + P_2 P_1 P_0 C_0 = 0 + (1)(1) + (1)(0)(0) + (1)(0)(1)(0) = 1. (2)

Question 3 (10)

(a) Y=S1S0D0+S1S0D1+S1S0D2+S1S0D3Y = \overline{S_1}\,\overline{S_0}D_0 + \overline{S_1}S_0 D_1 + S_1\overline{S_0}D_2 + S_1 S_0 D_3. (2)

(b) Select =AB=A B (A=MSB=S1S_1, B=S0S_0). Group minterms by ABAB, residual on CC:

  • AB=00AB=00 (m0,m1): F=1 only at m1 (C=1) → D0=CD_0 = C
  • AB=01AB=01 (m2,m3): F=1 at m2 (C=0) → D1=CD_1 = \overline{C}
  • AB=10AB=10 (m4,m5): F=1 at m4 (C=0) → D2=CD_2 = \overline{C}
  • AB=11AB=11 (m6,m7): F=1 at m7 (C=1) → D3=CD_3 = C

So D0=C, D1=C, D2=C, D3=CD_0=C,\ D_1=\overline C,\ D_2=\overline C,\ D_3=C. (6 — mark ~1.5 each, or per correct data input)

(c) An nn-select MUX routes one of 2n2^n data inputs per select combination; by placing the truth-table output value at each data input, any function of the nn select variables is realized (it directly implements the truth table). (2)


Question 4 (10)

(a) A>B:ABA>B: A\overline{B}; A=B:AB=AB+ABA=B: \overline{A\oplus B} = \overline A\,\overline B + AB; A<B:ABA<B: \overline A B. (3)

(b) Equality: E=(A1B1)(A0B0)E = (A_1 \odot B_1)(A_0 \odot B_0) where \odot is XNOR, i.e. E=(A1B1)(A0B0).E=(\overline{A_1\oplus B_1})(\overline{A_0\oplus B_0}). (2) Greater-than: A>B=A1B1+(A1B1)A0B0.A>B = A_1\overline{B_1} + (\overline{A_1\oplus B_1})\,A_0\overline{B_0}. (compare MSB first; if MSBs equal, compare LSB.) (2)

(c) Priority encoder (X=don't care), D3D_3 highest:

D3D2D1D0D_3 D_2 D_1 D_0 Y1Y0Y_1 Y_0 V
0 0 0 0 X X 0
0 0 0 1 0 0 1
0 0 1 X 0 1 1
0 1 X X 1 0 1
1 X X X 1 1 1

Y1=D3+D2Y_1 = D_3 + D_2; (Y0=D3+D2D1Y_0 = D_3 + \overline{D_2}D_1, V=D3+D2+D1+D0V = D_3+D_2+D_1+D_0). (3 — table 2, Y1Y_1 1)


Question 5 (10)

(a) A static-1 hazard: output should stay at logic 1 across a single-variable input change but momentarily glitches to 0. Cause: two paths of differing propagation delay converge; a change in one variable switches the covering product term off before the other turns on, leaving a gap. (3)

(b) F=AC+ABF=\overline A C + A B. On K-map, the "1" cells AC\overline A C (A=0,C=1) and ABAB (A=1,B=1) are adjacent when B=1,C=1B=1,C=1. Transition A:01A:0\to1 with B=C=1B=C=1: leaving cover of AC\overline A C, entering cover of ABAB — no common product term spans the boundary → static-1 hazard. (4)

(c) Add consensus term BCBC: F=AC+AB+BCF = \overline A C + AB + BC. This term stays high throughout the AA transition when B=C=1B=C=1, covering the gap. General rule: a two-level SOP is hazard-free for single-input changes iff every pair of adjacent 1-minterms is covered by a common product term (include all consensus/redundant primes needed to overlap covers). (3)


Question 6 (8)

(a) Partial products: A0B0, A1B0, A0B1, A1B1A_0B_0,\ A_1B_0,\ A_0B_1,\ A_1B_1.

  • P0=A0B0P_0 = A_0 B_0
  • P1=A1B0A0B1P_1 = A_1 B_0 \oplus A_0 B_1, carry c1=A1B0A0B1c_1 = A_1B_0\cdot A_0B_1
  • P2=(A1B1)c1P_2 = (A_1 B_1) \oplus c_1, carry c2=A1B1c1c_2 = A_1B_1\cdot c_1
  • P3=c2P_3 = c_2 (HA/FA description acceptable.) (5)

(b) For ABA-B in two's complement: XOR each BiB_i with a control line M=1M=1 to invert (Bi1=BiB_i \oplus 1 = \overline{B_i}), forming one's complement; set carry-in C0=1C_0 = 1 to add 1, completing two's complement. Result A+B+1=ABA + \overline B + 1 = A - B. So per bit: FA computes Ai+(BiM)+carryA_i + (B_i\oplus M) + \text{carry}, with C0=M=1C_0=M=1 for subtract. (3)

[
  {"claim":"RCA n=4 delay = 3*carry+sum = 9","code":"carry=2; summ=3; n=4; result=((n-1)*carry+summ)==9"},
  {"claim":"C3 for A=1011,B=0110,C0=0 equals 1","code":"A=[1,1,0,1]; B=[0,1,1,0]; C0=0; G=[A[i]&B[i] for i in range(4)]; P=[A[i]^B[i] for i in range(4)]; C3=G[2] | (P[2]&G[1]) | (P[2]&P[1]&G[0]) | (P[2]&P[1]&P[0]&C0); result=C3==1"},
  {"claim":"MUX data inputs realize F=sum m(1,2,4,7)","code":"from sympy import symbols; C=symbols('C'); vals={}; mins={1,2,4,7}; ok=True; D={}; \nfor AB in range(4):\n    a=(AB>>1)&1; b=AB&1; d0=1 if (AB*2+0) in mins else 0; d1=1 if (AB*2+1) in mins else 0; D[AB]=(d0,d1)\nexp={0:(0,1),1:(1,0),2:(1,0),3:(0,1)}; result=(D==exp)"},
  {"claim":"2x2 multiplier: A=3,B=3 gives product 9","code":"A=[1,1]; B=[1,1]; P0=A[0]&B[0]; s1=(A[1]&B[0])^(A[0]&B[1]); c1=(A[1]&B[0])&(A[0]&B[1]); P1=s1; P2=(A[1]&B[1])^c1; c2=(A[1]&B[1])&c1; P3=c2; val=P0+2*P1+4*P2+8*P3; result=val==9"}
]