Arithmetic logic unit
(Redirected from Arithmetic and logic unit)
Categories: Digital electronics | Computer hardware | Computer arithmetic | Computer architecture
- This article is about computer arithmetic units. An alternative meaning of ALU is Alu sequence (note lowercase).
The arithmetic logic unit/arithmetic-logic unit (ALU) of a computer's CPU is a part of the execution unit, a core component of all CPUs. ALUs are capable of calculating the results of a wide variety of basic arithmetical computations.
Virtually all modern computer ALUs use the two's complement binary number representation (whereas some early computers used either one's complement or sign-magnitude format).
ALU operations
Most ALUs will perform the following operations:
- integer arithmetic operations (addition, subtraction, multiplication)
- bitwise logic operations (and, not, or, xor)
- bit-shifting operations (shifting or rotating a word by a specified number of bits to the left or right, with or without sign extension)
A standard ALU typically does not handle integer division or any floating point operations. Optional methods for these types of calculations include:
- software emulation, commonly implemented in hand-written assembly code and placed in a library for use by other programs (slowest)
- microcode programs using the ALU to emulate the missing operations ("medium speed")
- Separate hardware components, such as dividers and floating point units (FPUs), sometimes in the form of arithmetic coprocessors (fastest)
Inputs and outputs
The ALU takes as input the data to be operated on (called operands) and a code from the control unit indicating which operation to perform. The output is the result of the computation.
In many designs the ALU also takes/generates as inputs/outputs a set of condition codes from/to a status register; typically these codes are used to indicate cases such as carry-in or carry-out, overflow, divide-by-zero, etc.
See also
de:Arithmetic Logical Unit es:Unidad aritmético-lógica fr:Unité arithmétique et logique gl:ALU it:Arithmetic Logic Unit hu:Aritmetikai logikai egység nl:ALU ja:演算論理装置 pl:Jednostka arytmetyczno-logiczna