Professional Documents
Culture Documents
Input-Output Organization:
Peripheral Devices, Input Output Interface, Data Transfer Schemes, Program Control and
Interrupts, Direct Memory Access Transfer and Input/Output Processor, Priority interrupt, Direct
memory access transfer, Input/Output processor, Modes of data transfer, Processor Status Word
Content
´ Peripheral Devices
´ Priority interrupt
´ Input/Output processor
´ Input-Output Subsystem
´ Provides an efficient mode of communication between the central system and the outside
environment
´ Programs and data must be entered into computer memory for processing and
results obtained from computer must be recorded and displayed to user
´ When input transferred via slow keyboard, processor will be idle most of the time
waiting for information to arrive
´ Magnetic tapes, disks
Peripheral Devices
´ Input or output devices attached to the computer are also referred – Peripherals
´ Devices that are under direct control of computer are said to be connected on-line
A. Touch screen
B. CRT
C. LCD
D. All of the above
Which of the following is a Peripheral
device
A. Touch screen
B. CRT
C. LCD
D. All of the above
Peripheral Devices
Input Devices Output Devices
´ Keyboard ´ Puncher
´ Card Puncher
´ Optical Input devices
´ Paper Tape Puncher
´ Card Reader
´ Paper Tape Reader
´ Display (Screen)
´ Bar Code Reader
´ CRT, LCD, LED
´ Optical Mark Reader
´ Magnetic Input Devices
´ Printer
´ Magnetic Stripe Reader
´ Daisy Wheel
´ Screen Input Devices ´ Dot Matrix
´ Touch Screen ´ Laser
´ Light Pen
´ Mouse ´ Plotter
Card puncher is a
A. Input device
B. Output device
C. Both A and B
D. None of the above
Card puncher is a
A. Input device
B. Output device
C. Both A and B
D. None of the above
Input Output Organization
Keyboard
and Printer Magnetic Magnetic
display disk tape
terminal
´ Interface:
´ Synchronizes the data flow and supervises
´ Transfer rate between peripheral and CPU or Memory (Data Formats)
´ Provides signals for the peripheral controller
´ Decodes the device address (device code)
´ Decodes the commands (operation)
Four types of command interface can receive: control, status, data output and data input
Input–Output Interface
´ Device address
´ Peripheral controller
´ Both A and B
´ None of the above
Which of the following is Correct about
Input–Output (I/O) interface
´ Device address
´ Peripheral controller
´ Both A and B
´ None of the above
I/O Bus and Interface
´ Control command
´ is issued to activate peripheral and to inform what to do
´ Status command
´ used to test various status condition in the interface and the peripherals
´ Control
´ Status
´ Data
´ All of the above
Which of the following is a example of
I/O command
´ Control
´ Status
´ Data
´ All of the above
I/O versus Memory Bus
´ Functions of Buses
´ MEMORY BUS is for information transfers between CPU and the Memory
´ I/O BUS is for information transfers between CPU and I/O devices through their I/O interface
´ Advantage
´ Full memory space is
available as I/O is Isolated
´ Disadvantage
´ Special instruction
´ Difficult for programming
Memory Mapped I/O
´ Common bus(data and address) and control lines are common for I/O and
memory
´ I/O devices and memory shares same address space, addressing
capability of memory become less
´ Single set of instructions for Read/Write for both I/O and Memory (eg. MOV)
´ Advantage
´ Single set of instructions
´ More user friendly
´ Disadvantage
´ Reduces memory address
range
Differences between memory mapped I/O and isolated I/O
Internal bus
Chip select I/O
CPU CS
Register select Control Device
RS1 Control
Register select Timing register
RS0 and
I/O read Control
RD Status
I/O write Status
WR 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
Content
´ Peripheral Devices
´ Priority interrupt
´ Input/Output processor
´ 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
´ 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
´ No Acknowledgement
Strobe I/O
CPU
Interface
Source Initiated using Handshaking
Destination Initiated using Handshaking
Advantage of Handshaking
´ 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” (One or two Stop bits).
1 1 0 0 0 1 0 1
Start Stop
Character bits
bit bit
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
CS
1 1 WR Control register Register select Status Receiver Receiver
RS Timing
register control clock
1 0 RD Receiver register and
I/O read and clock
RD
1 1 RD Status register Control
I/O write Receive
WR Receiver Shift data
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 (Parity Error, Framing Error and Overrun Error)
Control Register Bits
´ Define baud rate, no. of bits in each character, whether to generate and check parity, and no. of stop bits
Content
´ Peripheral Devices
´ Priority interrupt
´ Input/Output processor
´ Priority interrupt
´ Input/Output processor
Interrupts
´ Interrupt is a request from H/W device or S/W program for immediate service by processor
´ After Interrupt is generated, processor transfer the request to execute Interrupt Service
Routine (ISR) using Interrupt Handler
´ The status of the processor (Content of PC, Registers, PSW) is saved in the memory
´ ISR is completed, the saved states of processor is restored
Advantages Disadvantages
´ Efficiency of CPU is improved ´ Overhead required to service the interrupt (Interrupt Latency )
´ Save status of processor and restore it
Types of Interrupts
´ External interrupts – External Interrupts initiated from the outside of CPU and
Memory
´ I/O Device → Data transfer request or Data transfer complete
´ Timing Device → Timeout
´ Power Failure
´ Operator
´ Internal interrupts (traps) – Internal Interrupts are caused by the currently running
program
´ Register, Stack Overflow
´ Divide by zero
´ OP-code Violation
´ Protection Violation
´ Software Interrupts – Both External and Internal Interrupts are initiated by the
computer HW. Software Interrupts are initiated by the executing an instruction.
´ Supervisor Call
1. Switching from a user mode to the supervisor mode
2. Allows to execute a certain class of operations which are not allowed in the user mode
Vectored and Non-Vectored Interrupt
´ Ways the processor chooses the branch address of the service routine varies from one unit
to another. There are two methods
´ Non-Vectored Interrupt:
´ Branch address is assigned to a fixed location in memory
´ Device doesn’t provide the address of ISR
´ Vectored Interrupt:
´ Source (device) that interrupts, supplies the branch information to the computer – Interrupt Vector
´ Mostly used when CPU has multiple peripherals connected to system bus
In some computers the interrupt vector is the first address of I/O service routine
In other computers the interrupt vector is an address that points to the location in the memory
where the beginning address of I/O service routine is stored
Interrupt Initiated I/O
´ CPU constantly monitors the FLAG to let the interface inform the computer when it’s
ready to transfer
´ CPU proceeds to execute another programs and interface keeps monitoring the FLAG
´ When device is ready for transfer – generate interrupts
´ Detecting external interrupt signal – CPU stops the task momentarily and process I/O
data transfer and then resumes the original task it was performing
Advantage
´ Waiting period of CPU is ideally eliminated
Flag, Processor Status Word
´ In Basic Computer, the processor had several (status) flags – 1 bit value that
indicated various information about the processor’s state – E, FGI, FGO, I,
IEN, R
´ In some processors, flags like these are often combined into a register – the
Processor Status Register (PSR); sometimes called a Processor Status Word
(PSW)
´ Common flags in PSW are
Status Flag Circuit
´ C (Carry): Set to 1 if the carry out of the ALU is 1
A B
´ S (Sign): The MSB bit of the ALU’s output (F7) 8 8
c7
´ Z (Zero): Set to 1 if the ALU’s output is all 0’s
8-bit ALU
c8
´ V (Overflow): Set to 1 if there is an overflow F7 - F0
V Z S C
F7
Check for 8
zero output
F
Priority Interrupt
´ Data transfer between the CPU and an I/O device is initiated by CPU
´ Multiple I/O devices are connected to Computer
´ Priority Interrupt – System that establish priority, to determine which condition to be
serviced first when multiple Interrupt requests arrive simultaneously
´ Higher priority – High speed transfers (Magnetic Disks)
´ Lower priority – Lower speed (Keyboard)
´ Two method for priority interrupt
´ Software – Polling
´ Hardware
´ Serial Priority Interrupt – Serial connection
´ Parallel Priority Interrupt – Parallel connection
Interrupt–Initiated I/O VAD 1 VAD 2 VAD 3
´ Interrupt generated by any device – signals low state interrupt line (INTR )
´ CPU responds by enabling Interrupt Acknowledgement (INTACK) line
´ If device has requested the interrupt (PI=1)– Places the Vector Address (VAD) on the Bus
´ Blocks the further transfer of interrupt by PO=0 (PI=1 and PO=0) Highest Priority Device
´ If the device has not requested the interrupt
´ Passes the INTACK signal to the next device i.e. (PI=1 and PO=1)
´ This process continues unless appropriate device is found
´ If device get PI=0 generate PO=0 (INTACK has be blocked by the higher priority device)is
one with highest priority requesting interrupt
Working of Daisy Chain Priority Interrupt
One Stage of Daisy Chain Priority
0
If PI=1 and PO =0 , then
A. Interrupt is activated
B. No Interrupt
C. Interrupt ACK passed to next device
D. Invalid Interrupt
If PI=1 and PO =0 , then
A. Interrupt is activated
B. No Interrupt
C. Interrupt ACK passed to next device
D. Invalid Interrupt
Parallel Priority Interrupts
Interrupt register Bus
Buffer
Disk 0 I0 y
´ IEN: Set or Clear by instructions ION or IOF Printer 1 I1 x
Priority 0
´ IST: Represents an unmasked interrupt has Reader 2 encoder
I2
occurred. INTACK enables tristate Bus Buffer to 0 VAD
load VAD generated by the Priority Logic Keyboard 3 0 to CPU
I3
0
0
0 IEN IST
0
Mask
register 1 Enable
2
Interrupt
to CPU
3
INTACK
Interrupt Register: from CPU
´ 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
Inputs Outputs
6 9 10
´ Each interrupt service routine must have an initial and final set of operations for
controlling the registers in the hardware interrupt system
´ Priority interrupt
´ Input/Output processor
Direct Memory Access (DMA)
´ Allows I/O devices to transfer data directly to/from Memory without CPU intervention
´ 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) Address bus
Internal Bus
WR Write RS
Read RD Word count register
Address register: Write WR
Control
logic
Contains an address to specify Control register
Bus request BR
Desired location in memory
Word count register Bus grant BG
Holds no. of words to be transferred Interrupt Interrupt DMA request
Control register DMA acknowledge to I/O device
Specifies the mode of transfer
Direct Memory Access
RD and WR is bidirectional
´ When BG=0 CPU can communicate with DMA Register
´ When BG=1 CPU left the buses and DMA can communicate directly with memory
DMA is first initialized by CPU. After that DMA starts and continues to transfer data
between memory and peripheral unit until an entire block is transferred.
CPU initializes the DMA by sending following information through data bus:
Read control
Write control
Data bus
Address bus
Address
select
RD WR Addr Data
DS DMA ack.
RS I/O
DMA
Peripheral
BR Controller
device
BG DMA request
Interrupt
Content
´ Peripheral Devices
´ Priority interrupt
´ Input/Output processor
I/O Processor (IOP)
Channel
´ Processor with direct memory access capability that communicates with I/O devices
´ IOP is same as CPU – Designed to handle I/O processing
´ Unlike DMA Controller, IOP can fetch and execute its own instruction
´ IOP Instructions (Commands) specially designed to facilitate I/O transfer.(Additional function like
Arithmetic, Logic, Branching and code translation)
´ 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
unit PD PD PD PD
Input-output
processor
(IOP) I/O bus
Channel CPU Communication
CPU operations IOP operations
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