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

Instruction Register (IR)

How the IR holds the current instruction being decoded and executed by the CPU.

Instruction Register (IR)

What you'll learn: How the CPU uses the Instruction Register to hold the current instruction while it's being decoded and executed.

What Is the Instruction Register?

The Instruction Register (IR) is a special storage location inside the CPU that holds the instruction currently being processed. Think of it as the CPU's "workbench" — when the CPU fetches an instruction from memory, it places that instruction in the IR so it can examine and execute it.

Why the IR Matters

The CPU operates in a continuous cycle: fetch an instruction, decode it, execute it, and repeat. During the decode and execute phases, the CPU needs to keep the instruction accessible. The IR provides this temporary holding spot.

Here's the typical flow:

  1. The Program Counter (PC) points to the memory address of the next instruction
  2. The CPU fetches that instruction from memory
  3. The instruction is loaded into the IR
  4. The Control Unit reads the IR to decode what operation to perform
  5. The CPU executes the instruction
  6. The PC advances, and the cycle repeats

An Analogy

Imagine you're following a recipe. The recipe book is like your program in memory, and the page number you're on is the Program Counter. When you read a step ("Add 2 cups of flour"), you write it on a sticky note on your counter — that sticky note is the Instruction Register. You keep that step visible while you measure and add the flour, then move to the next step.

Key Takeaway: The Instruction Register (IR) temporarily holds the current instruction being decoded and executed, allowing the Control Unit and ALU to access the instruction's details throughout the execute phase.