Program instructions execution
Program instructions execution
Introduction
---
Before diving into execution, it’s essential to understand the key components that play a role:
Control Unit (CU): Directs operations, fetches instructions, and interprets them.
Program Counter (PC): Keeps track of the next instruction’s memory address.
3. Buses
---
Every instruction undergoes a systematic execution cycle consisting of three major steps: Fetch,
Decode, and Execute.
Step 1: Fetch
The CPU fetches the next instruction from memory using the Program Counter (PC), which
holds the memory address of the instruction.
The instruction is retrieved and sent to the CPU via the Data Bus.
Step 2: Decode
The Control Unit (CU) interprets the instruction stored in the Instruction Register (IR).
Opcode (Operation Code): Specifies what operation to perform (e.g., ADD, MOV).
The CPU identifies the required resources (registers, memory locations) for execution.
Step 3: Execute
The CPU carries out the instruction as per the decoded details.
If it involves:
---
3. Types of Instructions
2. Arithmetic Instructions
3. Logical Instructions
5. Input/Output Instructions
---
Instructions are fetched sequentially unless control instructions (e.g., JMP) alter the flow.
b) Harvard Architecture
---
---
During execution, the CPU may face interrupts or exceptions that temporarily pause execution:
Hardware Interrupts: Triggered by external devices (e.g., keyboard input, hardware failures).
---
7. Conclusion
The execution of program instructions follows a structured and optimized approach, ensuring
that computers process tasks efficiently. The Fetch-Decode-Execute cycle is the core of this
execution process, enhanced by architectures like pipelining and interrupt handling.
Understanding these concepts is crucial for software development, computer engineering, and
system optimization.