ALU

(not finished)

Introduction :
The ALU (arithmetic and logic unit) is an important part of processors, it processes data in the form of raw binary bits.

It is capable of performing :

- logic operations: NOT, AND, OR, XOR, NAND, NOR, XOR, shift left, shift right

- arithmetic operations: addition, subtraction, multiplication, division, two's complement (negation)

Logical operation :
Those operations are easy to perform by connecting standard logic  gates together. Shifts can be performed with shift registers if wired correctly.

Arithmetic operations :
Those operations are much harder to complete, we have to manage carrying for addition and multiplication, and borrowing for subtraction.

A full adder can add the two numbers with carrying inputs and outputs

The subtractor would be a full adder with an input and the output inverted with the global carry set to one.

The multiplier could be implemented in three ways:


 * the number can be added with several full adder with it left shifted numbers (most common way)


 * the number can be added to itself via a memory (compact but uncommon method)


 * the multiplier can be replaced with a routine that shifts and add the number

The divider is a multiplier using inverted number (½, ¼, 1/8, etc.)

The compare function is just to reuse carry informations

Control :
An easy way to control the ALU is to place buffers to select each inputs and outputs.