UNIT-5 IO Organization
UNIT-5 IO Organization
INPUT-OUTPUT ORGANIZATION
• Peripheral Devices
• Input-Output Interface
• Modes of Transfer
• Priority Interrupt
• Input-Output Processor
• Serial Communication
PERIPHERAL DEVICES
INPUT/OUTPUT INTERFACES
• -Data codes and formats in peripheral differ from the word format in the
CPU and memory
• - Operating Modes
• Peripherals - Autonomous, Asynchronous
• CPU or Memory - Synchronous
Keyboard
and Printer Magnetic Magnetic
display disk tape
terminal
There are three ways that computer buses can be used to communicate with
memory and I/O.
1. Some computer systems use two separate buses, one to communicate with
memory and the other with I/O interfaces
1. Use one common bus but separate control lines for each.
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
I/O INTERFACE
Port A I/O data
register
Bidirectional Bus
data bus buffers
Port B I/O data
register
The bits in the status register are used for status conditions
and for recording errors that may occur during the data
transfer.
Strobe pulse
- A strobe pulse is supplied by one unit to indicate the other unit when
the transfer has to occur
Handshaking
- A control signal is accompanied with each data being transmitted to
indicate the presence of data
-The receiving unit responds with another control
signal to acknowledge receipt of the data
Computer Organization Computer Architectures Lab
Input-Output Organization 20 Asynchronous Data Transfer
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
HANDSHAKING
Strobe Methods
Source-Initiated
The source unit that initiates the transfer has no way of knowing
whether the destination unit has actually received data
Destination-Initiated
Valid data
Data bus
Timing Diagram
Data valid
Data accepted
Data valid
Valid data
Data bus
1 1 0 0 0 1 0 1
Start Character bits Stop
bit bits
(1 bit) (at least 1 bit)
- When data are not being sent, the line is kept in the 1-state (idle state)
-The initiation of a character transmission is detected by a Start Bit ,
-which is always a 0.
- The character bits always follow the Start Bit
- After the last character , a Stop Bit is detected when
the line returns to the 1-state for at least 1 bit time
The receiver knows in advance the transfer rate of the bits and the number of
information bits to expect
Internal Bus
register control
and clock
Chip select CS
Register select 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
- 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
• Modes of Transfer
– Data transfer to and from peripherals may be handled
in a variety of modes.
1) Programmed I/O :
2) Interrupt-initiated I/O :
• Programmed I/O:
• Programmed I/O operations are the result of I/O instructions
written in the computer program.
• Each data item transfer is initiated by an instruction in the
program.
• Drawback: Transferring data under program control
requires monitoring of the peripherals by the CPU (Waste of
time)
• Interrupt initiate I/O:
• When the interface determines that the device is ready for
data transfer, it generates an interrupt request to the
computer. Then , the CPU momentarily stops the task its is
processing, branches to a service program to process the I/O
transfer, and then returns to the task it was originally
performing.
Computer Organization Computer Architectures Lab
Input-Output Organization 29
Status
I/O write F
register Data accepted
F = Flag bit
= 0
Flag
= 1
Operation no
complete ?
yes
Continue
with
program
Interrupt
BG Random access
CPU
memory (RAM)
BR
Read control
Write control
Data bus
Address bus
Address
select
RD WR Address Data
DMA acknowledge
DS
RS Direct memory I/O
access (DAM) Peripheral
BR controller device
DMA request
BG
Interrupt
Burst Transfer
• When the DMA takes control of the bus system, it
communicates directly with the memory.
• DMA burst transfer: a block sequence consisting of a
number of memory words is transferred in a continuous
burst.
• This mode of transfer is needed for fast devices such as
magnetic disks, where data transmission cannot be stopped
or slowed down until an entire block is transferred.
• Cycle stealing:
• It allows the DMA controller to transfer one data word at a
time(one memory cycle), after which it must return control
of the buses to the CPU.
DMA Initialization
• 1.The starting address of the memory block where data are
available (for read) or where data are to be stored (write).
• 2.The word count, which is the number of words in the
memory block.
• 3. Control to specify the mode of transfer such as read or
write.
• 4.A control to start the DMA transfer.
• The starting address is stored in the address register. The
word count is stored in the word count register, and the
control information in the control register.
• Once the DMA is initialized , the CPU stops
communicating with the DMA unless it receives an
interrupt signal or if it wants to check how many words
have been transferred.
VAD
» One stage of the daisy-chain priority
INTACK
PI
arrangement
Priority in : Fig. 11-13
Enable
Vector address
– Parallel Priority
Interrupt
to “1”
IEN 0 : Disable further interrupts Mask
register
– Software Routines
Address 현재 main program의 749 번지를 실행
» CPU가
도중에 KBD interrupt 발생 I/O service programs
Memory
» KBD0 service
JMP DISKprogram의DISK
255 번지를 실행 도중에
Program to service
magnetic disk
DISK
1 JMP PDR 발생
interrupt
2 JMP RDR PTR Program to service
line printer
3 JMP KBD
KBD Int. Here
749 RDR Program to service
character reader
750 Main program
KBD Program to service
Keyboard
Stack 256
256
750 DISK Int. Here
255
– Transfer Modes
» 1) Burst transfer : Block 단위 전송
» 2) Cycle stealing transfer : Byte 단위 전송
– DMA Controller ( Intel 8237 DMAC )Address
: Fig.bus11-17
» DMA Initialization Process
• 1) Set Address register : Data bus Address bus
Data bus buffers
– memory address for read/write buffers
Internal bus
• 3) Set transfer mode : DMA select CS Address register
Read control
» 4) DMAC sends a DMA acknowledge Write control
Data bus
to the I/O device Address bus
Peripheral devices
»Memory
Designed
unit
to handle the details
PD PD PD
ofPDI/O
processing
Input-output
processor (IOP) I/O bus
Information 전달 영역
Send instruction
Transfer status word
to test IOP path
• each processor leaves information for the other
to memory location
Message Center
If status OK. , send
start I/O instruction Access memory for
to IOP IOP program
Continue
– Start I/O, Start I/O fast release (less CPU time), (a) I/O instruction format
Test I/O, Clear I/O, Halt I/O, Halt device,
Test channel, Store channel ID
Key Address Status Count
» Channel Status Word : Fig. 11-21(b) (b) Channel status word format
• Always stored in Address 64 in memory
• Key : Protection used to prevent unauthorized Command
Data address Flags Count
access code
• Address : Last channel command word address (c) Channel command word format
used by channel
• Count : 0 (if successful transfer)
Computer Organization Computer Architectures Lab
Input-Output Organization 48
80
Same record
same device
8086
CPU Busy CCW TB address
8089
PB address Memory address
IOP
attention
Channel
Interrupt
program
Select
Bus System
Controller bus
Memory unit Byte count
Device address
Status
Interface Interface
– Data Link
» The communication lines, modems, and other
equipment used in the transmission of
information between two or more stations
– Data Link Protocol
» 1) Character-Oriented Protocol
SYN SYN SOH Header STX Text ETX BCC
» 2) Bit-Oriented Protocol
– Character-Oriented Protocol
» Message format for Character-Oriented
Protocol : Fig. 11-25
• TEXT : 전송할 내용
Computer Organization Computer Architectures Lab
Input-Output Organization 53
– Data Transparency
» Character-Oriented Protocol에서 Binary
Information을 전송하면, 이를 Control
Character로 오인하여 문제가 발생
» 따라서 Character-Oriented Protocol에서 Data
Transparency를 해결하기 위해서 DLE (Data Link
Escape) Character를 사용
– DLE
» Inserting a DLE character (bit pattern =
00010000) before each control character
• Exam) DLE ETX DLE SYN
Flag Address Control Information Frame check Flag
» 그러나
01111110 DLE
8 bits character
8 bits is inefficient
any number of bits 16 and
bits 01111110
somewhat complicated to implement
» 따라서 Bit-Oriented Protocol을 사용
Computer Organization Computer Architectures Lab
Input-Output Organization 54
» Zero Insertion
• Prevent a flag from occurring in the middle of a data frame
• Zero (0) is inserted by transmitting station after any succession of five
continuous 1’s
– Example of zero insertion
1 2 3
: 01111110 4
(data)5 011111010
6 7 8
Information transfer : 0 N S P/F N r
» Control Fields
• Ns : send frame count
• Nr : error free 한 receive frame count
• P/F :
– P = 1 : primary station is finished and ready for the secondary station
to respond
P = 0 : each frame sent to the secondary station from the primary
station
– F = 1 : secondary station sends the last frame
F = 0 : secondary station responds with a number of frame (when
primary station is finished)
• Code : type of command/response