All Topics  
Arithmetic logic unit

 

   Email Print
   Bookmark   Link






 

Arithmetic logic unit



 
 
In computing
Computing

Computing is usually defined as the activity of using and developing computer technology, computer hardware and computer software. It is the computer-specific part of information technology....
, an arithmetic logic unit (ALU) is a digital circuit
Digital circuit

Digital electronics are electronics systems that use digital signals. Digital electronics are representations of Boolean algebra and are used in computers, mobile phones, and other consumer products....
 that performs arithmetic
Arithmetic

Arithmetic or arithmetics is the oldest and most elementary branch of mathematics, used by almost everyone, for tasks ranging from simple day-to-day counting to advanced science and business calculations....
 and logicaloperations. The ALU is a fundamental building block of the central processing unit
Central processing unit

A central processing unit is an electronic circuit that can execute computer programs. This broad definition can easily be applied to many early computers that existed long before the term "CPU" ever came into widespread usage....
 (CPU) of a computer, and even the simplest microprocessor
Microprocessor

A microprocessor incorporates most or all of the functions of a central processing unit on a single integrated circuit . The first microprocessors emerged in the early 1970s and were used for electronic calculators, using Binary-coded decimal arithmetic on 4-bit Word ....
s contain one for purposes such as maintaining timers. The processors found inside modern CPUs and graphics processing units (GPUs
Graphics processing unit

A graphics processing unit or GPU is a dedicated graphics rendering device for a personal computer, workstation, or game console. Modern GPUs are very efficient at manipulating and displaying computer graphics, and their highly parallel structure makes them more effective than general-purpose Central processing unit for a range of com...
) have inside them very powerful and very complex ALUs; a single component may contain a number of ALUs.

Mathematician John von Neumann
John von Neumann

John von Neumann was a Hungarian American mathematician who made major contributions to a vast range of fields, including set theory, functional analysis, quantum mechanics, ergodic theory, continuous geometry, economics and game theory, computer science, numerical analysis, hydrodynamics , and statistics, as well as many other mathematical...
 proposed the ALU concept in 1945, when he wrote a report on the foundations for a new computer called the EDVAC
EDVAC

EDVAC was one of the earliest electronics computers. Unlike its predecessor the ENIAC, it was binary numeral system rather than decimal, and was a Von Neumann architecture machine....
.

946, von Neumann worked with his colleagues in designing a computer for the Princeton Institute of Advanced Studies (IAS).






Discussion
Ask a question about 'Arithmetic logic unit'
Start a new discussion about 'Arithmetic logic unit'
Answer questions from other users
Full Discussion Forum



Encyclopedia


In computing
Computing

Computing is usually defined as the activity of using and developing computer technology, computer hardware and computer software. It is the computer-specific part of information technology....
, an arithmetic logic unit (ALU) is a digital circuit
Digital circuit

Digital electronics are electronics systems that use digital signals. Digital electronics are representations of Boolean algebra and are used in computers, mobile phones, and other consumer products....
 that performs arithmetic
Arithmetic

Arithmetic or arithmetics is the oldest and most elementary branch of mathematics, used by almost everyone, for tasks ranging from simple day-to-day counting to advanced science and business calculations....
 and logicaloperations. The ALU is a fundamental building block of the central processing unit
Central processing unit

A central processing unit is an electronic circuit that can execute computer programs. This broad definition can easily be applied to many early computers that existed long before the term "CPU" ever came into widespread usage....
 (CPU) of a computer, and even the simplest microprocessor
Microprocessor

A microprocessor incorporates most or all of the functions of a central processing unit on a single integrated circuit . The first microprocessors emerged in the early 1970s and were used for electronic calculators, using Binary-coded decimal arithmetic on 4-bit Word ....
s contain one for purposes such as maintaining timers. The processors found inside modern CPUs and graphics processing units (GPUs
Graphics processing unit

A graphics processing unit or GPU is a dedicated graphics rendering device for a personal computer, workstation, or game console. Modern GPUs are very efficient at manipulating and displaying computer graphics, and their highly parallel structure makes them more effective than general-purpose Central processing unit for a range of com...
) have inside them very powerful and very complex ALUs; a single component may contain a number of ALUs.

Mathematician John von Neumann
John von Neumann

John von Neumann was a Hungarian American mathematician who made major contributions to a vast range of fields, including set theory, functional analysis, quantum mechanics, ergodic theory, continuous geometry, economics and game theory, computer science, numerical analysis, hydrodynamics , and statistics, as well as many other mathematical...
 proposed the ALU concept in 1945, when he wrote a report on the foundations for a new computer called the EDVAC
EDVAC

EDVAC was one of the earliest electronics computers. Unlike its predecessor the ENIAC, it was binary numeral system rather than decimal, and was a Von Neumann architecture machine....
.

Early development

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.

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 He therefore believed it was "reasonable that [the computer] should contain specialized organs for these operations.

Numerical systems

An ALU must process numbers using the same format as the rest of the digital circuit. The format of modern processors is almost always the two's complement
Two's complement

The two's complement of a binary number is defined as the value obtained by subtracting the number from a large power of two .A two's-complement system or two's-complement arithmetic is a system in which negative numbers are represented by the two's complement of the absolute value; this system is the most common Signed number r...
 binary number representation. Early computers used a wide variety of number systems, including one's complement
Signed number representations

In mathematics, negative numbers in any base are represented in the usual way, by prefixing them with a "−" sign. However, on a computer, there are various ways of representing a number's sign....
, sign-magnitude
Signed number representations

In mathematics, negative numbers in any base are represented in the usual way, by prefixing them with a "−" sign. However, on a computer, there are various ways of representing a number's sign....
 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
Two's complement

The two's complement of a binary number is defined as the value obtained by subtracting the number from a large power of two .A two's-complement system or two's-complement arithmetic is a system in which negative numbers are represented by the two's complement of the absolute value; this system is the most common Signed number r...
, as this is the representation that makes it easier for the ALUs to calculate additions and subtractions.

The two's-compliment number system allows for subtraction to be accomplished by adding the negative of a number in a very simple way which negates the need for specialised circuits to do subtraction.

Practical overview


Most of a processor's operations are performed by one or more ALUs. An ALU loads data from input register
Processor register

In computer architecture, a processor register is a small amount of Computer storage available on the CPU whose contents can be accessed more quickly than storage available elsewhere....
s, an external Control Unit
Control unit

A control unit in general is a central part of whatsoever machinery that controls its operation, provided that a piece of machinery is complex and organized enough to contain any such unit....
 then tells the ALU what operation to perform on that data, and then the ALU stores its result into an output register. Other mechanisms move data between these registers and memory.

Simple operations

Most ALUs can perform the following operations:

  • Integer
    Integer (computer science)

    In computer science, the term integer is used to refer to a data type which represents some finite subset of the mathematical integers. These are also known as integral data types....
     arithmetic operations (addition
    Addition

    Addition is the mathematics process of putting things together. The plus sign "+" means that numbers are added together. For example, in the picture on the right, there are 3 + 2 apples?meaning three apples and two other apples?which is the same as five apples, since 3 + 2 = 5....
    , subtraction
    Subtraction

    Subtraction is one of the four basic arithmetic operations; it is the inverse of addition, meaning that if we start with any number and add any number and then subtract the same number we added, we return to the number we started with....
    , and sometimes multiplication
    Multiplication

    Multiplication is the Operation of scaling one number by another. It is one of the four basic operations in elementary arithmetic .Multiplication is defined for Natural number in terms of repeated addition; for example, 4 multiplied by 3 can be calculated by adding 3 copies of 4 together:...
     and division
    Division (mathematics)

    In mathematics, especially in elementary arithmetic, division is an arithmetic operation which is the inverse of multiplication.Specifically, if c times b equals a, written:...
    , though this is more expensive)
  • Bitwise logic operations
    Bitwise operation

    In computer programming, a bitwise operation operates on one or two bit patterns or Binary numeral system at the level of their individual bits....
     (AND
    AND gate

    The AND gate is a digital logic gate that implements logical conjunction - it behaves according to the truth table to the right. A HIGH output results only if both the inputs to the AND gate are HIGH ....
    , NOT, OR
    OR gate

    The OR gate is a digital logic gate that implements logical disjunction - it behaves according to the truth table to the right. A HIGH output results if one or both the inputs to the gate are HIGH ....
    , XOR
    XOR gate

    The XOR gate is a digital logic gate that implements exclusive disjunction - it behaves according to the truth table above. A HIGH output results if one, and only one, of the inputs to the gate is HIGH ....
    )
  • Bit-shifting
    Bitwise operation

    In computer programming, a bitwise operation operates on one or two bit patterns or Binary numeral system at the level of their individual bits....
     operations (shifting or rotating a word by a specified number of bits to the left or right, with or without sign extension
    Sign extension

    Sign extension is the operation, in computer arithmetic, of increasing the number of bits of a binary number while preserving the number's negative and non-negative numbers....
    ). Shifts can be interpreted as multiplications by 2 and divisions by 2.


Complex 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:

  1. Design an extraordinarily complex ALU that calculates the square root of any number in a single step. This is called calculation in a single clock.
  2. Design a very complex ALU that calculates the square root of any number in several steps. But--and here's the trick--the intermediate results go through a series of circuits that are arranged in a line, like a factory production line. That makes the ALU capable of accepting new numbers to calculate even before finished calculating the previous ones. That makes the ALU able to produce numbers as fast as a single-clock ALU, although the results start to flow out of the ALU only after an initial delay. This is called calculation pipeline.
  3. Design a complex ALU that calculates the square root through several steps. This is called interactive calculation, and usually relies on control from a complex control unit
    Control unit

    A control unit in general is a central part of whatsoever machinery that controls its operation, provided that a piece of machinery is complex and organized enough to contain any such unit....
     with built-in microcode
    Microcode

    Microcode is a layer of lowest-level instructions involved in the implementation of machine code instructions in many computers and other processors; it resides in a special high-speed memory and translates machine instructions into sequences of detailed circuit-level operations....
    .
  4. 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. This is called the co-processor.
  5. Tell the programmers that there is no co-processor and there is no emulation, so they will have to write their own algorithms to calculate square roots by software. This is performed by software libraries.
  6. Emulate the existence of the co-processor, that is, whenever a program attempts to perform the square root calculation, make the processor check if there is a co-processor present and use it if there is one; if there isn't one, interrupt
    Interrupt

    In computing, an interrupt is an asynchronous communication signal from hardware indicating the need for attention or a synchronous event in software indicating the need for a change in execution....
     the processing of the program and invoke the operating system
    Operating system

    An operating system is an interface between hardware and applications; it is responsible for the management and coordination of activities and the sharing of the limited resources of the computer....
     to perform the square root calculation through some software algorithm. This is called software emulation.


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
Intel Core

The Core brand refers to Intel's 32-bit mobile dual-core x86 CPUs that derived from the Pentium M branded processors. The processor family used a more advanced version of the Intel P6 microarchitecture....
 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.

Inputs and outputs

The inputs to the ALU are the data to be operated on (called operand
Operand

An operand is one of the inputs of an operator in mathematics. The following arithmetic expression shows an example of operators and operands:...
s) and a code from the control unit
Control unit

A control unit in general is a central part of whatsoever machinery that controls its operation, provided that a piece of machinery is complex and organized enough to contain any such 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
Status register

A status register is a collection of Flag bits for a Central processing unit. A popular example of a status register is the FLAGS register of x86 architecture based microprocessors....
. These codes are used to indicate cases such as carry-in or carry-out, overflow
Arithmetic overflow

The term arithmetic overflow or simply overflow has the following meanings.# In a digital computer, the condition that occurs when a calculation produces a result that is greater in magnitude than what a given processor register or Computer storage location can store or represent....
, divide-by-zero
Division by zero

In mathematics, a division is called a division by zero if the divisor is 0 . Such a division can be formally expressed as a/0 where a is the dividend....
, etc.

ALUs vs. FPUs

A Floating Point Unit
Floating point unit

A floating-point unit is a part of a computer system specially designed to carry out operations on floating point numbers. Typical operations are addition, subtraction, multiplication, division , and square root....
 also performs arithmetic operations between two values, but they do so for numbers in floating point
Floating point

In computing, floating point describes a system for numerical representation in which a String of digits represents a rational number.The term floating point refers to the fact that the radix point can "float": that is, it can be placed anywhere relative to the Significant figures of the number....
 representation, which is much more complicated than the two's complement
Two's complement

The two's complement of a binary number is defined as the value obtained by subtracting the number from a large power of two .A two's-complement system or two's-complement arithmetic is a system in which negative numbers are represented by the two's complement of the absolute value; this system is the most common Signed number r...
 representation used in a typical ALU. In order to do these calculations, a FPU
Floating point unit

A floating-point unit is a part of a computer system specially designed to carry out operations on floating point numbers. Typical operations are addition, subtraction, multiplication, division , and square root....
 has several complex circuits built-in, including some internal ALUs.

Usually engineers call an ALU the circuit that performs arithmetic operations in integer
Integer

The integers are natural numbers including 0 and their negative and non-negative numberss . They are numbers that can be written without a fractional or decimal component, and fall within the set ....
 formats (like two's complement
Two's complement

The two's complement of a binary number is defined as the value obtained by subtracting the number from a large power of two .A two's-complement system or two's-complement arithmetic is a system in which negative numbers are represented by the two's complement of the absolute value; this system is the most common Signed number r...
 and BCD
Binary-coded decimal

In computing and electronics systems, binary-coded decimal is an encoding for decimal numbers in which each digit is represented by its own binary sequence....
), while the circuits that calculate on more complex formats like floating point
Floating point

In computing, floating point describes a system for numerical representation in which a String of digits represents a rational number.The term floating point refers to the fact that the radix point can "float": that is, it can be placed anywhere relative to the Significant figures of the number....
, complex numbers, etc. usually receive a more illustrious name.

See also

  • 7400 series
    7400 series

    The 7400 series of Transistor-transistor logic integrated circuits are historically important as the first widespread logic family of TTL integrated circuit logic ....
  • 74181
    74181

    The 74181 is a Bit slicing arithmetic logic unit , implemented as a 7400 series Transistor?transistor logic integrated circuit. The first complete ALU on a single chip, it was used as the arithmetic/logic core in the CPUs of many historically significant minicomputers and other devices....
  • adder (electronics)
    Adder (electronics)

    In electronics, an adder or summer is a digital circuit that performs addition of numbers.In modern computers adders reside in the arithmetic logic unit where other operations are performed....
  • multiplication ALU
    Multiplication ALU

    In digital circuit, a multiplier or multiplication Arithmetic logic unit is a hardware circuit dedicated to multiplication two binary values....
  • digital circuit
    Digital circuit

    Digital electronics are electronics systems that use digital signals. Digital electronics are representations of Boolean algebra and are used in computers, mobile phones, and other consumer products....
  • division (electronics)


External links

  • IS TDE