Coa Notes Unit IV
Coa Notes Unit IV
INPUT-OUTPUT ORGANIZATION
Peripheral devices
In addition to the processor and a set of memory modules, the third key element of a
computer system is a set of input-output subsystem referred to as I/O, provides an efficient
mode of communication between the central system and the outside environment.
Programs and data must be entered into computer memory for processing and results
obtained from computations must be recorded or displayed for the user.
Devices that are under the direct control of the computer are said to be connected online.
These devices are designed to read information into or out of the memory unit upon
command from CPU.
Input or output devices attached to the computer are also called peripherals.
Among the most common peripherals are keyboards, display units, and printers.
Perhaps those provide auxiliary storage for the systems are magnetic disks and tapes.
Peripherals are electromechanical and electromagnetic devices of some complexity.
We can broadly classify peripheral devices into three categories:
Human Readable: Communicating with the computer users, e.g. video display
terminal, printers etc.
Machine Readable: Communicating with equipments, e.g. magnetic disk, magnetic
tape, sensor, actuators used in robotics etc.
Communication: Communicating with remote devices means exchanging data with
that, e.g. modem, NIC (network interface Card) etc.
Control signals determine the function that the device will perform such as send data to I/O
module, accept data from I/O module.
118
Status signals indicate the state of the device i.e. device is ready or not.
Data bits are actual data transformation.
Page
Input Device
Keyboard
Optical input devices
Card Reader
Paper Tape Reader
Optical Character Recognition (OCR)
Optical Bar code reader (OBR)
Digitizer
Optical Mark Reader
Magnetic Input Devices
Magnetic Stripe Reader
Magnetic Ink Character Recognition (MICR)
Screen Input Devices
Touch Screen
Light Pen
Mouse
Analog Input Devices
Output Device
Card Puncher, Paper Tape Puncher
Monitor (CRT, LCD, LED)
Printer (Impact, Ink Jet, Laser, Dot Matrix)
Plotter
Analog
Voice
I/O MODULES
I/O modules interface to the system bus or central switch (CPU and Memory), interfaces
and controls to one or more peripheral devices.
I/O operations are accomplished through a wide assortment of external devices that
provide a means of exchanging data between external environment and computer by a link
to an I/O module.
The link is used to exchange control status and data between I/O module and the external
devices.
119
Page
The data are transferred from the I/O module to the processor.
Page
Device Communication:
It involves commands, status information and data.
Data Buffering:
I/O module must be able to operate at both device and memory speeds.
If the I/O device operates at a rate higher than the memory access rate, then the I/O module
performs data buffering.
If I/O devices rate slower than memory, it buffers data so as not to tie up the memory in
slower transfer operation.
Error Detection:
I/O module is responsible for error detection such as mechanical and electrical malfunction
reported by device e.g. paper jam, bad ink track & unintentional changes to the bit pattern
and transmission error.
The I/O bus from the processor is attached to all peripheral interfaces
To communicate with the particular devices, the processor places a device address on the
address bus.
Each interface contains an address decoder that monitors the address line.
121
When the interface detects the particular device address, it activates the path between the
data line and devices that it controls.
Page
Input-Output interface
Input-Output interface provides a method for transferring information between internal
storage (such as memory and CPU registers) and external I/O devices.
Peripherals connected to a computer need special communication links for interfacing them
with the central processing unit.
The communication link resolves the following differences between the computer and
peripheral devices.
Devices and signals
Peripherals - Electromechanical Devices CPU or Memory - Electronic Device
Data Transfer Rate
Peripherals - Usually slower
CPU or Memory - Usually faster than peripherals
Some kinds of Synchronization mechanism may be needed
Unit of Information
Peripherals - Byte CPU or Memory - Word
Operating Modes
Peripherals - Autonomous, Asynchronous CPU or Memory – Synchronous
To resolve these differences, computer systems include special hardware components
(Interfaces) between the CPU and peripherals to supervise and synchronize all input and
output interfaces.
Memory-mapped I/O
A single set of read/write control lines (no distinction between memory and I/O
transfer)
Memory and I/O addresses share the common address space which reduces memory
address range available
No specific input or output instruction so the same memory reference instructions
can be used for I/O transfers
Considerable flexibility in handling I/O operations
Modes of transfer
Data Transfer between the central computer and I/O devices may be handled in a variety of
modes.
Some modes use CPU as an intermediate path, others transfer the data directly to and from
the memory unit.
Data transfer to and from peripherals may be handled in one of three possible modes.
Programmed I/O
Interrupt Driven I/O
Direct Memory Access (DMA)
124
Page
I/O device places the data on the I/O bus and enables its data valid signal
The interface accepts the data in the data register and sets the F bit of status register and
125
Characteristics:
Continuous CPU involvement
CPU slowed down to I/O speed
Simple
Least hardware
126
Polling, or polled operation, in computer science, refers to actively sampling the status of an
external device by a client program as a synchronous activity. Polling is most often used in terms of
input/output (I/O), and is also referred to as polled I/O or software driven I/O.
Page
127
Page
Fast since identification of the highest priority interrupt request is identified by the
hardware
Page
2. Parallel Priority
129
Page
Priority Encoder
Determines the highest priority interrupt when more than one interrupts take place
Interrupt Cycle
At the end of each Instruction cycle
CPU checks IEN and IST
If IEN and IST = 1, CPU -> Interrupt Cycle
130
The two control signals Bus Request and Bus Grant are used to fascinate the DMA transfer.
The bus request input is used by the DMA controller to request the CPU for the control of
the buses.
When BR signal is high, the CPU terminates the execution of the current instructions and
then places the address, data, read and write lines to the high impedance state and sends
the bus grant signal.
The DMA controller now takes the control of the buses and transfers the data directly
between memory and I/O without processor interaction.
When the transfer is completed, the bus request signal is made low by DMA.
In response to which CPU disables the bus grant and again CPU takes the control of address,
data, read and write lines.
The transfer of data between the memory and I/O of course facilitates in two ways which
are DMA Burst and Cycle Stealing.
DMA Burst: The block of data consisting a number of memory words is transferred
at a time.
Cycle Stealing: DMA transfers one data word at a time after which it must return
control of the buses to the CPU.
CPU is usually much faster than I/O (DMA), thus CPU uses the most of the memory cycles
DMA Controller steals the memory cycles from CPU
For those stolen cycles, CPU remains idle
For those slow CPU, DMA Controller may steal most of the memory cycles which may cause
CPU remain idle long time
DMA Controller
The DMA controller communicates with the CPU through the data bus and control lines.
131
DMA select signal is used for selecting the controller, the register select is for selecting the
register.
Page
The address register specifies the desired location of the memory which is incremented
after each word is transferred to the memory.
The word count register holds the number of words to be transferred which is decremented
after each transfer until it is zero. When it is zero, it indicates the end of transfer.
After which the bus grant signal from CPU is made low and CPU returns to its normal
operation.
The control register specifies the mode of transfer which is Read or Write.
DMA Transfer
DMA request signal is given from I/O device to DMA controller.
DMA sends the bus request signal to CPU in response to which CPU disables its current
instructions and initialize the DMA by sending the following information.
The starting address of the memory block where the data are available (for read)
and where data to be stored (for write)
The word count which is the number of words in the memory block
Control to specify the mode of transfer
Sends a bust grant as 1 so that DMA controller can take the control of the buses
DMA sends the DMA acknowledge signal in response to which peripheral device puts
the words in the data bus (for write) or receives a word from the data bus (for read).
132
Page
I/O Processors
Processor with direct memory access capability that communicates with I/O devices
Channel accesses memory by cycle stealing
Channel can execute a Channel Program
Stored in the main memory
Consists of Channel Command Word(CCW)
Each CCW specifies the parameters needed by the channel to control the I/O devices and
perform data transfer operations
CPU initiates the channel by executing a channel I/O class instruction and once initiated,
channel operates independently of the CPU
A computer may incorporate one or more external processors and assign them the task of
communicating directly with the I/O devices so that no each interface need to communicate
with the CPU.
An I/O processor (IOP) is a processor with direct memory access capability that
communicates with I/O devices.
IOP instructions are specifically designed to facilitate I/O transfer.
The IOP can perform other processing tasks such as arithmetic logic, branching and code
translation.
133
Page
134
Page
Asynchronous
Transmission Error:
Parity
Page
Checksum
Computer Organization and Architecture By S RAMESH Asst. Professor
Cyclic Redundancy Check
Longitudinal Redundancy Check Transmission Modes:
Simples
Half Duplex
Full Duplex
The way that remote terminals are connected to a data communication processor is via
telephone lines or other public or private communication facilities.
The data communication may be either through synchronous transmission or through
asynchronous transmission.
One of the functions of data communication processor is check for transmission errors.
An error can be detected by checking the parity in each character received.
The other ways are checksum, longitudinal redundancy check (LRC) and cyclic redundancy
check (CRC).
Data can be transmitted between two points through three different modes.
First is simplex where data can be transmitted in only one direction such as TV
broadcasting.
Second is half duplex where data can be transmitted in both directions at a time such as
walkie-talkie. The third is full duplex where data can be transmitted in both directions
simultaneously such as telephone.
The communication lines, modems and other equipment used in the transmission of
information between two or more stations is called data link.
The orderly transfer of information in a data link is accomplished by means of a protocol.
MEMORY ORGANIZATION
MEMORY HIERARCHY
Main Memory: memory unit that communicates directly with the CPU (RAM)
Auxiliary Memory: device that provide backup storage (Disk Drives)
Cache Memory: special very-high-speed memory to increase the processing speed (Cache
136
RAM)
Multiprogramming:
Many operating systems are designed to enable the CPU to process a number of
independent programs concurrently.
Multiprogramming refers to the existence of 2 or more programs in different parts of the
memory hierarchy at the same time.
MAIN MEMORY
Main memory is the central storage unit in a computer system. It is a relatively large and
fast memory used to store programs and data during the computer operation.
The principal technology used for the main memory is based on semiconductor integrated
circuits.
Integrated circuits RAM chips are available in two possible operating modes, static and
dynamic.
Static RAM – Consists of internal flip flops that store the binary information.
137
Dynamic RAM – Stores the binary information in the form of electric charges that are
applied to capacitors.
Page
RAM chip –utilizes bidirectional data bus with three state buffers to perform
communication with CPU
The block diagram of a RAM Chip is shown in Fig.12-2.
The capacity of memory is 128 words of eight bits (one byte) per word.
This requires a 7-bit address and an 8-bit bidirectional data bus.
The read and write inputs specify the memory operation and the two chips select (CS)
control inputs are enabling the chip only when it is selected by the microprocessor.
The read and write inputs are sometimes combined into one line labelled R/W.
The function table listed in Fig.12-2(b) specifies the operation of the RAM chip.
The unit is in operation only when CS1=1 and CS2=0.The bar on top of the second select
variable indicates that this input is enabled when it is equal to 0.
If the chip select inputs are not enabled, or if they are enabled but the read or write inputs
are not enabled, the memory is inhibited and its data bus is in a high-impedance state.
When CS1=1 and CS2=0, the memory can be placed in a write or read mode.
When the WR input is enabled, the memory stores a byte from the data bus into a location
specified by the address input lines.
138
Page
ROM
A memory is called a read-only memory, or ROM, when information can be written into it only
once at the time of manufacture. A logic value 0 is stored in the cell if the transistor is connected
to ground at point P; otherwise, a 1 is stored.
The bit line is connected through a resistor to the power supply.
To read the state of the cell, the word line is activated to close the transistor switch.
As a result, the voltage on the bit line drops to near zero if there is a connection between the
transistor and ground.
If there is no connection to ground, the bit line remains at the high voltage level, indicating a 1.
A sense circuit at the end of the bit line generates the proper output value.
The state of the connection to ground in each cell is determined when the chip is manufactured,
using a mask with a pattern that represents the information to be stored.
PROM
Some ROM designs allow the data to be loaded by the user, thus providing a programmable
ROM (PROM).
Programmability is achieved by inserting a fuse at point P.
Before it is programmed, the memory contains all 0s.
The user can insert 1s at the required locations by burning out the fuses at these locations using
high-current pulses. Of course, this process is irreversible.
PROMs provide flexibility and convenience not available with ROMs.
The cost of preparing the masks needed for storing a particular information pattern makes ROMs
cost effective only in large volumes.
The alternative technology of PROMs provides a more convenient and considerably less
expensive approach, because memory chips can be programmed directly by the user.
EPROM
Another type of ROM chip provides an even higher level of convenience.
It allows the stored data to be erased and new data to be written into it.
Such an erasable, reprogrammable ROM is usually called an EPROM.
It provides considerable flexibility during the development phase of digital systems.
Since EPROMs are capable of retaining stored information for a long time, they can be used in
place of ROMs or PROMs while software is being developed.
In this way, memory changes and updates can be easily made.
An EPROM cell has a structure similar to the ROM cell in Figure.
However, the connection to ground at point P is made through a special transistor.
The transistor is normally turned off, creating an open switch. It can be turned on by injecting
charge into it that becomes trapped inside.
Thus, an EPROM cell can be used to construct a memory in the same way as the previously
discussed ROM cell.
Erasure requires dissipating the charge trapped in the transistors that form the memory cells.
This can be done by exposing the chip to ultraviolet light, which erases the entire contents of the
chip.
To make this possible, EPROM chips are mounted in packages that have transparent windows.
140
EEPROM
Page
The interconnection between memory and processor is then established from knowledge of
the size of memory needed and the type of RAM and ROM chips available.
The addressing of memory can be established by means of a table that specify the memory
address assigned to each chip.
The table called Memory address map, is a pictorial representation of assigned address
space for each chip in the system.
The memory address map for this configuration is shown in table 12-1.
RAM and ROM chips are connected to a CPU through the data and address buses.
The low order lines in the address bus select the byte within the chips and other lines in the
address bus select a particular chip through its chip select inputs.
The particular RAM chip selected is determined from lines 8 and 9 in the address bus.
This is done through a 2 X 4 decoder whose outputs go to the CS1 inputs in each RAM chip.
Thus, when address lines 8 and 9 are equal to 00, the first RAM chip is selected.
Page
142
AUXILIARY MEMORY
Page
Hardware Organization
It consists of a memory array and logic for m words with n bits per word.
The argument register A and key register K each have n bits, one for each bit of a word.
The match register M has m bits, one for each memory word.
Each word in memory is compared in parallel with the content of the argument register.
The words that match the bits of the argument register set a corresponding bit in the match
register. After the matching process, those bits in the match register that have been set
indicate the fact that their corresponding words have been matched.
Reading is accomplished by a sequential access to memory for those words whose
corresponding bits in the match register have been set.
143
The relation between the memory array and external registers in an associative memory is
shown in Fig.12-7.
Page
144
Page
Match Logic
The match logic for each word can be derived from the comparison algorithm for two
binary numbers.
First, neglect the key bits and compare the argument in A with the bits stored in the cells of
the words.
Write Operation
Can take two different forms
1. Entire memory may be loaded with new information
2. Unwanted words to be deleted and new words to be inserted
1.Entire memory : writing can be done by addressing each location in sequence – This makes it
random access memory for writing and content addressable memory for reading – number of lines
needed for decoding is d Where m = 2 d , m is number of words.
CACHE MEMORY
Effectiveness of cache mechanism is based on a property of computer programs called
“locality of reference”
The references to memory at any given time interval tend to be confined within a localized
areas
Analysis of programs shows that most of their execution time is spent on routines in which
instructions are executed repeatedly These instructions may be – loops, nested loops , or
few procedures that call each other
Many instructions in localized areas of program are executed repeatedly during some time
period and reminder of the program is accessed infrequently, this property is called
“Locality of Reference”.
Locality of Reference
Locality of reference is manifested in two ways:
1. Temporal- means that a recently executed instruction is likely to be executed again very soon.
The information which will be used in near future is likely tobe in use already (e.g. reuse
of information in loops)
2. Spatial- means that instructions in close proximity to a recently executed instruction are also
likely to be executed soon
If a word is accessed, adjacent (near) words are likely to be accessed soon (e.g. related data
items (arrays) are usually stored together; instructions are executed sequentially)
3. If active segments of a program can be placed in a fast (cache) memory, then total execution time
can be reduced significantly
146
Principles of cache
When addressed word is not in cache Read Miss occurs there are two ways this can be dealt with
1. Entire block of words that contain the requested word is copied from main memory to cache and
the particular word requested is forwarded to CPU from the cache (Load Through) (OR)
Page
Write Operation
If addressed word is not in cache Write Miss occurs
If write through protocol is used information is directly written in to main memory
In write back protocol, block containing the word is first brought in to cache , the desired
word is then overwritten.
Mapping Functions
Correspondence between main memory blocks and those in the cache is specified by a
memory mapping function
There are three techniques in memory mapping:
1. Direct Mapping
2. Associative Mapping
3. Set Associative Mapping
Direct mapping:
A particular block of main memory can be brought to a particular block of cache memory.
So, it is not flexible.
In fig 12-12. The CPU address of 15 bits is divided into two fields.
The nine least significant bits constitute the index field and remaining six bits form the tag
field.
The main memory needs an address that includes both the tag and the index bits.
The number of bits in the index field is equal to the number of address bits required to
access the cache memory.
148
Page
In fig 12-14, the index field is now divided into two parts:
Block field and the word field.
In a 512 word cache there are 64 blocks of 8 words each, since 64X8=512.
The block number is specified with a 6 bit field and the word with in the block is
specified with a 3-bit field.
The tag field stored within the cache is common to all eight words of the same block. 149
Page
150
Page
Replacement Policies
When the cache is full and there is necessity to bring new data to cache, then a decision
must be made as to which data from cache is to be removed
The guideline for taking a decision about which data is to be removed is called replacement
policy Replacement policy depends on mapping
There is no specific policy in case of Direct mapping as we have no choice of block
placement in cache Replacement Policies
VIRTUAL MEMORY
Early days memory was expensive – hence small
Programmers were using secondary storage for overlaying
Page
Types of Memory
Real memory
Main memory
Virtual memory
Memory on disk
Allows for effective multiprogramming andrelieves the user of tight constraints of main
memory
152
In a multiprogram computer system, programs and data are transferred to and from
Page
auxiliary memory and main memory based on demands imposed by the CPU.
as shown in Fig12-20.
Each entry in the associative memory array consists of two fields.
Page
The first three bits specify a field for storing the page number.
Address Translation
A table is needed to map virtual address to a physical address (dynamic operation)
This table may be kept in
a separate memory or
main memory or
associative memory
155
Page