What are the Steps to Execute an Instruction?

© 2003 by Charles C. Lin. All rights reserved.

Six Steps

The main purpose of a CPU is to execute instructions. We've already seen some simple examples of instructions, i.e., add and addi.

The CPU executes the binary representation of the instructions, i.e., machine code.

Since programs can be very large, and since CPUs have limited memory, programs are stored in memory (RAM). However, CPUs do its processing on the CPU. So, the CPU must copy the instruction from memory to the CPU, and once it's in the CPU, it can execute it.

The PC is used to determine which instruction is executed, and based on this execution, the PC is updated accordingly to the next instruction to be run.

Essentially, a CPU repeatedly fetches instructions and executes them.

The following is a summary of the six steps used to execute a single instruction.

These are the six steps to executing an instruction. Not every instruction goes through every step. However, we label each step so that you can be aware they exist.

Some of these steps may not make much sense now, but hopefully, they're be clearer once we start implementing the steps in depth.

Six Steps, In Summary

To make it easier to read, the six steps are listed below.

Step Description
1 Fetch Instruction from Memory
2 Decode Instruction and Fetch Operands
3 Perform ALU Operations
4 Memory Access (for load/store)
5 Store ALU result to register file
6 Update PC

Web Accessibility