630 likes | 820 Views
Program Execution. Preparation. The assembly language version is assembled into a machine language executable The executable is copied into main memory The Program Counter Register is loaded with the address of the first instruction in the program. Woody's instruction cycle.
E N D
Preparation • The assembly language version is assembled into a machine language executable • The executable is copied into main memory • The Program Counter Register is loaded with the address of the first instruction in the program
Woody's instruction cycle • Copy the word referred to by the Program Counter into the Instruction Register • Add 1 to the address in the Program Counter • Decode and execute the contents of the Instruction Register
1 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit Initial state of memory after loading program and setting PC to 00000
2 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 1. Copy word referred to by PC into Instruction register
3 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 1. Copy word referred to by PC into Instruction register
4 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 1. Copy word referred to by PC into Instruction register
5 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 2. Add 1 to the Program Counter
6 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and Execute instruction
7 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and Execute instruction – 000 is op code for CopyFrom
8 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and Execute instruction – 01001 is address to copy from
9 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and Execute instruction – 01001 is address to copy from
10 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and Execute instruction – Instruction execution is complete
11 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit Repeat: 1. Copy word referred to by PC to IR
12 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit Repeat: 1. Copy word referred to by PC to IR
13 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 2. Add 1 to PC
14 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction
15 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – 110 is the op code for IfNegGoTo
16 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – Check value in data register
17 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – DR value is -1
18 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – Copy rightmost 5 bits of IR to PC
19 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – execution is complete
20 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 1. Copy word referred to by PC to IR
21 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 1. Copy word referred to by PC to IR
22 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 2. Add 1 to PC
23 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction
24 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – 000 is op code for CopyFrom
25 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction
26 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – copy value to DR. Execution complete.
27 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 1. Copy word referred to by PC to IR.
28 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 1. Copy word referred to by PC to IR.
29 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 2. Add 1 to PC
30 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction
31 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – 011 is Subtract
32 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – data register is first operand
33 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – data register is first operand
34 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – word at 01100 is second operand
35 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – word at 01100 is second operand
36 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction: (6 – 1) = 5. Result is stored in DR.
37 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction: (6 – 1) = 5. Result is stored in DR.
38 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction: (6 – 1) = 5. Result is stored in DR.
39 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 1. Copy word referred to by PC to IR.
40 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 1. Copy word referred to by PC to IR.
41 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 2. Add 1 to PC
42 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction
43 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – 001 is CopyTo
44 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – 01010 is target location
45 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – value in DR copied to memory
46 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 1. Copy word referred to by PC to IR
47 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 1. Copy word referred to by PC to IR