Computer Organization-Chapter 9
Computer Organization-Chapter 9
Chapter 9
Input and Output Organization
9.1 Peripheral Devices
Those devices which are connected to computer are called peripheral devices. E.g. keyboard, mouse, printer,
magnetic tape, magnetic disk etc.
Input output operations are accomplished through peripheral device that provides a means of exchanging
data between the external environment and the computer.
Page 1
Chapter 9 – Input and Output Organization
To communicate with a particular device, the processor places a device address on the address lines. When
the interface detects its own address, then it activates the path between the bus lines and the device that it
controls. All the peripherals whose addresses don’t correspond to the address in the address bus are disabled
by their interface.
At the same time, the address is made available in the address line; the processor provides a function code in
the control line which is also called I/O command. The interface selected responds to the function code and
proceeds to execute it.
There are four types of I/O command:
i) Control command
The control command is issued to activate and inform the peripheral devices what they have to do.
ii) Status command
The processor issues status command to test the status condition of interface and peripherals.
iii) Output data command
It is issued to transfer data from system bus to one of storage register in I/O module.
iv) Input data command
It is issued to transfer data from peripheral to one of its register in I/O module.
Isolated I/O
The I/O in which one common bus is used for memory and I/O but there are separate read and write controls
for I/O and memory transfer is called isolated I/O.
This configuration isolates all I/O interface address from the address assigned to memory. Therefore, this
method is called isolated I/O.
The I/O read and I/O write control lines are enabled during an I/O transfer. The memory read and memory
write control lines are enabled during a memory transfer.
When the CPU doing I/O read and write operation, the address associated with information (instruction or
data) is placed in common address lines. At the same time, the I/O read and I/O write line is enabled. This
informs the interface that the address in the address bus is for I/O, not for memory.
When the CPU doing memory read and write operation, the address associated with information (instruction
or data) is placed in common address lines. At the same time, the memory read and memory write line is
enabled. This informs the interface that the address in the address bus is for memory, not for I/O.
Advantage
Same address can be used for either memory and I/O transfer, only control line identifies whether the
transfer is I/O or memory.
Disadvantage
Needed separate input-output read/write and memory read/write instructions for I/O and memory
transfer.
Page 2
Chapter 9 – Input and Output Organization
The addresses used by interface register cannot be used for memory space. So, if CPU places the register
addresses and data on common bus, the memory system ignores the operation. So, I/O operation is
performed.
Advantage
Same instructions are used for memory and I/O.
No need of separate control lines for I/O and memory operation.
Disadvantage
No full memory address can be used.
Strobe Control
Handshaking
Page 3
Chapter 9 – Input and Output Organization
Page 4
Chapter 9 – Input and Output Organization
In this method, CPU uses an interrupt and commands to inform the interface to issue an interrupt signal
when the data are available from the device and CPU does other work.
When I/O module determines that the device is ready for data transfer, it interrupts the CPU. When CPU
detects the external interrupt signal, it immediately stops the task it is processing, and jumps to a service
routine to process the I/O transfer and then returns to the task it was originally performing.
Example of Interrupt initiated I/O:
1. Vectored interrupt
2. Non-vectored interrupt
Vectored interrupt:
- In vectored interrupt, the source, that interrupts, supplies the branch information to the computer. This
information is called the interrupt vector.
Non-vectored interrupt:
- In a non vectored interrupt, the branch address is assigned to a fixed location in memory.
9.5 Interrupt
When a Process is executed by the CPU and when a user Request for another Process, then this will create
disturbance for the Running Process. This is also called as the Interrupt.
Interrupts can be generated by User, Some Error Conditions and also by Software’s and the hardware’s. But
CPU will handle all the Interrupts very carefully because when Interrupts are generated, then the CPU must
Page 5
Chapter 9 – Input and Output Organization
handle all the Interrupts very carefully means the CPU will also provide Response to the various Interrupts
those are generated so that when an interrupt has occurred, then the CPU will handle by using the Fetch,
Decode and Execute Operations.
Types of Interrupts
Generally there are three types o Interrupts those are occurred. For Example
a) Internal Interrupt
b) Software Interrupt.
c) External Interrupt.
The Internal Interrupts are those which are occurred due to some problem in the execution. For example, when a
user performing any operation which contains any type of error so that internal interrupts are those which are
occurred by some operations or by some instructions and the operations those are not possible but a user is
trying for that operation.
The software interrupts are those which are made some call to the system. For example, while we are processing
some instructions and when we want to execute one more application programs.
The External Interrupt occurs when any input and output devices request for any operation and the CPU will
execute those instructions first. For example, when a program is executed and when we move the mouse on the
screen, then the CPU will handle this external interrupt first and after that he will resume with his operation.
Priority Interrupt
A priority interrupt is a system that determines which condition is to be serviced first when two or more
requests arrive simultaneously. Highest priority interrupts are serviced first. Devices with high speed transfers
are given high priority and slow devices such as keyboards receive low priority. When two devices interrupt
the computer at the same time the computer services the device, with the higher priority first. Establishing the
priority of simultaneous interrupts can be done by software or hardware.
The hardware priority function can be established by either a serial or a parallel connection of interrupt lines.
Daisy-Chaining Priority
The serial connection is called daisy chaining method. In daisy chaining method, all the devices are connected
in serial. The device with the highest priority is placed in the first position, followed by lower priority devices.
Page 6
Chapter 9 – Input and Output Organization
used to control the status of each interrupt request. The mask register has the same number of bits as the
interrupt register. Each interrupt bit and its corresponding mask bit are applied to an AND gate.
Priority Encoder
The priority encoder is a circuit that implements the priority function. The logic of the priority encoder is such
that if two or more inputs arrive at the same time, the input having the highest priority will take precedence. The
truth table of a four-input priority encoder is given below.
The X's in the table designate don't care conditions. Input I0 has the highest priority. When I0 input is 1, the
output generates an output xy=00. I1 has the next priority level. The output is 01 if I 1=1 and I0=0. The output for
I2 is generated only if higher priority inputs are 0 and so on. The interrupt status IST is set only when one or
more inputs are equal to 1. If all inputs are 0, IST is cleared to 0 and the other outputs of the encoder are not
used, so they are marked with don't care conditions.
Page 7
Chapter 9 – Input and Output Organization
tied up managing I/O transfer. Removing CPU from the path and letting the peripheral device manage the
memory buses directly would improve the speed of transfer.
Fig: DMA
Extensively used method to capture buses is through special control signals:
Bus Request (BR): used by DMA controller to request the CPU for buses. When this input is active, CPU
terminates the execution of the current instruction and places the address bus; data bus and read & write
lines into high impedance state.
Bus Grant (BG): CPU activates BG output to inform DMA that buses are available (in high impedance
state). DMA now take control over buses to conduct memory transfers without processor intervention. When
DMA terminates the transfer, it disables the BR line and CPU disables BG and returns to normal operation.
When DMA takes control of bus system, the transfer with memory can be made in the following ways:
a) Burst transfer mode
Entire block of data is transferred to one contiguous sequence.
Useful for loading programs or data file into memory, but it makes CPU inactive for long periods of
time.
b) Cycle stealing mode
DMA controller transfers one byte of data then returns control of system buses to CPU.
CPU performs an instruction, and then DMA controller transfers a data value by stealing one machine
cycle of CPU.
Page 8
Chapter 9 – Input and Output Organization
Page 9