Electronics: ALU

An Arithmetic Logic Unit (ALU) is a digital circuit that performs arithmetic and logical operations.

The ALU is a fundamental building block of the central processing unit (CPU) of a computer. The processors found inside modern CPUs and graphics processing units (GPUs) accommodate very powerful and very complex ALUs; a single component may contain a number of ALUs.

A adder is a very simple ALU - it simply adds the inputs A and B. Most ALUs accomodate adders within them... but often give alternative actions to just addition.

Click here for a page that takes you through how to design an adder/subtractor unit.

An example of a simple ALU

Let us put this into a diagramatic form. (Remember that a dot on a crossing of lines means a junction - crossover without a dot is NOT a joining of lines/wires)

We need to take the A and B inputs into 'boxes' with AND, OR and Add/Subtract on them. The AND and OR inputs go into a multiplexer - signal S0 controlling which of those were to be output to the second multiplexer.

A and B also go into the add/subtract 'box' and whether you add or subtract them is controlled by the S0 switch on that unit. There are two outputs from the unit - the 'answer' (which goes to the output multiplexer) and an overflow (a value on that line tells you the answer is too big for the register).

Remember the output is called R because it gives the result.