Symbolic representation of an ALU and its input and output signal groups
In digital electronics, an arithmetic logic unit (ALU) is a digital circuit that performs arithmetic and bitwise logical operations on integer binary numbers. It is a fundamental building block of the central processing unit found in many digital computers. Powerful and complex ALUs are often used in modern, high performance CPUs and graphics processing units (GPUs). A single CPU or GPU may contain multiple ALUs.
Mathematician John von Neumann proposed the ALU concept in 1945 in a report on the foundations for a new computer called the EDVAC.
Contents

Numerical systems 1

Practical overview 2

Complex operations 2.1

Inputs and outputs 2.2

See also 3

Notes 4

References 5

External links 6
Numerical systems
Cascadable 8 Bit ALU Texas Instruments SN74AS888
An ALU must process numbers using the same formats as the rest of the digital circuit. The format of modern processors is almost always the two's complement binary number representation. Early computers used a wide variety of number systems, including ones' complement, two's complement, signmagnitude format, and even true decimal systems, with various^{[NB 2]} representation of the digits.
The ones' complement and two's complement number systems allow for subtraction to be accomplished by adding the negative of a number in a very simple way which negates the need for specialized circuits to do subtraction; however, calculating the negative in two's complement requires adding a one to the low order bit and propagating the carry. An alternative way to do two's complement subtraction of A−B is to present a one to the carry input of the adder and use ¬B rather than B as the second input. The arithmetic, logic and shift circuits introduced in previous sections can be combined into one ALU with common selection.
Practical overview
Most of a processor's operations are performed by one or more ALUs. An ALU loads data from input registers. Then an external control unit tells the ALU what operation to perform on that data, and then the ALU stores its result into an output register. The control unit is responsible for moving the processed data between these registers, ALU and memory.
Complex operations
Engineers can design an arithmetic logic unit to calculate most operations. 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. Therefore, engineers compromise. They make the ALU powerful enough to make the processor fast, yet not so complex as to become prohibitive. For example, computing the square root of a number might use:

Calculation in a single clock Design an extraordinarily complex ALU that calculates the square root of any number in a single step.

Calculation pipeline Design a very complex ALU that calculates the square root of any number in several steps. The intermediate results go through a series of circuits arranged like a factory production line. The ALU can accept new numbers to calculate even before having finished the previous ones. The ALU can now produce numbers as fast as a singleclock ALU, although the results start to flow out of the ALU only after an initial delay.

Iterative calculation Design a complex ALU that calculates the square root through several steps. This usually relies on control from a complex control unit with builtin microcode.

Coprocessor Design a simple ALU in the processor, and sell a separate specialized and costly processor that the customer can install just beside this one, and implements one of the options above.

Software libraries Tell the programmers that there is no coprocessor and there is no emulation, so they will have to write their own algorithms to calculate square roots by software.

Software emulation Emulate the existence of the coprocessor. Whenever a program attempts to perform the square root calculation, make the processor check if there is a coprocessor present and use it if there is one; if there is not one, interrupt the processing of the program and invoke the operating system to perform the square root calculation through some software algorithm.
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.
Inputs and outputs
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. One thing designers must keep in mind is whether the ALU will operate on bigendian or littleendian numbers.
In many designs, the ALU also takes or generates inputs or outputs a set of condition codes from or to a status register. These codes are used to indicate cases such as carryin or carryout, overflow, dividebyzero, etc.
A floatingpoint unit also performs arithmetic operations between two values, but they do so for numbers in floatingpoint 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 builtin, including some internal ALUs.
In modern practice, engineers typically refer to the ALU as the circuit that performs integer arithmetic operations (like two's complement and BCD). Circuits that calculate more complex formats like floating point, complex numbers, etc. usually receive a more specific name such as floatingpoint unit (FPU).
See also
Notes

^ ^{a} ^{b} IBM and UNIVAC used the term biquinary with different meanings.

^ Including BinaryCoded Decimal (BCD) in 4 bits, 2outof5 coding in five bits,^{[1]} 5bit biquinary^{[NB 1]} encoding,^{[2]} and 2outofseven biquinary^{[NB 1]} encoding in 7 bits^{[3]}
References

^ Reference Manual, 7070 Data Processing System, A22700301

^ UNIVAC SOLIDSTATE 90 Specification Features

^ 650 Data Processing Machine Manual of Operation, 2260602
External links

ALU and its Microoperations: Bitwise, Arithmetic and Shift

A Simulator of Complex ALU in MATLAB
This article was sourced from Creative Commons AttributionShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, EGovernment Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a nonprofit organization.