DLD Notes: Combinational Circuits

Nov 19, 2026·Pranesh Mahanta·21ECC203T — Digital Logic Design

Adders and subtractors, 2’s-complement arithmetic on parallel adders, multiplexers, demultiplexers, decoders, encoders, code converters and magnitude comparators — the complete unit, with every worked problem stated in full and solved step by step.

Contents
  1. Combinational circuits — the big picture
  2. Half adder
  3. Full adder
  4. Half and full subtractor
  5. Parallel binary adder (ripple carry)
  6. 2’s-complement subtraction using a parallel adder
  7. Multiplexer
  8. Demultiplexer
  9. Decoder
  10. Encoder
  11. Code converter: binary ↔ gray
  12. Code converter: BCD ↔ excess-3
  13. Magnitude comparator
  14. Formula & design-recipe sheet

1Combinational circuits — the big picture

A combinational circuit is a network of logic gates whose outputs at any instant depend only on the present combination of inputs — there is no memory, no feedback, no clock. (Circuits whose output depends on past inputs are sequential; they are built from combinational blocks plus storage elements and are the subject of Unit 3.) The standard design procedure, used for every circuit in this unit:

Combinational design procedure
1. State the problem (inputs, outputs, what the output means).
2. Assign binary codes to input and output values.
3. Derive the truth table (for n inputs: 2n rows).
4. Simplify each output function (algebra, K-map, or Quine–McCluskey).
5. Draw the gate-level diagram and verify against the table.
Two economics notes: the minimized SOP form maps naturally onto NAND–NAND two-level logic, and reusable MSI blocks (adders, MUXes, decoders) often replace dozens of gates — which is why sections 7–9 also show how to implement arbitrary functions with them.

2Half adder

The half adder adds two bits A, B and produces their 2-bit sum: output S (sum bit) and C (carry bit). The truth table is that of binary addition of two single bits:

ABC (carry)S (sum)
0000
0101
1001
1110

Reading the columns directly: S = 1 on the odd rows (exactly one input is 1) → S = A ⊕ B; C = 1 only when both are 1 → C = AB. One XOR gate and one AND gate implement it. The limitation is in the name: it can only add two bits — it has no input for the carry arriving from the previous column, which real multi-bit addition always needs. That job belongs to the full adder.

Half subtractor, by symmetry. Subtracting B from A gives difference D = A ⊕ B (the same XOR!) and borrow Bout = A′B (borrow is needed only when A = 0 and B = 1). See section 4 for the truth-table proof.

3Full adder

The full adder adds three bits — A, B and carry-in Cin — producing sum S and carry-out Cout. It is the column-adder cell from which all multi-bit adders are built. Truth table (index = A B Cin):

ABCinCoutS
00000
00101
01001
01110
10001
10110
11010
11111
A B HA 1 half adder A⊕B Cin HA 2 half adder S OR Cout S = (A ⊕ B) ⊕ Cin · Cout = AB + (A ⊕ B)·Cin
A full adder built from two half adders and an OR gate. Credit: redrawn after the standard textbook construction (Mano fig. 4.8 style).
Worked problem
From the full-adder truth table, derive minimized SOP expressions for Cout and S using K-maps, and show how Cout can be built from two half adders.
Sum. S = 1 at m1(001), m2(010), m4(100), m7(111). On a 3-variable K-map these four 1s are pairwise diagonal — no two are adjacent — so no grouping is possible and the canonical SOP A′B′Cin + A′BCin′ + AB′Cin′ + ABCin cannot be reduced as SOP. It factors instead as the three-input XOR: S = A ⊕ B ⊕ Cin (XOR is 1 exactly when an odd number of inputs is 1, matching the table).
Carry. Cout = 1 at m3(011), m5(101), m6(110), m7(111):
A \ BCin00011110
00010
10111
Three pairs: {3,7} → BCin; {5,7} → ACin; {6,7} → AB. So Cout = AB + ACin + BCin — “any two of the three inputs”, the majority function.
From half adders. Let HA1 compute P = A ⊕ B and Q = AB; HA2 computes S = P ⊕ Cin and R = P·Cin. Then Cout = Q + R = AB + (A ⊕ B)Cin. Expand to verify against the K-map result: (A⊕B)Cin = (A′B + AB′)Cin = A′BCin + AB′Cin, so Cout = AB + A′BCin + AB′Cin = AB(1 + Cin) + A′BCin + AB′Cin = AB + ABCin + A′BCin + AB′Cin = AB + BCin + ACin (absorption on AB). ✓ Identical — the two forms are the same function, and the two-half-adder form reuses the cheap XOR structure.

4Half and full subtractor

The half subtractor computes A − B producing difference D and borrow Bout; the full subtractor computes A − B − Bin where Bin is the borrow from the previous (less significant) column — if that column borrowed, it took 1 away from this column. Full-subtractor truth table (index = A B Bin):

ABBinBoutD
00000
00111
01011
01110
10001
10100
11000
11111
Worked problem
Derive the minimized expressions for the difference D and borrow-out Bout of a full subtractor, and verify each row of the truth table against your expression for Bout.
Difference. D = 1 at m1, m2, m4, m7 — exactly the odd-parity rows, so (as with the full adder) D = A ⊕ B ⊕ Bin.
Borrow-out. Bout = 1 at m1(001), m2(010), m3(011), m7(111). K-map on A vs BBin:
A \ BBin00011110
00111
10010
Pairs: {1,3} → A′Bin; {2,3} → A′B; {3,7} → BBin. So Bout = A′B + A′Bin + BBin.
Row-by-row verification. • 000: all terms 0 → no borrow (0−0−0 = 0) ✓. • 001: A′Bin = 1 → borrow (0−0−1 needs a loan) ✓. • 010: A′B = 1 → borrow (0−1) ✓. • 011: A′B = A′Bin = 1 → borrow ✓. • 100: all 0 → 1−0−0 = 1, no borrow ✓. • 101: 1−0−1 = 0, no borrow — check: A′B = 0, A′Bin = 0, BBin = 0 ✓. • 110: 1−1 = 0, no borrow: all terms 0 ✓. • 111: 1−1−1 = −1 ⇒ borrow, BBin = 1 ✓.
Compare with the full adder: Cout = AB + ACin + BCin vs Bout = A′B + A′Bin + BBin — the borrow is the carry with A replaced by A′, which is why a subtractor is an adder with the minuend complemented (the idea behind 2’s-complement subtraction in section 6).

5Parallel binary adder (ripple carry)

An n-bit parallel adder is n full adders chained: the carry-out of stage i feeds the carry-in of stage i + 1, and stage 0’s carry-in is tied to 0. Each stage computes one column of the sum; the carries ripple from LSB to MSB, which gives the structure its name. The 74LS83/74HC283 is the standard 4-bit MSI part.

FA stage 0 FA stage 1 FA stage 2 FA stage 3 0 C1 C2 C3 C4 A0 B0 A1 B1 A2 B2 A3 B3 S0 S1 S2 S3 S3S2S1S0 is the 4-bit sum; C4 is the carry out of the MSB (overflow / 5th bit)
4-bit ripple-carry parallel adder: four full adders, carry chained left to right (LSB at stage 0). Credit: redrawn after Mano fig. 4.9 style.
The price of rippling. Stage i cannot finish until stage i−1 has, so total delay ≈ n·tp(carry) — for 16 bits this dominates any other gate delay. Carry look-ahead adders precompute each carry directly from Pi = Ai ⊕ Bi (propagate) and Gi = AiBi (generate): Ci+1 = Gi + PiCi, expanded two levels deep — constant delay regardless of width, at the cost of wide gates.
Worked problem
Using a 4-bit parallel adder, compute 1011 + 0110. Trace every full adder: state each stage’s A, B and carry-in, its sum and carry-out, and give the final result.
Operands: A = 1011 (11), B = 0110 (6); expected result 17 = 10001.
• Stage 0: A0 = 1, B0 = 0, C0 = 0 → 1 + 0 + 0 = 1 ⇒ S0 = 1, C1 = 0.
• Stage 1: A1 = 1, B1 = 1, C1 = 0 → 1 + 1 + 0 = 10 ⇒ S1 = 0, C2 = 1.
• Stage 2: A2 = 0, B2 = 1, C2 = 1 → 0 + 1 + 1 = 10 ⇒ S2 = 0, C3 = 1.
• Stage 3: A3 = 1, B3 = 0, C3 = 1 → 1 + 0 + 1 = 10 ⇒ S3 = 0, C4 = 1.
Result: sum = C4S3S2S1S0 = 10001 = 17 ✓. Note how the carry generated at stage 1 ripples through stages 2 and 3 — exactly the worst-case delay path discussed above; had B been 0000, the result would have settled after a single gate delay.

62’s-complement subtraction using a parallel adder

Subtraction needs no separate subtractor circuit: in 2’s-complement representation, A − B = A + B′ where B′ is the 2’s complement of B (invert every bit, add 1). A parallel adder plus an array of inverters on the B inputs does the whole job. The elegant trick in hardware: use controllable inverters (XOR gates) on the B inputs and tie the “add 1” into the adder’s carry-in. With mode input M: M = 0 → B passes unchanged and C0 = 0 (addition); M = 1 → B is complemented and C0 = 1 (subtraction). Same circuit, two operations.

Reading the result (n-bit subtraction A − B)
If the final carry-out Cn = 1: discard it — the remaining n bits are the correct positive answer (A ≥ B).
If Cn = 0: the n-bit result is negative and is already in 2’s-complement form — take its 2’s complement to read the magnitude (A < B).
Why the carry rule works: forming B′ = 2n − B, the sum A + 2n − B either exceeds 2n − 1 (carry out = 1, and A − B remains in the low bits) or it does not (low bits hold 2n − (B − A) — the 2’s complement of the deficit B − A).
Worked problem
Using a 4-bit parallel adder in 2’s-complement mode, compute (a) 7 − 5 and (b) 5 − 7. For each, show the B’s-complement formation, the full binary addition with carries, the state of the final carry-out, and the interpretation of the result.
(a) 7 − 5: A = 0111, B = 0101.
• Complement B: 1’s comp of 0101 = 1010.
• Add with carry-in 1: 0111 + 1010 + 1:
— bit 0: 1 + 0 + 1 = 10 ⇒ S0 = 0, carry 1
— bit 1: 1 + 1 + 1 = 11 ⇒ S1 = 1, carry 1
— bit 2: 1 + 0 + 1 = 10 ⇒ S2 = 0, carry 1
— bit 3: 0 + 1 + 1 = 10 ⇒ S3 = 0, carry 1
• Raw sum = 1 0010, final carry C4 = 1 ⇒ discard it ⇒ 0010 = 2 ✓ (7 − 5 = 2).
(b) 5 − 7: A = 0101, B = 0111.
• 1’s comp of B: 1000.
• Add with carry-in 1: 0101 + 1000 + 1:
— bit 0: 1 + 0 + 1 = 10 ⇒ S0 = 0, carry 1
— bit 1: 0 + 0 + 1 = 1 ⇒ S1 = 1, carry 0
— bit 2: 1 + 0 + 0 = 1 ⇒ S2 = 1, carry 0
— bit 3: 0 + 1 + 0 = 1 ⇒ S3 = 1, carry 0
• Raw sum = 1110, final carry C4 = 0 ⇒ result is negative, in 2’s-complement form. Magnitude: 2’s comp of 1110 = (invert) 0001 + 1 = 0010 = 2 ⇒ answer = −2 ✓ (5 − 7 = −2).
Both results confirm the carry-out rule: carry 1 ⇒ discard and read positive; carry 0 ⇒ negate to read negative.
Overflow caveat. The carry-out rule above applies to the subtract operation. For signed addition of two n-bit 2’s-complement numbers, detect overflow by comparing carries into and out of the MSB: overflow occurs exactly when they differ. Equivalently: both operands positive, result negative — or both negative, result positive.

7Multiplexer

A multiplexer (MUX) routes one of 2n data inputs to a single output, chosen by n select lines — a digitally controlled rotary switch. A 4:1 MUX has inputs I0–I3, selects S1S0, and output Y = S1′S0′I0 + S1′S0I1 + S1S0′I2 + S1S0I3. Larger MUXes are built by tree expansion: an 8:1 MUX = two 4:1 MUXes feeding a 2:1 MUX, with the top select bit choosing which 4:1 to pass.

4 : 1 MUX I0 I1 I2 I3 S1 = A S0 = B Y select S1S0 = 00→I0 01→I1 10→I2 11→I3
A 4:1 multiplexer. Credit: redrawn after the standard MUX symbol (Mano fig. 4.x style).

Using a MUX as a universal logic block. Any 3-variable function fits in one 4:1 MUX: connect two variables to the selects, and to each data input apply the third variable, its complement, 0, or 1 — whichever the remaining truth-table column demands. Similarly 4 variables fit an 8:1 MUX. This is a standard exam task and a real board-level technique.

Worked problem
Implement F(A,B,C) = Σm(0, 2, 3, 5, 6) using one 4:1 MUX whose select lines are S1 = A, S0 = B. Give the signal required at each data input.
Split the minterms by the value of AB (the selects):
• AB = 00 → minterms m0(000), m1(001): F = 1, 0. So I0 must output 1 when C = 0 and 0 when C = 1 ⇒ I0 = C′.
• AB = 01 → m2(010), m3(011): F = 1, 1 ⇒ I1 = 1.
• AB = 10 → m4(100), m5(101): F = 0, 1 ⇒ I2 = C.
• AB = 11 → m6(110), m7(111): F = 1, 0 ⇒ I3 = C′.
Wiring: I0 = C′, I1 = 1, I2 = C, I3 = C′. Verification sweep: m0: A=B=0, C=0 → I0 = C′ = 1 ✓; m2: AB=01, C=0 → I1 = 1 ✓; m3: AB=01, C=1 → 1 ✓; m5: AB=10, C=1 → I2 = C = 1 ✓; m6: AB=11, C=0 → I3 = 1 ✓; and the non-minterms give 0 (e.g. m7: AB=11, C=1 → I3 = C′ = 0 ✓; m4: AB=10, C=0 → 0 ✓; m1: AB=00, C=1 → C′ = 0 ✓). One MUX + one inverter replaces the whole gate network.

8Demultiplexer

The demultiplexer (DEMUX) is the MUX’s mirror image: it takes one data input and routes it to one of 2n outputs, selected by n select lines; all other outputs sit at 0. A 1-to-4 DEMUX obeys Yi = D·mi(S1, S0) — output Yi carries the data when the selects equal i. 

The key identity: a demultiplexer is a decoder with an enable. Feed the data line into the decoder’s enable input and the select lines into the decoder’s address inputs: the enabled decoder raises exactly one output, and that output equals the data (0 or 1) — otherwise all outputs stay 0. So a 3:8 decoder with enable is a 1:8 demultiplexer; commercial parts (the 74LS138) are sold on exactly this dual role. Typical uses: distributing one serial data source to several receivers, time-division demultiplexing, and memory chip-select generation (a 1:2n DEMUX with the address bits as selects activates exactly one memory chip — see the memory-decoding discussion in the PLD & memory notes).

MUX/DEMUX pairs share wiring. Sending k parallel signals down one serial link uses a MUX at the sender and a DEMUX at the receiver running from the same select lines — the two units of section 7 and 8 are designed as a pair, which is why exams often test them together.

9Decoder

A decoder converts an n-bit input code into 2n outputs, exactly one of which is active for each input combination: output Di = mi, the i-th minterm of the inputs. A 3:8 decoder with inputs A B C produces D0 = A′B′C′ … D7 = ABC. Since every Boolean function is a sum of minterms, a decoder plus one OR gate implements any n-variable function — OR together the outputs corresponding to the function’s minterms. Decoders also drive displays (BCD-to-7-segment), select memory chips (address decoding), and implement instruction lookup in CPUs.

Worked problem
Using a 3-to-8 decoder with active-high outputs and two OR gates, implement the two functions F1(A,B,C) = Σm(1, 3, 6) and F2(A,B,C) = Σm(0, 2, 4, 7). State which decoder outputs feed which OR gate. How would the implementation change if the decoder outputs were active-LOW?
F1: OR decoder outputs D1, D3, D6 ⇒ F1 = D1 + D3 + D6 = A′B′C + A′BC + ABC′. Check: m1 = 001 → D1 = 1 ⇒ F1 = 1 ✓; m0 = 000 → all three outputs 0 ⇒ F1 = 0 ✓.
F2: OR D0, D2, D4, D7 ⇒ F2 = A′B′C′ + A′BC′ + AB′C′ + ABC. Check: m7 = 111 → D7 = 1 ✓; m5 = 101 → none of D0, D2, D4, D7 is active ⇒ F2 = 0 ✓.
Active-LOW outputs: with low-true outputs (as in the 74LS138), the selected output goes to 0 and all others sit at 1, so an OR gate can no longer detect a selection. The fix is the same gate shape with a different function: keep the same listed outputs but swap OR → NAND. Reason: for input combination j ∈ S, Dj = 0 while the other listed outputs are 1, so the NAND (which is 1 iff any input is 0) outputs 1 = F(j); for j ∉ S, every listed output is 1, so the NAND outputs 0 = F(j). Verify on F1 = Σm(1, 3, 6): input 001 → (D1, D3, D6) = (0, 1, 1) → NAND = 1 ✓; input 000 → (1, 1, 1) → NAND = 0 ✓. So the cheap mental rule: active-high outputs → OR the listed minterms; active-low outputs → NAND the same listed minterms — identical wiring, one gate type swapped.
Enable inputs and expansion. An enable (or strobe) input ANDs into every output: E′ = 1 forces all outputs inactive. Two 3:8 decoders sharing A2A1A0, with the enable steered by A3, build a 4:16 decoder — the same trick that lets a 74LS138 act as a 1:8 demultiplexer and as a memory chip-select tree.

10Encoder

The encoder is the decoder’s inverse: 2n input lines, of which (normally) exactly one is asserted, compressed into an n-bit binary code naming the active line. An 8:3 encoder outputs the binary number of the single active input (D5 asserted → output 101). A plain encoder misbehaves if two inputs assert at once (outputs become the OR of the two codes — garbage) and cannot even represent “nothing asserted”. Real hardware therefore uses a priority encoder: when multiple inputs assert, the output codes the highest-priority (highest-indexed) active input, and a valid flag tells you whether anything was asserted at all. The 4:2 priority encoder truth table shows the compression: e.g. I2 = 1 forces output 10 regardless of I0, I1 — those inputs become don’t-cares, which is exactly how the K-map of the priority encoder shrinks. Priority encoders are the interrupt controllers of computer systems: many devices may shout at once, the highest-priority one wins, and the CPU is interrupted only if the valid line says so. The 74LS148 is the classic 8-input priority encoder MSI part.

I3I2I1I0Y1Y0V (valid)
0000—0
0001001
001X011
01XX101
1XXX111

Read the last row as the definition of priority: if I3 = 1, the answer is 11 no matter what the lower inputs are doing. From the table (with don’t-cares): Y1 = I3 + I2, Y0 = I3 + I1I2′, V = I0 + I1 + I2 + I3. Check: I1 only → Y1 = 0, Y0 = 1·1 = 1 ⇒ 01 ✓; I2 and I0 → Y1 = 1, Y0 = 1·0 = 0 ⇒ 10 (priority winner I2) ✓.

11Code converter: binary ↔ gray

Gray code (reflected binary code) is a binary ordering in which successive codes differ in exactly one bit — the property that makes K-map axes glitch-free (a counter cycling through gray code never has two bits change simultaneously, so decoding the value never produces a spurious pulse). The conversion is a chain of XORs:

Binary → Gray (for bits B3B2B1B0 → G3G2G1G0)
G3 = B3    G2 = B3 ⊕ B2    G1 = B2 ⊕ B1    G0 = B1 ⊕ B0
Gray → Binary (recover left to right, feeding each recovered bit forward)
B3 = G3    B2 = B3 ⊕ G2    B1 = B2 ⊕ G1    B0 = B1 ⊕ G0
MSB copies across in both directions; every other bit is the XOR of the previous binary bit (forward) with the current gray bit, or the previous recovered binary bit (reverse) with the current gray bit.
B3 G3 B2 ⊕ G2 B1 ⊕ G1 B0 ⊕ G0 G3 = B3, G2 = B3⊕B2, G1 = B2⊕B1, G0 = B1⊕B0 — an XOR ladder
Binary-to-gray converter: three XOR gates for 4 bits (2n−1 gates for n bits in general).
Worked problem
Convert (a) binary 1011 to gray code; (b) gray code 1110 back to binary. Show every XOR step.
(a) B3B2B1B0 = 1011:
• G3 = B3 = 1
• G2 = B3 ⊕ B2 = 1 ⊕ 0 = 1
• G1 = B2 ⊕ B1 = 0 ⊕ 1 = 1
• G0 = B1 ⊕ B0 = 1 ⊕ 1 = 0
Gray = 1110. Sanity check by the adjacency property: binary 1010 (10) → gray 1111, binary 1100 (12) → gray 1010 — both neighbors of 1110, and each differs from 1110 in exactly one bit ✓.
(b) G3G2G1G0 = 1110:
• B3 = G3 = 1
• B2 = B3 ⊕ G2 = 1 ⊕ 1 = 0
• B1 = B2 ⊕ G1 = 0 ⊕ 1 = 1
• B0 = B1 ⊕ G0 = 1 ⊕ 0 = 1
Binary = 1011 ✓ — round trip (a) → (b) returns the original 1011, as it must.

12Code converter: BCD ↔ excess-3

Excess-3 (XS-3) code represents each decimal digit as its BCD value plus 3 (0011). It is self-complementing: the 9’s complement of a digit is the bitwise complement of its XS-3 code (e.g. 0 = 0011, 9 = 1100 = complement of 0011) — which lets subtraction hardware form complements with plain inverters, the same trick as section 6. It is also non-weighted: no positional weights exist, so conversion is only possible by addition, not by weight evaluation.

DecimalBCDExcess-3 (BCD + 0011)
000000011
100010100
200100101
300110110
401000111
501011000
601101001
701111010
810001011
910011100
Worked problem
(a) Convert BCD 0110 (decimal 6) to excess-3 using a 4-bit adder, showing the binary addition. (b) Convert excess-3 code 1011 back to BCD. (c) Verify the self-complementing property for decimal 3.
(a) BCD 6 = 0110; add the constant 0011 with a 4-bit parallel adder (carry-in 0):
• bit 0: 0 + 1 = 1 → E0 = 1, carry 0
• bit 1: 1 + 1 = 10 → E1 = 0, carry 1
• bit 2: 1 + 0 + 1 = 10 → E2 = 0, carry 1
• bit 3: 0 + 0 + 1 = 1 → E3 = 1, carry 0
Excess-3 = 1001, which per the table is indeed decimal 6 ✓. Hardware: the BCD-to-XS-3 converter is literally one 4-bit adder with three inputs hard-wired to 1 — cheaper than any gate-optimized K-map design.
(b) Reverse: subtract 0011 (equivalently add 2’s complement 1101): 1011 + 1101 = 1 1000 → discard carry → 1000 = BCD for decimal 8. Check the table: XS-3 1011 = 8 ✓.
(c) Decimal 3 = BCD 0011 = XS-3 0110. 9’s complement of 3 is 6. Bitwise complement of XS-3 0110 is 1001, and per the table XS-3 1001 = decimal 6 ✓ — the 9’s complement came out of four inverters, no arithmetic.
Invalid codes. BCD has six unused combinations (1010–1111); XS-3 has six too (0000–0010, 1101–1111). A converter’s behaviour on invalid inputs is unspecified unless you declare them don’t-cares (Unit 1, section 7) — good exam answers state that assumption explicitly.

13Magnitude comparator

A magnitude comparator compares two binary numbers A and B and produces three outputs: A > B, A = B, A < B (exactly one is 1). For one bit the logic is immediate:

1-bit comparator
(A > B) = AB′    (A = B) = (A ⊕ B)′ = AB + A′B′    (A < B) = A′B
Multi-bit rule (MSB-first): compare from the most significant bit down; the first position where the bits differ decides. Formally, for 4 bits:
(A > B) = A3B3′ + E3A2B2′ + E3E2A1B1′ + E3E2E1A0B0′, where Ei = (Ai ⊕ Bi)′ (bit-equality flags)
The MSI part is the 74LS85 (4-bit comparator) with cascade inputs A>B, A=B, A<B: feeding the three outputs of a lower-order chip into them chains comparators to any width. On the least-significant chip, tie A=B in high and the other two low.
Worked problem
Compare A = 1011 and B = 0111 with a 4-bit magnitude comparator: state which bit decides and prove the MSB-first rule on this pair by checking every bit position. Then verify the comparator’s equality output for A = B = 1010.
Bit-by-bit, MSB first:
• Position 3: A3 = 1, B3 = 0 → A3B3′ = 1·1 = 1 ⇒ A > B is asserted here, and once A > B is latched at the highest differing position no lower bit can overturn it.
• Position 2: A2 = 0, B2 = 1 (would suggest A < B) — but it is gated by E3 = (1 ⊕ 0)′ = 0, so this term is disabled.
• Position 1: A1 = 1, B1 = 1 → equal (E1 = 1), contributes nothing.
• Position 0: A0 = 1, B0 = 1 → equal, contributes nothing.
Result: A > B ⇒ 1011 (11) > 0111 (7) ✓. The disabled position-2 term is the whole point of the Ei gating in the SOP expression: a lower-position “win” only counts when every higher position was equal.
Equality check for A = B = 1010: every Ei = 1 (0⊕0′ = 1 at each of positions 3, 1, 0; 1⊕1′ = 1 at position 2), and no AiBi′ or Ai′Bi term can fire, so (A > B) = (A < B) = 0 and the equality output E3E2E1E0 = 1 ✓. For an 8-bit comparison with two 74LS85s: the low chip compares bits 3–0 and passes its three outputs into the high chip’s cascade inputs; the high chip’s outputs give the final verdict.

14Formula & design-recipe sheet

Adders & subtractors
HA: S = A⊕B, C = AB  •  FA: S = A⊕B⊕Cin, Cout = AB + ACin + BCin
FS: D = A⊕B⊕Bin, Bout = A′B + A′Bin + BBin
2’s-comp subtraction: A − B = A + B′ + 1; carry-out 1 ⇒ positive (discard carry), 0 ⇒ negative (negate result)
MUX / DEMUX / decoder / encoder
4:1 MUX: Y = S1′S0′I0 + S1′S0I1 + S1S0′I2 + S1S0I3
Function via 4:1 MUX: selects = 2 MSBs, each input = 3rd variable / its complement / 0 / 1
Function via decoder: active-high outputs → OR of Di, i ∈ S; active-low outputs → NAND the same Di  •  DEMUX = decoder + enable
Priority encoder 4:2: Y1 = I3 + I2, Y0 = I3 + I1I2′, V = ΣIi
Code converters
Binary→Gray: Gi = Bi+1 ⊕ Bi (Gtop = Btop)  •  Gray→Binary: Bi = Bi+1 ⊕ Gi (cascade left→right)
BCD→XS-3: E = B + 0011 (one 4-bit adder)  •  XS-3 self-complementing: complement bits = 9’s complement
Comparator
Bit level: A>B = AB′, A=B = (A⊕B)′, A<B = A′B  •  Multi-bit: MSB-first, lower decisions gated by equality flags Ei  •  Cascade: low chip’s 3 outputs → high chip’s cascade inputs; A=B in tied high on the LSB chip