Qbank Unit5 Updated1
Qbank Unit5 Updated1
In isolated I/O –one common bus is used to transfer information between memory or I/O and
the CPU.The distinction between memory transfer and I/O is made through separate read and
write lines. The CPU specifies whether the instruction is for memory word or for an I/O
interface.Seperate memory and input/Output addresses are used here. Separate instruction
sets are used for input output operations.
In memory-mapped I/O, both memory and I/O devices use the same address space. We assign
some of the memory addresses to I/O devices. The CPU treats I/O devices like computer
memory. The CPU either communicates with computer memory or some I/O devices depending
on the address. In the case of memory-mapped I/O, all the buses are the same for both
memory and I/O devices. Therefore, building a CPU that uses memory-mapped I/O is easier and
cheaper. Additionally, such CPUs consume less power due to reduced complexity. One
advantage of memory-mapped I/O is that we don’t need separate instruction sets for accessing
I/O devices. Instructions used for accessing memory can be easily used for accessing I/O devices.
But the availability of address space will be less in this case as compared to isolated I/O
Unit of Information
6. What is I/O command and how many types of commands I/O are there.
Ans. Whenever there is I/O transfer, processor provides a function code also through control
lines to i/o interface. These codes are called as I/O commands.
There are are four types of I/O command that an interface may receive from processor and
execute it-
a. Control- this is used to activate the peripheral and inform it what to do
b. Status-it is to test the status condition in the interface and peripheral.for example, the
computer may wish to check the status before it initiates transfer
c. Data output- This causes the interface to respond by transferring the data on the data
bus into the peripheral
d. Data input- This command places the data from the peripheral onto the databus from
where it is accepted by the processor
7. Discuss the design of typical input or output interface
Ans.
Input/output Interface provides a method for transferring information between processor and
external input/output devices i.e., peripherals. Peripherals connected to computer need special
communication links for interfacing them with CPU.
An I/O consists of two data registers called ports, a control register , a status register, bus
buffers and timing and control unit. The interface communicates with the CPU through data bus.
The chip select and register select inputs determines the address assigned to the interface. The
I/O read write are two control lines that specify an input or output. The four registers
communicate directly with the I/O device attached to the interface
Handshaking.
The disadvantage of strobe method is that the source unit/ destination unit that initiates the
transfer has no way of knowing whether the other unit has actually received the data or
placed the data on bus. The handshake method solves this problem by introducing a second
control signal that provides a reply to the unit that initiates the transfer. The two handshaking
lines are data valid and data accepted.
Two way handshaking can be employed in two ways
a. Source initiated transfer using handshake
b. Destination initiated transfer using handshake
10. What is DMA . Describe how DMA is used to transfer data from peripherals
Ans. The transfer of data between the fast device such as magnetic disk and memory is often
limited by the speed of the CPU. Removing the CPU from the memory path and letting the
peripheral device manage the memory buses directly would improve the speed of transfer. This
technique is called as Direct memory access(DMA). During DMA transfer the CPU is idle and has
no control on memory buses. A DMA controller takes over the buses to manage the transfer
directly between I/O device and memory.
Fig. CPU bus signals for DMA transfer
As shown in the above fig, the bus request signal is used by the DMA controller to request the
CPU to relinquish control of the buses. 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 high impedance state(high impedance means open circuit).
The CPU activates bus grant output to inform the external DMA that the buses are in high
impedance state. When the DMA terminates the transfer, it disables the bus request line and
CPU disables bus grant and takes control of buses.
In interrupt cycle, the return address available in the PC is stored in a specific location where it
can be found later when the program returns to the instruction at which it was interrupted. In
the above figure memory location at address 0 is the place for storing return address . Control
then inserts address 1 into PC and clears IEN and R so that no more interruptions can occur until
interrupt request from flag has been serviced.
Ans. The DMA controller needs the usual circuit of an interface to communicate with the CPU
and I/O device. In addition, it needs an address register , a word count register and a set of
address lines.The address register and the address lines are used for direct communication with
the memory. The word count register specifies the number of words that must be
transferred.The data transfer may be done directly between device and memory under the
control of DMA.
The unit communicates with the CPU via data bus and control lines.The registers in the DMA are
selected by CPU through the address bus by enabling DS(DMA select) and RS(register select)
inputs. The read(RD) write(WR) inputs are bidirectional. When the BG(bus grant) input is 0, the
cpu can communicate with DMA registers through data bus to read from or write to the DMA
registers. When BG=1 , the CPU has relinquished the buses and the DMA can communicate
directly with the memory by specifying an address in the address bus and activating RD or WR
control.
The CPU initializes the DMA by sending the given information through the data bus.
The starting address of the memory block where the data is available (to read) or where data
are to be stored (to write).
It also sends word count which is the number of words in the memory block to be read or write.
Control to define the mode of transfer such as read or write.
A control to begin the DMA transfer.
14. Explain burst transfer and cycle stealing modes of DMA transfer
Ans. When DMA takes control of the bus system , it communicates directly with memory. The
transfer can be made in two ways-
a. Burst Transfer- In this a block sequence consisting of words is transferred in continuous
burst. This mode of transfer is needed for fast devices such as magnetic disk etc. where
data transmission cannot be stopped or slowed down until an entire block is transfered
b. Cycle stealing- It allows the DMA controller to transfer one data word at a time after
which it must release the control of the buses to CPU