Realise F(A, B, C, D) = Σm(1, 3, 4, 11, 12, 13, 14, 15) with one 8-to-1 multiplexer (plus an inverter if needed), putting A, B, C on the select lines S₂S₁S₀.
A combinational circuit's outputs depend only on its present inputs — it has no memory. Adders, subtractors, comparators, multiplexers, decoders, encoders, code converters and parity circuits are its standard building blocks, and PSC asks their equations, gate counts and chip numbers.
A combinational circuit has n input variables and m outputs, and every output is a Boolean function of the present inputs alone. Change an input and, after a short propagation delay, the outputs settle to values that depend on nothing else — there is no clock, no feedback path and no stored history. A single logic gate is the smallest example; a 64-bit adder is a large one.
A sequential circuit adds memory: flip-flops store a state, and the outputs depend on the inputs and that state. Counters, registers and a CPU's control unit are sequential (see Flip-flops, counters & synchronous sequential design). Every sequential circuit still contains combinational logic that computes its next state and its outputs, so the blocks on this page reappear everywhere.
Mini example — a 3-input majority circuit. The output must be 1 when at least two of A, B, C are 1. The truth table has 1s at minterms 3, 5, 6 and 7, and the K-map gives F = AB + BC + CA: three 2-input AND gates feeding one 3-input OR, just two gate levels. Keep this function in mind — it is exactly the carry output of a full adder.
A half adder adds two bits A and B. The sum is 1 when exactly one input is 1 and the carry is 1 only when both are, so S = A ⊕ B and C = AB — one XOR gate and one AND gate. It is only a half adder because it has no input for a carry arriving from a lower stage.
A full adder adds three bits: A, B and the incoming carry Cin. Its sum is 1 when an odd number of inputs are 1, and its carry is the majority of the three.
| A | B | Cin | Sum S | Carry Cout |
|---|---|---|---|---|
| 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 |
Full adder from half adders. The first half adder forms A ⊕ B and AB; the second adds Cin, giving S = (A ⊕ B) ⊕ Cin and the partial carry Cin(A ⊕ B); an OR gate merges the two carries. So one full adder = 2 half adders + 1 OR gate (2 XOR, 2 AND, 1 OR in all).
Ripple-carry (parallel) adder. Chain n full adders so that each Cout drives the next stage's Cin. All operand bits arrive together, but stage i cannot settle until its carry arrives, so the carry ripples from LSB to MSB. Each stage adds two gate levels (an AND then an OR) to the carry path, so the worst case — for example 0111…1 + 0000…1 — costs about 2n gate delays. The 7483 / 74LS283 is a 4-bit binary full adder IC.
Ripple delay grows linearly with word length. A carry-lookahead adder (CLA) removes the chain by computing every carry directly from the operand bits. For stage i define carry generate Gᵢ = AᵢBᵢ (the stage creates a carry on its own) and carry propagate Pᵢ = Aᵢ ⊕ Bᵢ (the stage passes an incoming carry on). Then Cᵢ₊₁ = Gᵢ + PᵢCᵢ and Sᵢ = Pᵢ ⊕ Cᵢ. Substituting each carry into the next gives two-level expressions:
Timing (counting an XOR as one level): one level makes all Gᵢ and Pᵢ, two more (AND-OR) make all carries at the same moment, and one XOR makes the sums — about 4 gate delays whatever the block width. The price is fan-in and area: C₄ already needs a 5-input AND and a 5-input OR, so practical CLAs work in 4-bit groups. Each group's group-generate and group-propagate outputs feed a second-level 74182 look-ahead carry generator, the standard way to cascade 74181 4-bit ALUs; the 74LS283 uses look-ahead internally across its 4 bits.
| Adder | How carries are handled | Delay for n bits | Hardware |
|---|---|---|---|
| Ripple-carry | Each stage waits for the previous carry | ≈ 2n gate delays (linear) | n full adders — cheapest |
| Carry-lookahead | All carries formed in parallel from G and P | Constant per 4-bit block; ≈ log n when blocks are nested | Extra AND/OR gates with large fan-in |
| Carry-save | Carries kept as a separate vector, never propagated | One full-adder delay per CSA level | n independent full adders per CSA |
A carry-save adder (CSA) is a row of n independent full adders. It takes three numbers and outputs two — a sum vector and a carry vector shifted one place left — without propagating any carry. Each CSA therefore reduces the number of operands by one, so adding k numbers needs k − 2 CSAs to reach two operands, followed by one ordinary carry-propagate adder. Arranging the CSAs in parallel levels (a Wallace tree) shortens the delay in fast multipliers, but the count stays k − 2.
A half subtractor computes A − B for two bits, giving a difference D = A ⊕ B and a borrow Bout = A'B (a borrow is needed only for 0 − 1). A full subtractor also accepts a borrow Bin from the lower stage and computes A − B − Bin.
| A | B | Bin | Difference D | Borrow Bout |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 0 | 0 |
| 1 | 1 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 | 1 |
Real machines rarely build separate subtractors. A 4-bit adder–subtractor passes each Bᵢ through an XOR gate controlled by a mode line M, and connects M to the input carry C₀. With M = 0 the XORs pass B unchanged and C₀ = 0, giving A + B. With M = 1 the XORs invert B and C₀ = 1, giving A + B' + 1 = A + (2's complement of B) = A − B.
Reading the flags: for unsigned operands, C₄ = 1 after a subtraction means no borrow (A ≥ B). For signed 2's-complement operands, overflow V = C₄ ⊕ C₃ — the carry into the sign bit differs from the carry out of it. For instance 0110 + 0101 (6 + 5) gives 1011 with C₃ = 1 and C₄ = 0, so V = 1: the true answer 11 does not fit the 4-bit signed range −8 … +7.
A BCD adder adds two decimal digits plus a carry, so the raw sum runs from 0 to 19. A 4-bit binary adder produces K Z₈Z₄Z₂Z₁ (K = carry out). Whenever the sum exceeds 9, adding 0110 corrects it and creates the decimal carry. The correction signal is C = K + Z₈Z₄ + Z₈Z₂: K catches sums 16–19, while Z₈Z₄ and Z₈Z₂ catch 1010–1111. The circuit is two 4-bit adders plus this detector; C feeds 0110 into the second adder and is also the carry to the next decade. Example: 8 + 9 = 1 0001 → K = 1 → 0001 + 0110 = 0111 with carry 1 → BCD 1 0111 = 17. (BCD arithmetic itself is covered in Number systems, complements & codes.)
A multiplexer (MUX), or data selector, has 2ⁿ data inputs, n select lines and one output; the binary number on the select lines decides which input is copied to the output, like a rotary switch. Standard ICs: 74157 (quad 2-to-1), 74153 (dual 4-to-1), 74151 (8-to-1 with complementary outputs) and 74150 (16-to-1).
Large multiplexers are built as trees. A 16-to-1 MUX from 4-to-1 units needs four in the first level (selected by S₁S₀) and one in the second (selected by S₃S₂) — 5 in all. In general an N-to-1 MUX built from r-to-1 units (N a power of r) takes (N − 1)/(r − 1) units: 8:1 from 2:1 needs 7, and 16:1 from 2:1 needs 15.
A demultiplexer (DEMUX) does the reverse: one data input D is routed to one of 2ⁿ outputs chosen by n select lines. A 1-to-4 DEMUX has Y₀ = S₁'S₀'D, Y₁ = S₁'S₀D, Y₂ = S₁S₀'D, Y₃ = S₁S₀D — exactly a 2-to-4 decoder whose enable input carries D. That is why a decoder with enable doubles as a demultiplexer, and why the 74138 and 74155 are sold as decoder/demultiplexers. A MUX at the sender and a DEMUX at the receiver let many signals share one line (time-division multiplexing).
Implementing a function with a MUX. Since Y = Σ mₖIₖ, a MUX is a universal function generator. Method 1: for an n-variable function use a 2ⁿ-to-1 MUX, put all variables on the select lines and tie each Iₖ to the truth-table value (0 or 1) of row k. Method 2: use a 2ⁿ⁻¹-to-1 MUX — put n − 1 variables on the select lines and feed the remaining variable V (or V', 0, 1) to the data lines. Each select code picks two rows that differ only in V; the table shows what to connect. Hence a 2ⁿ:1 MUX can realise any function of n + 1 variables.
| F when V = 0 | F when V = 1 | Connect data input Iₖ to |
|---|---|---|
| 0 | 0 | 0 |
| 1 | 1 | 1 |
| 0 | 1 | V |
| 1 | 0 | V' |
Example. F(A, B, C) = Σm(1, 2, 6, 7) on a 4-to-1 MUX with A on S₁, B on S₀ and C as the data variable. AB = 00 picks m₀ = 0, m₁ = 1 → I₀ = C. AB = 01 picks m₂ = 1, m₃ = 0 → I₁ = C'. AB = 10 picks m₄ = 0, m₅ = 0 → I₂ = 0. AB = 11 picks m₆ = 1, m₇ = 1 → I₃ = 1. One MUX and an inverter replace the whole SOP circuit. Any variable may serve as V; choosing the LSB makes the row pairs adjacent, while older texts put the MSB on the data lines using an 'implementation table' — the result is equivalent.
A decoder has n inputs and up to 2ⁿ outputs, exactly one of which is active for each input code — each output is one minterm (a 2-to-4 decoder gives D₀ = A'B', D₁ = A'B, D₂ = AB', D₃ = AB). An enable input switches all outputs off when inactive. Common ICs: 74139 (dual 2-to-4), 74138 (3-to-8, enabled when G1 = 1 and G2A' = G2B' = 0, active-low outputs), 74154 (4-to-16) and 7442 (BCD-to-decimal).
Bigger decoders are built from smaller ones through their enables. A 4-to-16 decoder = two 3-to-8 decoders, with the MSB enabling the first when it is 0 and the second when it is 1 — or five 2-to-4 decoders (four producing outputs, one driven by the top two bits to enable them). In the same way a 6-to-64 decoder needs eight 3-to-8 decoders plus one more to enable them.
Because a decoder generates every minterm, any m-output function of n variables needs just one n-to-2ⁿ decoder and m OR gates, one per output, each collecting that output's minterms. If the decoder's outputs are active-low (like the 74138), use NAND gates in place of the OR gates — by De Morgan, a NAND of complemented minterms equals their OR.
An encoder does the inverse: 2ⁿ input lines, at most one active, produce that line's n-bit code. The octal-to-binary (8-to-3) encoder is just three OR gates: A₂ = D₄ + D₅ + D₆ + D₇, A₁ = D₂ + D₃ + D₆ + D₇, A₀ = D₁ + D₃ + D₅ + D₇. It has two weaknesses. Output 000 appears both for D₀ and for 'no input active', and two active inputs give a wrong code — D₃ and D₆ together produce 011 OR 110 = 111, which claims D₇.
A priority encoder cures both. When several inputs are active, the one with the highest priority wins, and a valid output V is 1 only when at least one input is active. For a 4-input version with D₃ highest:
| D₀ | D₁ | D₂ | D₃ | x | y | V |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | X | X | 0 |
| 1 | 0 | 0 | 0 | 0 | 0 | 1 |
| X | 1 | 0 | 0 | 0 | 1 | 1 |
| X | X | 1 | 0 | 1 | 0 | 1 |
| X | X | X | 1 | 1 | 1 | 1 |
A magnitude comparator compares numbers A and B and raises one of three outputs: A > B, A = B or A < B. For single bits, (A > B) = AB', (A < B) = A'B and (A = B) = AB + A'B' — an XNOR. For 4-bit numbers define equality bits xᵢ = AᵢBᵢ + Aᵢ'Bᵢ' (1 when bit i matches). The numbers are equal only if every bit matches; otherwise the most significant differing bit decides. The 7485 adds three cascade inputs so that chips can be chained for longer words; the lowest chip's 'A = B in' is tied HIGH.
Code converters translate one binary code into another and follow the usual design procedure, with unused input codes as don't cares; the BCD-to-excess-3 converter is worked out in the examples below. Binary → Gray needs only XOR gates working in parallel: G₃ = B₃, G₂ = B₃ ⊕ B₂, G₁ = B₂ ⊕ B₁, G₀ = B₁ ⊕ B₀. Gray → binary is a cascade: B₃ = G₃, B₂ = B₃ ⊕ G₂, B₁ = B₂ ⊕ G₁, B₀ = B₁ ⊕ G₀, so each bit waits for the one above. (The codes themselves are explained in Number systems, complements & codes.)
| Digit | Segments lit | Count |
|---|---|---|
| 0 | a b c d e f | 6 |
| 1 | b c | 2 |
| 2 | a b d e g | 5 |
| 3 | a b c d g | 5 |
| 4 | b c f g | 4 |
| 5 | a c d f g | 5 |
| 6 | a c d e f g | 6 |
| 7 | a b c | 3 |
| 8 | a b c d e f g | 7 |
| 9 | a b c d f g | 6 |
Seven-segment displays come in two wirings. In a common-anode display all anodes go to +5 V and a segment lights when its pin is pulled LOW, so it needs active-low outputs — the 7447 (open-collector, sinking LED current through resistors). In a common-cathode display all cathodes go to ground and a segment lights when driven HIGH, which suits the active-high 7448. Both accept BCD 0000–1001; inputs 1010–1111 are invalid and become don't cares when you design such a decoder yourself.
A parity generator appends one bit so that the total number of 1s is even (even parity) or odd (odd parity). For message bits ABC the even-parity bit is P = A ⊕ B ⊕ C and the odd-parity bit is its complement. The checker XORs all received bits including P; with even parity, a result of 1 flags an error. An n-input XOR tree needs n − 1 two-input XOR gates. Parity detects any odd number of flipped bits but misses an even number. The 74180 and 74280 are 9-bit odd/even parity generator/checkers; Hamming codes, which also locate the error, appear with error control in Module 7.
A hazard is an unwanted momentary output change — a glitch — caused by unequal propagation delays along different paths. In a static-1 hazard the output should stay 1 but briefly drops to 0 (typical of SOP/AND-OR circuits). In a static-0 hazard it should stay 0 but briefly rises to 1 (typical of POS circuits). In a dynamic hazard the output should change once but toggles several times, such as 1 → 0 → 1 → 0; it needs three or more signal paths and appears in multilevel logic.
Take F = AB + A'C with B = C = 1, so logically F = A + A' = 1. When A falls from 1 to 0, AB switches off at once but A'C switches on only after the inverter's delay, so for a few nanoseconds both terms are 0 and F glitches low. On the K-map, cells 111 and 011 are adjacent but covered by different groups. Adding the consensus term BC — a group bridging those two cells — holds F at 1 through the change: F = AB + A'C + BC. The function is unchanged (consensus theorem); only redundancy is added. The POS dual adds the consensus sum term: (A + B)(A' + C) → (A + B)(A' + C)(B + C).
Instead of wiring gates, combinational functions can be programmed into programmable logic devices (PLDs). Each implements two-level SOP as an AND array feeding an OR array; they differ in which array the user may program.
| Device | AND array | OR array | Notes |
|---|---|---|---|
| PROM / ROM | Fixed — a full decoder producing all 2ⁿ minterms | Programmable | Stores the whole truth table; wasteful for sparse functions |
| PAL | Programmable | Fixed | Fast and cheap; each output ORs a fixed number of product terms (introduced by MMI, 1978) |
| PLA | Programmable | Programmable | Most flexible; product terms shared between outputs; slower and costlier |
| CPLD / FPGA | Many PAL-like blocks / look-up tables | Programmable interconnect | Today's choice; an FPGA look-up table is a tiny ROM read through a MUX |
Sizing rules: a ROM for an n-input, m-output function needs 2ⁿ × m bits, because it stores the truth table itself. A PLA is specified as n × k × m (inputs × product terms × outputs), so it wins when the number of product terms k is much smaller than 2ⁿ.
Try the problem first, then reveal the working one step at a time.
Realise F(A, B, C, D) = Σm(1, 3, 4, 11, 12, 13, 14, 15) with one 8-to-1 multiplexer (plus an inverter if needed), putting A, B, C on the select lines S₂S₁S₀.
Add A = 1011 and B = 0110 with C₀ = 0 using the lookahead equations. Find every Gᵢ, Pᵢ, carry and sum bit.
Design a combinational circuit that converts a BCD digit ABCD (A = MSB) into its excess-3 code wxyz.
Implement a full adder with one 3-to-8 decoder and gates. What changes if the decoder is a 74138 with active-low outputs?
Implement F(A, B, C) = Σm(0, 2, 3, 5) with a 4-to-1 multiplexer, A on S₁ and B on S₀.
Count the building blocks: (a) 2-to-1 MUXes for a 16-to-1 MUX; (b) 4-to-1 MUXes for a 64-to-1 MUX; (c) 3-to-8 decoders (with enable) for a 6-to-64 decoder.
A 4-bit adder–subtractor works on 2's-complement numbers. Find the result bits, C₄ and V for (a) 0011 − 0101 and (b) 0110 + 0101, and interpret each.
An 8-to-3 priority encoder gives D₇ the highest priority. Inputs D₅, D₃ and D₂ are 1 and all others 0. Give A₂A₁A₀ and V. What would a plain (non-priority) OR-gate encoder output?
F = AC' + BC is built as a two-level AND-OR circuit. Identify the static hazard and remove it.
12 questions. 70 % passes the topic quiz (+30 XP, +20 more for 100 %). Exam scoring: +1 correct, −⅓ wrong.
Modelled on real KPSC questions (reworded) with the same concept and answer; each links to its original paper.