Unit 4
Unit 4
Overview
Peripheral Devices
Input-Output Interface
Modes of Transfer
Priority Interrupt
Input-Output Processor
Serial Communication
Input/Output Organization 3
– I/O Subsystem
• Provides an efficient mode of communication between the
central system and the outside environment
Peripheral Devices
• Devices that are under direct control of computer are said to be
connected on-line.
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
• Screen Input Devices
- Touch Screen
- Light Pen
- Mouse
•
Input/Output Organization 6
• ASCII Code :
• It uses 7 bits to code 128 characters (94 printable and 34 non printing)
• 7 bit - 00 - 7F ( 0 - 127 )
I/O 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
(1). Peripherals – Electromechanical or Electromagnetic Devices
CPU or Memory - Electronic Device
– Conversion of signal values required
(2). Data Transfer Rate
• Peripherals - Usually slower
• CPU or Memory - Usually faster than peripherals
– Some kinds of Synchronization mechanism may be needed
Keyboard
an Printer Magnetic Magnetic
displa
d dis tape
termina
y k
l
Interface :
- Decodes the device address (device code)
- Decodes the commands (operation)
- Provides signals for the peripheral controller
- Synchronizes the data flow and supervises
the transfer rate between peripheral and CPU or Memory
4 types of command interface can receive : control, status, data o/p and data i/p
Input/Output Organization 12
• Status command : used to test various status condition in the interface and
the peripherals
• data o/p command : causes the interface to respond by transferring data from
the bus into one of its registers
• data i/p command : interface receives an item of data from the peripheral and
places it in its buffer register.
Input/Output Organization 13
(1). use two separate buses, one to communicate with memory and the
other with I/O interfaces
- Computer has independent set of data, address and control bus one for
accessing memory and another I/O.
- done in computers that have separate IOP other than CPU.
(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
Input/Output Organization 15
I/O Interface
Port I/O data
Bidirectiona registe
A
Bu r
l data
buffers
s
bus Port B I/O data
registe
Internal bus
CP
Chip r I/O
select C
U
Register select S Control Control Device
RS Timin
Register select registe
1 g an
RS r
I/O read 0 Control
d
R Statu Statu
I/O write D s
WR registe
s
r
Peripheral Devices
Input-Output Interface
Asynchronous Data
Transfer
Modes of Transfer
Priority Interrupt
Input-Output Processor
11-3. Asynchronous Data Transfer
Synchronous Data Transfer: Clock pulses are applied to all registers
within a unit and all data transfer among internal registers occur
simultaneously during the occurrence of a clock pulse. Two units such
as CPU and I/O Interface are designed independently of each other. If
the registers in the interface share a common clock with CPU registers,
the transfer between the two is said to be synchronous.
Asynchronous Data Transfer: Internal timing in each unit (CPU and
Interface) is independent. Each unit uses its own private clock for
internal registers. Asynchronous data transfer between two
independent units requires that control signals be transmitted
between the communicating units to indicate the time at which data is
being transmitted. One way of achieving this is by means of
STROBE(Control signal to indicate the time at which data is being
transmitted) pulse and other method is HANDSHAKING(Agreement
between two independent units).
1
2
2
1
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”
• 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
• Baud Rate : Data transfer rate in bits per second
– 10 character per second with 11 bit format = 110 bit per second
Input/Output Organization 25
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.
Priority
- Determines which interrupt is to be served first when two or more requests
are made simultaneously
- Also determines which interrupts are permitted to interrupt the computer while
- Very slow
- if there are many interrupt time required to poll may exceed time available to
service IO device
Priority Interrupts
- 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
Inputs Outputs
I0 I1 I2 I3 x y IST Boolean functions
1 d d 0 0
d0 1 d d 0
1 1
0 0 1 1 0 x = I0 ' I 1 '
0
d 0 0 1 1 1 y = I 0 ' I1 + I 0 ’ I 2 ’
0 0 0 0 1d d (IST) = I 0 + I 1 + I 2 + I 3
0
Interrupt Cycle
a. PI=0, PO=0
b. PI=0, PO=1
c. PI=1, PO=0
d. PI=1, PO=1
Input/Output Organization 46
Overview
Peripheral Devices
Input-Output Interface
Modes of Transfer
Priority Interrupt
Input-Output Processor
Input/Output Organization 47
Internal Bus
DMA select D
Desired location in memory SR
Address register
(2) Cycle stealing : Alternative technique called cycle stealing allows DMA controller to
transfer one data word at time after which it must return control of
the buses to the CPU.
- CPU merely delays its operation for one memory cycle to allow the
direct memory I/O transfer to “steal” one memory cycle
Input/Output Organization 49
CPU initializes the DMA by sending following information through data bus:
Cycle Stealing
While DMA I/O takes place, CPU is also executing instructions
DMA Controller and CPU both access Memory -> Memory Access Conflict
Cycle Steal
DMA Transfer
Interrupt
Random-access
B
CP memory unit (RAM)
G
B U
R
R WR Addr Data R WR Addr Data
D D
Read control
Write control
Data bus
Address bus
Address
select
R WR Addr Data
D DMA ack.
D
S
R DMA I/
S Controller O
Peripheral
B devic
R e
B DMA request
G
Interrupt
Input/Output Organization 52
- Data gathered in IOP at device rate and bit capacity while CPU executing own program
- Transfer between IOP and Device similar to Programmed I/O and
transfer between IOP and Memory similar to DMA
- CPU is master while IOP is slave processor
- CPU initiates the channel by executing a channel I/O class instruction and once initiated,
channel operates independent of the CPU
Central
processing
unit (CPU)
Memory Bus
Peripheral devices
Memory
uni PD PD PD PD
t
Input-output
processor
(IOP I/O bus
)
Input/Output Organization 53
Send instruction
to test IOP.path
Transfer status word
to memory
If status OK, then send
start I/O instruction
to IOP. Access
for IOP program
memory
Continue