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
- Two operands come from registers.
- The second operand arrives too.
- An opcode selects add, subtract, AND, OR or shift.
- The result is produced in one stage.
- 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
- Open the interactive lesson, with a mini quiz.
- Take the Computer Architecture & Logic quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- 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?
Where do people use Arithmetic Logic Unit?
What is the most common mistake with Arithmetic Logic Unit?
What should I learn before this topic?
How can I practice it?
Is Arithmetic Logic Unit hard to learn?
How long does it take to learn Arithmetic Logic Unit?
Which topics are related to Arithmetic Logic Unit?
What should I study after Arithmetic Logic Unit?
Related topics
- Finite State Machines in Hardware (Computer Architecture & Logic)
- Instruction Set Architecture (Computer Architecture & Logic)
- Sequential Circuits (Computer Architecture & Logic)
- RISC vs CISC (Computer Architecture & Logic)
- Propositional Logic (Theory & Discrete Math)
- Predicate Logic (Theory & Discrete Math)
- Unit Testing (Software Engineering)