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 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.
