Input and Output Organization
Input and Output Organization
Input and Output Organization
Bus
•Multiple I/O devices may be connected to the processor and the memory via a bus.
•Bus consists of three sets of lines to carry address, data and control signals.
•Each I/O device is assigned an unique address.
•To access an I/O device, the processor places the address on the address lines.
•The device recognizes the address, and responds to the control signals.
Accessing I/O devices (contd..)
I/O devices and the memory may share the same address
space:
Memory-mapped I/O.
Any machine instruction that can access memory can be used to transfer data
to or from an I/O device.
Simpler software.
4
Address lines
Bus Data lines
Control lines
Input device
•I/O device is connected to the bus using an I/O interface circuit which has:
- Address decoder, control circuit, and data and status registers.
•Address decoder decodes the address placed on the address lines thus enabling the
device to recognize its address.
•Data register holds the data being transferred to or from the processor.
•Status register holds information necessary for the operation of the I/O device.
•Data and status registers are connected to the data lines, and have unique addresses.
•I/O interface circuit coordinates I/O transfers.
Accessing I/O devices (contd..)
Recall that the rate of transfer to and from I/O
devices is slower than the speed of the processor. This
creates the need for mechanisms to synchronize data
transfers between them.
Program-controlled I/O:
Processor repeatedly monitors a status flag to achieve the necessary
synchronization.
Processor polls the I/O device.
Address and
command
Data
t0 t1 t2
Bus cycle
Master places the
device address and Addressed slave places
command on the bus, data on the data lines Master “strobes” the data
and indicates that on the data lines into its
it is a Read operation. input buffer, for a Read
operation.
•In case of a Write operation, the master places the data on the bus along with the
address and commands at time t0.
•The slave strobes the data into its input buffer at time t 2.
Synchronous bus (contd..)
Once the master places the device address and
command on the bus, it takes time for this
information to propagate to the devices:
This time depends on the physical and electrical characteristics of the bus.
Data
Address & t DM
command reach
Seen by slave
the slave. tAS
Address and Data appears
command on the bus.
Data
tDS
t0 t1 t
2
•Signals do not appear on the bus as soon as they are placed on the bus, due to the
propagation delay in the interface circuits.
•Signals reach the devices after a propagation delay which depends on the
characteristics of the bus.
•Data must remain on the bus for some time after t2 equal to the hold time of the buffer.
Synchronous bus (contd..)
Data transfer has to be completed within one clock
cycle.
Clock period t2 - t0 must be such that the longest propagation delay on
the bus and the slowest device interface must be accommodated.
Forces all the devices to operate at the speed of the slowest device.
Address
Command
Master strobes data
into the input buffer.
Data
Slave-ready
Slave places the data on the bus, Clock changes are seen by all the devices
and asserts Slave-ready signal. at the same time.
Asynchronous bus
Data transfers on the bus is controlled by a handshake
between the master and the slave.
Common clock in the synchronous bus case is replaced by
two timing control lines:
Master-ready,
Slave-ready.
Master-ready
Slave-ready
Data
t0 t1 t2 t3 t4 t5
Bus cycle
t0 - Master places the address and command information on the bus.
t1 - Master asserts the Master-ready signal. Master-ready signal is asserted at t 1 instead of t0
t2 - Addressed slave places the data on the bus and asserts the Slave-ready signal.
t3 - Slave-ready signal arrives at the master.
t4 - Master removes the address and command information.
t5 - Slave receives the transition of the Master-ready signal from 1 to 0. It removes the data
and the Slave-ready signal from the bus.
Asynchronous vs. Synchronous bus
Advantages of asynchronous bus:
Eliminates the need for synchronization between the sender and the
receiver.
Can accommodate varying delays automatically, using the Slave-ready
signal.
Disadvantages of asynchronous bus:
Data transfer rate with full handshake is limited by two-round trip delays.
Data transfers using a synchronous bus involves only one round trip delay,
Address
DATAIN Data
Encoder
R /W and Keyboard
Processor SIN
debouncing switches
Master-ready circuit
Valid
Input
Slave-ready
interface
Address
DATAIN Data
Encoder
R/W and Keyboard
Processor SIN
debouncing switches
Master-ready circuit
Valid
Input
Slave-ready
interface
Processor
CPU R /W SOUT Printer
Valid
Master-ready
Output Idle
Slave-ready interface
Processor
CPU R /W SOUT Printer
Valid
Master-ready
Output Idle
Slave-ready interface
DATAIN
D1
D0 PA0
SIN
•Combined I/O interface circuit.
CA •Address bits A2 through A31, that is
Input
status
30 bits are used to select the overall
PB7
interface.
DATAOUT •Address bits A1 through A0, that is, 2
PB0bits select one of the three registers,
SOUT
CB1
namely, DATAIN, DATAOUT, and
Handshake
control CB2the status register.
Slave-
Ready 1
•Status register contains the flags SIN and
SOUT in bits 0 and 1.
•Data lines PA0 through PA7 connect the
Master- input device to the DATAIN register.
Ready
R/ W
•DATAOUT register connects the data
A31 lines on the processor bus to lines PB0
My-address
Address
decoder through PB7 which connect to the output
A2 device.
A1
RS1 •Separate input and output data lines for
connection to an I/O device.
RS0
A0
Serial port
Serial port is used to connect the processor to I/O devices that transmit
data one bit at a time.
Data are transferred in a bit serial fashion on the device side and in a bit
parallel fashion on the processor side.
Transformation between the parallel and serial formats is achieved with shift registers that have
parallel access capability.
The interface that deals with bus is same as in the parallel interface.
Two status flags, which we will refer to as SIN and SOUT flags maintained by
Status and control block.
SIN 1 when new data are loaded into DATAIN from input shift register.
SIN0 when these data are read by the processor.
SOUT 1 when data are transferred from DATAOUT to the output shift
register.
SOUT0 when processor writes new data into DATAOUT.
Input shift register Serial
input
•Input shift register accepts input one bit
at a time from the I/O device.
DATAIN •Once all the 8 bits are received, the
contents of the input shift register are
loaded in parallel into DATAIN register.
•Output data in the DATAOUT register
are loaded into the output shift register.
D7 •Bits are shifted out of the output shift
register and sent out to the I/O device one
D0 bit at a time.
•As soon as data from the input shift reg.
My-address DATAOUT are loaded into DATAIN, it can start
RS1 accepting another 8 bits of data.
RS0 •Input shift register and DATAIN registers
Chip and Serial
R /W register Output shift re gister
are both used at input so that the input
Ready select shift register can start receiving another
Accept set of 8 bits from the input device after
loading the contents to DATAIN, before
Receiving clock
Status
the processor reads the contents of
I NTR
and DATAIN. This is called as double-
control ransmission clock
T
buffering.
Serial port (contd..)
During the serial transmission, the receiver needs to know when each
bit is placed into its input shift register.
Because there is no separate line to carry a clock signal from
transmitter to the receiver.
So the timing information must be embedded into the transmitted
data using an encoding scheme.
2 basic approaches are there.
Asynchronous transmission (receiver’s clock is not synchronized with
transmitter clock.)
Synchronous Transmission:
Contd.,
Asynchronous also know as start-stop transmission.
Data transmission is not synchronized b/t 2 devices.
The transmitter sends data irregularly, rather than in a steady stream.
Here data is sent in the form of character/ byte.
As each character is preceded by a start bit that alerts the receiving
computer of its arrival and succeeded by one (or) two stop bits that
signal the end of the character.
Synchronous transmission: data is sent in form of blocks or frames.
There is no gap between data.
Standard I/O interfaces
I/O device is connected to a computer using an interface
circuit.
Do we have to design a different interface for every
combination of an I/O device and a computer?
A practical approach is to develop standard interfaces and
protocols.
A personal computer has:
A motherboard which houses the processor chip, main memory and some I/O
interfaces.
A few connectors into which additional interfaces can be plugged.
Processor bus is defined by the signals on the processor
chip.
Devices which require high-speed connection to the processor are connected
directly to this bus.
Standard I/O interfaces (contd..)
Because of electrical reasons only a few devices can be
connected directly to the processor bus.
Motherboard usually provides another bus that can
support more devices.
Processor bus and the other bus (called as expansion bus) are
interconnected by a circuit called “bridge”.
Devices connected to the expansion bus experience a small delay in data
transfers.
Standard I/O interfaces (contd..)
A number of standards have been developed for the
expansion bus.
Three widely used bus standards:
PCI (Peripheral Component Interconnect)
SCSI (Small Computer System Interface)
37
Main
Processor
memory
Bridge circuit translates
signals and protocols from
Processor bus
processor bus to PCI bus.
Bridge
PCI bus
Expansion bus on
the motherboard
Additional SCSI Ethernet USB ISA
memory controller Interface controller Interface
SCSI bus
IDE
disk
Video
Disk CD-ROM
controller controller
CD-
Disk 1 Disk 2 ROM K eyboard Game
PCI Bus
Peripheral Component Interconnect
Introduced in 1992
Low-cost bus
Processor independent
PCI bus is connected to the processor bus via a controller called b Bridge.
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 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.
Data transfer signals on the PCI bus.
Name Function
CLK
Frame#
AD Adress #1 #2 #3 #4
IRDY#
TRD Y#
DEVSEL#