Chapter 8 Overview Programmed I/O Interrupt Driven I/O.

Slides:



Advertisements
Similar presentations
Chapter 7 Introduction to LC-3 Assembly Language Assembly Language Assembly Process Using the Editor & Simulator for Assembly Language Programming.
Advertisements

Interrupts Chapter 8 – pp Chapter 10 – pp Appendix A – pp 537 &
CSS 372 Lecture 1 Course Overview: CSS 372 Web page Syllabus Lab Ettiquette Lab Report Format Review of CSS 371: Simple Computer Architecture Traps Interrupts.
Overview I/O – memory mapped programmed / interrupt driven Traps mechanism & RET Subroutines & JSR & JSRR & RET Interrupt mechanism & RTI.
Chapter 9 Overview Traps mechanism & RET Subroutines & JSR & JSRR & RET Interrupt mechanism & RTI.
Chapter 8 I/O. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 8-2 I/O: Connecting to Outside World So far,
CSS 372 Oct 2 nd - Lecture 1 Course Overview: CSS 372 Web page Syllabus Lab Ettiquette Lab Report Format Review of CSS 371: Simple Computer Architecture.
Chapter 5 The LC-3 LC-3 Computer Architecture Memory Map
Chapter 8 I/O. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 8-2 I/O: Connecting to Outside World So far,
Chapter 7 Interupts DMA Channels Context Switching.
Chapter 6 Programming in Machine Language The LC-3 Simulator
Chapter 9 & 10 Subroutines and Interrupts. JSR Instruction: JSR offset (11 bit) xxxxxxxxxxx [PC ]  R7, JMP Offset Jump to Subroutine at offset.
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
CSS 372 Oct 2 nd - Lecture 2 Review of CSS 371: Simple Computer Architecture Chapter 3 – Connecting Computer Components with Buses Typical Bus Structure.
S. Barua – CPSC 240 CHAPTER 8 I/O How are I/O devices identified? Memory-mapped vs. special instructions.
Chapter 9 Trap Routines & RET Subroutines (or Functions) & JSR & JSRR & RET.
Overview Projects The Assembly Process Programmed I/O Interrupt Driven I/O.
Chapter 8 Overview Programmed I/O Introduction to Interrupt Driven I/O Project 3.
TCSS 372A Computer Architecture. Getting Started Get acquainted (take pictures) Review Web Page (
Chapter 8 I/O Programming Chapter 9 Trap Service Routines Programmed I/O Interrupts Interrupt Driven I/O Trap Service Routines.
Chapter 9 Trap Routines TRAP number (go to service routine) & RET (return from service routine) Subroutines (or Functions) JSR offset or JSRR rn (go to.
Chapters 4 & 5: LC-3 Computer Architecture Machine Instructions Assembly language Programming in Machine and Assembly Language.
Overview von Neumann Model Components of a Computer Some Computer Organization Models The Computer Bus An Example Organization: The LC-3.
Midterm Wednesday 11/19 Overview: 25% First Midterm material - Number/character representation and conversion, number arithmetic - DeMorgan’s Law, Combinational.
TCSS 372A Computer Architecture. Getting Started Get acquainted (take pictures) Purpose, scope, and expectations of the course Expectations & strategy.
Introduction to Computing Systems from bits & gates to C & beyond Chapter 8 Input/Output Basic organization Keyboard input Monitor output Interrupts DMA.
Chapter 8 Input/Output l I/O basics l Keyboard input l Monitor output l Interrupt driven I/O l DMA.
Introduction to Computer Engineering ECE/CS 252, Fall 2010 Prof. Mikko Lipasti Department of Electrical and Computer Engineering University of Wisconsin.
Chapter 8 I/O. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 8-2 I/O: Connecting to Outside World So far,
Chapter 9 Chapter 9 Subroutines and TRAPs l Privileged Instructions l TRAP Routines l Subroutines.
Introduction to Computer Engineering CS/ECE 252, Spring 2010 Prof. Guri Sohi Computer Sciences Department University of Wisconsin – Madison.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Introduction to Computing Systems and Programming The LC-2.
Chapter 8 Input/Output An Hong 2015 Fall School of Computer Science and Technology Lecture on Introduction to.
Computer Science 210 Computer Organization
Chapter 8 I/O.
Chapter 9 TRAP Routines and Subroutines
Computer Science 210 Computer Organization
HKN ECE 220: Fall 2017 Midterm 1 AJ Schroeder, Evan Lissoos, Utsav Kawrani 23rd September, 2017.
Computer Science 210 Computer Organization
COSC121: Computer Systems: LC3 I/O (Intro)
Computer Science 210 Computer Organization
Chapter 8 I/O.
Chapter 8 Input/Output I/O basics Keyboard input Monitor output
Chapter 9 TRAP Routines and Subroutines
Chapter 8 I/O.
Chapter 7 LC-2 Assembly Language.
Computer Science 210 Computer Organization
Chapter 9 TRAP Routines and Subroutines
Computer Science 210 Computer Organization
HKN ECE 220: Spring 2018 Midterm 1
Introduction to Computer Engineering
Chapter 9 TRAP Routines and Subroutines
TRAP Routines Subroutines Privileged Instructions
Chapter 9 TRAP Routines and Subroutines
Chapter 8 I/O.
Chapter 7 LC-2 Assembly Language.
Introduction to Computer Engineering
Chapter 9 TRAP Routines and Subroutines
Chapter 7 Assembly Language
TRAP Routines Privileged Instructions Subroutines
Chapter 9 TRAP Routines and Subroutines
Chapter 8 I/O.
School of Computer Science and Technology
Chapter 8 Input/Output An Hong 2016 Fall
HKN ECE 220: Fall 2018 Midterm 1 Andrew Fortunat, Jeff Chang, Srijan Chakraborty, Kanad Sarkar February 16, 2019.
Chapter 9 TRAP Routines and Subroutines
Chapter 9 TRAP Routines and Subroutines
Midterm 2 Review Chapters 4-16 LC-3
Presentation transcript:

Chapter 8 Overview Programmed I/O Interrupt Driven I/O

Digressing How do you do the following in the LC-3 ? (good test question ?) Shift left Rotate left Shift right Rotate right

One Pass vs Two Pass Assemblers Two Pass – Checks for syntax errors and builds the Symbol Table during first pass, resolves operand addresses during second pass. One Pass – Checks for syntax errors, builds the Symbol Table, and resolves operand addresses during the first pass. So why have a two pass?

More than One Object (Load) File Symbol Table Symbols External Imports Addresses Start x3000 Number x300A Data Data x300D Value ? The “Linker/Loader” would generate another “global table to resolve Externals & Exports at Load time

Input / Output Memory Mapped I/O – A section of the memory address space is reserved for I/O Registers rather than general memory locations. Think of it as “pseudo” memory. The same instructions are used for general programming and I/O programming. Non-Memory Mapped I/O – There is a separate address space for I/O programming, and an entirely separate set of I/O Instructions.

LC-3 has Memory Mapped I/O LC-3 Memory Layout: x0000 – x00FF Trap vectors x0100 – x2FFF System Programs & Data x3000 – xFDFF User Programs Area xFE00 – xFFFF I/O Programming “Registers”

Synchronous vs Asynchronous I/O Synchronous – latest value of data could be expected to be available when the program wanted it. It might be periodically updated at a know frequency. This is not typical nor usually realistic for I/O. Asynchronous – computer is generally much faster than I/O so program must wait until requested data is available or data provided has been taken. “Handshaking” is used to ensure that data is available or I/O device is ready.

Polling vs Interrrupt Driven I/O Polling – program checks handshaking signals to find when data is available of device is done (typically a loop in the program) Interrupt – program initiates I/O and waits until data is available (typically goes to sleep until the operating system wakes the program up)

Keyboard Input Interface

Keyboard Input Registers KBDR: Assigned to xFE02 Data is in KBDR[7:0] Read only Register KBSR: Assigned to xFE00 Status is in KBSR[15] Set to “1” when new data is ready Cleared when data is read

Simple Program to Input from Keyboard START LDI R1, A ; Test for BRzp START ; character input LDI R0, B BRnzp NEXT_TASK ; Go to the next task A.FILL xFE00 ; Address of KBSR B.FILL xFE02 ; Address of KBDR

Monitor Output Interface

Monitor Output Registers DDR: Assigned to xFE06 Data is in DDR[7:0] DSR: Assigned to xFE04 Status is in DSR[15] Set to “1” when data is picked up Cleared when new data is written

Simple Program to Ouput to Monitor START LDI R1, A ; Test to see if BRzp START ; output register is ready STI R0, B BRnzp NEXT_TASK A.FILL xFE04 ; Address of DSR B.FILL xFE06 ; Address of DDR

LC-3 Memory Mapped I/O

Echo from Keyboard to Monitor START LDI R1, KBSR ; Test for character input BRzp START LDI R0, KBDR ECHO LDI R1, DSR ; Test output register ready BRzp ECHO STI R0, DDR BRnzp NEXT_TASK KBSR.FILL xFE00 ; Address of KBSR KBDR.FILL xFE02 ; Address of KBDR DSR.FILL xFE04 ; Address of DSR DDR.FILL xFE06 ; Address of DDR

The I/O Routine for the LC-3 Keyboard START ST R1,SaveR1 ; Save registers needed ST R2,SaveR2 ; by this routine ST R3,SaveR3 ; LD R2,Newline L1 LDI R3,DSR BRzp L1 ; Loop until Monitor is ready STI R2,DDR ; Move cursor to new clean line ; LEA R1,Prompt ; Starting address of prompt string Loop LDR R0,R1,#0 ; Write the input prompt BRz Input ; End of prompt string L2 LDI R3,DSR BRzp L2 ; Loop until Monitor is ready STI R0,DDR ; Write next prompt character ADD R1,R1,#1 ; Increment Prompt pointer BRnzp Loop ; Get next prompt character ; Input LDI R3,KBSR BRzp Input ; Poll until a character is typed LDI R0,KBDR ; Load input character into R0 L3 LDI R3,DSR BRzp L3 ; Loop until Monitor is ready STI R0,DDR ; Echo input character ; L4 LDI R3,DSR BRzp L4 ; Loop until Monitor is ready STI R2,DDR ; Move cursor to new clean line LD R1,SaveR1 ; Restore registers LD R2,SaveR2 ; to original values LD R3,SaveR3 BRnzp NEXT_TASK ; Do the program's next task ;

The I/O Routine for the LC-3 Keyboard (2) SaveR1.BKLW 1 ; Memory for registers saved SaveR2.BKLW 1 SaveR3.BKLW 1 DSR.FILL xFE04 DDR.FILL xFE06 KBSR.FILL xFE00 KBDR.FILL xFE02 Newline.FILL x000A ; ASCII code for newline Prompt.STRINGZ "Input a character>"

I/O Interrupts Requirements for a device to interrupt the processor The device must have the right to request service The I/O device must want service The device request must be at a higher priority than what is being done by the processor or is being requested by other devices The processor must be completed with the present instruction execution

Device(s) Generating Interrupt Request

Generating the LC-3 Interrupt Request

Servicing an Interrupt The following process is followed to service an interrupt The CPU enters the Supervisor State The “context” of the present program is saved (PC, PSW, SP) The device provides the address of location in the interrupt service routine table where the pointer to the service routine should reside. The Supervisor loads the address of the service routine into the PC The service routine is executed (ending with an RTI) The context of the original program is loaded and the original program resumed