SlideShare a Scribd company logo
1 of 57
Chapter 4. Input/Output
Organization
Computer Architecture and
Organization
Instructor: Mustafa Mohamed
1
Overview
 Computer has ability to exchange data with
other devices.
 Human-computer communication
 Computer-computer communication
 Computer-device communication
 …
2
Accessing I/O Devices
3
Single Bus
Processor Memory
I/O device 1 I/O de
vice n
Bus
Figure 4.1. A single-bus structure.
4
Memory-Mapped I/O
 When I/O devices and the memory share the same
address space, the arrangement is called memory-
mapped I/O.
 Any machine instruction that can access memory
can be used to transfer data to or from an I/O device.
Move DATAIN, R0
Move R0, DATAOUT
 Some processors have special In and Out
instructions to perform I/O transfer.
5
Interface
I/O
Bus
Address lines
Data lines
Control lines
Figure 4.2. I/O interface for an input device.
interf ace
decoder
Address Data and
status registers
Control
circuits
Input dev ice
6
Program-Controlled I/O
 I/O devices operate at speeds that are very
much different from that of the processor.
 Keyboard, for example, is very slow.
 It needs to make sure that only after a
character is available in the input buffer of the
keyboard interface; also, this character must
be read only once.
7
Three Major Mechanisms
 Program-controlled I/O – processor polls the
device.
 Interrupt
 Direct Memory Access (DMA)
8
Interrupts
9
Overview
 In program-controlled I/O, the program enters
a wait loop in which it repeatedly tests the
device status. During the period, the
processor is not performing any useful
computation.
 However, in many situations other tasks can
be performed while waiting for an I/O device
to become ready.
 Let the device alert the processor.
10
Enabling and Disabling
Interrupts
 Since the interrupt request can come at any
time, it may alter the sequence of events from
that envisaged by the programmer.
 Interrupts must be controlled.
11
Enabling and Disabling
Interrupts
 The interrupt request signal will be active until
it learns that the processor has responded to
its request. This must be handled to avoid
successive interruptions.
 Let the interrupt be disabled/enabled in the interrupt-
service routine.
 Let the processor automatically disable interrupts before
starting the execution of the interrupt-service routine.
12
Handling Multiple Devices
 How can the processor recognize the device requesting an
interrupt?
 Given that different devices are likely to require different
interrupt-service routines, how can the processor obtain the
starting address of the appropriate routine in each case?
 (Vectored interrupts)
 Should a device be allowed to interrupt the processor while
another interrupt is being serviced?
 (Interrupt nesting)
 How should two or more simultaneous interrupt requests be
handled?
 (Daisy-chain)
13
Vectored Interrupts
 A device requesting an interrupt can identify
itself by sending a special code to the
processor over the bus.
 Interrupt vector
 Avoid bus collision
14
Interrupt Nesting
 Simple solution: only accept one interrupt at a time, then disable
all others.
 Problem: some interrupts cannot be held too long.
 Priority structure
Priority arbitration
Dev ice 1 Dev ice 2 Dev ice
p
circuit
Processor
Figure 4.7. Implementation of interrupt priority using individual
INTA1
INTR1 I NTRp
INTAp
interrupt-request and acknowledge lines.
15
Simultaneous Requests
Figure 4.8. Interrupt priority schemes.
(b) Arrangement of priority groups
Dev ice Dev ice
circuit
Priority arbitration
Processor
Dev ice Dev ice
(a) Daisy chain
Processor
Dev ice 2
I NTR
INTA
I NTR1
INTR p
INTA1
INTAp
Dev icen
Dev ice 1
16
Controlling Device Requests
 Some I/O devices may not be allowed to
issue interrupt requests to the processor.
 At device end, an interrupt-enable bit in a
control register determines whether the
device is allowed to generate an interrupt
request.
 At processor end, either an interrupt enable
bit in the PS register or a priority structure
determines whether a given interrupt request
will be accepted.
17
Exceptions
 Recovery from errors
 Debugging
 Trace
 Breakpoint
 Privilege exception
18
Use of Interrupts in Operating
Systems
 The OS and the application program pass
control back and forth using software
interrupts.
 Supervisor mode / user mode
 Multitasking (time-slicing)
 Process – running, runnable, blocked
 Program state
19
Processor Examples
20
Condition
Codes
Interrupt
Priority
Superv isor
Trace
T S X N Z V C
0
1
2
3
4
8
10
13
15
Figure 4.14.Processor status re
gister in the 68000 processor
.
21
Main program
MOVE.L #LINE,PNTR Initialize buffer pointer.
CLR EOL Clearend-of-lineindicator.
ORI.B #4,CONTR
OL Set bit KEN.
MOVE #$100,SR Setprocessorpriority to1.
.
.
.
Interrupt-serviceroutine
READ MOVEM.L A0/D0, (A7) Saveregisters
A0, D0 onstac
k.
MOVEA.L PNTR,A0 Load addresspointer.
MOVE.B DATAIN,D0 Get input character.
MOVE.B D0,(A0)+ Store it in memorybuffer.
MOVE.L A0,PNTR Updatepointer.
CMPI.B #$0D,D0 Chec
k if CarriageReturn.
BNE RTRN
MOVE #1,EOL Indicateend of line.
ANDI.B #$FB,CONTR
OL Clearbit KEN.
RTRN MOVEM.L (A7)+,A0/D0 RestoreregistersD0, A0.
RTE
Figure 4.15. A 68000 interrupt-service routine to read an input line from a keyboard based on Figure 4.9.
–
22
Direct Memory Access
23
DMA
 Think about the overhead in both polling and
interrupting mechanisms when a large block of data
need to be transferred between the processor and
the I/O device.
 A special control unit may be provided to allow
transfer of a block of data directly between an
external device and the main memory, without
continuous intervention by the processor – direct
memory access (DMA).
 The DMA controller provides the memory address
and all the bus signals needed for data transfer,
increment the memory address for successive
words, and keep track of the number of transfers.
24
DMA Procedure
 Processor sends the starting address, the number of
data, and the direction of transfer to DMA controller.
 Processor suspends the application program
requesting DMA, starts DMA transfer, and starts
another program.
 After the DMA transfer is done, DMA controller
sends an interrupt signal to the processor.
 The processor puts the suspended program in the
Runnable state.
25
DMA Register
Done
IE
IRQ
Status and control
Starting address
Word count
W
R/
31 30 1 0
Figure 4.18.Registers in a DMA interf
ace.
26
System
Figure 4.19.Use of DMA controllers in a computer system.
memory
Processor
Key board
Sy stem b
us
Main
Interf
ace
Netw
ork
Disk/DMA
controller Printer
DMA
controller
Disk
Disk
27
Memory Access
 Memory access by the processor and the
DMA controller are interwoven.
 DMA device has higher priority.
 Among all DMA requests, top priority is given
to high-speed peripherals.
 Cycle stealing
 Block (burst) mode
 Data buffer
 Conflicts
28
Bus Arbitration
 The device that is allowed to initiate data
transfers on the bus at any given time is
called the bus master.
 Bus arbitration is the process by which the
next device to become the bus master is
selected and bus mastership is transferred to
it.
 Need to establish a priority system.
 Two approaches: centralized and distributed
29
Centralized Arbitration
Processor
DMA
controller
1
DMA
controller
2
BG1 BG2
BR
BBSY
Figure 4.20. A simple arrangement for b
us arbitration using a daisy chain.
30
Centralized Arbitration
BBSY
BG1
BG2
Bus
master
BR
Processor DMA controller 2 Processor
Figure 4.21.Sequence of signals during transfer of b
us mastership
for the de
vices in Figure 4.20.
Time
31
Distributed Arbitration
Figure 4.22. A distributed arbitration scheme.
Interf ace circuit
f or dev ice A
0 1 0 1 0 1 1 1
O.C.
Vcc
Start-Arbitration
ARB0
ARB1
ARB2
ARB3
32
Buses
33
Overview
 The primary function of a bus is to provide a
communications path for the transfer of data.
 A bus protocol is the set of rules that govern the
behavior of various devices connected to the bus as
to when to place information on the bus, assert
control signals, etc.
 Three types of bus lines: data, address, control
 The bus control signals also carry timing information.
 Bus master (initiator) / slave (target)
34
Synchronous Bus Timing
Figure 4.23. Timing of an input transfer on a synchronous bus.
Bus cy cle
Data
Bus clock
command
Address and
t0 t1 t2
Time
35
Synchronous Bus Detailed
Timing
Figure 4.24.A detailed timing diagram for the input transfer of Figure 4.23.
Data
Bus clock
command
Address and
t0 t1
t2
command
Address and
Data
Seen by master
Seen by sla
ve
tAM
tAS
tDS
tDM
Time
36
Multiple-Cycle Transfers
Figure 4.25.An input transfer using multiple clock c
ycles.
1 2 3 4
Clock
Address
Command
Data
Sla
ve-ready
Time
37
Asynchronous Bus – Handshaking
Protocol for Input Operation
Figure 4.26. Handshake control of data transfer during an input operation.
Slav e-ready
Data
Master-ready
and command
Address
Bus cy cle
t1 t2 t3 t4 t5
t0
Time
38
Asynchronous Bus – Handshaking
Protocol for Output Operation
Figure 4.27. Handshake control of data transfer during an output operation.
Bus cy cle
Data
Master-ready
Slav e-ready
and command
Address
t1 t2 t3 t4 t5
t0
Time
39
Discussion
 Trade-offs
 Simplicity of the device interface
 Ability to accommodate device interfaces that introduce
different amounts of delay
 Total time required for a bus transfer
 Ability to detect errors resulting from addressing a
nonexistent device or from an interface malfunction
 Asynchronous bus is simpler to design.
 Synchronous bus is faster.
40
Interface Circuits
41
Function of I/O Interface
 Provide a storage buffer for at least one word of
data;
 Contain status flags that can be accessed by the
processor to determine whether the buffer is full or
empty;
 Contain address-decoding circuitry to determine
when it is being addressed by the processor;
 Generate the appropriate timing signals required by
the bus control scheme;
 Perform any format conversion that may be
necessary to transfer data between the bus and the
I/O device.
42
Parallel Port
 A parallel port transfers data in the form of a
number of bits, typically 8 or 16,
simultaneously to or from the device.
 For faster communications
43
Parallel Port – Input Interface (Keyboard
to Processor Connection)
Valid
Data
Key board
switches
Encoder
and
debouncing
circuit
SIN
Input
interface
Data
Address
R /
Master
-ready
Sla
ve-ready
W
DATAIN
Processor
Figure 4.28. Keyboard to processor connection.
44
45
Parallel Port – Input Interface (Keyboard
to Processor Connection)
46
Parallel Port – Output Interface
(Printer to Processor Connection)
CPU SOUT
Output
interface
Data
Address
R /
Master
-eady
Slave-ready
Valid
W
Data
DATAOUT
Figure 4.31.Printer to processor connection.
Printer
Processor
Idle
47
48
DATAIN
1
SIN
Ready
A31
A1
A0
Address
decoder
D7
D0
R/ W
Figure 4.33. Combined input/output interface circuit.
A2
DATAOUT
Input
status
Bus
PA7
PA0
CA
PB7
PB0
CB1
CB2
SOUT
D1
RS1
RS0
My-address
Handshak
e
control
Master
-
Ready
Slave-
49
Figure 4.34.A general 8-bit parallel interf
ace.
50
Recall the Timing Protocol
Figure 4.25.An input transfer using multiple clock c
ycles.
1 2 3 4
Clock
Address
Command
Data
Sla
ve-ready
Time
51
Handshak
e
control
DATAOUT
Printer
data
Idle
Valid
Read Load
SOUT
ready
A31
A1
A0
Address
decoder
D7 Q7
D0 Q0
D7
D0
Figure 4.35. A parallel point interface for the bus of Figure 4.25,
with a state-diagram for the timing logic.
status data
D1 Q1
D0
Timing
Logic
Clock
My-address
R/W
Sla
ve-
Idle Respond
My-address
Go
Go=1
52
Serial Port
 A serial port is used to connect the processor
to I/O devices that require transmission of
data one bit at a time.
 The key feature of an interface circuit for a
serial port is that it is capable of
communicating in bit-serial fashion on the
device side and in a bit-parallel fashion on
the bus side.
 Capable of longer distance communication
than parallel transmission.
53
54
Standard I/O
Interfaces
55
Overview
 The needs for standardized interface signals
and protocols.
 Motherboard
 Bridge: circuit to connect two buses
 Expansion bus
 ISA, PCI, SCSI, USB,…
56
memory
Processor
Bridge
Processor b
us
PCI b
us
Main
memory
Additional
controller
CD-ROM
controller
Disk
Disk 1 Disk 2 ROM
CD-
SCSI
controller
USB
controller
Video
Ke
yboard Game
disk
IDE
SCSI b
us
Figure 4.38. An example of a computer system using different interface standards.
ISA
interface
Ethernet
interface
57

More Related Content

Similar to 8555046.ppt

Direct Memory Access & Interrrupts
Direct Memory Access & InterrruptsDirect Memory Access & Interrrupts
Direct Memory Access & InterrruptsSharmilaChidaravalli
 
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptxUNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptxLeahRachael
 
420214730-15cs34-module-2-pptx.pptx
420214730-15cs34-module-2-pptx.pptx420214730-15cs34-module-2-pptx.pptx
420214730-15cs34-module-2-pptx.pptxddscraft123
 
CO--MODULE-1 (b) - Input-Output-Organization.pptx
CO--MODULE-1 (b) - Input-Output-Organization.pptxCO--MODULE-1 (b) - Input-Output-Organization.pptx
CO--MODULE-1 (b) - Input-Output-Organization.pptxahmedsalik057
 
Unit 5 I/O organization
Unit 5   I/O organizationUnit 5   I/O organization
Unit 5 I/O organizationchidabdu
 
CH03-COA10e_ComputerFun5656565656565ction.pdf
CH03-COA10e_ComputerFun5656565656565ction.pdfCH03-COA10e_ComputerFun5656565656565ction.pdf
CH03-COA10e_ComputerFun5656565656565ction.pdfcauuthovohoaichau
 
discuss the drawbacks of programmed and interrupt driven io and des.pdf
discuss the drawbacks of programmed and interrupt driven io and des.pdfdiscuss the drawbacks of programmed and interrupt driven io and des.pdf
discuss the drawbacks of programmed and interrupt driven io and des.pdfinfo998421
 
Input output in computer Orgranization and architecture
Input output in computer Orgranization and architectureInput output in computer Orgranization and architecture
Input output in computer Orgranization and architecturevikram patel
 
Chapter 5 IO Unit.pptx we are electrical
Chapter 5 IO Unit.pptx we are electricalChapter 5 IO Unit.pptx we are electrical
Chapter 5 IO Unit.pptx we are electricalbayisabayecha51
 
Dma and dma controller 8237
Dma and dma controller 8237Dma and dma controller 8237
Dma and dma controller 8237Ashwini Awatare
 

Similar to 8555046.ppt (20)

Bc0040
Bc0040Bc0040
Bc0040
 
Direct Memory Access & Interrrupts
Direct Memory Access & InterrruptsDirect Memory Access & Interrrupts
Direct Memory Access & Interrrupts
 
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptxUNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
 
Isa bus nptel
Isa bus nptelIsa bus nptel
Isa bus nptel
 
420214730-15cs34-module-2-pptx.pptx
420214730-15cs34-module-2-pptx.pptx420214730-15cs34-module-2-pptx.pptx
420214730-15cs34-module-2-pptx.pptx
 
CO--MODULE-1 (b) - Input-Output-Organization.pptx
CO--MODULE-1 (b) - Input-Output-Organization.pptxCO--MODULE-1 (b) - Input-Output-Organization.pptx
CO--MODULE-1 (b) - Input-Output-Organization.pptx
 
I/O Channel IBM 370
I/O Channel IBM 370I/O Channel IBM 370
I/O Channel IBM 370
 
Unit 5 I/O organization
Unit 5   I/O organizationUnit 5   I/O organization
Unit 5 I/O organization
 
Chapter 6
Chapter 6Chapter 6
Chapter 6
 
CH03-COA10e_ComputerFun5656565656565ction.pdf
CH03-COA10e_ComputerFun5656565656565ction.pdfCH03-COA10e_ComputerFun5656565656565ction.pdf
CH03-COA10e_ComputerFun5656565656565ction.pdf
 
discuss the drawbacks of programmed and interrupt driven io and des.pdf
discuss the drawbacks of programmed and interrupt driven io and des.pdfdiscuss the drawbacks of programmed and interrupt driven io and des.pdf
discuss the drawbacks of programmed and interrupt driven io and des.pdf
 
I/O System
I/O SystemI/O System
I/O System
 
Lecture 9.pptx
Lecture 9.pptxLecture 9.pptx
Lecture 9.pptx
 
Io pro
Io proIo pro
Io pro
 
IO organization.ppt
IO organization.pptIO organization.ppt
IO organization.ppt
 
Input output in computer Orgranization and architecture
Input output in computer Orgranization and architectureInput output in computer Orgranization and architecture
Input output in computer Orgranization and architecture
 
Chapter 5 IO Unit.pptx we are electrical
Chapter 5 IO Unit.pptx we are electricalChapter 5 IO Unit.pptx we are electrical
Chapter 5 IO Unit.pptx we are electrical
 
Co notes
Co notesCo notes
Co notes
 
Dma and dma controller 8237
Dma and dma controller 8237Dma and dma controller 8237
Dma and dma controller 8237
 
Unit 5
Unit 5Unit 5
Unit 5
 

Recently uploaded

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxAnaBeatriceAblay2
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 

Recently uploaded (20)

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 

8555046.ppt

  • 1. Chapter 4. Input/Output Organization Computer Architecture and Organization Instructor: Mustafa Mohamed 1
  • 2. Overview  Computer has ability to exchange data with other devices.  Human-computer communication  Computer-computer communication  Computer-device communication  … 2
  • 4. Single Bus Processor Memory I/O device 1 I/O de vice n Bus Figure 4.1. A single-bus structure. 4
  • 5. Memory-Mapped I/O  When I/O devices and the memory share the same address space, the arrangement is called memory- mapped I/O.  Any machine instruction that can access memory can be used to transfer data to or from an I/O device. Move DATAIN, R0 Move R0, DATAOUT  Some processors have special In and Out instructions to perform I/O transfer. 5
  • 6. Interface I/O Bus Address lines Data lines Control lines Figure 4.2. I/O interface for an input device. interf ace decoder Address Data and status registers Control circuits Input dev ice 6
  • 7. Program-Controlled I/O  I/O devices operate at speeds that are very much different from that of the processor.  Keyboard, for example, is very slow.  It needs to make sure that only after a character is available in the input buffer of the keyboard interface; also, this character must be read only once. 7
  • 8. Three Major Mechanisms  Program-controlled I/O – processor polls the device.  Interrupt  Direct Memory Access (DMA) 8
  • 10. Overview  In program-controlled I/O, the program enters a wait loop in which it repeatedly tests the device status. During the period, the processor is not performing any useful computation.  However, in many situations other tasks can be performed while waiting for an I/O device to become ready.  Let the device alert the processor. 10
  • 11. Enabling and Disabling Interrupts  Since the interrupt request can come at any time, it may alter the sequence of events from that envisaged by the programmer.  Interrupts must be controlled. 11
  • 12. Enabling and Disabling Interrupts  The interrupt request signal will be active until it learns that the processor has responded to its request. This must be handled to avoid successive interruptions.  Let the interrupt be disabled/enabled in the interrupt- service routine.  Let the processor automatically disable interrupts before starting the execution of the interrupt-service routine. 12
  • 13. Handling Multiple Devices  How can the processor recognize the device requesting an interrupt?  Given that different devices are likely to require different interrupt-service routines, how can the processor obtain the starting address of the appropriate routine in each case?  (Vectored interrupts)  Should a device be allowed to interrupt the processor while another interrupt is being serviced?  (Interrupt nesting)  How should two or more simultaneous interrupt requests be handled?  (Daisy-chain) 13
  • 14. Vectored Interrupts  A device requesting an interrupt can identify itself by sending a special code to the processor over the bus.  Interrupt vector  Avoid bus collision 14
  • 15. Interrupt Nesting  Simple solution: only accept one interrupt at a time, then disable all others.  Problem: some interrupts cannot be held too long.  Priority structure Priority arbitration Dev ice 1 Dev ice 2 Dev ice p circuit Processor Figure 4.7. Implementation of interrupt priority using individual INTA1 INTR1 I NTRp INTAp interrupt-request and acknowledge lines. 15
  • 16. Simultaneous Requests Figure 4.8. Interrupt priority schemes. (b) Arrangement of priority groups Dev ice Dev ice circuit Priority arbitration Processor Dev ice Dev ice (a) Daisy chain Processor Dev ice 2 I NTR INTA I NTR1 INTR p INTA1 INTAp Dev icen Dev ice 1 16
  • 17. Controlling Device Requests  Some I/O devices may not be allowed to issue interrupt requests to the processor.  At device end, an interrupt-enable bit in a control register determines whether the device is allowed to generate an interrupt request.  At processor end, either an interrupt enable bit in the PS register or a priority structure determines whether a given interrupt request will be accepted. 17
  • 18. Exceptions  Recovery from errors  Debugging  Trace  Breakpoint  Privilege exception 18
  • 19. Use of Interrupts in Operating Systems  The OS and the application program pass control back and forth using software interrupts.  Supervisor mode / user mode  Multitasking (time-slicing)  Process – running, runnable, blocked  Program state 19
  • 21. Condition Codes Interrupt Priority Superv isor Trace T S X N Z V C 0 1 2 3 4 8 10 13 15 Figure 4.14.Processor status re gister in the 68000 processor . 21
  • 22. Main program MOVE.L #LINE,PNTR Initialize buffer pointer. CLR EOL Clearend-of-lineindicator. ORI.B #4,CONTR OL Set bit KEN. MOVE #$100,SR Setprocessorpriority to1. . . . Interrupt-serviceroutine READ MOVEM.L A0/D0, (A7) Saveregisters A0, D0 onstac k. MOVEA.L PNTR,A0 Load addresspointer. MOVE.B DATAIN,D0 Get input character. MOVE.B D0,(A0)+ Store it in memorybuffer. MOVE.L A0,PNTR Updatepointer. CMPI.B #$0D,D0 Chec k if CarriageReturn. BNE RTRN MOVE #1,EOL Indicateend of line. ANDI.B #$FB,CONTR OL Clearbit KEN. RTRN MOVEM.L (A7)+,A0/D0 RestoreregistersD0, A0. RTE Figure 4.15. A 68000 interrupt-service routine to read an input line from a keyboard based on Figure 4.9. – 22
  • 24. DMA  Think about the overhead in both polling and interrupting mechanisms when a large block of data need to be transferred between the processor and the I/O device.  A special control unit may be provided to allow transfer of a block of data directly between an external device and the main memory, without continuous intervention by the processor – direct memory access (DMA).  The DMA controller provides the memory address and all the bus signals needed for data transfer, increment the memory address for successive words, and keep track of the number of transfers. 24
  • 25. DMA Procedure  Processor sends the starting address, the number of data, and the direction of transfer to DMA controller.  Processor suspends the application program requesting DMA, starts DMA transfer, and starts another program.  After the DMA transfer is done, DMA controller sends an interrupt signal to the processor.  The processor puts the suspended program in the Runnable state. 25
  • 26. DMA Register Done IE IRQ Status and control Starting address Word count W R/ 31 30 1 0 Figure 4.18.Registers in a DMA interf ace. 26
  • 27. System Figure 4.19.Use of DMA controllers in a computer system. memory Processor Key board Sy stem b us Main Interf ace Netw ork Disk/DMA controller Printer DMA controller Disk Disk 27
  • 28. Memory Access  Memory access by the processor and the DMA controller are interwoven.  DMA device has higher priority.  Among all DMA requests, top priority is given to high-speed peripherals.  Cycle stealing  Block (burst) mode  Data buffer  Conflicts 28
  • 29. Bus Arbitration  The device that is allowed to initiate data transfers on the bus at any given time is called the bus master.  Bus arbitration is the process by which the next device to become the bus master is selected and bus mastership is transferred to it.  Need to establish a priority system.  Two approaches: centralized and distributed 29
  • 30. Centralized Arbitration Processor DMA controller 1 DMA controller 2 BG1 BG2 BR BBSY Figure 4.20. A simple arrangement for b us arbitration using a daisy chain. 30
  • 31. Centralized Arbitration BBSY BG1 BG2 Bus master BR Processor DMA controller 2 Processor Figure 4.21.Sequence of signals during transfer of b us mastership for the de vices in Figure 4.20. Time 31
  • 32. Distributed Arbitration Figure 4.22. A distributed arbitration scheme. Interf ace circuit f or dev ice A 0 1 0 1 0 1 1 1 O.C. Vcc Start-Arbitration ARB0 ARB1 ARB2 ARB3 32
  • 34. Overview  The primary function of a bus is to provide a communications path for the transfer of data.  A bus protocol is the set of rules that govern the behavior of various devices connected to the bus as to when to place information on the bus, assert control signals, etc.  Three types of bus lines: data, address, control  The bus control signals also carry timing information.  Bus master (initiator) / slave (target) 34
  • 35. Synchronous Bus Timing Figure 4.23. Timing of an input transfer on a synchronous bus. Bus cy cle Data Bus clock command Address and t0 t1 t2 Time 35
  • 36. Synchronous Bus Detailed Timing Figure 4.24.A detailed timing diagram for the input transfer of Figure 4.23. Data Bus clock command Address and t0 t1 t2 command Address and Data Seen by master Seen by sla ve tAM tAS tDS tDM Time 36
  • 37. Multiple-Cycle Transfers Figure 4.25.An input transfer using multiple clock c ycles. 1 2 3 4 Clock Address Command Data Sla ve-ready Time 37
  • 38. Asynchronous Bus – Handshaking Protocol for Input Operation Figure 4.26. Handshake control of data transfer during an input operation. Slav e-ready Data Master-ready and command Address Bus cy cle t1 t2 t3 t4 t5 t0 Time 38
  • 39. Asynchronous Bus – Handshaking Protocol for Output Operation Figure 4.27. Handshake control of data transfer during an output operation. Bus cy cle Data Master-ready Slav e-ready and command Address t1 t2 t3 t4 t5 t0 Time 39
  • 40. Discussion  Trade-offs  Simplicity of the device interface  Ability to accommodate device interfaces that introduce different amounts of delay  Total time required for a bus transfer  Ability to detect errors resulting from addressing a nonexistent device or from an interface malfunction  Asynchronous bus is simpler to design.  Synchronous bus is faster. 40
  • 42. Function of I/O Interface  Provide a storage buffer for at least one word of data;  Contain status flags that can be accessed by the processor to determine whether the buffer is full or empty;  Contain address-decoding circuitry to determine when it is being addressed by the processor;  Generate the appropriate timing signals required by the bus control scheme;  Perform any format conversion that may be necessary to transfer data between the bus and the I/O device. 42
  • 43. Parallel Port  A parallel port transfers data in the form of a number of bits, typically 8 or 16, simultaneously to or from the device.  For faster communications 43
  • 44. Parallel Port – Input Interface (Keyboard to Processor Connection) Valid Data Key board switches Encoder and debouncing circuit SIN Input interface Data Address R / Master -ready Sla ve-ready W DATAIN Processor Figure 4.28. Keyboard to processor connection. 44
  • 45. 45
  • 46. Parallel Port – Input Interface (Keyboard to Processor Connection) 46
  • 47. Parallel Port – Output Interface (Printer to Processor Connection) CPU SOUT Output interface Data Address R / Master -eady Slave-ready Valid W Data DATAOUT Figure 4.31.Printer to processor connection. Printer Processor Idle 47
  • 48. 48
  • 49. DATAIN 1 SIN Ready A31 A1 A0 Address decoder D7 D0 R/ W Figure 4.33. Combined input/output interface circuit. A2 DATAOUT Input status Bus PA7 PA0 CA PB7 PB0 CB1 CB2 SOUT D1 RS1 RS0 My-address Handshak e control Master - Ready Slave- 49
  • 50. Figure 4.34.A general 8-bit parallel interf ace. 50
  • 51. Recall the Timing Protocol Figure 4.25.An input transfer using multiple clock c ycles. 1 2 3 4 Clock Address Command Data Sla ve-ready Time 51
  • 52. Handshak e control DATAOUT Printer data Idle Valid Read Load SOUT ready A31 A1 A0 Address decoder D7 Q7 D0 Q0 D7 D0 Figure 4.35. A parallel point interface for the bus of Figure 4.25, with a state-diagram for the timing logic. status data D1 Q1 D0 Timing Logic Clock My-address R/W Sla ve- Idle Respond My-address Go Go=1 52
  • 53. Serial Port  A serial port is used to connect the processor to I/O devices that require transmission of data one bit at a time.  The key feature of an interface circuit for a serial port is that it is capable of communicating in bit-serial fashion on the device side and in a bit-parallel fashion on the bus side.  Capable of longer distance communication than parallel transmission. 53
  • 54. 54
  • 56. Overview  The needs for standardized interface signals and protocols.  Motherboard  Bridge: circuit to connect two buses  Expansion bus  ISA, PCI, SCSI, USB,… 56
  • 57. memory Processor Bridge Processor b us PCI b us Main memory Additional controller CD-ROM controller Disk Disk 1 Disk 2 ROM CD- SCSI controller USB controller Video Ke yboard Game disk IDE SCSI b us Figure 4.38. An example of a computer system using different interface standards. ISA interface Ethernet interface 57