Arithmetic Logic Unit

At the core of the CPU is the arithmetic logic unit (ALU), which is used to perform computations (AND, ADD, INC, . . . ). Several control lines select which operation the ALU should perform on the input data. The ALU takes two inputs and returns the result of the operation as its output. Source and destination are taken from registers or from memory. In addition, the ALU stores some information about the nature of the result in the status register (also called condition code register):

Z (Zero): The result of the operation is zero.

N (Negative): The result of the operation is negative, that is, the most significant bit (msb) of the result is set (1).

O (Overflow): The operation produced an overflow, that is, there was a change of sign in a two’scomplement operation.

C (Carry): The operation produced a carry.