Definition
Arithmetic Logic Unit
An arithmetic logic unit is the heart of the processor that performs basic arithmetic and logic functions:
The ALU takes in two inputs and a control signal. The control signals determines the function to apply on the given inputs:
Control Signal Function Addition Subtraction AND OR The ALU can be extended to additionally output status flags:
Flag Description Result is Negative Result is Zero adder produces Carry out Adder oVerflowed (signed, two’s complement)
Implementation
A way of implementing ALUs is to use a single adder for both subtraction and addition by introducing a multiplexer. This is possible since , which is equivalent to . Thus, if the control signal is , the negated value of is passed to the adder.

As said above, ALUs can be extended to output status flags:

The overflow part is a bit more tricky:

- The most right gate outputs true if the ALU is instructed to do addition or subtraction.




