Skip to main content

Microcontrollers

Section 2.3 Arithmetic and Logic Unit (ALU)

The arithmetic and logic unit (ALU) contains hardware that’s capable of performing arithmetic (addition, subtraction, multiplication, two’s complement), logic (AND, XOR, OR), and bitshifting functions. The functions that are available in the ALU dictate the types of instructions that are possible to execute on the computer.
The circuit symbol of an ALU is depicted in Figure 2.3.1. The operands represent the two pieces of data to be operated on, with the result representing the arithmetic or logical outcome of the operation. The opcode input is used to denote the exact operation to be executed. The status input is used to represent any important or necessary additional input signals (such as a carry in term for addition or subtraction). The status output is used to represent the important output signals (such as a carry out term). Status signals used in the ATmega328P are described in Section 4.3.
The circuit symbol resembles a trapezoid with a central notch at the top. To the left of the notch at the top is a pin labeled "operand 1." To the right of the notch at the top is a pin labeled "operand 2." On the left side of the trapezoid are two pins. The upper pin is labeled "status" and the lower pin is labeled "opcode." The bottom of the trapezoid has a pin labeled "result." The right side of the trapezoid has a pin labeled "status."
Figure 2.3.1. Circuit symbol used for an arithmetic and logic unit (ALU).
The exact hardware used in the design of an ALU is beyond the scope of this textbook. However, an example ALU used in a model microcontroller is described in Section 3.1.