CS代写 CIT 593 Intro to Computer Systems | Property of Penn Engineering

Key Takeaways From Module 8: Input/Output (I/O) And Operating Systems
Module Learning Objectives
● Describe the generic architecture of I/O devices connected to a CPU
● Differentiate between memory-mapped I/O and directly connected I/O devices

Copyright By PowCoder代写 加微信 powcoder

● Recall and describe the four basic I/O devices on the LC4
● Write programs in LC4 assembly to exchange data with LC4 I/O devices
● Describe the purpose of an OS and its connection to I/O devices
● Write programs in LC4 assembly to implement I/O TRAPS
Module Glossary
● I/O controller: ​acts as a translator between digital (CPU) and analog (device); consists of three basic parts:
○ electronics (convert device’s inputs into digital data the CPU can understand)
○ status register
○ data register(s)
● Status register: ​a hardware register containing information about the state of the
I/O device
● Data register: ​stores the data being transferred to and from the I/O device
● Isolation: i​n terms of the OS and I/O discussion, the OS isolates user programs
from one another. A given user program should “feel” it owns the hardware but the OS actually owns it. All programs “believe” they own hardware but they are really using it in a time-sharing mode controlled by the OS.
○ Makes programs much easier to write.
○ Makes the whole system more stable and secure.
■ A​ can’t mess with ​B​ if it doesn’t even know ​B​ exists!
● Polling: ​one of two techniques for working with I/O devices. Polling refers to
requesting status from the I/O devices until there is status to be given. Sort of like
a “Mom/Dad, are we there yet? How about now? How about now?” model.
● Interrupts: ​second technique for working with I/O devices. The I/O device sends
a signal to the OS (called an “interrupt request”) to give its status. When the OS is ready, it deals with the interrupt (usually by invoking something like a trap).
CIT 593 Intro to Computer Systems | Property of Penn Engineering

○ Think of how you set up email on your smartphone: you can have the server send it to you (like the interrupt model) or you can constantly check it for new emails (poll the server)!
Study Tips From Your TAs
● To prepare you for this module’s homework, it is necessary to familiarize yourself with the functionality of several instructions.
● Video display
○ Entire display is memory-mapped.
○ One memory location per pixel
○ Memory region xC000-xFDFF
■ xC000-xC07F is first row, xC080-xC0FF is second row, etc. ○ To set pixel color, write to memory location.
● Addressing a pixel
○ Pixel at vmem[2][5] stored at
■ xC000 + (2 * 128) + 5
○ In general vmem[y][x] stored at
■ xC000 + (y * 128) + x
○ Note indexing from upper-left corner of the display
○ The TRAP instruction is very similar to a JSR but it also elevates the
privilege level of the CPU from 0 to 1.
○ The purpose of the TRAP instruction is to allow a program to run in USER
program memory.
○ Because of TRAPs limitation, the user can only jump into the first 256
rows of the OS. We shouldn’t install our “TRAPS” starting at x8000.
○ The RTI instruction is very similar to a RET:
■ It restores the PC back to the value saved in R7 (just like RET).
■ But​ it also lowers the privilege level of the CPU from 1 to 0.
○ The purpose of the RTI instruction:
■ Allow a subroutine running in the OS program memory to return
back to a caller in the USER program memory.
CIT 593 Intro to Computer Systems | Property of Penn Engineering

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com