DOC PREVIEW
Berkeley COMPSCI 61C - Lecture 13 ­ Input/Output: Polling and Interrupts

This preview shows page 1-2-15-16-31-32 out of 32 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS61C - Machine Structures Lecture 13 - Input/Output: Polling and InterruptsReview 1/2Review 2/2OutlineAnatomy: 5 components of any ComputerMotivation for Input/OutputI/O Device Examples and SpeedsWhat do we need to make I/O work?Instruction Set Architecture for I/OMemory Mapped I/OProcessor-I/O Speed MismatchProcessor Checks Status before ActingSPIM I/O SimulationSPIM I/OI/O ExampleAdministrivia“What’s This Stuff Good For?”Cost of Polling?% Processor time to poll mouse, floppy% Processor time to hard diskWhat is the alternative to polling?I/O InterruptDefinitions for ClarificationInterrupt Driven Data TransferInstruction Set Support for I/O InterruptSlide 26SPIM I/O Simulation: Interrupt Driven I/OBenefit of Interrupt-Driven I/OQuestions Raised about Interrupts4 Responsibilities leading to OS4 Functions OS must provideThings to RememberCS61C L13 I/O © UC Regents1CS61C - Machine StructuresLecture 13 - Input/Output: Polling and Interrupts October 11, 2000David Pattersonhttp://www-inst.eecs.berkeley.edu/~cs61c/CS61C L13 I/O © UC Regents2Review 1/2°Pointer is high level language version of address°Like goto, with self-imposed discipline can achieve clarity and simplicity•Dereferences in C turn into loads or stores in MIPS code•Powerful, dangerous concept: can cause difficult to fix bugs°C supports pointers, pointer arithmetic°Java structure pointers have many of the same potential problemsCS61C L13 I/O © UC Regents3Review 2/2°MIPS Signed v. Unsigned "overloaded" term•Do/Don't sign extend (lb, lbu)•Don't overflow (addu, addiu, subu, multu, divu)•Do signed/unsigned compare (slt,slti/sltu,sltiu) •Immediate sign extension independent of term (andi, ori zero extend; rest sign extend)°Assembler uses $at to turn MAL into TALCS61C L13 I/O © UC Regents4Outline°I/O Background°Polling°InterruptsCS61C L13 I/O © UC Regents5Anatomy: 5 components of any Computer Processor (active)ComputerControl(“brain”)Datapath(“brawn”)Memory(passive)(where programs, data live whenrunning)DevicesInputOutputKeyboard, MouseDisplay, PrinterDisk (where programs, data live when not running)CS61C L13 I/O © UC Regents6Motivation for Input/Output°I/O is how humans interact with computers°I/O lets computers do amazing things:•Read pressure of synthetic hand and control synthetic arm and hand of fireman•Control propellers, fins, communicate in BOB (Breathable Observable Bubble)•Read bar codes of items in refrigerator°Computer without I/O like a car without wheels; great technology, but won’t get you anywhereCS61C L13 I/O © UC Regents7I/O Device Examples and Speeds°I/O Speed: bytes transferred per second(from mouse to display: million-to-1) °Device Behavior Partner Data Rate (Kbytes/sec)Keyboard Input Human 0.01Mouse Input Human 0.02Line Printer Output Human 1.00Floppy disk Storage Machine 50.00Laser Printer Output Human 100.00Magnetic Disk Storage Machine 10,000.00Network-LAN I or O Machine 10,000.00Graphics Display Output Human 30,000.00CS61C L13 I/O © UC Regents8What do we need to make I/O work?°A way to connect many types of devices to the Proc-Mem°A way to control these devices, respond to them, and transfer data°A way to present them to user programs so they are usefulProcMemPCI BusSCSI Buscmd reg.data reg.Operating SystemWindowsFilesCS61C L13 I/O © UC Regents9Instruction Set Architecture for I/O°Some machines have special input and output instructions°Alternative model (used by MIPS):•Input: ~ reads a sequence of bytes •Output: ~ writes a sequence of bytes°Memory also a sequence of bytes, so use loads for input, stores for output•Called “Memory Mapped Input/Output”•A portion of the address space dedicated to communication paths to Input or Output devices (no memory there)CS61C L13 I/O © UC Regents10Memory Mapped I/O°Certain addresses are not regular memory°Instead, they correspond to registers in I/O devices00xFFFFFFFF0xFFFF0000cmd reg.data reg.addressCS61C L13 I/O © UC Regents11Processor-I/O Speed Mismatch°500 MHz microprocessor can execute 500 million load or store instructions per second, or 2,000,000 KB/s data rate•I/O devices from 0.01 KB/s to 30,000 KB/s°Input: device may not be ready to send data as fast as the processor loads it•Also, might be waiting for human to act°Output: device may not be ready to accept data as fast as processor stores it°What to do?CS61C L13 I/O © UC Regents12Processor Checks Status before Acting°Path to device generally has 2 registers:•1 register says it’s OK to read/write (I/O ready), often called Control Register•1 register that contains data, often called Data Register°Processor reads from Control Register in loop, waiting for device to set Ready bit in Control reg to say its OK (0  1)°Processor then loads from (input) or writes to (output) data register•Load from device/Store into Data Register resets Ready bit (1  0) of Control RegisterCS61C L13 I/O © UC Regents13SPIM I/O Simulation°SPIM simulates 1 I/O device: memory-mapped terminal (keyboard + display)•Read from keyboard (receiver); 2 device regs•Writes to terminal (transmitter); 2 device regsReceived ByteReceiver Data0xffff0004Unused (00...00)(IE)Receiver Control0xffff0000Ready(I.E.)Unused (00...00)TransmittedByteTransmitter Control0xffff0008Transmitter Data0xffff000cReady(I.E.)Unused (00...00)UnusedCS61C L13 I/O © UC Regents14SPIM I/O°Control register rightmost bit (0): Ready•Receiver: Ready==1 means character in Data Register not yet been read; 1 0 when data is read from Data Reg•Transmitter: Ready==1 means transmitter is ready to accept a new character;0  Transmitter still busy writing last char-I.E. bit discussed later°Data register rightmost byte has data•Receiver: last char from keyboard; rest = 0•Transmitter: when write rightmost byte, writes char to displayCS61C L13 I/O © UC Regents15I/O Example°Input: Read from keyboard into $v0lui $t0, 0xffff #ffff0000Waitloop: lw $t1, 0($t0) #controlandi $t1,$t1,0x0001beq $t1,$zero, Waitlooplw $v0, 4($t0) #data°Output: Write to display from $a0lui $t0, 0xffff #ffff0000Waitloop: lw $t1, 8($t0) #controlandi $t1,$t1,0x0001beq $t1,$zero, Waitloopsw $a0, 12($t0) #data°Processor waiting for I/O called “Polling”CS61C L13 I/O © UC Regents16Administrivia°Midterm will be in 2 weeks 5-8 pm•Old midterms will be onlineCS61C L13 I/O © UC Regents17“What’s This Stuff Good For?”Remote Diagnosis:“NeoRest ExII,” a high-tech toilet


View Full Document

Berkeley COMPSCI 61C - Lecture 13 ­ Input/Output: Polling and Interrupts

Documents in this Course
SIMD II

SIMD II

8 pages

Midterm

Midterm

7 pages

Lecture 7

Lecture 7

31 pages

Caches

Caches

7 pages

Lecture 9

Lecture 9

24 pages

Lecture 1

Lecture 1

28 pages

Lecture 2

Lecture 2

25 pages

VM II

VM II

4 pages

Midterm

Midterm

10 pages

Load more
Download Lecture 13 ­ Input/Output: Polling and Interrupts
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 13 ­ Input/Output: Polling and Interrupts and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 13 ­ Input/Output: Polling and Interrupts 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?