Level 4 — ApplicationBoolean Algebra & Logic Gates

Boolean Algebra & Logic Gates

60 minutes60 marksprintable — key stays hidden on paper

Level: 4 (Application — novel problems, no hints) Time limit: 60 minutes Total marks: 60

Answer all questions. Show all working. Use ...... notation for Boolean expressions where A\overline{A} denotes NOT, \cdot denotes AND, ++ denotes OR, \oplus denotes XOR.


Question 1 — Number systems & two's complement [12 marks]

A microcontroller stores 8-bit signed integers in two's complement.

(a) Convert decimal 93-93 to its 8-bit two's complement binary form, then express that byte in hexadecimal. [4]

(b) The register holds the byte 0xB6. Interpret it as (i) an unsigned integer and (ii) a signed two's complement integer. [3]

(c) Perform the 8-bit two's complement addition of +59+59 and +87+87. State the resulting byte, the decimal value it represents when interpreted as signed, and whether overflow occurred (justify using the carry-in/carry-out or sign rule). [5]


Question 2 — Gate-level derivation & universal gates [14 marks]

A 2-input function F(A,B)F(A,B) produces output 1 only when the two inputs differ.

(a) Name this function and write its Boolean expression. [2]

(b) Construct the complete truth table for FF. [2]

(c) Prove algebraically that FF can be implemented using exactly four 2-input NAND gates. Show the intermediate signals. [6]

(d) A single NAND gate has propagation delay tp=4 nst_p = 4\text{ ns}. Determine the worst-case propagation delay from an input transition to the output of your 4-NAND circuit, and explain which path is critical. [4]


Question 3 — SOP, POS and Boolean laws [12 marks]

Consider the function defined by the minterms: F(A,B,C)=m(1,2,4,7)F(A,B,C) = \sum m(1,2,4,7)

(a) Write the canonical Sum-of-Products (SOP) expression. [3]

(b) Write the canonical Product-of-Sums (POS) expression by first identifying the maxterms. [3]

(c) Using only Boolean algebra laws (state each law used), simplify ABC+ABC+ABC+ABC\overline{A}BC + A\overline{B}C + ABC + AB\overline{C} as far as possible. [6]


Question 4 — Karnaugh map with don't-cares [12 marks]

A 4-variable function of inputs A,B,C,DA,B,C,D is specified as: F=m(0,2,5,7,8,10,13,15)+d(1,3)F = \sum m(0,2,5,7,8,10,13,15) + \sum d(1,3) where dd denotes don't-care conditions.

(a) Draw the 4-variable K-map and enter the 1s, 0s and don't-cares. [4]

(b) Determine the minimal SOP expression, clearly circling/listing your prime implicant groups. State whether you used either don't-care to reduce the term count. [6]

(c) Count the number of 2-input gates (AND/OR only) required for a two-level implementation of your minimal SOP. [2]


Question 5 — Quine–McCluskey method [10 marks]

For the function F(A,B,C)=m(0,1,2,5,6,7)F(A,B,C) = \sum m(0,1,2,5,6,7)

(a) Apply the Quine–McCluskey tabular method: group minterms by number of 1s, perform the combination steps, and list all prime implicants. [7]

(b) Build the prime implicant chart and derive the minimal expression. Identify any essential prime implicants. [3]

Answer keyMark scheme & solutions

Question 1 [12]

(a) 93-93 in 8-bit two's complement. [4]

  • +93=010111012+93 = 0101\,1101_2 (64+16+8+4+1). [1]
  • Invert: 101000101010\,0010. [1]
  • Add 1: 101000111010\,0011. [1]
  • Hex: 10100011=0xA31010\,0011 = \text{0xA3}. [1]

(b) Byte 0xB6 = 1011011021011\,0110_2. [1]

  • (i) Unsigned =128+32+16+4+2=182= 128+32+16+4+2 = 182. [1]
  • (ii) Signed: MSB=1 so negative. Two's complement: value =182256=74= 182-256 = -74. [1]

(c) 59+8759 + 87: [5]

  • 59=0011101159 = 0011\,1011, 87=0101011187 = 0101\,0111. [1]
  • Sum: 00111011+01010111=100100100011\,1011 + 0101\,0111 = 1001\,0010 (= 146 unsigned). [2]
  • Interpreted signed: MSB=1 → 146256=110146-256 = -110. [1]
  • Overflow: two positives gave a negative sign → overflow occurred. (Carry into MSB = 1, carry out of MSB = 0; they differ ⇒ overflow.) [1]

Question 2 [14]

(a) Function is XOR. F=AB=AB+ABF = A\oplus B = \overline{A}B + A\overline{B}. [2]

(b) Truth table: [2]

A B F
0 0 0
0 1 1
1 0 1
1 1 0

(c) 4-NAND XOR proof: [6] Let N(x,y)=xyN(x,y)=\overline{xy}.

  • G1=N(A,B)=ABG_1 = N(A,B) = \overline{AB}. [1]
  • G2=N(A,G1)=AAB=A(A+B)=ABG_2 = N(A,G_1) = \overline{A\cdot\overline{AB}} = \overline{A(\overline{A}+\overline{B})} = \overline{A\overline{B}}. [1.5]
  • G3=N(B,G1)=BAB=B(A+B)=ABG_3 = N(B,G_1) = \overline{B\cdot\overline{AB}} = \overline{B(\overline{A}+\overline{B})} = \overline{\overline{A}B}. [1.5]
  • G4=N(G2,G3)=ABAB=AB+ABG_4 = N(G_2,G_3) = \overline{\overline{A\overline{B}}\cdot\overline{\overline{A}B}} = A\overline{B} + \overline{A}B (De Morgan). [2] This equals ABA\oplus B. ∎

(d) Propagation delay: [4]

  • G1G_1 is level 1; G2,G3G_2,G_3 are level 2 (fed by G1G_1); G4G_4 is level 3. [2]
  • Critical path: input → G1G_1G2G_2(or G3G_3) → G4G_4 = 3 gates in series. [1]
  • Worst-case delay =3×4=12 ns= 3\times 4 = 12\text{ ns}. [1]

Question 3 [12]

(a) Canonical SOP (m1,m2,m4,m7): [3] F=ABC+ABC+ABC+ABCF = \overline{A}\,\overline{B}C + \overline{A}B\overline{C} + A\overline{B}\,\overline{C} + ABC (1 mark for correct set, deduct for each wrong term; full 3 for all correct.)

(b) Maxterms are the remaining M(0,3,5,6)M(0,3,5,6): [3] F=(A+B+C)(A+B+C)(A+B+C)(A+B+C)F = (A+B+C)(A+\overline{B}+\overline{C})(\overline{A}+B+\overline{C})(\overline{A}+\overline{B}+C)

(c) Simplify ABC+ABC+ABC+ABC\overline{A}BC + A\overline{B}C + ABC + AB\overline{C}: [6]

  • Combine ABC+ABC=BC\overline{A}BC + ABC = BC (distributive/complement A+A=1A+\overline{A}=1). [2]
  • Combine ABCA\overline{B}C... use ABCABC again via idempotent ABC+ABCABC+ABC. Take ABC+ABC=ACA\overline{B}C + ABC = AC. [2]
  • Combine ABC+ABC=ABABC + AB\overline{C} = AB. [1]
  • Result: F=BC+AC+ABF = BC + AC + AB (majority function). [1]

Question 4 [12]

(a) K-map (rows AB, cols CD; order 00,01,11,10): [4]

AB\CD 00 01 11 10
00 1 d d 1
01 0 1 1 0
11 0 1 1 0
10 1 0 0 1

(minterms: 0,2 in AB=00; 5,7 in AB=01; 8,10 in AB=10; 13,15 in AB=11; d=1,3 in AB=00)

(b) Grouping: [6]

  • Ones at 5,7,13,15 → columns CD=01,11 with B=1,D=1B=1,D=1: group BDBD. [2]
  • Ones at 0,2,8,10 (with don't-cares 1,3 available in AB=00):
    • Group BD\overline{B}\,\overline{D} covers 0,2,8,10. [2]
    • The don't-cares 1,3 could extend but are not needed; using BD\overline{B}\,\overline{D} alone is minimal.
  • Minimal SOP: F=BD+BDF = BD + \overline{B}\,\overline{D} [1] This is the XNOR of BB and DD: F=BDF = \overline{B\oplus D}. Don't-cares not needed for minimality. [1]

(c) Two-level: 2 AND gates (each 2-input) + 1 OR gate = 3 gates. (One AND needs B,D\overline{B},\overline{D} via inverters, not counted as 2-input AND/OR.) [2]


Question 5 [10]

(a) QM combination for m(0,1,2,5,6,7)\sum m(0,1,2,5,6,7): [7]

Group by 1s (3-bit):

  • 0 ones: 000 (0)
  • 1 one: 001(1), 010(2)
  • 2 ones: 101(5), 110(6)
  • 3 ones: 111(7)

Combine size-2:

  • 0-1: 00– (0,1)
  • 0-2: 0–0 (0,2)
  • 1-5: –01 (1,5)
  • 2-6: –10 (2,6)
  • 5-7: 1–1 (5,7)
  • 6-7: 11– (6,7)

Combine size-4: none combine (differing patterns don't pair with matching dashes). Prime implicants: (0,1)=AB\overline{A}\,\overline{B}; (0,2)=AC\overline{A}\,\overline{C}; (1,5)=BC\overline{B}C; (2,6)=C...C\overline{... } wait: (2,6)=–10 → BCB\overline{C}; (5,7)=ACAC; (6,7)=ABAB. [7]

PIs: AB, AC, BC, BC, AC, AB\overline{A}\,\overline{B},\ \overline{A}\,\overline{C},\ \overline{B}C,\ B\overline{C},\ AC,\ AB.

(b) PI chart (minterms 0,1,2,5,6,7): [3]

PI 0 1 2 5 6 7
AB\overline{A}\,\overline{B} (0,1)
AC\overline{A}\,\overline{C} (0,2)
BC\overline{B}C (1,5)
BCB\overline{C} (2,6)
ACAC (5,7)
ABAB (6,7)

No single essential PI (each minterm covered ≥2 ways). A minimal cover needs 3 PIs, e.g.: F=AB+BC+ACF = \overline{A}\,\overline{B} + B\overline{C} + AC (covers 0,1 / 2,6 / 5,7 — all six minterms). Alternative equally minimal: AC+BC+AB\overline{A}\,\overline{C}+\overline{B}C+AB. [3]


[
  {"claim":"-93 in 8-bit two's complement equals 0xA3 (163 as unsigned pattern)","code":"val=(-93)%256; result = (val==0xA3)"},
  {"claim":"0xB6 as signed 8-bit is -74","code":"u=0xB6; s=u-256 if u>=128 else u; result = (s==-74)"},
  {"claim":"59+87 signed 8-bit overflows to -110","code":"r=(59+87)%256; s=r-256 if r>=128 else r; result = (r==0b10010010 and s==-110)"},
  {"claim":"Q3(c) majority: minterm sum of BC+AC+AB equals AND/OR combos over the 4 given terms","code":"A,B,C=symbols('A B C'); f=(~A&B&C)|(A&~B&C)|(A&B&C)|(A&B&~C); g=(B&C)|(A&C)|(A&B); result = simplify_logic(f)==simplify_logic(g)"},
  {"claim":"Q4 minimal F = BD + ~B~D equals XNOR of B,D over minterm set","code":"A,B,C,D=symbols('A B C D'); mins=[0,2,5,7,8,10,13,15]; dc=[1,3]; f=(B&D)|(~B&~D); vals=[]; \nfrom itertools import product\nok=True\nfor a,b,c,d in product([0,1],repeat=4):\n    idx=a*8+b*4+c*2+d\n    fv=1 if f.subs({A:a,B:b,C:c,D:d}) else 0\n    if idx in mins:\n        ok=ok and fv==1\n    elif idx in dc:\n        pass\n    else:\n        ok=ok and fv==0\nresult = ok"},
  {"claim":"Q5 F=~A~B + B~C + AC covers exactly m(0,1,2,5,6,7)","code":"A,B,C=symbols('A B C'); f=(~A&~B)|(B&~C)|(A&C); cov=set(); \nfrom itertools import product\nfor a,b,c in product([0,1],repeat=3):\n    if f.subs({A:a,B:b,C:c}): cov.add(a*4+b*2+c)\nresult = cov=={0,1,2,5,6,7}"}
]