1 / 17

Fetch-Execute Cycle Instructor Euripides Montagne

Fetch-Execute Cycle Instructor Euripides Montagne. Assembly Language programs. In this lecture we will show the execution of a program in the tiny VN machine. The program is written using the assembly language of the tiny VN computer.

Télécharger la présentation

Fetch-Execute Cycle Instructor Euripides Montagne

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. Fetch-Execute CycleInstructor Euripides Montagne

  2. Assembly Language programs In this lecture we will show the execution of a program in the tiny VN machine. The program is written using the assembly language of the tiny VN computer. We will also refer to the assembly language as the tiny VN Computer Instruction Set Architecture (ISA). For the first instruction in the following example we will show The fetch and execution cycles for the first instruction

  3. Data Memory Program Memory • IN < 5 > “18” • OUT < 9 > • STORE < 0001 > • IN < 5 > “4” • OUT < 9 > • STORE < 0004 > • LOAD < 0001 > • ADD < 0004 > • OUT < 9 > • STORE < 0002 > • END 000 001 002 003 004 005 006 007 008 009 Assembly Language programs 20 PC C P U IR A 9 5 7 ....... Keyboard Printer Screen

  4. Data Memory Program Memory FETCH CYCLE 1.- Fetch instruction from memory to IR 2.- PC  PC + 1 • IN < 5 > “18” • OUT < 9 > • STORE < 0001 > • IN < 5 > “4” • OUT < 9 > • STORE < 0004 > • LOAD < 0001 > • ADD < 0004 > • OUT < 9 > • STORE < 0002 > • END 000 001 002 003 004 005 006 007 008 009 Assembly Language programs 21 PC C P U IN < 5 > IR A 9 5 7 ....... Keyboard Printer “type in 18” Screen

  5. EXECUTION CYCLE (The computer reads in the typed value (18) and saves it in A) Data Memory Program Memory • IN < 5 > “18” • OUT < 9 > • STORE < 0001 > • IN < 5 > “4” • OUT < 9 > • STORE < 0004 > • LOAD < 0001 > • ADD < 0004 > • OUT < 9 > • STORE < 0002 > • END 000 001 002 003 004 005 006 007 008 009 Assembly Language programs 21 PC C P U IN < 5 > IR 18 A 9 5 7 ....... Keyboard Printer Screen

  6. Data Memory FETCH CYCLE 1.- Fetch instruction from memory to IR 2.- PC  PC + 1 Program Memory • IN < 5 > “18” • OUT < 9 > • STORE < 0001 > • IN < 5 > “4” • OUT < 9 > • STORE < 0004 > • LOAD < 0001 > • ADD < 0004 > • OUT < 9 > • STORE < 0002 > • END 000 001 002 003 004 005 006 007 008 009 Assembly Language programs 22 PC C P U OUT < 9 > IR 18 A 9 5 7 ....... Keyboard Printer Screen

  7. EXECUTION CYCLE (The computer displays the contents of A on the screen) Data Memory Program Memory • IN < 5 > “18” • OUT < 9 > • STORE < 0001 > • IN < 5 > “4” • OUT < 9 > • STORE < 0004 > • LOAD < 0001 > • ADD < 0004 > • OUT < 9 > • STORE < 0002 > • END 000 001 002 003 004 005 006 007 008 009 Assembly Language programs 22 PC C P U OUT < 9 > IR 18 A 9 5 7 ....... 18 Keyboard Printer Screen

  8. So far we have shown the execution of each instruction describing the instruction cycle, which has two steps: Fetch and Execute. From now on, we will show the state of the machine after executing each instruction. The instruction being executed will be highlighted in red. PC will point to the next instruction.

  9. Data Memory Program Memory • IN < 5 > “18” • OUT < 9 > • STORE < 0001 > • IN < 5 > “4” • OUT < 9 > • STORE < 0004 > • LOAD < 0001 > • ADD < 0004 > • OUT < 9 > • STORE < 0002 > • END 000 001 002 003 004 005 006 007 008 009 18 Assembly Language programs 23 PC C P U STORE < 0001 > IR 18 A 9 5 7 ....... 18 Keyboard Printer Screen

  10. Data Memory Program Memory • IN < 5 > “18” • OUT < 9 > • STORE < 0001 > • IN < 5 > “4” • OUT < 9 > • STORE < 0004 > • LOAD < 0001 > • ADD < 0004 > • OUT < 9 > • STORE < 0002 > • END 000 001 002 003 004 005 006 007 008 009 18 Assembly Language programs 24 PC C P U IN < 5 > IR 4 A 9 5 7 ....... 18 Keyboard Printer Screen

  11. Data Memory Program Memory • IN < 5 > “18” • OUT < 9 > • STORE < 0001 > • IN < 5 > “4” • OUT < 9 > • STORE < 0004 > • LOAD < 0001 > • ADD < 0004 > • OUT < 9 > • STORE < 0002 > • END 000 001 002 003 004 005 006 007 008 009 18 Assembly Language programs 25 PC C P U OUT < 9 > IR 4 A 9 5 7 ....... 4 18 Keyboard Printer Screen

  12. Data Memory Program Memory • IN < 5 > “18” • OUT < 9 > • STORE < 0001 > • IN < 5 > “4” • OUT < 9 > • STORE < 0004 > • LOAD < 0001 > • ADD < 0004 > • OUT < 9 > • STORE < 0002 > • END 000 001 002 003 004 005 006 007 008 009 18 Assembly Language programs 4 26 PC C P U STORE < 0004 > IR 4 A 9 5 7 ....... 4 18 Keyboard Printer Screen

  13. Data Memory Program Memory • IN < 5 > “18” • OUT < 9 > • STORE < 0001 > • IN < 5 > “4” • OUT < 9 > • STORE < 0004 > • LOAD < 0001 > • ADD < 0004 > • OUT < 9 > • STORE < 0002 > • END 000 001 002 003 004 005 006 007 008 009 18 Assembly Language programs 4 27 PC C P U LOAD < 0001 > IR 18 A 9 5 7 ....... 4 18 Keyboard Printer Screen

  14. Data Memory Program Memory • IN < 5 > “18” • OUT < 9 > • STORE < 0001 > • IN < 5 > “4” • OUT < 9 > • STORE < 0004 > • LOAD < 0001 > • ADD < 0004 > • OUT < 9 > • STORE < 0002 > • END 000 001 002 003 004 005 006 007 008 009 18 Assembly Language programs 4 28 PC C P U ADD < 0004 > IR 22 A 9 5 7 ....... 4 18 Keyboard Printer Screen

  15. Data Memory Program Memory • IN < 5 > “18” • OUT < 9 > • STORE < 0001 > • IN < 5 > “4” • OUT < 9 > • STORE < 0004 > • LOAD < 0001 > • ADD < 0004 > • OUT < 9 > • STORE < 0002 > • END 000 001 002 003 004 005 006 007 008 009 18 Assembly Language programs 4 29 PC C P U OUT < 0009 > IR 22 A 9 5 7 ....... 22 4 18 Keyboard Printer Screen

  16. Data Memory Program Memory • IN < 5 > “18” • OUT < 9 > • STORE < 0001 > • IN < 5 > “4” • OUT < 9 > • STORE < 0004 > • LOAD < 0001 > • ADD < 0004 > • OUT < 9 > • STORE < 0002 > • END 000 001 002 003 004 005 006 007 008 009 18 22 Assembly Language programs 4 30 PC C P U STORE < 0002 > IR 22 A 9 5 7 ....... 22 4 18 Keyboard Printer Screen

  17. Data Memory Program Memory Program ends and machine stops the execution of instructions • IN < 5 > “18” • OUT < 9 > • STORE < 0001 > • IN < 5 > “4” • OUT < 9 > • STORE < 0004 > • LOAD < 0001 > • ADD < 0004 > • OUT < 9 > • STORE < 0002 > • END 000 001 002 003 004 005 006 007 008 009 18 22 Assembly Language programs 4 31 PC C P U END IR 22 A 9 5 7 ....... 22 4 18 Keyboard Printer Screen

More Related