CH08 COA11e
CH08 COA11e
Chapter 8
Input/Output
System
Data Lines Bus
Control Lines
I/O Module
Links to
peripheral
devices
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
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
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
No No
Done? Done?
Yes Yes
Next instruction Next instruction
(a) Programmed I/O (b) Interrupt-driven I/O
Figure 8.4 Three Techniques for ©
Copyright Input
2022of Pearson
a Block of Data
Education, Ltd. All Rights Reserved
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
• 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
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
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
D7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5 D4 D3 D2 D1 D0
D3 D2 D1
Port C (lower)
0 0 0 bit 0 of Port C
1 = Input
0 0 1 bit 1 of Port C
0 = Output
0 1 0 bit 2 of Port C
Port B
0 1 1 bit 3 of Port C
1= Input
1 0 0 bit 4 of Port C
0 = Output
1 0 1 bit 5 of Port C
Mode selection
1 1 0 bit 6 of Port C
0 = Mode 0
1 1 1 bit 7 of Port C
1 = Mode 1
Port C (upper)
1 = Input Bit set/reset Bit set/reset
0 = Output flag 1 = set
Port A 0 = Active 0 = reset
1= Input
0 = Output
Mode selection
Mode set 00 = Mode 0
flag 01 = Mode 1
1 = Active 1X = Mode 2
(a) Mode definition of the 8255 control (b) Bit definitions of the 8255 control
register to configure the 8255 register to modify single bits of port C
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
Data
count
Address
Address lines register
Request to DMA
Acknowledge from DMA
Control
Interrupt
logic
Read
Write
DMA Interrupt
Breakpoints Breakpoint
Copyright © 2022 Pearson Education, Ltd. All Rights Reserved
Figure 8.14
Alternative DMA Configurations
Processor DMA I/O I/O Memory
I/O
I/O I/O
System bus
I/O bus
Data bus
DREQ
HRQ
8237 DMA Main Disk
chip memory controller
HLDA DACK
Address bus
E/D = enable/disable
TC = terminal count
Copyright © 2022 Pearson Education, Ltd. All Rights Reserved
Direct Cache Access (DCA)
The lowest, or link, level protocol is typically Ethernet, so that each arriving and departing block of
data consists of an Ethernet packet containing as payload the higher-level protocol packet
The higher-level protocols are usually the Internet Protocol (IP), operating on top of Ethernet and
the Transmission Control Protocol (TCP), operating on top of IP
The Ethernet payload consists of a block of data with a TCP header and an IP header
For outgoing data, Ethernet packets are formed in a peripheral component, such as in I/O controller
or network interface controller (NIC)
For incoming traffic, the I/O controller strips off the Ethernet information and delivers the TCP/IP packet to
the host CPU
Incoming Outgoing
• Packet arrives
• Packet transfer requested
• DMA
• Packet created
• NIC interrupts host
• Output operation invoked
• Retrieve descriptors and
headers • DMA transfer
• Cache miss occurs • NIC signals completion
• Header is processed • Driver frees buffer
• Payload transferred
Much more substantial gains can be realized by avoiding the system buffer in
main memory altogether
(a) Selector
Data and
address channel
to main memory
Multi-
plexor
channel
Control signal
path to CPU I/O
Controller
I/O
Controller
I/O
Controller
I/O
Controller
(b) Multiplexor
up to 64k
channels per
subchannel set
Copyright © 2022 Pearson Education, Ltd. All Rights Reserved
Figure 8.20
IBM z13 I/O System Structure