The instruction lifecycle refers to the sequence of stages a CPU follows to execute an instruction. Here’s a step-by-step explanation:
The Program Counter (PC) points to the address of the next instruction.
The instruction is fetched from memory and placed in the Memory Buffer Register (MBR).
The Instruction Register (IR) stores the fetched instruction.
The PC is incremented to point to the next instruction.
The instruction in the IR is decoded by the Control Unit (CU).
The CU determines what action needs to be performed (e.g., arithmetic operation, memory access, jump).
It identifies the operands and any necessary data for the operation.
If the instruction requires operands (data), the addresses of the operands are sent to the Memory Address Register (MAR) to fetch them from memory.
The operands are loaded into the appropriate registers or memory.
The Arithmetic Logic Unit (ALU) performs the specified operation (e.g., addition, subtraction, logical operations).
The result of the operation is generated.
The result from the ALU is written back to the destination register or memory location, as needed.