LearnViz CompSci
Home / Learn / Computer Architecture & Logic / Arithmetic Logic Unit

Intermediate Topic 20 of 51 Computer Architecture & Logic

Arithmetic Logic Unit

CPU component performing arithmetic and bitwise operations.

How it works

The arithmetic logic unit is the part of the processor that performs integer arithmetic such as addition, subtraction and comparison, plus logic operations such as AND, OR, XOR and shifts. A control signal selects the operation, a multiplexer chooses the result and status flags report zero, negative, carry and overflow. It is purely combinational, built from adders, gates and shifters.

Step-by-step walkthrough

  1. Two operands come from registers.
  2. The second operand arrives too.
  3. An opcode selects add, subtract, AND, OR or shift.
  4. The result is produced in one stage.
  5. Flags such as zero, carry and overflow tell branches what happened.

Where it is used

Every instruction that computes a value, a branch condition or a memory address uses the ALU. Superscalar processors contain several ALUs to execute multiple operations per cycle.

Common pitfall

Flags such as carry and overflow are easily confused, and using the wrong one after signed or unsigned comparison causes bugs. Multiplication and division are slower or handled by separate units. The ALU handles only integers; floating-point work goes to a separate floating-point unit.

Where it fits in the course

Arithmetic Logic Unit is topic 20 of 51 in Computer Architecture & Logic, rated Intermediate. It follows Finite State Machines in Hardware. The next topic is Instruction Set Architecture.

Practice and explore

How to study this topic

  1. Read the explanation above and restate the definition in your own words.
  2. Open the interactive lesson and answer its mini quiz.
  3. Read the common pitfall, then write a short example that avoids it.
  4. Check your understanding in the Computer Architecture & Logic quiz, and revisit the topic if you miss a question.

Frequently asked questions

What is Arithmetic Logic Unit?
CPU component performing arithmetic and bitwise operations. It belongs to Computer Architecture & Logic and is an intermediate-level topic.
Where do people use Arithmetic Logic Unit?
Every instruction that computes a value, a branch condition or a memory address uses the ALU.
What is the most common mistake with Arithmetic Logic Unit?
Flags such as carry and overflow are easily confused, and using the wrong one after signed or unsigned comparison causes bugs.
What should I learn before this topic?
Start with Finite State Machines in Hardware, the topic just before it in Computer Architecture & Logic.
How can I practice it?
Answer the mini quiz in the interactive lesson, then take the Computer Architecture & Logic quiz.
Is Arithmetic Logic Unit hard to learn?
It is an Intermediate topic. Be comfortable with the Beginner topics in this area first, then read the common pitfall carefully, since it is where most mistakes happen.
How long does it take to learn Arithmetic Logic Unit?
Most learners can read the explanation and finish the interactive lesson in under an hour. Fluency comes from applying the idea, so plan a few short practice sessions with the quiz.
Which topics are related to Arithmetic Logic Unit?
Finite State Machines in Hardware, Instruction Set Architecture, Sequential Circuits are closely connected. The full list is in the related topics section of this page.
What should I study after Arithmetic Logic Unit?
Continue with Instruction Set Architecture, the next topic in Computer Architecture & Logic.

Related topics