1
|
A typical schematic symbol for an ALU: A & B are the data (registers); R is the output; F is the Operand (instruction) from the Control Unit; D is an output status
In computing, 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, and even the simplest microprocessors contain one for purposes such as maintaining timers. The processors found inside modern CPUs and GPUs have inside them very powerful and very complex ALUs; a single component may contain a number of ALUs.
Mathematician John von Neumann proposed the ALU concept in 1945, when he wrote a report on the foundations for a new computer called the EDVAC.
Contents |
In 1946, von Neumann worked with his colleagues in designing a computer for the Princeton Institute of Advanced Studies (IAS). The IAS computer became the prototype for many later computers. In the proposal, von Neumann outlined what he believed would be needed in his machine, including an ALU.
Von Neumann stated that an ALU is a necessity for a computer because it is guaranteed that a computer will have to compute basic mathematical operations, including addition, subtraction, multiplication, and division.Stallings page 19 He therefore believed it was "reasonable that [the computer] should contain specialized organs for these operations."Stallings page 19
An ALU must process numbers using the same format as the rest of the digital circuit. For modern processors, that almost always is the two\'s complement binary number representation. Early computers used a wide variety of number systems, including one\'s complement, sign-magnitude format, and even true decimal systems, with ten tubes per digit.
ALUs for each one of these numeric systems had different designs, and that influenced the current preference for two\'s complement, as this is the representation that makes it easier for the ALUs to calculate additions and subtractions.[citation needed]
A simple 2-bit ALU that does XOR, AND, OR, and addition (click image for an explanation)
Most of a processor\'s operations are performed by one or more ALU. An ALU loads data from input registers, executes, and stores the result into an output register. A Control Unit tells the ALU what operation to perform on the data. Other mechanisms move data between these registers and memory.Stallings page 290-291
Most ALUs can perform the following operations:
An engineer can design an ALU to calculate any operation, however complicated it is; the problem is that the more complex the operation, the more expensive the ALU is, the more space it uses in the processor, and the more power it dissipates, etc.
Therefore, engineers always calculate a compromise, to provide for the processor (or other circuits) an ALU powerful enough to make the processor fast, but yet not so complex as to become prohibitive. Imagine that you need to calculate the square root of a number; the digital engineer will examine the following options to implement this operation:
The options above go from the fastest and most expensive one to the slowest and least expensive one. Therefore, while even the simplest computer can calculate the most complicated formula, the simplest computers will usually take a long time doing that because of the several steps for calculating the formula.
Powerful processors like the Intel Core and AMD64 implement option #1 for several simple operations, #2 for the most common complex operations and #3 for the extremely complex operations. That is possible by the ability of building very complex ALUs in these processors.
The inputs to the ALU are the data to be operated on (called operands) and a code from the control unit indicating which operation to perform. Its output is the result of the computation.
In many designs the ALU also takes or generates as inputs or outputs a set of condition codes from or to a status register. These codes are used to indicate cases such as carry-in or carry-out, overflow, divide-by-zero, etc.Stallings page 290-291
A Floating Point Unit also performs arithmetic operations between two values, but they do so for numbers in floating point representation, which is much more complicated than the two\'s complement representation used in a typical ALU. In order to do these calculations, a FPU has several complex circuits built-in, including some internal ALUs.
Usually engineers call an ALU the circuit that performs arithmetic operations in integer formats (like two\'s complement and BCD), while the circuits that calculate on more complex formats like floating point, complex numbers, etc. usually receive a more illustrious name.
This article is licensed under the GNU Free Documentation License. It uses material from Wikipedia