1 / 61

Program Execution

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.

raine
Download Presentation

Program Execution

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Program Execution

  2. 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

  3. 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

  4. 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

  5. 2 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 1. Copy word referred to by PC into Instruction register

  6. 3 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 1. Copy word referred to by PC into Instruction register

  7. 4 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 1. Copy word referred to by PC into Instruction register

  8. 5 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 2. Add 1 to the Program Counter

  9. 6 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and Execute instruction

  10. 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

  11. 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

  12. 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

  13. 10 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and Execute instruction – Instruction execution is complete

  14. 11 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit Repeat: 1. Copy word referred to by PC to IR

  15. 12 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit Repeat: 1. Copy word referred to by PC to IR

  16. 13 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 2. Add 1 to PC

  17. 14 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction

  18. 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

  19. 16 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – Check value in data register

  20. 17 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – DR value is -1

  21. 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

  22. 19 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – execution is complete

  23. 20 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 1. Copy word referred to by PC to IR

  24. 21 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 1. Copy word referred to by PC to IR

  25. 22 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 2. Add 1 to PC

  26. 23 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction

  27. 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

  28. 25 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction

  29. 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.

  30. 27 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 1. Copy word referred to by PC to IR.

  31. 28 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 1. Copy word referred to by PC to IR.

  32. 29 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 2. Add 1 to PC

  33. 30 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction

  34. 31 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – 011 is Subtract

  35. 32 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – data register is first operand

  36. 33 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – data register is first operand

  37. 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

  38. 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

  39. 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.

  40. 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.

  41. 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.

  42. 39 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 1. Copy word referred to by PC to IR.

  43. 40 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 1. Copy word referred to by PC to IR.

  44. 41 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 2. Add 1 to PC

  45. 42 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction

  46. 43 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – 001 is CopyTo

  47. 44 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 3. Decode and execute instruction – 01010 is target location

  48. 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

  49. 46 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 1. Copy word referred to by PC to IR

  50. 47 CPU Main Memory Program Counter Instruction Register Data Register Input Unit Output Unit 1. Copy word referred to by PC to IR

More Related