CSA UNIt 4
CSA UNIt 4
A typical communication link between the processor and several peripherals is shown in
figure.
The I/O bus consists of data lines, address lines, and control lines.
The magnetic disk, printer, and terminal are employed in practically any general purpose
computer.
Each peripheral device has associated with it an interface unit.
Each interface decodes the address and control received from the I/O bus, interprets them
for the peripheral, and provides signals for the peripheral controller.
It also synchronizes the data flow and supervises the transfer between peripheral and
processor.
Each peripheral has its own controller that operates the particular electromechanical
device.
For example, the printer controller controls the paper motion, the print timing, and the
selection of printing characters.
The I/O bus from the processor is attached to all peripheral interfaces.
To communicate with a particular device, the processor places a device address on the
address lines.
Each interface attached to the I/O bus contains an address decoder that monitors the
address lines.
When the interface detects its own address, it activates the path between the bus lines
and the device that it controls.
All peripherals whose address does not correspond to the address in the bus are disabled
by their interface selected responds to the function code and proceed to execute it.
The function code is referred to as an I/O command.
There are four types of commands that an interface may receive. They are classified as
control, status, data output, and data input.
A control command is issued to activate the peripheral and to inform it what to do.
For example, a magnetic tape unit may be instructed to backspace the tape by one record,
to rewind the tape, or to start the tape moving in the forward direction.
A status command is used to test various status conditions in the interface and the
peripheral.
For example, the computer may wish to check the status of the peripheral before a
transfer is initiated.
During the transfer, one or more errors may occur which are detected by the interface.
These errors are designated by setting bits in a status register that the processor can read
at certain intervals.
A data output command causes the interface to respond by transferring data from the bus
into one of its registers.
The computer starts the tape moving by issuing a control command.
The processor then monitors the status of the tape by means of a status command.
When the tape is in the correct position, the processor issues a data output command.
The interface responds to the address and command and transfers the information from
the data lines in the bus to its buffer register.
The interface that communicates with the tape controller and sends the data to be stored
on tape.
The data input command is the opposite of the data output.
In this case the interface receives an item of data from the peripheral and places it in its
buffer register.
The processor checks if data are available by means of a status command and then issues a
data input command.
The interface places the data on the data lines, where they are accepted by the processor.
For example, port A may be defined as an input port and port B as an output port.
A magnetic tape unit may be instructed to rewind the tape or to start the tape moving in
the forward direction.
The bits in the status register are used for status conditions and for recording errors that
may occur during the data transfer.
For example, a status bit may indicate that port A has received a new data item from the
I/O device.
Another bit in the status register may indicate that a parity error has occurred during the
transfer.
The interface registers communicate with the CPU through the bidirectional data bus.
The address bus selects the interface unit through the chip select and the two register
select inputs.
A circuit must be provided externally (usually, a decoder) to detect the address assigned to
the interface registers.
This circuit enables the chip select (CS) input when the interface is selected by the address
bus.
The two register select inputs RS1 and RS0 are usually connected to the two least
significant lines of the address bus.
These two inputs select one of the four registers in the interface as specified in the table
accompanying the diagram.
The content of the selected register is transfer into the CPU via the data bus when the I/O
read signal is enables.
The CPU transfers binary information into the selected register via the data bus when the
I/O write input is enabled.
The other control line is in the other direction from the destination to the source.
It is used by the destination unit to inform the source whether it can accept data.
The sequence of control during the transfer depends on the unit that initiates the transfer.
Figure shows the data transfer procedure initiated by the source.
The two handshaking lines the data valid, which is generated by the source unit, and data
accepted, generated by the destination unit, the timing diagram shows the exchange of
signals between the two units.
The sequence of events listed in figure shows the four possible states that the system can
be at any given time.
The source unit initiates the transfer by placing the data on the bus and enabling its data
valid signal.
The data accepted signal is activated by the destination unit after it accepts the data from
the bus.
The source unit then disables its data valid signal, which invalidates the data on the bus.
The destination unit then disables its data accepted signal and the system goes into its
initial state.
The source does not send the next data item until after the destination unit shows its
readiness to accept new data by disabling its data accepted signal.
This scheme allows arbitrary delays from one state to the next and permits each unit to
respond at its own data transfer rate.
Note that the sequence of events in both cases would be identical if we consider the ready
for data signal as the complement of data accepted.
In fact, the only difference between the source-initiated and the destination-initiated
transfer is in their choice of initial state.
The stop bits are always in the 1-state and frame the end of the character to signify the
idle or wait state.
At the end of the character the line is held at the 1-state for a period of at least one or two
bit times so that both the transmitter and receiver can resynchronize.
The length of time that the line stays in this state depends on the amount of time required
for the equipment to resynchronize.
Synchronous Serial Transmission :
In synchronous transmission, the two units share a common clock frequency and bits are
transmitted continuously at the rate dictated by the clock pulses.
In long distant serial transmission, each unit is driven by a separate clock of the same
frequency.
Synchronization signals are transmitted periodically between the two units to keep their
clocks in step with each other.
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.
Once the flag is cleared, the interface disables the data accepted line and the device can
then transfer the next data byte.
The DMA controller has three registers: an address register, a word count register, and a
control register.
The address register contains an address to specify the desired location in memory.
The word count register holds the number of words to be transferred.
This register is decremented by one after each word transfer and internally tested for zero.
The control register specifies the mode of transfer.
All registers in the DMA appear to the CPU as I/O interface registers.
Thus the CPU can read from or write into the DMA register under program control via the
data bus.
The DMA is first initialized by the CPU.
After that, the DMA starts and continues to transfer data between memory and peripheral
unit until an entire block is transferred.
The CPU initializes the DMA by sending the following information through the data bus
1. The staring address of the memory block where data are available (for read) or where
data are to be stored (for write)
2. The word count, which is the number of words in the memory block.
3. Control to specify the mode of transfer such as read or write.
4. The starting address is stored in the address register.
The CPU responds to an interrupt request by enabling the interrupt acknowledge line.
This signal passes on to the next device through the PO (priority out) output only if device
1 is not requesting an interrupt.
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 data bus for the
CPU to use during the interrupt cycle.
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 intercept the
acknowledge signal by placing a 0 in its PO output.
If the device does not have pending interrupts, it transmits the acknowledge signal to the
next device by placing a 1 in its PO output.
Thus the device with Pl = 1 and PO = 0 is the one with the highest priority 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 farther the device is from the first position; the lower is its priority.
IOP is similar to a CPU except that it is designed to handle the details of I/O processing.
Unlike the DMA controller that must be setup entirely by the CPU, the IOP can fetch and
execute its own instruction.
IOP instructions are specifically designed to facilitate I/O transfers.
In addition, IOP can perform other processing tasks, such as arithmetic, logic branching,
and code translation.
The block diagram of a computer with two processors is shown in figure 8.12.
The memory unit occupies central position and can communicate with each processor by
means of direct memory access.
The CPU is responsible for processing data needed in the solution of computational tasks.
The IOP provides a path of for transfer of data between various peripheral devices and
memory unit.
13 Dept: CE COA(3340705) Prof. Chintan N. Kanani
Unit–V Input-Output Organization
The CPU is usually assigned the task of initiating the I/O program.
From then, IOP operates independent of the CPU and continues to transfer data from
external devices and memory.
The data formats of peripheral devices differ from memory and CPU data formats. The IOP
must structure data words from many different sources. For example, it may be necessary
to take four bytes from an input device and pack them into one 32-bit word before the
transfer to memory.
Data are gathered in the IOP at the device rate and bit capacity while the CPU is executing
its own program.
After the input data are assembled into a memory word, they are transferred from IOP
directly into memory by "stealing" one memory cycle from the CPU.
Similarly, an output word transferred from memory to the IOP is directed from the IOP to
the output word transferred from memory to the IOP.
In most computer systems, the CPU is the master while the IOP is a slave processor.
The CPU is assigned the task of initiating all operations, but I/O instructions are executed in
the IOP.
CPU instructions provide operations to start an I/O transfer and also to test I/O status
conditions needed for making decisions on various I/O activities.
The IOP, in turn, typically asks for CPU attention by means of an interrupt.
Instructions that are read from memory by an IOP are sometimes called commands, to
distinguish them from instructions that are read by the CPU.
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 completed satisfactorily without errors.
The IOP takes care of all data transfers between several I/O units and the memory while
the CPU is processing another program.
The IOP and CPU are competing for the use of memory, so the number of devices that can
be in operation is limited by the access time of the memory.
Priority levels are established by the arbitration logic to select one CPU when two or more
CPUs attempt to access the same memory.
The multiplex are controlled with the binary code that is generated by a priority encoder
with in the arbitration logic.
A crossbar switch organization supports simultaneous transfers from memory modules
because there is a separate path associated with each module.
However, the hardware required to implement the switch can becomes quite large and
complex.