Sec 2 3 Program Execution 1 Program Execution

  • Slides: 10
Download presentation
Sec (2. 3) Program Execution 1

Sec (2. 3) Program Execution 1

Program Execution n 1. 2. In the CPU we have CU and ALU, in

Program Execution n 1. 2. In the CPU we have CU and ALU, in CU there are two special purpose registers: Instruction Register Program Counter 2

The architecture of the machine described in Appendix C 3

The architecture of the machine described in Appendix C 3

Program Execution 1. Instruction Register Is used to holed the instruction being executed 2.

Program Execution 1. Instruction Register Is used to holed the instruction being executed 2. Program Counter Contains the address of next instruction to be executed 4

Program Execution CU performs its job by continually repeating an algorithm that guides it

Program Execution CU performs its job by continually repeating an algorithm that guides it through a 3 -steps process known as the Machine Cycle The steps are: 1. fetch 2. decode 3. execute n 5

: In fetch step n the CU requests that main memory provide it with

: In fetch step n the CU requests that main memory provide it with the instruction that is stored at the address indicated by the program counter ¨ ¨ Each instruction in our machine is 2 bytes long, this fetch process involves retrieving the contents of 2 memory cells The CU places the instruction received from memory in its instruction register and then increments the program counter by 2 so, it contains the address of the next instruction stored in memory 6

: Decode step n The instruction new in the instruction register ¨ The CU

: Decode step n The instruction new in the instruction register ¨ The CU decodes the instruction, which involves breaking the operand field a proper component based on the instructions opcode 7

: Execute step n The CU executes the instruction by activating the appropriate circuitry

: Execute step n The CU executes the instruction by activating the appropriate circuitry to perform the requested task 8

Decoding the instruction B 258 9

Decoding the instruction B 258 9

: Cache memory There is a cache in CPU which takes the data from

: Cache memory There is a cache in CPU which takes the data from memory n Small memory and faster in accessing. n It is between CPU and RAM n It contains the information and instructions which are commonly used n 10