CH 9
CH 9
Control
Keyboard
and Printer Magnetic
display disk
terminal
Peripheral
device
Connection of I/O bus to input-output devices
I/O BUS and Interface Module
• It defines the typical link between the processor and several peripherals.
• The I/O Bus consists of data lines, address lines and control lines.
•
The I/O bus from the processor is attached to all peripherals interface.
•
To communicate with a particular device, the processor places a device
interprets them for peripherals and provides signals for the peripheral
• controller.
It is also synchronizes the data flow and supervises the transfer between
• peripheral and processor.
Each peripheral has its own controller. For example, the printer controller
• The control lines are referred as an I/O command. The
commands are as following:
Control command- A control command is issued to activate the
peripheral and to inform it what to do.
Status command- A status command is used to test various status
conditions in the interface and the peripheral.
Output data command- A data output command causes the
interface to respond by transferring data from the bus into one
of its registers.
Input data command- The data input command is the opposite of
the data output. In this case the interface receives Data from
the peripheral and places it in its buffer register.
Example of I/O Interface
Port A I/O data
register
Bidirectional Bus
data bus buffers
Port B I/O data
register
Internal bus
CPU Chip select CS
I/O
Register select Control Control Device
RS1 Timing register
Register select RS0 and
I/O read Control
RD Status Status
I/O write WR register
i. Use two Separate buses , one for memory and other for I/O.
ii. Use one common bus for both memory and I/O but separate
control lines for each.
iii. Use one common bus for memory and I/O with common control lines.
GTU Questions
Strobe Control
• The Strobe control method of asynchronous data transfer employs a
single control line to time each transfer.
• The strobe may be activated by either the source or the
destination unit.
Fig: Source-initiated strobe for data transfer Fig: Destination-initiated strobe for
data transfer
Source-initiated strobe for data transfer
• The strobe may be activated by either the source or the destination unit.
• Figure shows a source-initiated transfer.
• The data bus carries the binary information from source unit to the destination
unit.
•
The strobe is a single line that informs the destination unit when a valid data
• for a sufficient time period to allow the destination unit to receive the data.
The source removes the data from the bus a brief period after it disables its
Destination-initiated strobe for data transfer
• Figure shows a data transfer initiated by the destination unit. In this case
the destination unit activates the strobe pulse, informing the source to provide the
data.
•
The source unit responds by placing the requested binary information on the data
bus.
•
The data must be valid and remain in the bus long enough for the destination unit to
• accept it.
The falling edge of the strobe pulse can be used again to trigger a destination
• register.
The destination unit then disables the strobe. The source removes the data from the
• bus after a predetermined time interval.
The transfer of data between the CPU and an interface unit is similar to the strobe
Disadvantage of Strobe Signal
• The disadvantage of the strobe method is that, the source
unit initiates the transfer has no way of knowing whether
the destination unit has actually received the data item that
was places in the bus.
• Similarly, a destination unit that initiates the transfer has no
way of knowing whether the source unit has actually placed
the data on bus.
• The Handshaking method solves this problem.
Handshaking
• The source unit then disables its data accepted signal and the
system goes into its initial state.
Handshaking
Data Bus
Source Unit Data Valid Destination
Unit
Data accepted
• The source unit in this case does not place data on the bus until
after it receives the ready for data signal from the destination unit.
• From there on, the handshaking procedure follows the same pattern
as in the source initiated case.
Destination Unit
Source unit
Place the data on bus. Ready to accept data.
Enable ready for data.
Enable data Valid.
If any of one unit is faulty, the data transfer will not be completed.
Such an error can be detected by means of a Timeout mechanism
time.
GTU Questions
• In the programmed I/O method, the I/O device does not have direct access to
memory.
• An example of data transfer from an I/O device through an interface into the
CPU is shown in figure.
• When a byte of data is available, the device places it in the I/O bus and
enables its data valid line.
• The interface accepts the byte into its data register and enables the data
accepted line.
• The interface sets a bit in the status register that we will refer to as an F
or "flag" bit.
• The device can now disables the data valid line, but it will not transfer
another byte until the data accepted line is disables by the interface.
•
A program is written for the computer to check the flag in the
status register to determine if a byte has been placed in the data
register by the I/O device.
• This is done by reading the status register into a CPU register and
checking the value of the flag bit.
• line
Once the flag is cleared, the interface disables the data accepted
and the device can then transfer the next data byte.
Figure : Flowchart for CPU program to input data
Example of Programmed I/O:
• A flowchart of the program that must be written for the CPU is shown in figure
• It is assumed that the device is sending a sequence of bytes that must be stored
in memory.
•
The transfer of each byte requires three instructions :
•
1. Read the status register.
•
2. Check the status of the flag bit and branch to step 1 if not set or to step 3 if
set.
•
3. Read the data register.
•
Each byte is read into a CPU register and then transferred to memory with a
store instruction.
•
A common I/O programming task is to transfer a block of words from an I/O
Interrupt Initiated I/O
• In programmed initiated, CPU stays in a program loop until the I/O unit indicates that
While the CPU is running a program, it does not check the flag. However, when the flag
is set, the computer is momentarily interrupted from proceeding with the current
program and is informed of the fact that the flag has been set.
• The CPU deviates from what it is doing to take care of the input or output transfer.
• After the transfer is completed, the computer returns to the previous program to
counter into a memory stack and then control branches to a service routine that processes
acknowledge line.
•
This signal passes on to the next device through the PO (priority out) output
If device 1 has a pending interrupt, it blocks the acknowledge signal from the
• next device by placing a 0 in the PO output.
It then proceeds to insert its own interrupt vector address (VAD) into the
• A device with a 0 in its Pl input generates a 0 in its PO output to inform the
next-lower- priority device that the acknowledge signal has been blocked.
• A device that is requesting an interrupt and has a 1 in its Pl input will
that is requesting an interrupt, and this device places its VAD on the data
• bus.
The daisy chain arrangement gives the highest priority to the device that
• receives the interrupt acknowledge signal from the CPU.
The further the device is from the first position; the lower is its priority.
Direct Memory Access (DMA)
• In the Direct Memory Access (DMA) the interface transfer the data
into and out of the memory unit through the memory bus.
• Removing the CPU from the path and letting the peripheral device
manage the memory buses directly would improve the speed of
transfer.
the CPU.
•
When this input is active, the CPU terminates the execution of the
current instruction and places the address bus, data bus and read write
• lines into a high Impedance state.
High Impedance state means that the output is disconnected.
Direct Memory Access (DMA)
is enable Read
RD
Bus Grant
BG
Write
WR
• The CPU disables the Bus Grant (BG), takes control of the
buses and return to its normal operation.
Direct Memory Access (DMA)
• The transfer can be made in several ways that are:
i. Address Register
• The DMA has its own address, which activates the DS and RS lines. The CPU
initializes the DMA through the data bus.
• Once the DMA receives the start control command, it can transfer between the
peripheral and the memory.
• When BG = 0 the RD and WR are input lines allowing the CPU to
communicate with the internal DMA registers.
• When BG=1, the RD and WR are output lines from the DMA controller to
the random access memory to specify the read or write operation of data.
GTU Questions
computational tasks.
•
The IOP provides a path for transfer of data between various peripheral
devices and memory unit.
Feature and Function of IOP
• IOP can fetch and execute its own instructions.
• In addition to data transfer, IOP can perform other processing tasks, such as
• IOP can transfer data from an 8-bit source to 16 bit destination and vice versa.
• Communications between IOP and CPU is through memory based control blocks.
CPU defines tasks in the control blocks to locate a program sequence called a channel
program.
overload condition, device busy with another transfer, or device ready for I/O transfer.
•
The CPU refers to the status word in memory to decide what do next.
•
If all is in order, the CPU sends the instruction to start I/O transfer.
•
The memory address received with this instruction tells the IOP where to find
its program.
•
The CPU can now continue with another program while the IOP is busy with the I/O
program.
• Both programs refer to memory by means of DMA transfer.
• When the IOP terminates the execution of its program, it sends an interrupt request to the CPU.
• The CPU responds to the interrupt by issuing an instruction to read the status from the IOP.
• The IOP responds by placing the contents of its status report into a specified memory location.
• The status word indicates whether the transfer has been completed or if any errors occurred during
the transfer.
• From inspection of the bits in the status word, the CPU determines if the I/O operation was
• The IOP takes care of all data transfers between several I/O units and the memory while the CPU is
• The IOP and CPU are competing for the use of memory, so the number of devices that can be in
• simultaneously.
Example: transmission through telephone lines.
Brief Summary
• Interface is the point where a connection is made between two different parts
of a system.
• The strobe control method of Asynchronous data transfer employs a single
control line to time each transfer.
• The handshaking method solves the problem of strobe method by introducing
a second control signal that provides a reply to the unit that initiates the
transfer.
Brief Summary
• Programmed I/O mode of data transfer the operations are the results in
I/O instructions which is a part of computer program.
• In the Interrupt Initiated I/O method an interrupt facility an interrupt
command is used to inform the device about the start and end of transfer.
• In the Direct Memory Access (DMA) the interface transfer the data into
and out of the memory unit through the memory bus.
GTU Questions