DDCO Module 4 Notes Final
DDCO Module 4 Notes Final
Module -4
Chapter 4
Input-Output Organization
Presented By
Dr. Maya B S
Assistant Professor
Department of CS&E
Bangalore Institute of Technology
Bangalore
❖Accessing I/O Devices
❖Interrupts – Interrupt Hardware
❖ Enabling and Disabling Interrupts
❖ Handling Multiple Devices
❖Direct Memory Access: Bus Arbitration
❖ Speed, size and Cost of memory systems
❖ Cache Memories – Mapping Functions
Text book 2: 4.1, 4.2.1, 4.2.2, 4.2.3, 4.4, 5.4, 5.5.1
❖An I/O device is connected to the interconnection network by using a circuit, called the device
interface, which provides the means for data transfer and for the exchange of status and control
information needed to facilitate the data transfers and govern the operation of the device.
❖The interface includes some registers that can be accessed by the processor.
❖One register may serve as a buffer for data transfers, another may hold information about the
current status of the device, and yet another may store the information that controls the operational
behavior of the device.
❖These data, status, and control registers are accessed by program instructions as if they were
memory locations.
❖Typical transfers of information are between I/O registers and the registers in the processor.
❖Figure 3.2 illustrates how the keyboard and display devices are connected to the processor from the
software point of view.
2. Instead of waiting for the line to be printed, the PRINT routine may be temporarily suspended and
execution of COMPUTE routine continued.
3. Whenever the printer becomes ready, it alerts the processor by sending an interrupt request signal.
4. The processor interrupts the execution of the COMPUTE routine and transfers control to the
PRINT routine.
5. The PRINT routine sends the second line to the printer and is again suspended.
7. This process continues until all n lines are printed and the PRINT routine ends.
❖The task of storing and restoring information can be done automatically by the processor. But this
increases the total execution time.
❖Saving registers also increases the delay between the time an interrupt request is received and the start
of execution of the interrupt service routine. This delay is called interrupt latency.
❖This latency should be kept minimum. So the processor saves only the contents of program counter and
processor status register.
• The figure below shows that a single interrupt line can serve n devices.
• To request an interrupt, the device closes its associated switch.
• If all interrupt request signals are inactive (all switches are open), the voltage on the interrupt request
line will be equal to Vdd. This is inactive state of the line.
• When a device requests an interrupt (switch is closed), the voltage on the line drops to 0 causing the
interrupt request signal INTR received by the processor togo to 1.
• The value of INTR is the logical OR of the requests from individual devices.
• INTR = INTR1 + ........................... + INTRn
• In the electronic implementation of the circuit in fig. 4.6, special gates known as open collector (for
bipolar circuits) or open drain (for MOS circuits) are used to drive the INTR line.
• The resistor R is called a pull up resistor because it pulls the line voltage up to the high voltage state
when the switches are open.
• There is a possibility that many devices may interrupt at the same time. Some of the methods of
overcoming this situation is
✓ One method of overcoming this situation is polling scheme.
✓ Normally when a device raises an interrupt request, the IRQ bit in its status register is set to 1.
✓ In polling scheme, the ISR polls all the I/O devices connected to the bus.
✓ The first device encountered with its IRQ bit set is the device that should be served.
✓ Its main disadvantage is the time spent interrogating the IRQ bits of all the devices that may not be
requesting any service.
❖The device requesting an interrupt can identify itself by sending a special code to the processor over
the bus.
❖The code supplied by the device may represent the starting address of the ISR for that device. The code
length is in the range of 4-8 bits.
❖This arrangement implies that the ISR for the given device must always start at the same location.
However, the location pointed to by the interrupting device can be used to store the starting address of
ISR.
❖The processor reads this address called interrupt vector and loads it into the PC. Sometimes the
processor may not be ready to receive the interrupt vector code immediately.
❖So the interrupting device must wait to put the data on the bus only when the processor is ready to
receive it.
❖When the processor is ready to receive the interrupt vector code, it activates the interrupt acknowledge
line INTA.
❖The I/O device responds by sending its interrupt vector code and turning OFF the INTR signal.
Direct Memory Access (DMA) is an approach in which large blocks of data retransferred at high speed
directly between an external device and the main memory without continuous intervention by the processor.
• DMA Controller - It is a control circuit that is a part of I/O device to perform DMA transfer.
• For each word transferred, it provides memory address and all the bus signals that control data transfer.
• DMA controller must even increment the memory address for successive words and keep track of the
number of transfers.
• Although DMA controller can transfer data without intervention by the processor, its operation must be
under the control of a program executed by the processor.
• The processor sends the starting address, the number of words in the block and the direction of the transfer.
• On receiving this information the DMA controller performs the requested operation.
• When the entire block has been transferred, the controller informs the processor by raising an interrupt
signal.
• After the DMA transfer is completed, the processor can return to the program that requested the transfer.
The OS is responsible for suspending that requested the transfer in Blocked State, initiating DMA operation
and starting another program.
❖The device that is allowed to initiate data transfers on the bus at any given time is
called the bus master.
❖When the current master relinquishes control of the bus, another device can acquire
this status.
❖Bus arbitration is the process by which the next device to become the bus master is
selected and bus mastership is transferred to it.
❖The selection of the bus master must take into account the needs of various devices by
establishing a priority system for gaining access to the bus.
❖There are two approaches to bus arbitration: Centralized and Distributed.
❖In centralized arbitration, a single bus arbiter performs the required arbitration.
❖In distributed arbitration, all devices participate in the selection of the next bus master.
❖When a Read request is received from the processor, the contents of a block of memory words
containing the location specified are transferred into the cache one word at a time.
❖ Subsequently, when the program references any of the locations in this block, the desired contents are
read directly from the cache.
❖Usually, the cache memory can store a reasonable number of blocks at any given time, but this number
is small compared to the total number of block in the main memory.
❖The simplest way to determine cache locations in which to store memory blocks is
the direct mapping technique.
❖In this technique, block j of the main memory maps onto block j modulo 128 of
the cache, as depicted in Figure 3.15.
❖Thus, whenever one of the main memory blocks 0, 128, 256, is loaded in the
cache, it is stored in cache block 0.
❖Block 1,129, 257, are stored in cache block 1, and so on. Since more that one
memory block is mapped onto a given cache block position, even when cache is
not full.
❖For example, instructions of program may start in block-1 and continue in block
129, possibly after a branch.