Top Banner Ad

BEC302 — Unit 2: Combinational circuits

Table of Contents (22 sections)

BEC302 · DIGITAL SYSTEM DESIGN · Unit 2

Combinational circuits

Unit Scope & Exam Weightage: This unit turns gate-level algebra into MSI building blocks: analysis/design of combinational circuits, half/full adders and subtractors (serial, parallel, BCD), magnitude comparators, multiplexers and demultiplexers, encoders and decoders, circuit realisation with MUX/decoder, and barrel shifter/ALU. The unit consistently contributes 14–21 marks, especially 7-mark design questions on full adders, comparators and MUX-based realisation.


Front Page: Importance-Wise Topic Roadmap (2023–26 PYQs)

Priority Topic (Exact Syllabus) PYQs Asked Marks Weightage Tag
1 half and full adders 4 (2023-24 ×3, 2025-26) 7m × 3 + 2m Survival Mode Design
2 MSI devices like comparators 3 (2023-24 ×2, 2024-25) 7m × 3 Survival Mode Design
3 multiplexers (+ circuit realization using Multiplexers and decoders) 4 (2023-24, 2024-25, 2025-26 ×2) 7m × 3 + 2m High-Yield
4 encoder (+ decoder) 2 (2024-25 ×2) 7m + 2m Design
5 serial and parallel adders 1 (2025-26) 7m Numerical/Design
6 subtractors, BCD adder, barrel shifter and ALU 0 direct — Supporting Topic

2-Hour Last-Night Survival Checklist:

  1. Adder equations: half adder S=A⊕BS=A\oplus B, C=ABC=AB; full adder S=A⊕B⊕CinS=A\oplus B\oplus C_{in}, Cout=AB+BCin+ACinC_{out}=AB+BC_{in}+AC_{in}; derive both from the truth table before drawing gates.
  2. Comparator: A>B=A1Bˉ1+(A1⊙B1)A0Bˉ0A>B=A_1\bar B_1+(A_1\odot B_1)A_0\bar B_0; A=B=(A1⊙B1)(A0⊙B0)A=B=(A_1\odot B_1)(A_0\odot B_0); A<BA<B is the complement — memorise this cascade form for any bit width.
  3. MUX realisation: for an nn-variable function use an 2n−12^{n-1}:1 MUX with the remaining variable(s) as data inputs (0, 1, XX, Xˉ\bar X); implement 16:1 with five 4:1 MUXes in two levels.
  4. Encoder/decoder: an n:2nn{:}2^n decoder gives one-hot minterms; an encoder reverses it; a priority encoder resolves simultaneous inputs by highest index.
  5. Adder–subtractor: feed B⊕SubB\oplus Sub into a ripple adder with C0=SubC_0=Sub; overflow V=Cin(MSB)⊕Cout(MSB)V=C_{\text{in(MSB)}}\oplus C_{\text{out(MSB)}}.

1. Analysis and Design of Combinational Circuits

Combinational circuit (2 Marks): a logic network whose outputs at any instant depend only on the present inputs — it contains no memory element and no feedback path. Examples: adders, comparators, multiplexers, decoders, encoders and ALUs.

Design flow: statement → truth table → Boolean expression → minimise (algebra/K-map) → draw logic diagram → verify with the truth table. Analysis flow: logic diagram → equations → truth table → interpretation.


2. Half and Full Adders, Subtractors

2.1 Half Adder

S=A⊕B=AˉB+ABˉ,C=ABS=A\oplus B=\bar AB+A\bar B,\qquad C=AB
AA BB Sum Carry
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1

Limitation: no carry-in, so it cannot be cascaded for multi-bit addition.

2.2 Full Adder

S=A⊕B⊕Cin,Cout=AB+ACin+BCin=AB+Cin(A⊕B)S=A\oplus B\oplus C_{in},\qquad C_{out}=AB+AC_{in}+BC_{in}=AB+C_{in}(A\oplus B)
AA BB CinC_{in} Sum CoutC_{out}
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1

Two half adders plus an OR gate form a full adder: HA1 adds A+B→S1,C1A+B\to S_1,C_1; HA2 adds S1+Cin→S,C2S_1+C_{in}\to S,C_2; Cout=C1+C2C_{out}=C_1+C_2.

Full adder from NANDs only: generate P=A⊕BP=A\oplus B with four NANDs, S=P⊕CinS=P\oplus C_{in} with four more, Pˉ=NAND(P,P)\bar P=\text{NAND}(P,P), and Cout=NAND(NAND(A,B),NAND(PCin))C_{out}=\text{NAND}(\text{NAND}(A,B),\text{NAND}(P C_{in})) — NAND–NAND realisation of AB+PCinAB+PC_{in}.

2.3 Subtractors

  • Half subtractor: D=A⊕BD=A\oplus B, Bout=AˉBB_{out}=\bar AB.
  • Full subtractor: D=A⊕B⊕BinD=A\oplus B\oplus B_{in}, Bout=AˉB+AˉBin+BBinB_{out}=\bar AB+\bar A B_{in}+B B_{in}.
  • Practical machines use a adder–subtractor: B⊕SubB\oplus Sub into the adder; Sub=0Sub=0 → add, Sub=1Sub=1 → add 2's complement of BB.

2.4 Serial and Parallel Adders

Type Hardware Speed Cost
Serial (bit-serial) One full adder + shift registers; bits added one at a time Slow: nn clock cycles Very low hardware
Ripple-carry parallel nn full adders, CoutC_{out} of stage ii to CinC_{in} of i+1i+1 Moderate: carry ripples through nn gates Low, simple
Carry-lookahead Generate Gi=AiBiG_i=A_iB_i, Propagate Pi=Ai⊕BiP_i=A_i\oplus B_i; Ci+1=Gi+PiCiC_{i+1}=G_i+P_iC_i Fast, logarithmic carry More hardware

Overflow in 2's complement: V=Cn−1⊕CnV=C_{n-1}\oplus C_n (carry into sign bit XOR carry out). Example 4-bit 5+4=0101+0100=1001=−75+4=0101+0100=1001=-7: carry into MSB =1, carry out=0 → V=1V=1.

2.5 BCD Adder and Barrel Shifter

BCD adder: add two 4-bit BCD digits with a 4-bit binary adder; if the result exceeds 9 (Cout=1C_{out}=1 or S3S2S1S0>1001S_3S_2S_1S_0>1001), add 01100110 (6) via a second adder and take the new carry as the BCD carry.

Barrel shifter: combinational NN-bit shifter built from log₂NN stages of muxes; shift amount selects which input tap reaches the output; used inside ALUs for variable shifts and rotations. ALU = barrel shifter + arithmetic unit + logic unit selected by operation code.

Examiner Tip (adder designs): For the 2023-24 "design a full adder by constructing the truth table and simplify the output equations" question, the marks are in this order: 8-row table (2 marks), SS via K-map or XOR (2), CoutC_{out} via K-map (2), gate diagram with two-HA construction (1). Never skip the carry equation — it is the most commonly omitted scoring point.


3. Magnitude Comparators

Comparator (2 Marks): a combinational circuit that compares two binary words and asserts one of A>BA>B, A=BA=B, A<BA<B. It is the decision block in sorting, address decoding and condition-code logic.

3.1 1-Bit Comparison

A>B=ABˉA>B=A\bar B, A<B=AˉBA<B=\bar AB, A=B=A⊕B‾=A⊙BA=B=\overline{A\oplus B}=A\odot B (XNOR).

3.2 2-Bit Comparator Design

Let the numbers be A1A0A_1A_0 and B1B0B_1B_0. Compare the MSB first; if equal, compare the LSB:

A>B=A1Bˉ1+(A1⊙B1)A0Bˉ0A>B = A_1\bar B_1 + (A_1\odot B_1)A_0\bar B_0 A<B=Aˉ1B1+(A1⊙B1)Aˉ0B0A<B = \bar A_1B_1 + (A_1\odot B_1)\bar A_0B_0 A=B=(A1⊙B1)(A0⊙B0)A=B = (A_1\odot B_1)(A_0\odot B_0)
A1A0A_1A_0 B1B0B_1B_0 A>BA>B A=BA=B A<BA<B
10 01 1 0 0
01 01 0 1 0
00 10 0 0 1
11 11 0 1 0

Cascade extension for nn bits: (A>B)i=(A>B)i−1+(A=B)i−1AiBˉi(A>B)_i=(A>B)_{i-1}+(A=B)_{i-1}A_i\bar B_i; similarly for A<BA<B. This is how a 4-bit comparator IC (74LS85) expands.


4. Multiplexers, Demultiplexers and Function Realisation

Multiplexer (MUX) (2 Marks): a combinational switch that selects one of 2n2^n data inputs and routes it to a single output using nn select lines. A demultiplexer (DEMUX) performs the reverse: one input is routed to one of 2n2^n outputs.

Device Inputs Outputs Select lines Expression for 4:1
4:1 MUX 4 data (D0..D3D_0..D_3) 1 2 (S1S0S_1S_0) Y=Sˉ1Sˉ0D0+Sˉ1S0D1+S1Sˉ0D2+S1S0D3Y=\bar S_1\bar S_0D_0+\bar S_1S_0D_1+S_1\bar S_0D_2+S_1S_0D_3
1:4 DEMUX 1 data 4 2 Yi=D⋅(minterm of select)Y_i=D\cdot(\text{minterm of select})

Building a larger MUX: a 16:1 MUX needs four select lines S3S2S1S0S_3S_2S_1S_0. Use four 4:1 MUXes for groups D0D_0–D3D_3, D4D_4–D7D_7, D8D_8–D11D_{11}, D12D_{12}–D15D_{15} driven by S1S0S_1S_0; feed their four outputs into a fifth 4:1 MUX whose select is S3S2S_3S_2. Total = five 4:1 MUXes.

Function realisation with an MUX: for an nn-variable function, use an 2n−12^{n-1}:1 MUX; apply n−1n-1 variables to the select lines and derive each data input as a function (0, 1, variable or complement) of the remaining variable by comparing rows of the truth table.


5. Encoders and Decoders

Decoder (2 Marks): an n:2nn{:}2^n circuit that activates exactly one output for each input code — its outputs are the minterms, so any Boolean function can be built by OR-ing selected minterms. Encoder: the inverse circuit, converting a one-hot input into an nn-bit code.

Feature Encoder Decoder
Direction 2n2^n inputs → nn outputs nn inputs → 2n2^n outputs
Output Binary code One-hot minterm
Conflict Multiple inputs ambiguous Only one output high
Priority version Highest-index active input wins Enable input for expansion

4-bit priority encoder (inputs D3D_3 highest priority):

A1=D2+D3,A0=D3+Dˉ2D1,V=D0+D1+D2+D3A_1=D_2+D_3,\qquad A_0=D_3+\bar D_2D_1,\qquad V=D_0+D_1+D_2+D_3
D3D2D1D0D_3D_2D_1D_0 A1A0A_1A_0 VV Reason
0001 00 1 D0D_0 only
0010 01 1 D1D_1
0100 10 1 D2D_2
1001 11 1 D3D_3 wins over D0D_0

Examiner Tip (comparator/MUX): For "Design a two-bit comparator circuit using logic gates", first write the three equations from Section 3.2, then draw two XNOR gates (equality of each bit) and two AND–OR networks; state that A=BA=B needs only one AND of the two XNORs. For MUX questions, always show the truth-table reduction to data inputs — this is where the marks are, not in the MUX symbol.

After-Topic PYQs:

  • 2023-24 (7 Marks): "Design a full adder by constructing the truth table and simplify the output equations." / "Implement a full adder using NAND gates."
  • 2025-26 (7 Marks): "Describe a circuit of 4-bit binary adder-subtractor with overflow detection."
  • 2024-25 (7 Marks): "What is a comparator? Design and implement a 2-bit comparator." / "Design 4 bit priority Encoder."
  • 2023-24 / 2025-26 (7 Marks): "What is magnitude comparator? Design a two-bit comparator circuit using logic gates."
  • 2024-25 (7 Marks): "What is multiplexer? Design 16:1 multiplexer using 4:1 multiplexer."
  • 2025-26 (7 Marks): "Implement the following Boolean function using 4:1 MUX: F(A,B,C,D)=∑m(0,1,3,4,7,8,9,11,14,15)F(A, B, C, D) = \sum m(0, 1, 3, 4, 7, 8, 9, 11, 14, 15)."
  • 2024-25 (2 Marks): "Differentiate between encoder and decoder."
  • 2023-24 (2 Marks): "Explain the operation of a multiplexer." / "How does a full adder differ from a half adder?"

Solved Exam-Ready Questions

Solved Q1 (2023-24 — 7 Marks | Full Adder Design)

Q: Design a full adder by constructing the truth table and simplify the output equations.

Solution:

  1. Truth table: eight rows with inputs A,B,CinA,B,C_{in} and outputs S,CoutS,C_{out} (given in Section 2.2).
  2. Sum: S=1S=1 at minterms 1,2,4,7; these are exactly the odd-parity combinations, so S=A⊕B⊕CinS=A\oplus B\oplus C_{in}.
  3. Carry K-map: group {6,7}→AB\{6,7\}\to AB, {5,7}→ACin\{5,7\}\to AC_{in}, {3,7}→BCin\{3,7\}\to BC_{in}.
Cout=AB+ACin+BCin=AB+Cin(A⊕B)C_{out}=AB+AC_{in}+BC_{in}=AB+C_{in}(A\oplus B)
  1. Realisation: two half adders and an OR gate, or two XOR gates + three ANDs + one OR.
  2. Verification row: A=1,B=1,Cin=1A=1,B=1,C_{in}=1 → S=1⊕1⊕1=1S=1\oplus1\oplus1=1, Cout=1+1+1=1C_{out}=1+1+1=1 ✓ matches the table.
  3. Cascade use: tie CinC_{in} of the least significant bit to 0 and connect each CoutC_{out} to the next CinC_{in} to form an nn-bit ripple adder.

Solved Q2 (2023-24 — 7 Marks | Full Adder with NANDs)

Q: Implement a full adder using NAND gates.

Solution:

  1. Replace every NOT by a NAND with tied inputs: Aˉ=NAND(A,A)\bar A=\text{NAND}(A,A).
  2. Build XOR P=A⊕BP=A\oplus B using the four-NAND network: N1=AB‾N_1=\overline{AB}, N2=AN1‾N_2=\overline{AN_1}, N3=BN1‾N_3=\overline{BN_1}, P=N2N3‾P=\overline{N_2N_3}.
  3. Build the second XOR S=P⊕CinS=P\oplus C_{in} with the same four-NAND structure using PP and CinC_{in}.
  4. Carry: Cout=AB+PCin=AB‾⋅PCin‾‾C_{out}=AB+PC_{in}=\overline{\overline{AB}\cdot\overline{PC_{in}}} — use NAND(A,BA,B), NAND(P,CinP,C_{in}) and a final NAND to combine them.
  5. Total ≈11 NAND gates (4+4+3), all of the same IC type — the practical advantage.
  6. Check: for A=B=1,Cin=0A=B=1,C_{in}=0: P=0P=0, S=0S=0, Cout=0⋅1‾=1C_{out}=\overline{0\cdot1}=1 ✓.

Solved Q3 (2024-25 — 7 Marks | 2-bit Comparator)

Q: What is a comparator? Design and implement a 2-bit comparator.

Solution:

  1. Definition: a combinational circuit that compares two binary numbers and generates A>BA>B, A=BA=B, A<BA<B.
  2. Bitwise equality: E1=A1⊙B1E_1=A_1\odot B_1, E0=A0⊙B0E_0=A_0\odot B_0 using XNOR gates.
  3. Equality output: A=B=E1E0A=B=E_1E_0.
  4. Greater output: A>B=A1Bˉ1+E1A0Bˉ0A>B=A_1\bar B_1+E_1A_0\bar B_0 — the MSB decides first; only if MSBs are equal does the LSB matter.
  5. Lesser output: A<B=Aˉ1B1+E1Aˉ0B0A<B=\bar A_1B_1+E_1\bar A_0B_0.
  6. Circuit: two XNOR gates, two inverters per bit pair, three AND gates and two OR gates (or NAND–NAND equivalents).
  7. Test: A=10A=10, B=01B=01: E1=0E_1=0, A1Bˉ1=1⋅1=1A_1\bar B_1=1\cdot1=1 → A>B=1A>B=1 ✓.

Solved Q4 (2024-25 — 7 Marks | 4-bit Priority Encoder)

Q: Design 4 bit priority Encoder.

Solution:

  1. Inputs: D0D_0 (lowest) … D3D_3 (highest priority). Outputs: A1,A0A_1,A_0 and valid bit VV.
  2. Truth table: 0001→00, 0010→01, 0100→10, 1000→11; with multiple 1s the highest index wins (e.g. 1001→11).
  3. A1=1A_1=1 whenever D2D_2 or D3D_3 is active: A1=D2+D3A_1=D_2+D_3.
  4. A0=1A_0=1 for D1D_1 (provided D2,D3D_2,D_3 are 0) or D3D_3: A0=D3+Dˉ2D1A_0=D_3+\bar D_2D_1.
  5. Valid: V=D0+D1+D2+D3V=D_0+D_1+D_2+D_3; when V=0V=0 no input is asserted.
  6. Circuit: OR for A1A_1, NOT–AND–OR for A0A_0, four-input OR for VV.
  7. Check 1101 (D3=1,D2=1,D0=1D_3=1,D_2=1,D_0=1): A1=1A_1=1, A0=1A_0=1, V=1V=1 → code 11, correct priority.

Solved Q5 (2024-25 — 7 Marks | 16:1 MUX from 4:1 MUXes)

Q: What is multiplexer? Design 16:1 multiplexer using 4:1 multiplexer.

Solution:

  1. Definition: a MUX selects one of 2n2^n inputs using nn select lines; output Y=∑(minterm of selects)⋅DiY=\sum(\text{minterm of selects})\cdot D_i.
  2. A 16:1 MUX needs four select lines S3,S2,S1,S0S_3,S_2,S_1,S_0 and 16 data inputs.
  3. First level: four 4:1 MUXes M0–M3 receive D0D_0–D3D_3, D4D_4–D7D_7, D8D_8–D11D_{11}, D12D_{12}–D15D_{15} respectively; all use S1S0S_1S_0 as their select lines.
  4. Second level: the four outputs Y0..Y3Y_0..Y_3 feed the data inputs of a fifth 4:1 MUX with select lines S3S2S_3S_2.
  5. Enable handling: if the 4:1 MUX has an active-low enable, drive M0's enable with Sˉ3Sˉ2\bar S_3\bar S_2, M1 with Sˉ3S2\bar S_3S_2, M2 with S3Sˉ2S_3\bar S_2, M3 with S3S2S_3S_2 (a 2:4 decoder); alternatively let the final MUX do all the selection.
  6. Gate count: five 4:1 MUXes + one 2:4 decoder (if enables are used); selecting S3S2S1S0=1011S_3S_2S_1S_0=1011 routes D11D_{11} to YY ✓.

Solved Q6 (2025-26 — 7 Marks | Function Realisation Using 4:1 MUX)

Q: Implement the following Boolean function using 4:1 MUX: F(A,B,C,D)=∑m(0,1,3,4,7,8,9,11,14,15)F(A, B, C, D) = \sum m(0, 1, 3, 4, 7, 8, 9, 11, 14, 15).

Solution:

  1. Use A,BA,B as the MUX select lines (S1=AS_1=A, S0=BS_0=B) and express each data input as a function of C,DC,D.
  2. AB=00AB=00 (minterms 0,1,2,3): values at CD=00,01,10,11CD=00,01,10,11 are 1,1,0,11,1,0,1 → I0=Cˉ+DI_0=\bar C+D (only CD=10CD=10 gives 0).
  3. AB=01AB=01 (minterms 4,5,6,7): values 1,0,0,11,0,0,1 → I1=CD+CˉDˉ=C⊙DI_1=CD+\bar C\bar D=C\odot D.
  4. AB=10AB=10 (minterms 8,9,10,11): values 1,1,0,11,1,0,1 → I2=Cˉ+DI_2=\bar C+D.
  5. AB=11AB=11 (minterms 12,13,14,15): values 0,0,1,10,0,1,1 → I3=CI_3=C.
  6. Circuit: one 4:1 MUX, selects A,BA,B; invert CC for the first and third data inputs; AND/OR gates for the XNOR; connect CC directly to I3I_3.
  7. Verification: for ABCD=1110ABCD=1110 (m14), AB=11AB=11 and C=1C=1 → I3=1I_3=1, matching the minterm list ✓; for m12m_{12} (C=0C=0) output 0 ✓.

Solved Q7 (2025-26 — 7 Marks | Adder–Subtractor with Overflow)

Q: Describe a circuit of 4-bit binary adder-subtractor with overflow detection.

Solution:

  1. Block diagram: four full adders in cascade; the BB input of each passes through a 2-input XOR whose other input is the control line SubSub; the carry-in of the least significant adder is also SubSub; the carry-out of each stage feeds the next carry-in.
  2. Addition (Sub=0Sub=0): B⊕0=BB\oplus0=B, C0=0C_0=0, so Y=A+BY=A+B.
  3. Subtraction (Sub=1Sub=1): B⊕1=BˉB\oplus1=\bar B, C0=1C_0=1, so Y=A+Bˉ+1=A−BY=A+\bar B+1=A-B in 2's complement.
  4. Overflow detector: V=C3⊕C4V=C_3\oplus C_4, where C3C_3 is the carry into the sign bit (bit 3) and C4C_4 is the carry out. Overflow occurs only when adding two numbers of the same sign gives a result of the opposite sign.
  5. Example: 0101+0100=10010101+0100=1001; C3=1C_3=1, C4=0C_4=0 → V=1V=1 (true overflow).
  6. Non-overflow example: 0101+0010=01110101+0010=0111; C3=0,C4=0C_3=0,C_4=0 → V=0V=0.
  7. Applications: the ALU uses this block with a mode bit and also flags zero, carry and sign from the result.

Practice Questions (Self-Test)

  1. (2 Marks) How does a full adder differ from a half adder? (Carry-in input; cascadable.)
  2. (2 Marks) Explain the operation of a multiplexer with the 4:1 output equation.
  3. (2 Marks) Differentiate between encoder and decoder.
  4. (7 Marks) Design a BCD adder and explain why 6 (0110) is added when the sum exceeds 9.
  5. (7 Marks) Implement F(A,B,C)=Σm(1,2,4,7)F(A,B,C)=\Sigma m(1,2,4,7) using an 8:1 MUX and then using a 4:1 MUX.
  6. (7 Marks) Draw a 4-bit ripple-carry adder and compute the total propagation delay if each full adder takes 20 ns from carry-in to carry-out.