Course contentsShow
← Computer Science
Lesson 1077 of 2,87225. Computer Architecture FoundationsFree lesson

Accumulator and Status Registers

The accumulator for storing intermediate results and flags register for tracking operation conditions.

Accumulator and Status Registers

You'll learn how the CPU uses special-purpose registers to hold intermediate computation results and track the outcome of operations.

What Is an Accumulator?

The accumulator is a special register that acts as the CPU's "working scratchpad" for arithmetic and logic operations. When the ALU performs a calculation like addition or subtraction, it typically stores the result in the accumulator. Think of it as the calculator's display screen—it shows the running total of your computation.

For example, if you want to compute 5 + 3 + 7, the accumulator might hold 5, then update to 8 after adding 3, and finally become 15 after adding 7. Many simple CPUs use the accumulator as both an input and output for most operations, making it central to computation.

What Are Status Registers (Flags)?

The status register (also called the flags register) contains individual bits that indicate the condition or outcome of the last operation. Each bit is a flag that turns on or off based on what just happened.

Common flags include:

  • Zero flag (Z): Set if the result was zero
  • Carry flag (C): Set if an addition produced a carry-out or subtraction needed a borrow
  • Overflow flag (V): Set if signed arithmetic overflowed
  • Negative flag (N): Set if the result is negative (in two's complement)

These flags help the Control Unit make decisions. For instance, conditional jumps ("branch if zero") check the zero flag to decide whether to change the Program Counter.

Why They Matter

The accumulator provides fast access to intermediate results without writing to memory, while status flags enable the CPU to react intelligently to computation outcomes—like detecting errors or controlling program flow.

Key Takeaway: The accumulator stores intermediate calculation results, while the status register's flags track conditions like zero, carry, and overflow, enabling the CPU to make informed decisions during program execution.