Slide Chương 8
Slide Chương 8
Slide Chương 8
Control Lines
External
Address M Ports Data
Internal
I/O Module
Data Interrupt
Signals
External
Data
Links to
Instructions Address
peripheral
Control devices
Data CPU Signals
Interrupt Data
Signals
Figure 3.15 Computer Modules Figure 7.1 Generic Model of an I/O Module
CPU-Memory-I/O Architecture
Memory
I/O I/O
CPU
module device
“CPU bus”
or “Bus interface” “I/O bus”
“System bus”
why does not connect peripherals
directly to the system bus?
There are a wide variety of peripherals with various methods of
operation. It would be impractical to incorporate the necessary logic
within the processor to control a range of devices.
The data transfer rate of peripherals is often much slower than that of
the memory or processor. Thus, it is impractical to use the high-speed
system bus to communicate directly with a peripheral.
The data transfer rate of some peripherals is faster than that of the
memory or processor. Again, the mismatch would lead to inefficiencies
if not managed properly.
Peripherals often use different data formats and word lengths than the
computer to which they are attached.
Ethernet modem
(max speed)
Graphics display
Wi-Fi modem
(max speed)
Hard disk
Optical disc
Laser printer
Scanner
Mouse
Keyboard
101 102 103 104 105 106 107 108 109 1010 1011
Data Rate (bps)
Three
Provide a means of
exchanging data between the categories:
external environment and the
computer Human readable
Suitable for communicating with
the computer user
Attach to the computer by a Video display terminals (VDTs),
link to an I/O module printers
The link is used to exchange
control, status, and data
Machine readable
between the I/O module and Suitable for communicating with
equipment
the external device
Magnetic disk and tape systems,
sensors and actuators
Peripheral device
An external device connected Communication
to an I/O module Suitable for communicating with
remote devices such as a terminal,
a machine readable device, or
another computer
Control Status Data bits
signals from signals to to and from
I/O module I/O module I/O module
Control Buffer
Logic
Transducer
Data (device-unique)
to and from
environment
Processor communication
• Involves command decoding, data, status reporting, address recognition
Device communication
• Involves commands, status information, and data
Data buffering
• Performs the needed buffering operation to balance device and memory speeds
Error detection
• Detects and reports transmission errors
Interface to Interface to
System Bus External Device
Data
Data Registers External
Device
Data Status
Interface
Lines
Logic
Status/Control Registers Control
Address
Lines Data
External
I/O Device
Logic Status
Interface
Control Logic
Lines Control
1) Control
- used to activate a peripheral and tell it what to do
2) Test
- used to test various status conditions associated with an I/O
module and its peripherals
3) Read
- causes the I/O module to obtain an item of data from the
peripheral and place it in an internal buffer
4) Write
- causes the I/O module to take an item of data from the data bus
and subsequently transmit that data item to the peripheral
Issue Read Issue Read CPU I/O Issue Read CPU DMA
command to CPU I/O command to Do something block command Do something
I/O module I/O module else to I/O module else
No No
Done? Done?
Yes Yes
Next instruction Next instruction
(a) Programmed I/O (b) Interrupt-driven I/O
Figure 7.4 Three Techniques for Input of a Block of Data
I/O Instructions
With programmed I/O there is a close correspondence between the I/O-related
instructions that the processor fetches from memory and the I/O commands that
the processor issues to an I/O module to execute the instructions
Thus each I/O module There is a single address space for A single read line and a single write
must interpret the memory locations and I/O devices line are needed on the bus
address lines to
determine if the
command is for itself
+
I/O Mapping Summary
Isolated I/O
Separate address spaces
Need I/O or memory select lines
Special commands for I/O
Limited set
7 6 5 4 3 2 1 0
516 Keyboard input data register
7 6 5 4 3 2 1 0
Keyboard input status
517
and control register
1 = ready Set to 1 to
0 = busy start read
Device controller or
other system hardware
issues an interrupt
Save remainder of
process state
information
Processor finishes
execution of current
instruction
Process interrupt
Processor signals
acknowledgment
of interrupt
Restore process state
information
Processor pushes PSW
and PC onto control
stack
Restore old PSW
and PC
Processor loads new
PC value based on
interrupt
Y Start Y Start
Interrupt General Interrupt General
Service Registers Service Registers
Y + L Return Routine T Y + L Return Routine T–M
Stack Stack
Pointer Pointer
Processor Processor
T–M T
N User's N User's
N+1 N+1
Program Program
Main Main
Memory Memory
Software poll
When processor detects an interrupt it branches to an interrupt-service routine whose job is to poll
each I/O module to determine which module caused the interrupt
Time consuming
Slave Master
82C59A 82C59A
interrupt interrupt 80386
controller controller processor
External device 08 IR0 IR0
External device 09 IR1 INT IR1 INT INTR
IR2 IR2
IR3 IR3
IR4 IR4
IR5 IR5
IR6 IR6
External device 15 IR7 IR7
Slave
82C59A
interrupt
controller
External device 56 IR0
External device 57 IR1 INT
IR2
IR3
IR4
IR5
IR6
External device 63 IR7
C4 Data ready
C5 Acknowledge
82C55A
B0 S0
B1 S1
B2 S2
B3 S3
OUTPUT DISPLAY
B4 S4
PORT
B5 S5
B6 Backspace
B7 Clear
C1 Data ready
C2 Acknowledge
C6 Blanking
C0 C7 Clear line
Interrupt
request