Skip to content

Combinational Logic

A combinational circuit has no stored state. Its outputs are Boolean functions of the present inputs only. Adders, comparators, multiplexers, demultiplexers and parity circuits are standard examples.

The elementary addition and subtraction rules are

AdditionSubtraction
ABSumCarryABDifferenceBorrow
00000000
01100111
10101010
11011100

For unsigned nn-bit addition, a carry beyond bit n−1n-1 indicates that the exact result exceeds 2n−12^n-1. For two’s-complement addition, discard that carry and test signed overflow separately.

One’s- and two’s-complement subtraction

Section titled “One’s- and two’s-complement subtraction”

To evaluate A−BA-B with one’s complement, add AA to the bitwise complement of BB. If a carry leaves the word, add it back to the least-significant bit (end-around carry). Without a carry, complement the sum and mark it negative.

Two’s complement removes the end-around step:

A−B=A+B‾+1.\boxed{A-B=A+\overline B+1}.

The operation uses the same nn-bit adder as addition. The result is valid as an nn-bit signed number only when it lies in [−2n−1,2n−1−1][-2^{n-1},2^{n-1}-1].

A half adder accepts two operand bits but no carry input:

S=A⊕B,C=AB.\boxed{S=A\oplus B},\qquad \boxed{C=AB}.

A full adder includes the incoming carry CinC_{in}:

S=A⊕B⊕Cin,Cout=AB+ACin+BCin.\boxed{S=A\oplus B\oplus C_{in}},\qquad \boxed{C_{out}=AB+AC_{in}+BC_{in}}.
AABBCinC_{in}SSCoutC_{out}
0000
00110
01010
01101
10010
10101
11001
11111

Full-adder truth table.

Gate realization of a half adder and construction of a full adder.

Gate realization of a half adder and construction of a full adder.

Two half adders form a full adder:

S1=A⊕B,C1=AB,S=S1⊕Cin,C2=S1Cin,Cout=C1+C2.S_1=A\oplus B,\quad C_1=AB,\quad S=S_1\oplus C_{in},\quad C_2=S_1C_{in},\quad C_{out}=C_1+C_2.

An nn-bit parallel adder applies all operand bits together, but each full adder waits for the carry from the next lower position:

Si=Ai⊕Bi⊕Ci,Ci+1=AiBi+(Ai⊕Bi)Ci.S_i=A_i\oplus B_i\oplus C_i,\qquad C_{i+1}=A_iB_i+(A_i\oplus B_i)C_i.

Four cascaded full adders and their compact parallel-adder symbol.

Four cascaded full adders and their compact parallel-adder symbol.

The circuit is regular and economical. Its worst carry path crosses all nn stages, so a first estimate is

tcarry,wc≈ntc.\boxed{t_{carry,wc}\approx nt_c}.

Intermediate sum bits may be temporarily wrong while the carry ripples. A carry look-ahead design instead forms generate Gi=AiBiG_i=A_iB_i and propagate Pi=Ai⊕BiP_i=A_i\oplus B_i terms so several carries can be evaluated in parallel; it is faster but uses more logic and routing.

For a half subtractor,

D=A⊕B,Bout=A‾B.D=A\oplus B,\qquad B_{out}=\overline A B.

For a full subtractor with borrow input BinB_{in},

D=A⊕B⊕Bin,Bout=A‾B+A‾Bin+BBin.\boxed{D=A\oplus B\oplus B_{in}},\qquad \boxed{B_{out}=\overline A B+\overline A B_{in}+BB_{in}}.

An ALU normally uses complement addition instead of a separate multi-bit subtractor.

Apply mode MM to every BiB_i through XOR and also set the initial carry to C0=MC_0=M:

F=A+(B⊕M)+M.\boxed{F=A+(B\oplus M)+M}.
MMBi⊕MB_i\oplus MC0C_0Operation
BiB_i0A+BA+B
1B‾i\overline B_i1A−BA-B

Adder–subtractor modes.

Four-bit adder–subtractor with mode-controlled complementing of B.

Four-bit adder–subtractor with mode-controlled complementing of BB.

For two’s-complement arithmetic, signed overflow is

V=Cn−1⊕Cn.\boxed{V=C_{n-1}\oplus C_n}.

During addition, this is equivalent to equal-sign operands producing an opposite-sign result. The final carry alone is not a signed-overflow flag.

First add two BCD digits and the input carry as ordinary binary. If the four-bit sum exceeds 9 or produces carry C4C_4, add 01100110:

K=C4+Z3Z2+Z3Z1,K=1⇒add 0110.\boxed{K=C_4+Z_3Z_2+Z_3Z_1}, \qquad K=1\Rightarrow\text{add }0110.

For example, 7+87+8 gives 11111111; adding 01100110 produces 1 01011\,0101, the BCD digits 1 and 5.

A magnitude comparator produces mutually exclusive outputs GG (A>BA>B), EE (A=BA=B), and LL (A<BA<B).

G=AB‾,E=A‾ B‾+AB=A⊕B‾,L=A‾B.\boxed{G=A\overline B},\qquad \boxed{E=\overline A\,\overline B+AB=\overline{A\oplus B}},\qquad \boxed{L=\overline A B}.
AABBGGEELL
0010
01001
10100
11010

Compare from the most-significant bit. The first unequal pair decides the result; lower bits matter only when all higher pairs are equal. For two-bit words A1A0A_1A_0 and B1B0B_1B_0, let Ei=Ai⊕Bi‾E_i=\overline{A_i\oplus B_i}. Then

A>B=A1B‾1+E1A0B‾0,A>B=A_1\overline B_1+E_1A_0\overline B_0, A=B=E1E0,A<B=A‾1B1+E1A‾0B0.A=B=E_1E_0, \qquad A<B=\overline A_1B_1+E_1\overline A_0B_0.

Cascading two four-bit magnitude comparators.

Cascading two four-bit magnitude comparators.

Devices such as the 7485 include cascade inputs. Connect the less-significant group’s G,E,LG,E,L outputs to the next more-significant group so the higher group can override lower-bit decisions.

A 2n2^n-to-1 multiplexer (MUX) uses nn select lines to connect one of 2n2^n data inputs to one output.

For a four-to-one MUX,

Y=S‾1S‾0D0+S‾1S0D1+S1S‾0D2+S1S0D3.\boxed{Y=\overline S_1\overline S_0D_0 +\overline S_1S_0D_1+S_1\overline S_0D_2+S_1S_0D_3}.
S1S_1S0S_0YY
0D0D_0
01D1D_1
10D2D_2
11D3D_3

Gate-level realization of a four-to-one multiplexer.

Gate-level realization of a four-to-one multiplexer.

A MUX is also a function generator. For an nn-variable truth table, connect the variables to the select inputs and each DiD_i to the required 0 or 1. A 2n−12^{n-1}-to-1 MUX can implement an nn-variable function when each data input is chosen from 0,1,X,X‾0,1,X,\overline X for the remaining variable XX.

A one-to-2n2^n demultiplexer (DEMUX) routes one data input to the output selected by nn address lines. Under the active-HIGH convention used here, all unselected outputs remain 0; practical devices may instead use active-LOW enables or outputs.

For a one-to-four DEMUX,

Y0=DS‾1S‾0,Y1=DS‾1S0,Y2=DS1S‾0,Y3=DS1S0.\begin{aligned} Y_0 & =D\overline S_1\overline S_0, & Y_1 & =D\overline S_1S_0, \\ Y_2 & =DS_1\overline S_0, & Y_3 & =DS_1S_0. \end{aligned}

Gate-level realization of a one-to-four demultiplexer.

Gate-level realization of a one-to-four demultiplexer.

A decoder with enable acts as a DEMUX when the enable is used as the data input. Check active-LOW enables and outputs on practical devices before applying the active-HIGH equations above.

Parity adds one check bit so the total number of 1s is forced even or odd. For data bits D0,…,Dn−1D_0,\ldots,D_{n-1},

Peven=D0⊕D1⊕⋯⊕Dn−1,Podd=Peven‾.\boxed{P_{even}=D_0\oplus D_1\oplus\cdots\oplus D_{n-1}},\qquad \boxed{P_{odd}=\overline{P_{even}}}.

At the receiver, XOR all received data and the parity bit:

S=D0⊕⋯⊕Dn−1⊕P.S=D_0\oplus\cdots\oplus D_{n-1}\oplus P.

For even parity, S=0S=0 means parity is consistent and S=1S=1 reports an error. For odd parity the interpretation is reversed.

XOR-tree parity generation and end-to-end parity checking.

XOR-tree parity generation and end-to-end parity checking.

  1. Verify the Boolean expression against every truth-table row.

  2. State active-HIGH and active-LOW conventions explicitly.

  3. Check unused input combinations and output exclusivity where required.

  4. Count logic levels on the longest path and include fan-out loading.

  5. Remember that unequal gate delays can produce temporary hazards even when the final Boolean function is correct.