Asynchronous Data Transfer Modes of Transfer Priority Interrupt Direct Memory Access Input-Output Processor Serial Communication
Asynchronous Data Transfer Modes of Transfer Priority Interrupt Direct Memory Access Input-Output Processor Serial Communication
Asynchronous Data Transfer Modes of Transfer Priority Interrupt Direct Memory Access Input-Output Processor Serial Communication
Overview
Peripheral Devices
Input-Output Interface
Asynchronous Data Transfer
Modes of Transfer
Priority Interrupt
Direct Memory Access
Input-Output Processor
Serial Communication
Input/Output Organization
Input/Output Organization
Peripheral Devices
Input/Output Organization
Peripheral Devices
Input Devices
Keyboard
Optical input devices
- Card Reader
- Paper Tape Reader
- Bar code reader
- Optical Mark Reader
Magnetic Input Devices
- Magnetic Stripe Reader
Screen Input Devices
- Touch Screen
- Light Pen
- Mouse
Output Devices
Card Puncher, Paper Tape Puncher
CRT
Printer (Daisy Wheel, Dot Matrix, Laser)
Plotter
Input/Output Organization
Input/Output Organization
I/O Interface
Input/Output Organization
10
Data
Address
Control
Processor
Interface
Interface
Interface
Interface
Keyboard
and
display
terminal
Printer
Magnetic
disk
Magnetic
tape
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
11
Input/Output Organization
12
(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
13
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
-> reduces memory address range available
- No specific input or output instruction
-> The same memory reference instructions can
be used for I/O transfers
- Considerable flexibility in handling I/O operations
Input/Output Organization
14
I/O Interface
Bidirectional
Register select
Register select
I/O read
I/O write
Programmable Interface
CS
RS1
RS0
RD
Timing
and
Control
Internal bus
Chip select
I/O data
Port B
register
I/O data
Bus
buffers
data bus
CPU
Port A
register
Control
register
Status
register
WR
CS RS1 RS0
0
x
x
1
0
0
1
0
1
1
1
0
1
1
1
Control
I/O
Device
Status
Register selected
None - data bus in high-impedence
Port A register
Port B register
Control register
Status register
- Information in each port can be assigned a meaning depending on the mode of operation of the
I/O device Port A = Data; Port B = Command;
- CPU initializes(loads) each port by transferring a byte to the Control Register
Allows CPU can define the mode of operation of each port
Programmable Port: By changing the bits in the control register, it is possible to change the
interface characteristics
Input/Output Organization
Lecture 36
15
Peripheral Devices
Input-Output Interface
Asynchronous Data Transfer
Modes of Transfer
Priority Interrupt
Direct Memory Access
Input-Output Processor
Timeout : If the return handshake signal does not respond within a given time period,
the unit assumes that an error has occurred.
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
S ta rt
b it
C h a r a c te r b its
S to p
b it
Input/Output Organization
24
Bus
buffers
CS
RS
I/O read
I/O write
RD
WR
Timing
and
Control
Internal Bus
Chip select
Transmitter
register
Control
register
Shift
register
Transmit
data
Transmitter Transmitter
clock
control
and clock
Status
register
Receiver
control
and clock
Receiver
register
Shift
register
Receiver
clock
Receive
data
CS
0
1
1
1
1
RS
x
0
1
0
1
Oper.
x
WR
WR
RD
RD
Register selected
None
Transmitter registe
Control register
Receiver register
Status 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
Overview
Peripheral Devices
Input-Output Interface
Asynchronous Data Transfer
Modes of Transfer
Priority Interrupt
Direct Memory Access
Input-Output Processor
Modes of Transfer
Binary information received from external device is usually
stored in memory.
Information transferred from central computer into an external
device originates in the memory unit.
The CPU merely execute I/O instructions and may accept data
temporarily but ultimate source or destination is the Memory Unit.
Data transfer between central computer and I/O devices may be
handled in a variety of modes. Some modes use CPU as
intermediate path and others transfer data directly to and from
memory unit.
Data Transfer to or from peripheral can be handled in one of
three possible modes :
Programmed I/O
Interrupt-Initiated I/O
Direct Memory Access (DMA)
Input/output Organization
27
Data bus
Address bus
CPU
Data register
I/O read
I/O write
Status
register F
I/O bus
Data valid
I/O
device
Data accepted
flag
=0
=1
Read data register
Transfer data to memory
no
Operation
complete?
yes
Continue with
program
Programmed I/O
- Programmed I/O operations are the result of I/O
Instructions written in computer program. Each data item
transfer is initiated by an instruction in the program.
- Usually, transfer is to and from a CPU register to
peripheral. Other instructions are needed to transfer data
to and from CPU and Memory
- Transferring data under program control requires
constant monitoring of the peripheral by CPU.
Interrupted I/O
DMA
Priority Interrupts
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
another is being serviced
- Higher priority interrupts can make requests while servicing a lower priority
interrupt
Priority Interrupts
Priority Interrupt by Software (Polling)
Polling procedure is used to identify highest priority source by software
means
- common branch address for all the interrupts
- Priority is established by the order of polling the devices(interrupt sources)
- highest priority device is tested first and if interrupt is on , control
branches to service routine for this source otherwise next lower priority
source is tested
- Flexible since it is established by software
- Low cost since it needs a very little hardware
- Very slow
- if there are many interrupt time required to poll may exceed time available to
service IO device
Priority Interrupts
VAD 1
Device 1
PI
PO
Device 2
PI
PO
VAD 3
Device 3
PI
PO
Interrupt request
To next
device
INT
CPU
Interrupt acknowledge
INTACK
Interrupt register
Disk
I0
Printer
I1
Reader
Keyboard
0
Mask
register
1
2
3
Priority
I 2 encoder
I3
IEN
VAD
to CPU
0
IST
0
0
Enable
Interrupt
to CPU
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
Priority Encoder
Determines the highest priority interrupt when
more than one interrupts take place
Priority Encoder Truth table
Inputs
I0 I1 I2
1 d
0 1
0 0
0 0
0 0
I3
d
d
1
0
0
Outputs
d
d
d
1
0
IST
Boolean functions
0
0
1
1
d
0
1
0
1
d
1
1
1
1
0
x = I0' I1'
y = I0' I1 + I0 I2
(IST) = I0 + I1 + I2 + I3
Interrupt Cycle
At the end of each Instruction cycle
- CPU checks IEN and IST
- If IEN IST = 1, CPU -> Interrupt Cycle
SP SP - 1
M[SP] PC
INTACK 1
PC VAD
IEN 0
Go To Fetch
VAD=00000011
KBD
interrupt
JMP DISK
JMP PTR
JMP RDR
JMP KBD
Main program
1
749
750
11
2
DISK
PTR
Program to service
line printer
RDR
Program to service
character reader
current instr.
Stack
KBD
5
256
750
Program to service
magnetic disk
Disk
interrupt
Program to service
keyboard
255
256
6
10
9
Initial and Final Operations
Each interrupt service routine must have an initial and final set of
operations for controlling the registers in the hardware interrupt system
Initial Sequence
Final Sequence
[1] Clear lower level Mask reg. bits [1] IEN <- 0
[2] IST <- 0
[2] Restore CPU registers
[3] Save contents of CPU registers
[3] Clear the bit in the Interrupt Reg
[4] IEN <- 1
[4] Set lower level Mask reg. bits
[5] Go to Interrupt Service Routine [5] Restore return address, IEN <- 1
Input/Output Organization
42
Overview
Peripheral Devices
Input-Output Interface
Asynchronous Data Transfer
Modes of Transfer
Priority Interrupt
Direct Memory Access
Input-Output Processor
Input/Output Organization
44
Bus granted
BG
CPU
Address bus
Data bus
Read
Write
Data bus
Address register:
Contains an address to specify
Desired location in memory DMA select
Word count register
Read
Holds no. of words to be transferred
Write
Control register
Bus request
Specifies the mode of transfer
Bus grant
Interrupt
Data bus
buffers
DS
RS
RD
WR Control
logic
BR
Address bus
buffers
Internal Bus
Bus request
ABUS
DBUS
RD
WR
Address register
Word count register
Control register
BG
Interrupt
DMA request
DMA acknowledge
to I/O device
Input/Output Organization
45
Input/Output Organization
46
CPU initializes the DMA by sending following information through data bus:
(1) Starting address of the memory block (for read/write)
(2) Word Count (no. of words in memory block)
(3) Control to specify mode of transfer (E.g. read/write)
(4) A control to start DMA Transfer
Input/Output Organization
48
DMA Transfer
Interrupt
BG
Random-access
memory unit (RAM)
CPU
BR
RD
WR
Addr
Data
RD
WR
Addr
Data
Read control
Write control
Data bus
Address bus
Address
select
RD
WR
Addr
DMA ack.
DS
RS
BR
BG
Interrupt
Data
I/O
Peripheral
device
DMA
Controller
DMA request
Input/Output Organization
49
Memory Bus
I/O bus
Input/Output Organization
50
IOP operations
Access memory
for IOP program
Conduct I/O transfers
using DMA;
Prepare status report.
I/O transfer completed;
Interrupt CPU