Skip to content

Electronics · Ch 10 — Digital Electronics

Arithmetic logic circuits

10.3

Arithmetic logic circuits

Arithmetic logic circuits are logic circuits that carry out arithmetic operations — addition, subtraction and so on — inside a digital computer. In practice only addition and subtraction hardware is needed: multiplication is repeated addition, division is repeated subtraction, and subtraction itself is performed by addition using 1's- and 2's-complement arithmetic. This section covers the three basic building blocks: the half adder, the half subtractor and the full adder. Each is a combinational circuit built only from gates, and each is described by a block diagram, a logic diagram, a truth table and a timing diagram.

Half adder

A half adder adds two single bits A and B and produces two outputs — a sum and a carry. The elementary additions are 0+0 = 0, 0+1 = 1, 1+0 = 1 and 1+1 = 10 (binary), where the leading 1 is the carry. From the truth table the sum is an XOR of A and B and the carry is their AND (the Boolean expressions are given in the Half adder outputs card). Its block diagram is figure 10.3.1, its logic diagram (one XOR and one AND) is figure 10.3.2, and its timing diagram is figure 10.3.3. The half adder can also be built entirely from universal NAND gates (figure 10.3.5). Its limitation is that it has no input for a carry coming from a previous stage, so a half adder alone cannot be used for multi-digit addition.

Note

In the printed truth table of the half adder, the fourth input row is misprinted as A = 1, B = 0. It should read A = 1, B = 1, which correctly gives Sum = 0 and Carry = 1. The corrected truth table is shown here.

Half subtractor

A half subtractor subtracts one bit (the subtrahend B) from another (the minuend A) and produces a difference and a borrow. The elementary operations are 0−0 = 0, 0−1 = 1 with a borrow of 1, 1−0 = 1 and 1−1 = 0. From the truth table the difference is the XOR of A and B and the borrow is HIGH only when A is 0 and B is 1 (the Boolean expressions are given in the Half subtractor outputs card). It is realized with one XOR, one AND and one NOT gate (logic diagram figure 10.3.4), and can also be built using the minimum number of NAND gates.

Full adder …

Definition 1Arithmetic logic circuit

A logic circuit that performs arithmetic operations (addition, subtraction, etc.) in a digital computer. Multiplication is done as repeated addition, division as repeated subtraction, and subtraction as addition using 1's/2's-complement arithmetic — so adder an …

Definition 2Half adder

A combinational circuit that adds two single bits A and B, giving a sum and a carry: Sum = A ⊕ B, Carry = AB. Its limitation is that it has no input for a carry from a previous stage, so it cannot be …

Figure 3Schematic block diagram of a half adder with inputs A, B and outputs Sum and Carry.
Fig. 3 — Schematic block diagram of a half adder with inputs A, B and outputs Sum and Carry.

Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your textbook's own diagram.

Figure 10.3.1: a block labelled Half Adder with the two inputs A and B entering on the left and the two outputs Sum and Carry leaving on the right. What to notice: the two outputs are separate — Sum = A ⊕ B is the bit written down and Carry = AB is passed to the next column …

Figure 4Logic diagram of a half adder using one XOR gate and one AND gate.
Fig. 4 — Logic diagram of a half adder using one XOR gate and one AND gate.

Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your textbook's own diagram.

Figure 10.3.2: inputs A and B feed an XOR gate whose output is Sum = A ⊕ B, and also feed an AND gate whose output is Carry = AB. What to notice: the same two inputs drive both gates in parallel — the XOR produces the sum bit while the AND produces the carry bit; there is no ca …

Formula 5Half adder outputs

Sum=A⊕B=A‾B+AB‾\text{Sum} = A \oplus B = \overline{A}B + A\overline{B} and Carry=AB\text{Carry} = AB. The sum bit is the XOR of A and B (HIGH when they differ) and the carry bit is their AND (HIGH only when both are 1). These two relations follow directly f …

Table 6Truth table of the half adder
ABSum = A ⊕ BCarry = AB
0000
0110
1010
1101
Figure 7Timing diagram of the half adder showing inputs A, B and outputs Sum and Carry.
Fig. 7 — Timing diagram of the half adder showing inputs A, B and outputs Sum and Carry.

Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your textbook's own diagram.

Figure 10.3.3: waveforms A = 0,0,1,1; B = 0,1,0,1; Sum = 0,1,1,0; Carry = 0,0,0,1. Reading the pattern: Sum follows A ⊕ B, HIGH where A and B differ (columns 2 and 3); Carry follows AB, HIGH only in the last column where both A and B are 1 — th …

Figure 8Half adder realized using five universal NAND gates.
Fig. 8 — Half adder realized using five universal NAND gates.

Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your textbook's own diagram.

Figure 10.3.5: five NAND gates. Gate 1 forms AB‾\overline{AB}; gates 2 and 3 form A‾+AB\overline{A}+AB and B‾+AB\overline{B}+AB; gate 4 gives Sum = A ⊕ B; gate 5 acts as an inverter giving Carry = AB. What to notice: the whole half adder is built from universal NAND gates alone, producing the sa …

Definition 9Half subtractor

A combinational circuit that subtracts one bit B from another bit A, giving a difference and a borrow: Difference = A ⊕ B, Borrow = ĀB (A-complement AND B). Built from one …

Figure 10Logic diagram of a half subtractor using one XOR, one AND and one NOT gate.
Fig. 10 — Logic diagram of a half subtractor using one XOR, one AND and one NOT gate.

Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your textbook's own diagram.

Figure 10.3.4: inputs A and B feed an XOR gate giving Difference = A ⊕ B; A is inverted and ANDed with B to give Borrow = A‾B\overline{A}B. What to notice: the XOR gives the difference (HIGH when A and B differ), while inverting A before ANDing with B gives the borrow $\overl …

Formula 11Half subtractor outputs

Difference=A⊕B=A‾B+AB‾\text{Difference} = A \oplus B = \overline{A}B + A\overline{B} and Borrow=A‾B\text{Borrow} = \overline{A}B. The difference bit is the XOR of A and B (HIGH when they differ), matching the half adder's sum; the borrow A‾B\overline{A}B is HIGH only when …

Table 12Truth table of the half subtractor
ABDifference = A ⊕ BBorrow = ĀB
0000
0111
Figure 13Block diagram of a half subtractor with inputs A, B and outputs Difference and Borrow.
Fig. 13 — Block diagram of a half subtractor with inputs A, B and outputs Difference and Borrow.

Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your textbook's own diagram.

Block diagram (p389): a block labelled Half Subtractor with inputs A and B on the left and outputs Difference Y and Borrow Bo on the right; relations Difference Y = A ⊕ B = $\overline{A}B + A\overline{ …

Figure 14Half subtractor realized using the minimum number of NAND gates.
Fig. 14 — Half subtractor realized using the minimum number of NAND gates.

Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your textbook's own diagram.

Half-subtractor NAND circuit (p389): a network of five NAND gates producing Difference = A ⊕ B and Borrow = A‾B\overline{A}B, with intermediate nodes AB‾\overline{AB}, A‾+AB\overline{A}+AB an …

Definition 15Full adder

A combinational circuit that adds three input bits A, B and a carry-in Cin, giving a sum and a carry-out: S = A ⊕ B ⊕ Cin, Co = AB + BCin + CinA. Chaining full adders allows …

Figure 16Schematic block diagram of a full adder with inputs A, B, Cin and outputs Sum and Co.
Fig. 16 — Schematic block diagram of a full adder with inputs A, B, Cin and outputs Sum and Co.

Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your textbook's own diagram.

Figure 10.3.6: a block labelled Full adder with three inputs A, B and Cin on the left and two outputs Sum and Co on the right. What to notice: unlike the half adder this block has a third input Cin for the carry from the previous stage, so full adders can be chained to add …

Formula 17Full adder outputs

S=A⊕B⊕CinS = A \oplus B \oplus C_{in} and Co=AB+BCin+CinAC_o = AB + BC_{in} + C_{in}A. The sum S is the XOR of all three inputs (HIGH when an odd number of them are 1), and the carry-out Co is HIGH whenever any two of A, B and Cin are 1 — the …

Table 18Truth table of the full adder
ABCinSum SCarry Co
00000
00110
01010
01101
10010
10101
Figure 19Timing diagram of the full adder over the eight input combinations.
Fig. 19 — Timing diagram of the full adder over the eight input combinations.

Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your textbook's own diagram.

Figure 10.3.7: waveforms A = 0,0,0,0,1,1,1,1; B = 0,0,1,1,0,0,1,1; Cin = 0,1,0,1,0,1,0,1; Sum = 0,1,1,0,1,0,0,1; Co = 0,0,0,1,0,1,1,1. Reading the pattern: over all eight input combinations Sum is HIGH when an odd number of A, B, Cin are 1, and Co is HIGH when two or more are …

Figure 20Full adder implemented using two half adders and an OR gate.
Fig. 20 — Full adder implemented using two half adders and an OR gate.

Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your textbook's own diagram.

Figure 10.3.8: A and B enter a first half adder giving A ⊕ B and AB; A ⊕ B and Cin enter a second half adder giving Sum = A ⊕ B ⊕ Cin and (A ⊕ B)Cin; the AB and (A ⊕ B)Cin outputs feed an …

Figure 21Full adder implemented using two XOR gates plus two AND gates and an OR gate.
Fig. 21 — Full adder implemented using two XOR gates plus two AND gates and an OR gate.

Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your textbook's own diagram.

Figure 10.3.9: XOR gate 1 gives A ⊕ B, XOR gate 2 gives Sum = A ⊕ B ⊕ Cin; AND gate 1 gives AB, AND gate 2 gives (A ⊕ B)Cin; an OR gate combines them to give Co = AB + BCin + ACin. What to notice: the two XOR gates build the sum while the two AND gates and the OR collec …

Figure 22Full adder implemented using a three-input XOR gate and basic gates.
Fig. 22 — Full adder implemented using a three-input XOR gate and basic gates.

Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your textbook's own diagram.

Figure 10.3.10: a single three-input XOR gate gives Sum = A ⊕ B ⊕ Cin; three 2-input AND gates (A,B), (B,Cin), (Cin,A) feed a 3-input OR gate giving Carry = AB + BCin + CinA. What to notice: one three-input XOR forms the sum directly, while three AND gates and an OR form the majority carry — t …