Machine Cycle – The CPU’s Step-by-Step Process
The machine cycle (also called the instruction cycle) is the process the CPU follows to execute an instruction. It consists of four main stages:
Stages of the Machine Cycle
- Fetch – The CPU will be retrieves the instructions from memory.
- Decode – The CPU interprets the instruction.
- Execute – The CPU performs the instruction.
- Store – The CPU saves the result in memory or a register.
Each cycle is controlled by the Control Unit (CU) and processed through the Arithmetic & Logic Unit (ALU) when necessary.
Detailed Breakdown of Each Stage
1. Fetch (Getting the Instruction)
- The Program Counter (PC) holds all the addresses of the next instruction.
- The Control Unit (CU) sends a signal to fetch the instruction from memory (RAM).
- The instruction is placed into the Instruction Register (IR).
2. Decode (Understanding the Instruction)
- The Control Unit deciphers the instruction.
- It determines what actions are required (e.g., arithmetic, logic, memory access).
- If needed, it prepares the ALU for calculations.
3. Execute (Performing the Instruction)
- The CPU carries out the instruction using the ALU (for calculations) or registers.
- Logical decisions (such as comparisons) are processed.
- The result is generated.
4. Store (Saving the Result)
- The result is stored in a register or memory for future use.
- The Program Counter (PC) is to be updated to point to the next instruction.
- The cycle repeats for the next operation.
Machine Cycle and CPU Speed
- The number of the cycles are per second is measured in Hertz (Hz).
- A 1 GHz processor can perform 1 billion machine cycles per second.
- More cores and higher clock speeds improve efficiency.
Comments
Post a Comment