Nepedia
Back to Discover
Fluent Reader
💻

Arithmetic logic unit

technology Maturity 7-9 Next article →

An arithmetic logic unit, or ALU, is a vital part of a computer.

ALU block
ALU block

It is a digital circuit that does math and logic tasks. This unit works with integer binary numbers. It is different from a floating-point unit, which handles different types of numbers. You can find an ALU inside many computing circuits. It is a building block for a central processing unit (CPU). It is also found in graphics processing units (GPUs).

ALU data paths
ALU data paths

How does an ALU work? It needs a few things to start a task. First, it needs two numbers called operands. Second, it needs an opcode. An opcode is a code that tells the ALU which operation to perform. For example, the opcode might tell the ALU to add two numbers. The ALU then sends the result to an output.

74181aluschematic
74181aluschematic

This process happens when electrical signals move through the circuit. There is a tiny wait called a propagation delay. This is the time it takes for signals to move through the parts. The computer uses a clock signal to keep everything timed correctly.

An ALU can do many different jobs. It can perform basic math like adding or subtracting. It can also increment a number by one. Another job is decrementing a number by one. The ALU can also do bitwise logic operations. These include tasks like AND, OR, and XOR.

Rotate left logically
Rotate left logically

It can even shift bits left or right. Some complex ALUs use something called a barrel shifter. This lets them shift many bits all at once. This variety makes the ALU very useful for all kinds of math.

Sometimes, the ALU gives extra information about its work. These are called status outputs. A carry-out signal shows if a number was carried over. A zero signal shows if the result is zero. The ALU can also show if a number is negative. It can show if a result is too big, which is called an overflow.

AluStatusRegister
AluStatusRegister

It can also show parity, which tells if there is an even or odd number of bits. These signals help the computer make decisions. They are often stored in a status register for later use.

An ALU can also help work with very large numbers. This is called multiple-precision arithmetic. An ALU might only be 8 bits wide. To handle a 24-bit number, it breaks it into three smaller pieces. The ALU works on one piece at a time. It uses the carry-out bit from one piece to help with the next piece. This allows a small circuit to solve very large math problems. It is a clever way to use simple parts for big jobs.

440 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (11)
File:ALU block.svg
ALU block.svg
File:74181aluschematic.svg
74181aluschematic.svg
File:Rotate left logically.svg
Rotate left logically.svg
File:Rotate right logically.svg
Rotate right logically.svg
File:Rotate right through carry.svg
Rotate right through carry.svg
File:Rotate left through carry.svg
Rotate left through carry.svg
File:Rotate left.svg
Rotate left.svg
File:Rotate right.svg
Rotate right.svg
File:Rotate right arithmetically.svg
Rotate right arithmetically.svg
File:AluStatusRegister.svg
AluStatusRegister.svg
File:ALU data paths.svg
ALU data paths.svg
More to explore

🔗 What's this?

Concepts mentioned in this article

🔬 Go deeper

More advanced topics to explore

🪜 Step back

Simpler topics to build understanding

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.