COA Mod3@AzDOCUMENTS - in
COA Mod3@AzDOCUMENTS - in
INTRODUCTION
Input/output architecture is a interface to the outside world that provide systematic means of
controlling interaction with outside world. Input device such as keyboard, scanner, digital camera, etc.
Output devices such as display, printer etc.Input/output devices cannot directly connect to the system bus
because Data transfer rate of input/output devices is slower than (memory & processor) and verse versa.
Input/output devices are used different data format and word length.
• There are 2 ways to deal with I/O-devices: 1) Memory-mapped I/O & 2) I/O-mappedI/O.
1) Memory-MappedI/O
Memory and I/O-devices share a commonaddress-space.
Any data-transfer instruction (like Move, Load) can be used to exchangeinformation.
Forexample,
Move DATAIN, R0; This instruction sends the contents of location DATAIN to register R0.
Here, DATAIN address of the input-buffer of the keyboard.
2) I/O-MappedI/O
Memory and I/0 address-spaces aredifferent.
A special instructions named IN and OUT are used fordata-transfer.
Ex: Processor in Intel family.
Advantage of separate I/O space: I/O-devices deal with feweraddress-lines.
I/O Interface for an Input Device
1) Address Decoder: enables the device to recognize its address when this address
appears on the address-lines (Figure7.2).
2) Status Register: contains information relevant to operation ofI/O-device.
3) Data Register: holds data being transferred to or from processor. There are 2types:
i) DATAIN Input-buffer associated withkeyboard.
ii) DATAOUT Output data buffer of adisplay/printer.
Both data and status register are connected to the data bus and assigned unique address.
The address decoder, the data and status register and the control circuitry required to coordinate
I/O transfers constitute the device’s interface circuit.
3.2 INTERRUPTS
• There are many situations where other tasks can be performed while waiting for an I/O device to
becomeready.
• A hardware signal called an Interrupt will alert the processor when an I/O device becomesready.
• Interrupt-signal is sent on the interrupt-requestline.
• The processor can be performing its own task without the need to continuously check theI/O-device.
• The routine executed in response to an interrupt-request is calledISR.
• The processor must inform the device that its request has been recognized by sending INTA
signal. (INTR Interrupt Request, INTA Interrupt Acknowledge, ISR Interrupt
ServiceRoutine)
• For example, consider COMPUTE and PRINT routines (Figure3.6).
Assume that an interrupt request arrives during execution of instruction i in Fig 3.6
• The processor first completes the execution of instructioni.
• Then, processor loads the PC with the address of the first instruction of theISR (interrupt service
routine).
• After the execution of ISR, the processor has to come back to instructioni+1.
• Therefore, when an interrupt occurs, the current content of PC is put in temporary storagelocation.
• A return at the end of ISR reloads the PC from that temporary storagelocation.
• This causes the execution to resume at instructioni+1.
• When processor is handling interrupts, it must inform device that its request has beenrecognized.
• This may be accomplished by special control signal on bus. An interrupt-acknowledge signal is used
• The task of saving and restoring the information can be done automatically by theprocessor or by
program instruction.
• Saving and restoring registers involves memory transfers:
• Increases the total execution time.
• 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.
• In order to reduce the interrupt latency, most processors save only the minimal amount of
information:
• This minimal amount of information includes Program Counter and processor status registers.
• Any additional information that must be saved, must be saved explicitly by the program instructions
at the beginning of the interrupt service routine.
1) Processor should ignore the interrupts until execution of first instruction of theISR by the
processor hardware.
By using an Interrupt-disable instruction as the first instruction in the interrupt-service
routine, the programmer can ensure that no further interruptions will occur until an
Interrupt-enable instruction is executed. Typically, the Interrupt-enable instruction will
be the last instruction in the interrupt-service routine before the Returnfrom-interrupt
instruction.
2) Processor should automatically disable interrupts before starting the execution of theISR.
The second option, which is suitable for a simple processor with only one interrupt-
request line, is to have the processor automatically disable interrupts before starting
the execution of the interrupt-service routine. After saving the contents of the PC Dept
of CSE,SJBIT Page 64 INTR , to name the interrupt-request COMPUTER ORGANIZATION
10CS46 and the processor status register (PS) on the stack, the processor performs the
equivalent of executing an Interrupt-disable instruction. It is often the case that one bit
in the PS register, called Interrupt-enable, indicates whether interrupts are enabled.
3) In the third option, the processor has a special interrupt-request line for which the interrupt-
handling circuit responds only to the leading edge of the signal. Such a line is said to be edge-
triggered.
VECTORED INTERRUPTS
• A device requesting an interrupt identifies itself by sending a special-code to processor overbus.
• Then, the processor starts executing theISR.
• The special-code indicates starting-address ofISR.
• The special-code length ranges from 4 to 8bits.
• The location pointed to by the interrupting-device is used to store the staring address toISR.
• The staring address to ISR is called the interruptvector.
• Processor
→ loads interrupt-vector into PC &
→ executes appropriate ISR.
• When processor is ready to receive interrupt-vector code, it activates INTAline.
• Then, I/O-device responds by sending its interrupt-vector code & turning off the INTRsignal.
• The interrupt vector also includes a new value for the Processor StatusRegister.
INTERRUPT NESTING
Interrupts should be disabled during the execution of an interrupt-service routine, to ensure that a
request from one device will not cause more than one interruption. The same arrangement is often
used when several devices are involved, in which case execution of a given interrupt-service routine,
once started, always continues to completion before the processor accepts an interrupt request from a
second device. Interrupt-service routines are typically short, and the delay they may cause is
acceptable for most simple devices
• A multiple-priority scheme is implemented by using separate INTR & INTA lines for eachdevice
• Each INTR line is assigned a different priority-level (Figure4.7).
• Priority-level of processor is the priority of program that is currently beingexecuted.
• Processor accepts interrupts only from devices that have higher-priority than itsown.
• At the time of execution of ISR for some device, priority of processor is raised to that of thedevice.
• Thus, interrupts from devices at the same level of priority or lower aredisabled.
Privileged Instruction
• Processor's priority is encoded in a few bits of PS word. (PS Processor-Status).
• Encoded-bits can be changed by Privileged Instructions that write intoPS.
• Privileged-instructions can be executed only while processor is running in SupervisorMode.
• Processor is in supervisor-mode only when executing operating-systemroutines.
Privileged Exception
• User programcannot
→ accidently or intentionally change the priority of the processor &
→ disrupt the system-operation.
• An attempt to execute a privileged-instruction while in user-mode leads to a PrivilegedException.
SIMULTANEOUS REQUESTS
• The processor must have some mechanisms to decide which request to service when simultaneous
requestsarrive.
A widely used scheme is to connect the devices to form a daisy chain, as shown in fig. 4.8a
• INTR line is common to all devices (Figure4.8a).
• The interrupt-acknowledge line, INTA, is connected in a daisy-chain fashion, such that the INTA signal
propagates serially through the devices.
• INTA signal propagates serially throughdevices.
• When several devices raise an interrupt-request, INTR line isactivated.
• Processor responds by setting INTA line to 1. This signal is received by device1.
• Device-1 passes signal on to device 2 only if it does not require anyservice.
• If device-1 has a pending-request for interrupt, thedevice-1
→ blocks INTA signal &
→ proceeds to put its identifying-code on data-lines.
• Device that is electrically closest to processor has highestpriority.
• Advantage: It requires fewer wires than the individualconnections.
Arrangement of Priority Groups
• Here, the devices are organized in groups & each group is connected at a different prioritylevel.
• Within a group, devices are connected in a daisy chain. (Figure4.8b).