CO3 - PPT-Modified

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 44

Welcome

1
19EC1202
COMPUTER ORGANIZATION AND ARCHITECTURE
CO3

Input / Output Devices

Wednesday, June 19, 2024 2


Input / Output Devices

Input / Output Devices: Introduction to input/output processing, Program


controlled I/O transfer. Interrupt controlled I/O transfer, DMA controller.
Secondary storage and type of storage devices. Introduction to buses and
connecting I/O devices to CPU and memory, TRAP and Interrupts

Wednesday, June 19, 2024 3


Input / Output
The computer system's input/output (I/O) architecture is its interface to the
outside world.
The two important modules of the computer system -
1. The processor and
2. The memory module.
The third key component of a computer system is a set of I/O modules
Each I/O module interfaces to the system bus and controls one or more
peripheral devices.
Wednesday, June 19, 2024 4
Input / Output
There are several reasons why an I/O device or peripheral device is not
directly connected to the system bus?
1. There are a wide variety of peripherals with various methods of operation.
2. The data transfer rate of peripherals is often much slower than that of the
memory or processor.
3. Peripherals often use different data formats and word lengths than the
computer to which they are attached

Wednesday, June 19, 2024 5


Input/output Modules
The major functions of an I/O module are categorized as follows –

1. Control and timing

2. Processor Communication

3. Device Communication

4. Data Buffering

5. Error Detection
Wednesday, June 19, 2024 6
Input/output Modules

1. Control & timings


•The I/O function includes a control and timing requirement to co-ordinate the
flow of traffic between internal resources and external devices.

Wednesday, June 19, 2024 7


Input/output Modules

The control of the transfer of data from an external device to the processor might involve the
following sequence of steps –
1. The processor interacts with the I/O module to check the status of the attached device.
2. The I/O module returns the device status.
3. If the device is operational and ready to transmit, the processor requests the transfer of
data, by means of a command to the I/O module.
4. The I/O module obtains a unit of data from external device.
5. The data are transferred from the I/O module to the processor.

Wednesday, June 19, 2024 8


Input/output Modules
2. Processor & Device Communication
During the I/O operation, the I/O module must communicate with the processor
and with the external device
Processor communication involves the following:
Command decoding
Data
Status Reporting
Address Recognition
Wednesday, June 19, 2024 9
Input/output Modules

Processor communication involves the following:

1. Command decoding :The I/O module accepts command from the processor,

typically sent as signals on control bus.

2. Data :Data are exchanged between the processor and the I/O module over

the data bus.

Wednesday, June 19, 2024 10


Input/output Modules
3. Status Reporting :Because peripherals are so slow, it is important to know the
status of the I/O module. For example, if an I/O module is asked to send data
to the processor(read), it may not be ready to do so because it is still working
on the previous I/O command. This fact can be reported with a status signal.
Common status signals are BUSY and READY.
4. Address Recognition :Just as each word of memory has an address, so thus
each of the I/O devices. Thus an I/O module must recognize one unique
address for each peripheral it controls.
Wednesday, June 19, 2024 11
Input/output Modules
3. Device communication: On the other hand, the I/O must be able to perform device
communication. This communication involves command, status information and data.
4. Data Buffering
An essential task of an I/O module is data buffering
The data buffering is required due to the mismatch of the speed of CPU, memory and other
peripheral devices.
So, the I/O modules store the data in a data buffer and regulate the transfer of data as per the
speed of the devices.

Wednesday, June 19, 2024 12


Input/output Modules

5. Error Detection
Another task of I/O module is error detection and for subsequently reporting
error to the processor.
One class or error includes mechanical and electrical malfunctions reported by
the device (e.g. paper jam).
Another class consists of unintentional changes to the bit pattern as it is
transmitted from devices to the I/O module.

Wednesday, June 19, 2024 13


Block diagram of I/O Module

1. Control & timings


•The I/O function includes a control and timing requirement to co-ordinate the
flow of traffic between internal resources and external devices.

Wednesday, June 19, 2024 14


Input/output Modules

Wednesday, June 19, 2024 15


I/O Operations
Two types of addressing are possible

Memory-mapped I/O
Isolated or I/O mapped I/O

Wednesday, June 19, 2024 16


Memory-mapped I/O
• There is a single address space for memory locations and I/O devices
• The processor treats the status and address register of the I/O modules as
memory location and the same machine instructions are used to access both
memory and I/O devices.
• For example, if the size of address bus of a processor is 16, then there are 216
combinations and all together 216 address locations can be addressed with
these 16 address lines.

Wednesday, June 19, 2024 17


Memory-mapped I/O

• Since I/O devices are included in the same memory address space, so the
status and address registers of I/O modules are treated as memory location
by the processor.

• Therefore, the same machine instructions are used to access both memory
and I/O devices.

Wednesday, June 19, 2024 18


Isolated or I/O -mapped I/O
• In this scheme, the full range of addresses may be available for both.

• The address refers to a memory location or an I/O device is specified with the

help of a command line.

• In general command line is used to identify a memory location or an I/O

device.

Wednesday, June 19, 2024 19


Isolated or I/O -mapped I/O

• If = 1, it indicates that the address present in address bus is the address


of an I/O device.
• If = 0, it indicates that the address present in address bus is the address
of a memory location.
• Since full range of address is available for both memory and I/O devices, so,
with 16 address lines, the system may now support both 216 memory
locations and 216 I/O addresses.

Wednesday, June 19, 2024 20


Differences between Memory Mapped I/O & I/O
S.No. Memory Mapped I/O
Mapped I/O I/O Mapped I/O
1 I/O device is treated like a memory device and I/O device is treated as an I/O device and hence given
hence given a memory address. an I/O address.

2 Both have same address space Memory and I/O have separate address space

3 Due to addition of I/O addressable memory become All address can be used by the memory
less for memory
4 Same instructions can control both I/O and Memory Separate instruction control read and write operation
in I/O and Memory
5 Normal memory address are for both In this I/O address are called ports.

6 Lesser efficient More efficient due to separate buses


7 Smaller in size Larger in size due to more buses
8 Simpler logic is used as I/O is also treated as It is complex due to separate separate logic is used to
memory only. control both.

Wednesday, June 19, 2024 21


Differences between Memory Mapped I/O & I/O
Mapped I/O
S.No. Memory Mapped I/O I/O Mapped I/O
9 I/O device has a 20 bit Memory address. I/O device has an 8 or 16 bit I/O address.
10 I/O device is given MEMR# and MEMW# control I/O device is given IOR# and IOW# control signals
signals
11 Decoding is more complex due to more address lines Decoding is easier due to lesser address lines
12 More gates add more delays hence slower Works faster due to less delays
13 Allows many more I/O devices as I/O addresses are Allows many more I/O devices as I/O addresses are
now 20 bits. now 20 bits.
14 Popular technique in Microcontrollers Popular technique in Microprocessors.
15 Any register can be used to transfer data with the I/O ONLY AL/ AH/ AX registers can be used to transfer data
device with the I/O device
16 I/O devices can now be accessed using any memory I/O devices can only be accessed by IN and OUT
instruction. instructions.

Wednesday, June 19, 2024 22


Data Transfer

1. Synchronous : All devices derive the timing information from common clock line.
2. Asynchronous: No common clock
Require control signals
1. Strobe Pulse
2. Handshaking

Wednesday, June 19, 2024 23


Strobe Control

Wednesday, June 19, 2024 24


Handshaking
Source initiated transfer using handshake

Block Diagram

Timing Diagram

Sequence of events

Wednesday, June 19, 2024 25


Handshaking
Destination initiated transfer using handshake

Block Diagram

Timing Diagram

Sequence of events

Wednesday, June 19, 2024 26


Input / Output Subsystem

There are three basic forms of input and output systems

Programmed I/O

Interrupt driven I/O

Direct Memory Access(DMA)

Wednesday, June 19, 2024 27


Input / Output Subsystem
Programmed I/O: With programmed I/O, the processor executes a program that
gives its direct control of the I/O operation, including sensing device status,
sending a read or write command, and transferring the data.
Interrupt driven I/O: With interrupt driven I/O, the processor issues an I/O
command, continues to execute other instructions, and is interrupted by the I/O
module when the I/O module completes its work.
DMA: In Direct Memory Access (DMA), the I/O module and main memory
exchange data directly without processor involvement.
Wednesday, June 19, 2024 28
I/O Commands
There are four types of I/O commands that an I/O module will receive when it is
addressed by a processor
Control : Used to activate a peripheral device and instruct it what to do. These
commands are specific to a particular type of peripheral device.
Test : Used to test various status conditions associated with an I/O module and
its peripherals. The processor will want to know if the most recent I/O operation
is completed, or any error has occurred.

Wednesday, June 19, 2024 29


I/O Commands

Read : Causes the I/O module to obtain an item of data from the peripheral and
place it in the internal buffer.

Write : Causes the I/O module to take an item of data ( byte or word ) from the
data bus and subsequently transmit the data item to the peripheral.

Wednesday, June 19, 2024 30


Programmed I/O

With programmed I/O, the processor


executes a program that gives its
direct control of the I/O operation,
including sensing device status,
sending a read or write command,
and transferring the data.

Wednesday, June 19, 2024 31


Example

Wednesday, June 19, 2024 32


Example
The transfer of each byte requires three
instructions:
1. Read the status register.
2. Check the status of the flag bit and branch
to step 1 if not set or to step 3 if set.
3. Read the data register.

Flow chart for CPU program to input data

Wednesday, June 19, 2024 33


Interrupt driven I/O
With interrupt driven I/O, the processor issues an
I/O command, continues to execute other
instructions, and is interrupted by the I/O module
when the I/O module completes its work.

Wednesday, June 19, 2024 34


Direct Memory Access (DMA)

Wednesday, June 19, 2024 35


DMA Transfer

Wednesday, June 19, 2024 36


Direct Memory Access

Wednesday, June 19, 2024 37


DMA Modes of Operation
DMA performs data transfer operation. The different DMA transfer modes are as

follows:-

1. Burst or block transfer DMA

2. Cycle steal or single byte transfer DMA.

3. Transparent or hidden DMA.

Wednesday, June 19, 2024 38


Burst or block transfer DMA
1. It is the fastest DMA mode. In this two or more data bytes are transferred continuously.

2. Processor is disconnected from system bus during DMA transfer. N number of machine
cycles are adopted into the machine cycles of the processor where N is the number of
bytes to be transferred.

3. DMA sends HOLD signal to processor to request for system bus and waits for HLDA signal.

4. After receiving HLDA signal, DMA gains control of system bus and transfers one byte. After
transferring one byte, it increments memory address, decrements counter and transfers
next byte.
5. In this way, it transfer all data bytes between memory and I/O devices. After transferring
all data bytes, the DMA controller disables HOLD signal & enters into slave mode.

Wednesday, June 19, 2024 39


Cycle steal or single byte transfer DMA
1. In this mode only one byte is transferred at a time. This is slower than burst
DMA.

2. DMA sends HOLD signal to processor and waits for HLDA signal on receiving
HLDA signal, it gains control of system bus and executes only one DMA cycle.

3. After transfer one byte, it disables HOLD signal and enters into slave mode.

4. Processor gains control of system bus and executes next machine cycle. If
count is not zero and data is available then the DMA controller sends HOLD
signal to the processor and transfer next byte of data block.
Wednesday, June 19, 2024 40
Transparent or Hidden DMA transfer

1. Processor executes some states during which is floats the address and data
buses. During this process, processor is isolated from the system bus.
2. DMA transfers data between memory and I/O devices during these states.
This operation is transparent to the processor.
3. This is slowest DMA transfer. In this mode, the instruction execution speed of
processor is not reduced. But, the transparent DMA requires logic to detect
the states when the processor is floating the buses.

Wednesday, June 19, 2024 41


Introduction to secondary memory devices
To store large amount of data or programs permanently, we need a cheaper and
permanent memory. Such memory is called secondary memory.
Depending on whether secondary memory device is part of CPU or not, there are two
types of secondary memory – fixed and removable.
Hard Disk Drive:Hard disk drive is made up of a series of circular disks called
platters arranged one over the other. Disks are made of non-magnetic material
like aluminum alloy and coated with 10-20 nm of magnetic material.
CD Drive:CDs are circular disks that use optical rays, usually lasers, to read and
write data.
CD-ROM (Compact Disk – Read Only Memory) − The data on these CDs are
recorded by the manufacturer. Proprietary Software, audio or video are released
on CD-ROMs.
CD-R (Compact Disk – Recordable) − Data can be written by the user once on the
CD-R. It cannot be deleted or modified later.
CD-RW (Compact Disk – Rewritable) − Data can be written and deleted on these
optical disks again and again.
DVD Drive:DVD stands for Digital Video Display. DVD are optical devices that can
store 15 times the data held by CDs. They are usually used to store rich
multimedia files that need high storage capacity. DVDs also come in three
varieties – read only, recordable and rewritable.
Pen Drive:Pen drive is a portable memory device that uses solid state memory rather
than magnetic fields or lasers to record data. It uses a technology similar to RAM, except
that it is nonvolatile. It is also called USB drive, key drive or flash memory.
Blu Ray Disk:Blu Ray Disk (BD) is an optical storage media used to store high definition
(HD) video and other multimedia filed. BD uses shorter wavelength laser as compared to
CD/DVD. This enables writing arm to focus more tightly on the disk and hence pack in
more data. BDs can store up to 128 GB data.
Characteristics of Secondary Memory
•It is non-volatile, i.e. it retains data when power is switched off
•It is large capacities to the tune of terabytes
•It is cheaper as compared to primary memory
• Connected to main memory through a bus and a device controller.
• Only occasionally interacts with CPU
• Contents are easily changed, but access is very slow compared to main
memory.

You might also like