Cse211 - Unit 4
Cse211 - Unit 4
1/15
Central Processing Unit 2 Lecture 22
Overview
Peripheral Devices
Input-Output Interface
Asynchronous Data
Transfer
Modes of Transfer
Priority Interrupt
Input-Output Processor
Serial Communication
I/O Subsystem
Efficient Mode Of Communication
between central system and outside environment
Programmed, Input Data, Process, Record, Display Results.
Slow Keyboard Processor Idles Waiting For Slow Input.
time of waiting is more for information to arrive
E.G. Magnetic Tapes, Disks
Input/Output Organization 5
Peripheral Devices
Peripheral Devices
KeyBoard (Input Device) : light pen, mouse, touch screen, joy stick, digitizer
Printer (Hard Copy Device) : Daisy wheel, dot matrix and laser printer
Peripheral Devices
Input Devices Output Devices
• Keyboard • Card Puncher, Paper Tape Puncher
• Optical input devices • CRT
- Card Reader • Printer (Daisy Wheel, Dot Matrix, Laser)
- Paper Tape Reader • Plotter
- Bar code reader
- Optical Mark Reader
• Magnetic Input Devices
- Magnetic Stripe Reader
(ATM)
• Screen Input Devices
- Touch Screen
- Light Pen
- Mouse
•
Input/Output Organization 9
• ASCII Code :
• It uses 7 bits to code 128 characters
• 7 bit - 00 - 7F ( 0 - 127 )
Input/Output Organization 10
and pages.
I/O Interface
• Provides a method for transferring information
I/O Interface
I/O bus
Data
Processor Address
Control
Keyboard
and Printer Magnetic Magnetic
display disk tape
terminal
Input/Output Organization 16
Interface :
- Decodes the device address (device code)
4 types of command interface can receive : control, status, data o/p and data i/p
Input/Output Organization 17
• Control command :
• issued to activate peripheral and to inform what to do
• Status command :
• used to test various status condition in interface and peripherals
• Transfer between CPU and I/O devices through their I/O interface
Input/Output Organization 19
(2). Use one common bus for memory and I/O but separate control lines
for each
(3). Use one common bus for memory and I/O with common control
lines for both
Asynchronous Data Transfer
Two methods:
1 1
2
2
Destination initiated strobe:
1 1
Source initiated handshaking:
Timeout : If the return handshake signal does not respond within a given time period,
the unit assumes that an error has occurred.
• Asynchronous Serial Transfer
• Synchronous transmission :
• The two unit share a common clock frequency
• Bits are transmitted continuously at the rate dictated by the clock pulses
• Asynchronous transmission :
• Binary information sent only when it is available and line remain idle
otherwise
• Special bits are inserted at both ends of the character code
• Each character consists of three parts :
• 1) start bit : always “0”, indicate the beginning of a character
• 2) character bits : data
• 3) stop bit : always “1”
1 1 0 0 0 1 0 1
S ta rt S to p
C ha ra c ter b its
b it b it
• Asynchronous transmission rules :
• When a character is not being sent, the line is kept in the 1-state
• The initiation of a character transmission is detected from the start bit,
which is always “0”
• The character bits always follow the start bit
• After the last bit of the character is transmitted, a stop bit is detected
when the line returns to the 1-state for at least one bit time
Internal Bus
and clock
Chip select CS
Status Receiver Receiver CS RS Oper. Register selected
RS Timing clock
register control 0 x x None
I/O read and and clock 1 0 WR Transmitter register
RD Control 1 1 WR Control register
I/O write Receive 1 0 RD Receiver register
WR Receiver Shift data
1 1 RD Status register
register register
Transmitter Register
- Accepts a data byte(from CPU) through the data bus
- Transferred to a shift register for serial transmission
Receiver Register
- Receives serial information into another shift register
- Complete data byte is sent to the receiver register
Status Register Bits
- Used for I/O flags and for recording errors
Control Register Bits
- Define baud rate, no. of bits in each character, whether to generate and check parity, and no. of
stop bits
•UART stands for?
Peripheral Devices
Input-Output Interface
Modes of Transfer
Priority Interrupt
Input-Output Processor
Modes of Transfer
The CPU merely execute I/O instructions and may accept data
temporarily but ultimate source or destination is the Memory Unit.
Modes of Transfer
Programmed I/O
Interrupt-Initiated I/O
Direct Memory Access (DMA)
Input/output Organization 34
- Other instructions are needed to transfer data to and from CPU and Memory
• CPU stays in a program loop until the I/O unit indicated that it is
ready for data transfer.
• This is a time consuming process since it keeps the processor
busy needlessly.
• It can be avoided by using Interrupt facility and special
commands
• Interrupt to inform the interface to issue an interrupt request
signal when data are available for the device.
Interrupted I/O
• In the programmed I/O method, the CPU stays in a program loop until the I/O unit
indicates that it is ready for data transfer.
• It can be avoided by using an interrupt facility and special commands to inform the
interface to issue an interrupt request signal when the data are available from the device.
• In the meantime the CPU can proceed to execute another program. The interface
meanwhile keeps monitoring the device.
Interrupted I/O
• When the interface determines that the device is ready for data transfer, it generates an
interrupt request to the computer.
• Upon detecting the external interrupt signal, the CPU momentarily stops the task it is
processing,
• Then, Branches to a service program to process the I/O transfer, and then returns to the
task it was originally performing.
DMA
1. Transfer of data under programmed I/O is between CPU and peripheral.
2. In direct memory access (DMA), the interface transfers data into and out of the memory unit through the
memory bus.
3. The CPU initiates the transfer by supplying the interface with the starting address and the number of words
needed to be transferred and then proceeds to execute other tasks.
4. When the transfer is made, the DMA requests memory cycles through the memory bus.
5. When the request is granted by the memory controller, the DMA transfers the data directly into memory.
6. The CPU merely delays its memory access operation to allow the direct memory I/O transfer.
7. Since peripheral speed is usually slower than processor speed, I/O-memory transfers are infrequent
compared to processor access to memory.
Priority Interrupts
Priority
- Higher priority interrupts can make requests while servicing a lower priority
interrupt
Priority Interrupts
- control branches to service routine for this source otherwise next lower priority source is tested
Priority Interrupts
- Very slow
- if there are many interrupt time required to poll may exceed time available to
service IO device
Priority Interrupts
- Require a priority interrupt manager which accepts all the interrupt requests
to determine the highest priority request
- Fast since each interrupt source has its own interrupt vector to access
directly to its own service routine
Interrupt request
INT
CPU
Interrupt acknowledge
INTACK
-Device with highest priority placed in first position followed by devices with lower priority and so
on.
- device receives PI=1 and passes to next only when not requesting else PI=0
-Thus device with PI=1 and PO=0 is one with highest priority requesting interrupt
Hardware Priority Interrupts – Daisy Chain
2
Interrupt
to CPU
3
INTACK
from CPU
IEN: Set or Clear by instructions ION or IOF
IST: Represents an unmasked interrupt has occurred. INTACK enables tristate Bus Buffer to load VAD generated
by the Priority Logic
Interrupt Register:
- Each bit is associated with an Interrupt Request from different Interrupt Source - different priority level
- Each bit can be cleared by a program instruction
Mask Register:
- Mask Register is associated with Interrupt Register
- Each bit can be set or cleared by an Instruction
Interrupt Cycle
• Block of data transfer between high speed devices like Disk and Memory
* DMA controller - Interface which takes over the buses to manage the
transfer directly between
• Memory and I/O Device, freeing CPU for other tasks
* CPU initializes DMA Controller by sending memory address and the block
size (number of words)
Input/Output Organization 52
Fig 1: CPU bus signals for DMA transfer (Bus control by DMA)
Internal Bus
DMA select DS
Desired location in memory Address register
RS
Word count register
Read RD Word count register
Holds no. of words to be transferred Write WR Control
logic
Control register Bus request BR Control register
Specifies the mode of transfer
Bus grant BG
Interrupt Interrupt DMA request
DMA acknowledge to I/O device
Input/Output Organization 53
CPU initializes the DMA by sending following information through data bus:
DMA Transfer
Interrupt
Random-access
BG
CPU memory unit (RAM)
BR
RD WR Addr Data RD WR Addr Data
Read control
Write control
Data bus
Address bus
Address
select
RD WR Addr Data
DS DMA ack.
RS DMA I/O
Controller Peripheral
BR device
BG DMA request
Interrupt
Input/Output Organization 58
Central
processing
unit (CPU)
Memory Bus
Peripheral devices
Memory
unit PD PD PD PD
Input-output
processor
(IOP) I/O bus
Input/Output Organization 59
Send instruction
to test IOP.path
Transfer status word
to memory
If status OK, then send
start I/O instruction
to IOP. Access memory
for IOP program
Continue