Instruction Fetch (IF)
- Fetch the instruction pointed by Program Counter (PC) from memory (instruction memory. It's different from the memory that you access in MEM stage)
Instruction Decode (ID)
- Decode the instruction for the desired operation and operands
- Reading source register value -- therefore, you access to register file
Execution (EX) It's happening in ALU of the processor
- ALU instructions: Perform ALU operations
- Conditional Branch: Determine the branch outcome (taken/not taken)
- Memory Instructions: Determine the effective address for data memory access.
Data Memory Access (MEM)
- Read/write data memory
Write Back (WB)
- Present ALU result(or read value from MEM stage) in the target register
Update PC
- If the branch is taken or some kind of jump/return operation - set to the branch target address
- Otherwise, advance to the next instruction -- current PC + 4