Professional Documents
Culture Documents
UNIT-V: Input/Output Organization: Accredited by Naac & Nba (Cse, It, Ece, Eee&Me)
UNIT-V: Input/Output Organization: Accredited by Naac & Nba (Cse, It, Ece, Eee&Me)
(AUTONOMOUS)
ACCREDITED BY NAAC & NBA (CSE, IT, ECE, EEE&ME)
APPROVED BY AICTE, NEW DELHI AND AFFILIATED TO JNTUK, KAKINADA
L.B.REDDY NAGAR, MYLAVARAM-521230, KRISHNA DIST., ANDHRA PRADESH, INDIA
Address Lines
System
Data Lines Bus
Control Lines
I/O Module
2 Links to
peripheral
devices
Machine readable
◼ Attach to the computer by a
Suitable for communicating
link to an I/O module with equipment
◼ The link is used to exchange Magnetic disk and tape
control, status, and data systems, sensors and actuators
3 between the I/O module and
the external device Communication
Suitable for communicating
◼ Peripheral device with remote devices such as a
terminal, a machine-readable
◼ An external device device, or another computer
connected to an I/O module
Department of ECE 04-02-2021
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING
(AUTONOMOUS)
ACCREDITED BY NAAC & NBA (CSE, IT, ECE, EEE&ME)
APPROVED BY AICTE, NEW DELHI AND AFFILIATED TO JNTUK, KAKINADA
L.B.REDDY NAGAR, MYLAVARAM-521230, KRISHNA DIST., ANDHRA PRADESH, INDIA
Control Buffer
Logic
Transducer
4
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
6 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
7 Logic Interface
Status
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
9 - 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
Department of ECE 04-02-2021
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING
(AUTONOMOUS)
ACCREDITED BY NAAC & NBA (CSE, IT, ECE, EEE&ME)
APPROVED BY AICTE, NEW DELHI AND AFFILIATED TO JNTUK, KAKINADA
L.B.REDDY NAGAR, MYLAVARAM-521230, KRISHNA DIST., ANDHRA PRADESH, INDIA
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
10
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
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
Each I/O device connected through I/O modules is given a
I/O unique identifier or address
Instructions
11
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
12
◼ 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 r egister
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
13 ADDRESS
200
INSTRUCTION
Load I/O
OPERAND
5
COMMENT
Initiate keyboard read
201 Test I/O 5 Check for completion
Branch Not Ready 201 Loop until complete
In 5 Load data byte
Interrupt-
An alternative is for the processor to issue an I/O
Driven I/O command to a module and then go on to do some
other useful work
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
15 Restore old PSW
and PC
Processor loads new
PC value based on
interrupt
T–M T–M
Y N+1
Control Control
Stack Stack
T T
N+1 Y+L
Program Program
Counter Counter
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
16
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
◼ When the processor detects the interrupt it responds on the interrupt acknowledge line
◼ Then the requesting module places its vector on the data lines
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
19 Slave
82C59A
interrupt
controller
External device 56 IR0
External device 57 IR1 INT
IR2
IR3
IR4
IR5
IR6
External device 63 IR7
Department of ECE
Figure 7.8 Use of the 82C59A Interrupt Controller 04-02-2021
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING
(AUTONOMOUS)
ACCREDITED BY NAAC & NBA (CSE, IT, ECE, EEE&ME)
APPROVED BY AICTE, NEW DELHI AND AFFILIATED TO JNTUK, KAKINADA
L.B.REDDY NAGAR, MYLAVARAM-521230, KRISHNA DIST., ANDHRA PRADESH, INDIA
PA3 1 40 PA4
Power +5 V PA2 2 39 PA5
supplies Group Group A
GND Port A PA1 3 38 PA6
A I/O
control (8) PA7 - PA0 PA0 4 37 PA7
RD 5 36 WR
CS 6 35 Reset
Bi-directional Group A GND 7 34 D0
data bus Data Port C I/O A1 8 33 D1
bus upper (4) PC7 - PC4 A0 9 8255A 32 D2
D7 - D0 buffer PC7 10 31 D3
8-bit Group B PC6 11 30 D4
internal Port C I/O PC5 12 29 D5
data bus Lower(4) PC3 - PC0
PC4 13 28 D6
RD PC3 14 27 D7
Read/
WR PC2 15 26 V
write Group
A1 Group B
control B PC1 16 25 PB7
A0 Port B I/O
logic control PC0 17 24 PB6
(8) PB7 - PB0
Reset PB0 18 23 PB5
20 CS
PB1
PB2
19
20
22
21
PB4
PB3
(a) Block diagram (b) Pin layout
Interrupt
request
C3 A0 R0
A1 R1
A2 R2
A3 R3
INPUT A4 R4 KEYBOARD
PORT A5 R5
A6 Shift
A7 Control
C4 Data ready
C5 Acknowledge
82C55A
B0 S0
B1 S1
B2 S2
B3 S3
OUTPUT DISPLAY
B4 S4
PORT
B5 S5
21 B6
B7
Backspace
Clear
C1 Data ready
C2 Acknowledge
C6 Blanking
C0 C7 Clear line
Interrupt
request
1) The I/O transfer rate is limited by the speed with which the processor
can test and service a device
Data
count
Address
Address lines register
Request to DMA
Acknowledge from DMA
Control
Interrupt
logic
Read
23 Write
Time
Instruction Cycle
24 DMA Interrupt
Breakpoints Breakpoint
I/O
I/O I/O
System bus
25 I/O bus
Data bus
DREQ
HRQ
8237 DMA Main Disk
chip memory controller
HLDA DACK
Address bus
26
Control bus (IOR, IOW, MEMR, MEMW)
Intel
memory E/D reached TC
Select channal bit
Channel select
Channel 0 mask bit Clear/set
Channel 1 has
8237A
D1 address hold channel 1 mask
reached TC
E/D bit
Clear/set
Registers
Channel 2 has Clear/set mask
D2 Controller E/D channel 2 mask
reached TC bit
Verify/write/ bit
read transfer Clear/set
Normal/compre Channel 3 has
D3 channel 3 mask
ssed timing reached TC
bit
Auto-
Fixed/rotating Channel 0
D4 initialization
priority request
E/D
Address
28 D5
Late/extended
write selection
Channel 0
request
increment/
decrement
Not used
Not used
select
(a) Selector
Data and
address channel
to main memory
Multi-
plexor
channel
Control signal
path to CPU I/O
Controller
I/O
Controller
30 I/O
Controller
I/O
Controller
(b) Multiplexor
Processor
Main
memory
Bridge circuit translates
signals and protocols from
processor bus to PCI bus.
Processor bus
Bridge
PCI bus
Expansion bus on
the motherboard
Additional SCSI Ethernet USB ISA
memory controller Interface controller
SCSI b us
IDE
34 V ideo
disk
Disk CD-R OM
controller controller
CD-
Disk 1 Disk 2 R OM K eyboard Game
PCI Bus
Peripheral Component Interconnect
Introduced in 1992
Low-cost bus
Processor independent
Plug-and-play capability
In today’s computers, most memory transfers involve a burst of data rather than just one
word. The PCI is designed primarily to support this mode of operation.
The bus supports three independent address spaces: memory, I/O, and configuration.
we assumed that the master maintains the address information on the bus until data transfer
35
is completed. But, the address is needed only long enough for the slave to be selected. Thus,
the address is needed on the bus for one clock cycle only, freeing the address lines to be used
for sending data in subsequent clock cycles. The result is a significant cost reduction.
A master is called an initiator in PCI terminology. The addressed device that responds to read
and write commands is called a target.
Department of ECE 04-02-2021
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING
(AUTONOMOUS)
ACCREDITED BY NAAC & NBA (CSE, IT, ECE, EEE&ME)
APPROVED BY AICTE, NEW DELHI AND AFFILIATED TO JNTUK, KAKINADA
L.B.REDDY NAGAR, MYLAVARAM-521230, KRISHNA DIST., ANDHRA PRADESH, INDIA
36
37
Devices connected to the SCSI bus are not part of the address space of the processor
The SCSI bus is connected to the processor bus through a SCSI controller. This controller uses
DMA to transfer data packets from the main memory to the device, or vice versa.
A packet may contain a block of data, commands from the processor to the device, or status
information about the device.
A controller connected to a SCSI bus is one of two types – an initiator or a target.
An initiator has the ability to select a particular target and to send commands specifying the
operations to be performed. The disk controller operates as a target. It carries out the commands it
receives from the initiator.
The initiator establishes a logical connection with the intended target.
40 Once this connection has been established, it can be suspended and restored as needed to transfer
commands and bursts of data.
While a particular connection is suspended, other device can use the bus to transfer information.
This ability to overlap data transfer requests is one of the key features of the SCSI bus that leads to
its high performance.
Department of ECE 04-02-2021
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING
(AUTONOMOUS)
ACCREDITED BY NAAC & NBA (CSE, IT, ECE, EEE&ME)
APPROVED BY AICTE, NEW DELHI AND AFFILIATED TO JNTUK, KAKINADA
L.B.REDDY NAGAR, MYLAVARAM-521230, KRISHNA DIST., ANDHRA PRADESH, INDIA
Data transfers on the SCSI bus are always controlled by the target controller.
To send a command to a target, an initiator requests control of the bus and,
after winning arbitration, selects the controller it wants to communicate with
and hands control of the bus over to it.
Then the controller starts a data transfer operation to receive a command
from the initiator.
41
Assume that processor needs to read block of data from a disk drive and that data are stored in disk sectors
that are not contiguous.
The processor sends a command to the SCSI controller, which causes the following sequence of events to take
place:
1. The SCSI controller, acting as an initiator, contends for control of the bus.
2. When the initiator wins the arbitration process, it selects the target controller and hands over control
of the bus to it.
3. The target starts an output operation (from initiator to target); in response to this, the initiator sends a
command specifying the required read operation.
4. The target, realizing that it first needs to perform a disk seek operation, sends a message to the
initiator indicating that it will temporarily suspend the connection between them. Then it releases the
42 bus.
5. The target controller sends a command to the disk drive to move the read head to the first sector
involved in the requested read operation. Then, it reads the data stored in that sector and stores them
in a data buffer. When it is ready to begin transferring data to the initiator, the target requests control
of the bus. After it wins arbitration, it reselects the initiator controller, thus restoring the suspended
connection.
6. The target transfers the contents of the data buffer to the initiator and then
suspends the connection again
7. The target controller sends a command to the disk drive to perform another seek
operation. Then, it transfers the contents of the second disk sector to the initiator
as before. At the end of this transfers, the logical connection between the two
controllers is terminated.
8. As the initiator controller receives the data, it stores them into the main memory
using the DMA approach.
9. The SCSI controller sends as interrupt to the processor to inform it that the
43 requested operation has been completed
– C/D
44 Information Control/Data: Asserted during transfer of
type con trol information (command, status or
message)
DB 5
DB 6
BS Y
47
SEL
Root
hub
Hub Hub
I/O I/O
device device
USB Protocols
All information transferred over the USB is organized in packets, where a packet consists of one
or more bytes of information. There are many types of packets that perform a variety of control
functions.
The information transferred on the USB can be divided into two broad categories: control and
data.
Control packets perform such tasks as addressing a device to initiate data transfer,
acknowledging that data have been received correctly, or indicating an error.
Data packets carry information that is delivered to a device.
A packet consists of one or more fields containing different kinds of information. The first field
52 of any packet is called the packet identifier, PID, which identifies the type of that packet.
They are transmitted twice. The first time they are sent with their true values, and the second
time with each bit complemented
The four PID bits identify one of 16 different packet types. Some control packets, such as ACK
(Acknowledge), consist only of the PID byte.
Department of ECE 04-02-2021
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING
(AUTONOMOUS)
ACCREDITED BY NAAC & NBA (CSE, IT, ECE, EEE&ME)
APPROVED BY AICTE, NEW DELHI AND AFFILIATED TO JNTUK, KAKINADA
L.B.REDDY NAGAR, MYLAVARAM-521230, KRISHNA DIST., ANDHRA PRADESH, INDIA
USB packet format
53
Token
Data0
ACK
Time
Token
Data0
ACK
Token
Data1
54 ACK
Token
Data1
ACK
Electrical Characteristics
The cables used for USB connections consist of four wires.
Two are used to carry power, +5V and Ground.
Thus, a hub or an I/O device may be powered directly from the bus, or it
may have its own external power connection.
The other two wires are used to carry data.
Different signaling schemes are used for different speeds of transmission.
At low speed, 1s and 0s are transmitted by sending a high voltage state (5V)
56 on one or the other o the two signal wires. For high-speed links, differential
transmission is used.