Unit 3 Notes
Unit 3 Notes
Unit 3 Notes
INPUT-OUTPUT ORGANIZATION
• Peripheral Devices
• Input-Output Interface
• Modes of Transfer
• Priority Interrupt
• Input-Output Processor
• Serial Communication
© Manish Mahajan
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
I/O ORGANIZATION
• The input-output organization of a computer is a
function of the size of the computer and the devices
connected to it.
• The difference between a small and a large system is
mostly dependent on the amount of hardware the
computer has available for communicating with
peripheral units and the number of peripherals
connected to the system.
© Manish Mahajan
Peripheral Devices
PERIPHERAL DEVICES
Input Devices Output Devices
• Keyboard
• Card Puncher, Paper Tape Puncher
• Optical input devices
• CRT
- Card Reader
• Printer (Impact, Ink Jet,
- Paper Tape Reader
Laser, Dot Matrix)
- Bar code reader
• Plotter
- Digitizer
• Analog
- Optical Mark Reader
• Voice
• Magnetic Input Devices
- Magnetic Stripe Reader
• Screen Input Devices
- Touch Screen
- Light Pen
- Mouse
• Analog Input Devices
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
© Manish Mahajan
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
© Manish Mahajan
Input/Output Interfaces
INPUT/OUTPUT INTERFACE
• Provides a method for transferring information between internal
storage (such as memory and CPU registers) and external I/O
devices
• Resolves the differences between the computer and peripheral
devices
– Peripherals – Electromechanical/Electromagnetic Devices
– CPU or Memory - Electronic Device
• Conversion of signal values required
– 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, Block, …
» CPU or Memory – Word
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
Device Interface
© Manish Mahajan
Input/Output Interfaces
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
I/O Process
• The I/O bus from the processor is attached to all peripheral interfaces.
• To communicate with a particular device, the processor places a device
address on the address lines.
• Each interface attached to the I/O bus contains an address decoder that
monitors the address lines.
• When the interface detects its own address, it activates the path between the
bus lines and the device that it controls.
• All peripherals whose address does not correspond to the address in the bus
are disabled by their interface.
• At the same time that the address is made available in the address lines, the
processor provides a function code in the control lines. The interface selected
responds to the function code and proceeds to execute it.
• The function code is referred to as an I/O command and is in essence an
instruction that is executed in the interface and its attached peripheral unit.
• The interpretation of the command depends on the peripheral that the
processor is addressing.
• There are four types of commands that an interface may receive. They are
classified as control, status, data output, and data input.
© Manish Mahajan
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
Command Types
• A control command is issued to activate the
peripheral and to inform it what to do.
» For example, a magnetic tape unit may be instructed to backspace the
tape by one record, to rewind the tape, or to start the tape moving in
the forward direction.
– The particular control command issued depends on the peripheral,
and each peripheral receives its own distinguished sequence of
control commands, depending on its mode of operation.
• A status command is used to test various status
conditions in the interface and the peripheral.
» For example, the computer may wish to check the status of the
peripheral before a transfer is initiated. During the transfer, one or
more errors may occur which are detected by the interface. These
errors are designated by setting bits in a status register that the
processor can read at certain intervals.
© Manish Mahajan
Command Types
• A data output command causes the interface to
respond by transferring data from the bus into one of
its registers.
» Consider an example with a tape unit. The computer starts the tape
moving by issuing a control command. The processor then monitors
the status of the tape by means of a status command. When the tape is
in the correct position, the processor issues a data output command.
The interface responds to the address and command and transfers the
information from the data lines in the bus to its buffer register. The
interface then communicates with the tape controller and sends the
data to be stored on tape.
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
I/O MODULE
• Interfaces
– Internal Interface to the CPU and memory via the system Bus
– External Interface to one or more I/O devices by tailored data links.
• Requirements
– Control & Timing
» To coordinate the flow of traffic between internal resources
and external devices
– CPU Communication
» Control signal to the I/O module over the control bus
» Exchange of data between CPU and I/O module over data bus
» Status signals like BUSY, READY needed as the data transfer
rates of the CPU and the peripherals vary
» Address of the various peripherals connected to CPU
– Device Communication
» Commands, status information and data
– Data Buffering
– Error Detection
© Manish Mahajan
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
© Manish Mahajan
ISOLATED I/O
Isolated I/O
- Separate I/O read/write control lines in addition to memory read/write control lines
- Separate (isolated) memory and I/O address spaces
- Distinct input and output instructions
- Memory address values are not affected by interface register assignment
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
Memory Mapped IO
• Both the memory and I/O devices are connected to the CPU through the
same bus
• The device addresses are a part of the memory address space.
• The load and store instructions used with memory operands can be used as
the read and write instructions with respect to those addresses configured for
I/O devices.
• Separate I/O instructions are not needed
• Some of the memory address space is used up by the I/O, and it can be
difficult to distinguish between the memory and I/O – oriented operations in a
program.
© Manish Mahajan
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
Input/Output Interfaces
I/O INTERFACE
Port A I/O data
register
Bidirectional Bus
data bus buffers
Port B I/O data
register
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
STROBE CONTROL
* Employs a single control line to time each transfer
* The strobe may be activated by either the source or
the destination unit
Strobe Strobe
e.g. I/O Write CPU I/O(Strobe) e.g. I/O Read CPU I/O (strobe)
CPU I/O(data) I/O CPU (data)
© Manish Mahajan
HANDSHAKING
Strobe Methods
Source-Initiated
Destination-Initiated
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
Valid data
Data bus
Timing Diagram
Data valid
Data accepted
Data valid
Valid data
Data bus
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
TRANSMISSON MODES
• The transfer of data between two units may be done in parallel or serial.
– In parallel data transmission, each bit of the message has its own path and the total
message is transmitted at the same time. This means that an n-bit message must be
transmitted through n separate conductor paths.
– In serial data transmission, each bit in the message is sent in sequence one at a time.
This method requires the use of one pair of conductors or one conductor and a
common ground.
– Parallel transmission is faster but requires many wires. It is used for short distances
and where speed is important.
– Serial transmission is slower but is less expensive since it requires only one pair of
conductors.
• Serial transmission can be synchronous or asynchronous.
– In synchronous transmission, the two units share a common clock frequency and bits
are transmitted continuously at the rate dictated by the clock pulses. In long- distant
serial transmission, each unit is driven by a separate clock of the same frequency.
Synchronization signals are transmitted periodically between the two units to keep
their clocks in step with each other.
– In asynchronous transmission, binary information is sent only when it is available and
the line remains idle when there is no information to be transmitted.
– This is in contrast to synchronous transmission, where bits must be transmitted
continuously to keep the clock frequency in both units synchronized with each other.
© Manish Mahajan
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
© Manish Mahajan
ASYNCHRONOUS INTERFACE
• The interface is initialized for a particular mode of transfer by means of a
control byte that is loaded into its control register.
– The transmitter register accepts a data byte from the CPU through the data bus. This byte is
transferred to a shift register for serial transmission.
– The receiver portion receives serial information into another shift register, and when a complete
data byte is accumulated, it is transferred to the receiver register. The CPU can select the receiver
register to read the byte through the data bus.
• The bits in the status register are used for input and output flags and for
recording certain errors that may occur during the transmission. The CPU
can read the status register to check the status of the flag bits and to
determine if any errors have occurred.
– Two bits in the status register are used as flags. One bit is used to indicate whether the transmitter
register is empty and another bit is used to indicate whether the receiver register is full.
• The chip select and the read and write control lines communicate with the
CPU. The chip select (CS) input is used to select the interface through
the address bus.
• The register select (RS) is associated with the read (RD) and write (WR)
controls. Two registers are write-only and two are read-only. The register
selected is a function of the RS value and the RD and WR status, as
listed in the table accompanying the diagram.
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
© Manish Mahajan
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
ERRORS
• Three possible errors that the interface checks
during transmission are
– parity error,
– framing error, and
– overrun error.
• Parity error occurs if the number of l's in the received
data is not the correct parity.
• A framing error occurs if the right number of stop
bits is not detected at the end of the received
character.
• An overrun error occurs if the CPU does not read the
character from the receiver register before the next
one becomes available in the shift register. Overrun
error results in a loss of characters in the received
data stream.
© Manish Mahajan
MODES OF TRANSFER
• Binary information received from an external device is
usually stored in memory for later processing.
• Information transferred from the central computer into an
external device originates in the memory unit.
• The CPU merely executes the I/O instructions and may
accept the data temporarily, but the ultimate source or
destination is the memory unit.
• Data transfer between the central computer and I/O devices
may be handled in a variety of modes.
• Some modes use the 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:
– 1. Programmed I/O
– 2. Interrupt-initiated I/O
– 3. Direct memory access (DMA)
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
Modes of Transfer
© Manish Mahajan
Programmed I/O
• The benefit of using this approach is that we
have programmatic control over the behavior
of each device. Program changes can make
adjustments to the number and types of
devices in the system as well as their polling
priorities and intervals.
• Constant register polling, however, is a
problem. The CPU is in a continual “busy
wait” loop until it starts servicing an I/O
request. It doesn’t do any useful work until
there is I/O to process.
• Owing to these limitations, programmed I/O
is best suited for special-purpose systems
such as automated teller machines and
systems that control or monitor
environmental events.
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
EXAMPLE
© Manish Mahajan
PROCESS
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
Modes of Transfer
© Manish Mahajan
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
Priority Interrupt
An interrupt service routine is a program preloaded into the machine memory that
performs the following functions:
© Manish Mahajan
Modes of Transfer
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
© Manish Mahajan
The DMA controller is a piece of hardware that controls one or more peripheral devices. It
allows devices to transfer data to or from the system’s memory without the help of the
processor. In a typical DMA transfer, some event notifies the DMA controller that data needs
to be transferred to or from memory. Both the DMA and CPU use memory bus and only one
or the other can use the memory at the same time. The DMA controller then sends a request
to the CPU asking its permission to use the bus. The CPU returns an acknowledgment to the
DMA controller granting it bus access. The DMA can now take control of the bus to
independently conduct memory transfer. When the transfer is complete the DMA relinquishes
its control of the bus to the CPU.
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
© Manish Mahajan
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
2. When the I/O device is ready to transfer data, it informs the DMA controller. The
DMA controller starts the transfer operation. This step consists of the following
substeps.
a) Obtain the bus by going through the bus arbitration process
b) Place the memory address and generate the appropriate read and write control
signals;
c) Complete the transfer and release the bus for use by the processor or other DMA
devices;
d) Update the memory address and count value;
e) If more bytes are to be transferred, repeat the loop from Step (a).
© Manish Mahajan
IOP
© Manish Mahajan
© MANISH MAHAJAN
ECS 301 COMPUTER ORGANIZATION
Input/Output Processor
Continue
© Manish Mahajan
IOP Types
• A Selector Channel controls several
devices, but handles transfers for a
single device at a time.
© Manish Mahajan
© MANISH MAHAJAN