Module 3 IO Organization
Module 3 IO Organization
INPUT/OUTPUT
ORGANIZATION
Accessing I/O
Devices
Accessing I/O devices
Processor Memory
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.
•Processor requests for either Read / Write
•The data will be placed on Data lines
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.
eg. Move DATAIN, R0 and Move R0, DATAOUT
Accessing I/O devices (contd..)
I/O devices and the memory may have different address spaces:
Special instructions ( eg. IN and OUT) to transfer data to and from I/O
devices.
I/O devices to use the special address space OR a part of the memory
address space
I/O devices may have to deal with fewer address lines.
I/O address lines need not be physically separate from memory address
lines.
In fact, address lines may be shared between I/O devices and memory,
with a control signal to indicate whether it is a memory address or an I/O
address.
•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 the 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.
Two other mechanisms used for synchronizing data transfers
between the processor and memory:
Interrupts.
Direct Memory Access.
Registers used in the data transfer operation: Program
controlled I/O
An example
Carriage return: is one of the control characters in
ASCII code, used to reset device’s to the beginning
of the line of text.
Its ASCII value is 0x0D(13 in decimal).
Interrupt
occurs i
here
i +1
37
I/O device interface generates interrupt request
whenever it is ready for I/O transfer. EX: whenever
SIN flag is equal to 1.
It is important to ensure that interrupt request are
generated only by those I/O devices that are
currently being used by given problem.
We need some mechanism in the interface circuit
of individual devices to control whether a device is
allowed to generate an interrupt request.
The control needed is provided in the form of
interrupt-enable bit in the device’s interface circuit.
These are KEN,DEN flags in the register CONTROL.
Whenever these flags are set to 1 then interface circuit
generates interrupt request.
At the same time KIRQ and DIRQ are set to 1.
If interrupt enable bit is 0 ,interface circuit will not generate
interrupt request.
There are two independent mechanism for controlling
interrupt requests.
1) At the device end, an interrupt-enable bit in a control
register determines whether the device is allowed to generate
interrupt request.
2) At the processor end, an interrupt-enable bit in PS register
determines whether interrupt request is accepted or not.
Consider a processor that uses vectored
scheme,where the starting address of interrupt-
service routine is stored at memory location
INTVEC.