SlideShare a Scribd company logo
1 of 17
1/
/faculty of Electrical Engineering
eindhoven university of technology
Introduction
Part 3: Input/output and co-processors
dr.ir. A.C. Verschueren
Eindhoven University of Technology
Section of Digital Information Systems
1/
/faculty of Electrical Engineering
eindhoven university of technology
What IS communication?
• For a computer to do any useful work,
it must communicate with its surroundings
'Communication' consists out of two things
1) Information transfer
2) Synchronisation
• These may be present in variable amounts,
from pure (continuous) information transfer
to pure synchronisation
• First, clear a common misconception...
no user interface  no communication
1/
/faculty of Electrical Engineering
eindhoven university of technology
address
0
7
address
decoder
addr
‘Memory mapped’ input/output
• Addresses in memory space are used to access the
I/O ports with normal memory read/writes
– More ports possible by extra address decoding
input port
output port
1
memory
CPU input
output
memory
4
'real'
data data
data
data
addr
addr
read read
read
write
write
write
4..7 select
0
select
1
select
1/
/faculty of Electrical Engineering
eindhoven university of technology
Separate input/output (address) space
• The CPU uses extra control signals (and
special instructions) to access input and
output ports
– More ports possible by adding control signals or
by using the address bus to encode port
addresses
CPU
memory
input
output
data data
data
data
read
read
in read
write
write
addr
addr
out
write
1/
/faculty of Electrical Engineering
eindhoven university of technology
Ports and synchronisation
• Input ports transfer data to the processor data
bus
• Output ports 'latch' (remember) the data
provided by the processor between output
accesses
• Synchronisation of data transfer can be done
– Use separate output port bits as synchronisation
signal
– Use read/write/in/out signals for synchronisation
– Receiving synchronisation signals via input port bits
1/
/faculty of Electrical Engineering
eindhoven university of technology
Receiving synchronisation signals
• It is much better to let the synchronisation
signal itself inform the CPU that it has become
activated !
– Add hardware to the CPU which 'listens' to a
synchronisation signal
– When activity is detected, this hardware...
1)Stops whatever the CPU was doing
2)Handles the synchronisation signal by calling a subroutine
– At return from this subroutine, the program which
was running is continued as if nothing has happened
• This forms the basis of the 'interrupt'
mechanism
1/
/faculty of Electrical Engineering
eindhoven university of technology
Basic interrupt hardware and
operation
• An input pin on the CPU is checked at the end
of handling each instruction
– The PC is saved and a JUMP (to a specific
address) is performed if this pin is found to be
active
– At the end of the interrupt routine, the PC must be
restored to continue with the interrupted program
– The interrupt routine should not modify storage
locations (memory AND registers) used by this
program
…unless they form the communication medium
between the interrupt routine and the program !
1/
/faculty of Electrical Engineering
eindhoven university of technology
Saving & restoring PC and other
registers
• Use separate register sets for the main
program and the interrupt routines
– Limited number of interrupts, no recursion possible
+ Extremely fast switching, interrupt 'tasks' possible
• Save register set in fixed memory locations
– Much slower switching, no recursion possible
+ Simple hardware if most of work done in software
• Save register set on the stack
– Still slow in switching
+ Recursion possible, can use existing hardware
(for CALL, RET, PUSH, POP)
1/
/faculty of Electrical Engineering
eindhoven university of technology
Where to start the interrupt routine ?
• At hardware-fixed locations in program
memory
– Very inflexible, number of interrupts limited
+ Relatively simple hardware
• External logic provides start address (input
port)
– Complex hardware outside the CPU
+ Can be very flexible, simple hardware in CPU
• Use a table in memory indexed by interrupt
nr.
– Special hardware in CPU (moderate complexity)
1/
/faculty of Electrical Engineering
eindhoven university of technology
Importance of interrupts
• Not all interrupts are equally important
1)Interrupt routines may not be interrupted by less
important ones
– If a less important interrupt occurs, this must be
remembered so that its routine can be started
a.s.a.p.
2)Interrupt routines must be interruptable by more
important ones
• Most CPU’s automatically disable ALL
interrupts when an interrupt routine is started
We need much ‘finer’ control than that !
1/
/faculty of Electrical Engineering
eindhoven university of technology
Remembering, masking & prioritising
• Hardware should remember an interrupt’s
occurrence until it is actually handled
– May be part of I/O synchronisation hardware
• Must be possible to 'mask' (disable) interrupts
individually
– Software controlled mask bits via an output port
– Mask bits can be controlled completely by
hardware
• Hardware should 'prioritise' interrupts to
select the most important non-masked one
Possible, but very slow in
software !
1/
/faculty of Electrical Engineering
eindhoven university of technology
‘Traps’: interrupts from within the
CPU
• Generated when instructions encounter an
error
– Arithmetic errors, f.i.: overflow, divide by zero
• These traps can be seen as the hardware basis for
'exceptions'
– Hardware errors, f.i.:
memory fault, accessed device does not respond
• Traps and interrupts have some small
differences
– During trap handling, most interrupts remain
enabled
– A trap handler is an extension of the running
This is sometimes very difficult
1/
/faculty of Electrical Engineering
eindhoven university of technology
request
grant
CPU
I/O
HW
Reducing I/O handling time even
further
• Interrupts still require a lot of software (= time!) to
move data between memory and a port
– Save time by allowing I/O hardware to access memory
directly, without assistance of the CPU
This is called 'Direct Memory Access' (DMA)
CPU has bus
memory
DMArequest DMArequest
DMAgrant DMAgrant
read read
write write
data data
address address
CPU releases
I/O HW has bus
CPU takes bus back
1/
/faculty of Electrical Engineering
eindhoven university of technology
The ‘intelligence’ of DMA
• DMA can be used to create and/or read
complex data structures without bothering the
CPU
– This requires a lot of 'intelligence' in the I/O
hardware
– Still requires an interrupt to signal the main program
• Concurrent I/O needs multiple DMA 'channels’
– Same functionality needed as for handling multiple
interrupts (remembering, masking and prioritising)
But this time, it has to be all in hardware !
1/
/faculty of Electrical Engineering
eindhoven university of technology
Co-processors: divide and conquer
• A ’co-processor' is hardware which takes over
(software) functions from the main CPU
This increases the speed of the system as a
whole
– The CPU has fewer functions to perform
– Co-processors can use customised (fast) hardware
instead of standard hardware running software
• Co-processors should not bother the CPU
– Use DMA to transfer data, commands and results
– Use interrupts to signal important things only
interrupts may run in both directions !
1/
/faculty of Electrical Engineering
eindhoven university of technology
’Loosely coupled' co-processors
• Have no connection with main CPU instructions
– May even execute their own programs !
– Commanded by explicit I/O actions from the CPU or
command blocks in memory (with an ‘attention’
signal)
– Returns results through memory or explicit I/O
actions after interrupting the main CPU
Used to off-load complete I/O related tasks from the main CPU
(for instance the device drivers in an O.S.)
Also used to speed complex data processing tasks if the
co-processor contains better hardware than the CPU
1/
/faculty of Electrical Engineering
eindhoven university of technology
’Closely coupled' co-processors
• Keep track of instructions executed by main
CPU
– Are actually controlled by these instructions
• Some instructions are treated as 'no-operation' by main
CPU
• These trigger the co-processor to start a specific operation
– Data transfer is done with DMA
• The address may be provided by main CPU using a
'dummy' read cycle during execution of the 'no-operation'
instruction
– Result codes transferred with DMA or special I/O
ports

More Related Content

Similar to I_O-co-processors.ppt

I/o management and disk scheduling .pptx
I/o management and disk scheduling .pptxI/o management and disk scheduling .pptx
I/o management and disk scheduling .pptxwebip34973
 
Input_Output_Organization.pptx
Input_Output_Organization.pptxInput_Output_Organization.pptx
Input_Output_Organization.pptxSherinRappai
 
Computer System Overview,
Computer System Overview, Computer System Overview,
Computer System Overview, Sajid Marwat
 
Pipeline & Nonpipeline Processor
Pipeline & Nonpipeline ProcessorPipeline & Nonpipeline Processor
Pipeline & Nonpipeline ProcessorSmit Shah
 
computer organization and architecture notes
computer organization and architecture notescomputer organization and architecture notes
computer organization and architecture notesUpasana Talukdar
 
Report in SAD
Report in SADReport in SAD
Report in SADjesseledm
 
Computer architecture input output organization
Computer architecture input output organizationComputer architecture input output organization
Computer architecture input output organizationMazin Alwaaly
 
Computer organization-and-architecture-questions-and-answers
Computer organization-and-architecture-questions-and-answersComputer organization-and-architecture-questions-and-answers
Computer organization-and-architecture-questions-and-answersappasami
 
What is operating system
What is operating systemWhat is operating system
What is operating systemSuvithak
 
Principle of Computer Operation.ppt
Principle of Computer Operation.pptPrinciple of Computer Operation.ppt
Principle of Computer Operation.pptAbdulRehman703897
 

Similar to I_O-co-processors.ppt (20)

ch1.pptx
ch1.pptxch1.pptx
ch1.pptx
 
Chap 3 CA.pptx
Chap 3 CA.pptxChap 3 CA.pptx
Chap 3 CA.pptx
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
I/o management and disk scheduling .pptx
I/o management and disk scheduling .pptxI/o management and disk scheduling .pptx
I/o management and disk scheduling .pptx
 
Input_Output_Organization.pptx
Input_Output_Organization.pptxInput_Output_Organization.pptx
Input_Output_Organization.pptx
 
Computer System Overview,
Computer System Overview, Computer System Overview,
Computer System Overview,
 
IO_ORGANIZATION.pdf
IO_ORGANIZATION.pdfIO_ORGANIZATION.pdf
IO_ORGANIZATION.pdf
 
Pipeline & Nonpipeline Processor
Pipeline & Nonpipeline ProcessorPipeline & Nonpipeline Processor
Pipeline & Nonpipeline Processor
 
computer organization and architecture notes
computer organization and architecture notescomputer organization and architecture notes
computer organization and architecture notes
 
Computer system
Computer systemComputer system
Computer system
 
Unit 6
Unit 6Unit 6
Unit 6
 
Report in SAD
Report in SADReport in SAD
Report in SAD
 
Computer architecture input output organization
Computer architecture input output organizationComputer architecture input output organization
Computer architecture input output organization
 
Computer organization-and-architecture-questions-and-answers
Computer organization-and-architecture-questions-and-answersComputer organization-and-architecture-questions-and-answers
Computer organization-and-architecture-questions-and-answers
 
What is operating system
What is operating systemWhat is operating system
What is operating system
 
Principle of Computer Operation.ppt
Principle of Computer Operation.pptPrinciple of Computer Operation.ppt
Principle of Computer Operation.ppt
 
Ch 01 os8e
Ch 01  os8eCh 01  os8e
Ch 01 os8e
 
Mikroprosessor system
Mikroprosessor systemMikroprosessor system
Mikroprosessor system
 
ESSENTIAL of (CS/IT/IS)
ESSENTIAL of (CS/IT/IS)ESSENTIAL of (CS/IT/IS)
ESSENTIAL of (CS/IT/IS)
 
I/O Organization
I/O OrganizationI/O Organization
I/O Organization
 

Recently uploaded

litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdflitvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdfAlexander Litvinenko
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Ramkumar k
 
一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样
一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样
一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样A
 
Developing a smart system for infant incubators using the internet of things ...
Developing a smart system for infant incubators using the internet of things ...Developing a smart system for infant incubators using the internet of things ...
Developing a smart system for infant incubators using the internet of things ...IJECEIAES
 
Augmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptxAugmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptxMustafa Ahmed
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...josephjonse
 
Basics of Relay for Engineering Students
Basics of Relay for Engineering StudentsBasics of Relay for Engineering Students
Basics of Relay for Engineering Studentskannan348865
 
Path loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata ModelPath loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata ModelDrAjayKumarYadav4
 
analog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxanalog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxKarpagam Institute of Teechnology
 
Databricks Generative AI Fundamentals .pdf
Databricks Generative AI Fundamentals  .pdfDatabricks Generative AI Fundamentals  .pdf
Databricks Generative AI Fundamentals .pdfVinayVadlagattu
 
一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书
一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书
一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书c3384a92eb32
 
Artificial Intelligence in due diligence
Artificial Intelligence in due diligenceArtificial Intelligence in due diligence
Artificial Intelligence in due diligencemahaffeycheryld
 
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...Amil baba
 
Circuit Breakers for Engineering Students
Circuit Breakers for Engineering StudentsCircuit Breakers for Engineering Students
Circuit Breakers for Engineering Studentskannan348865
 
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisSeismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisDr.Costas Sachpazis
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxkalpana413121
 
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024EMMANUELLEFRANCEHELI
 
SLIDESHARE PPT-DECISION MAKING METHODS.pptx
SLIDESHARE PPT-DECISION MAKING METHODS.pptxSLIDESHARE PPT-DECISION MAKING METHODS.pptx
SLIDESHARE PPT-DECISION MAKING METHODS.pptxCHAIRMAN M
 
handbook on reinforce concrete and detailing
handbook on reinforce concrete and detailinghandbook on reinforce concrete and detailing
handbook on reinforce concrete and detailingAshishSingh1301
 
DBMS-Report on Student management system.pptx
DBMS-Report on Student management system.pptxDBMS-Report on Student management system.pptx
DBMS-Report on Student management system.pptxrajjais1221
 

Recently uploaded (20)

litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdflitvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样
一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样
一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样
 
Developing a smart system for infant incubators using the internet of things ...
Developing a smart system for infant incubators using the internet of things ...Developing a smart system for infant incubators using the internet of things ...
Developing a smart system for infant incubators using the internet of things ...
 
Augmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptxAugmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptx
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
 
Basics of Relay for Engineering Students
Basics of Relay for Engineering StudentsBasics of Relay for Engineering Students
Basics of Relay for Engineering Students
 
Path loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata ModelPath loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata Model
 
analog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxanalog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptx
 
Databricks Generative AI Fundamentals .pdf
Databricks Generative AI Fundamentals  .pdfDatabricks Generative AI Fundamentals  .pdf
Databricks Generative AI Fundamentals .pdf
 
一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书
一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书
一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书
 
Artificial Intelligence in due diligence
Artificial Intelligence in due diligenceArtificial Intelligence in due diligence
Artificial Intelligence in due diligence
 
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
 
Circuit Breakers for Engineering Students
Circuit Breakers for Engineering StudentsCircuit Breakers for Engineering Students
Circuit Breakers for Engineering Students
 
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisSeismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptx
 
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
 
SLIDESHARE PPT-DECISION MAKING METHODS.pptx
SLIDESHARE PPT-DECISION MAKING METHODS.pptxSLIDESHARE PPT-DECISION MAKING METHODS.pptx
SLIDESHARE PPT-DECISION MAKING METHODS.pptx
 
handbook on reinforce concrete and detailing
handbook on reinforce concrete and detailinghandbook on reinforce concrete and detailing
handbook on reinforce concrete and detailing
 
DBMS-Report on Student management system.pptx
DBMS-Report on Student management system.pptxDBMS-Report on Student management system.pptx
DBMS-Report on Student management system.pptx
 

I_O-co-processors.ppt

  • 1. 1/ /faculty of Electrical Engineering eindhoven university of technology Introduction Part 3: Input/output and co-processors dr.ir. A.C. Verschueren Eindhoven University of Technology Section of Digital Information Systems
  • 2. 1/ /faculty of Electrical Engineering eindhoven university of technology What IS communication? • For a computer to do any useful work, it must communicate with its surroundings 'Communication' consists out of two things 1) Information transfer 2) Synchronisation • These may be present in variable amounts, from pure (continuous) information transfer to pure synchronisation • First, clear a common misconception... no user interface  no communication
  • 3. 1/ /faculty of Electrical Engineering eindhoven university of technology address 0 7 address decoder addr ‘Memory mapped’ input/output • Addresses in memory space are used to access the I/O ports with normal memory read/writes – More ports possible by extra address decoding input port output port 1 memory CPU input output memory 4 'real' data data data data addr addr read read read write write write 4..7 select 0 select 1 select
  • 4. 1/ /faculty of Electrical Engineering eindhoven university of technology Separate input/output (address) space • The CPU uses extra control signals (and special instructions) to access input and output ports – More ports possible by adding control signals or by using the address bus to encode port addresses CPU memory input output data data data data read read in read write write addr addr out write
  • 5. 1/ /faculty of Electrical Engineering eindhoven university of technology Ports and synchronisation • Input ports transfer data to the processor data bus • Output ports 'latch' (remember) the data provided by the processor between output accesses • Synchronisation of data transfer can be done – Use separate output port bits as synchronisation signal – Use read/write/in/out signals for synchronisation – Receiving synchronisation signals via input port bits
  • 6. 1/ /faculty of Electrical Engineering eindhoven university of technology Receiving synchronisation signals • It is much better to let the synchronisation signal itself inform the CPU that it has become activated ! – Add hardware to the CPU which 'listens' to a synchronisation signal – When activity is detected, this hardware... 1)Stops whatever the CPU was doing 2)Handles the synchronisation signal by calling a subroutine – At return from this subroutine, the program which was running is continued as if nothing has happened • This forms the basis of the 'interrupt' mechanism
  • 7. 1/ /faculty of Electrical Engineering eindhoven university of technology Basic interrupt hardware and operation • An input pin on the CPU is checked at the end of handling each instruction – The PC is saved and a JUMP (to a specific address) is performed if this pin is found to be active – At the end of the interrupt routine, the PC must be restored to continue with the interrupted program – The interrupt routine should not modify storage locations (memory AND registers) used by this program …unless they form the communication medium between the interrupt routine and the program !
  • 8. 1/ /faculty of Electrical Engineering eindhoven university of technology Saving & restoring PC and other registers • Use separate register sets for the main program and the interrupt routines – Limited number of interrupts, no recursion possible + Extremely fast switching, interrupt 'tasks' possible • Save register set in fixed memory locations – Much slower switching, no recursion possible + Simple hardware if most of work done in software • Save register set on the stack – Still slow in switching + Recursion possible, can use existing hardware (for CALL, RET, PUSH, POP)
  • 9. 1/ /faculty of Electrical Engineering eindhoven university of technology Where to start the interrupt routine ? • At hardware-fixed locations in program memory – Very inflexible, number of interrupts limited + Relatively simple hardware • External logic provides start address (input port) – Complex hardware outside the CPU + Can be very flexible, simple hardware in CPU • Use a table in memory indexed by interrupt nr. – Special hardware in CPU (moderate complexity)
  • 10. 1/ /faculty of Electrical Engineering eindhoven university of technology Importance of interrupts • Not all interrupts are equally important 1)Interrupt routines may not be interrupted by less important ones – If a less important interrupt occurs, this must be remembered so that its routine can be started a.s.a.p. 2)Interrupt routines must be interruptable by more important ones • Most CPU’s automatically disable ALL interrupts when an interrupt routine is started We need much ‘finer’ control than that !
  • 11. 1/ /faculty of Electrical Engineering eindhoven university of technology Remembering, masking & prioritising • Hardware should remember an interrupt’s occurrence until it is actually handled – May be part of I/O synchronisation hardware • Must be possible to 'mask' (disable) interrupts individually – Software controlled mask bits via an output port – Mask bits can be controlled completely by hardware • Hardware should 'prioritise' interrupts to select the most important non-masked one Possible, but very slow in software !
  • 12. 1/ /faculty of Electrical Engineering eindhoven university of technology ‘Traps’: interrupts from within the CPU • Generated when instructions encounter an error – Arithmetic errors, f.i.: overflow, divide by zero • These traps can be seen as the hardware basis for 'exceptions' – Hardware errors, f.i.: memory fault, accessed device does not respond • Traps and interrupts have some small differences – During trap handling, most interrupts remain enabled – A trap handler is an extension of the running This is sometimes very difficult
  • 13. 1/ /faculty of Electrical Engineering eindhoven university of technology request grant CPU I/O HW Reducing I/O handling time even further • Interrupts still require a lot of software (= time!) to move data between memory and a port – Save time by allowing I/O hardware to access memory directly, without assistance of the CPU This is called 'Direct Memory Access' (DMA) CPU has bus memory DMArequest DMArequest DMAgrant DMAgrant read read write write data data address address CPU releases I/O HW has bus CPU takes bus back
  • 14. 1/ /faculty of Electrical Engineering eindhoven university of technology The ‘intelligence’ of DMA • DMA can be used to create and/or read complex data structures without bothering the CPU – This requires a lot of 'intelligence' in the I/O hardware – Still requires an interrupt to signal the main program • Concurrent I/O needs multiple DMA 'channels’ – Same functionality needed as for handling multiple interrupts (remembering, masking and prioritising) But this time, it has to be all in hardware !
  • 15. 1/ /faculty of Electrical Engineering eindhoven university of technology Co-processors: divide and conquer • A ’co-processor' is hardware which takes over (software) functions from the main CPU This increases the speed of the system as a whole – The CPU has fewer functions to perform – Co-processors can use customised (fast) hardware instead of standard hardware running software • Co-processors should not bother the CPU – Use DMA to transfer data, commands and results – Use interrupts to signal important things only interrupts may run in both directions !
  • 16. 1/ /faculty of Electrical Engineering eindhoven university of technology ’Loosely coupled' co-processors • Have no connection with main CPU instructions – May even execute their own programs ! – Commanded by explicit I/O actions from the CPU or command blocks in memory (with an ‘attention’ signal) – Returns results through memory or explicit I/O actions after interrupting the main CPU Used to off-load complete I/O related tasks from the main CPU (for instance the device drivers in an O.S.) Also used to speed complex data processing tasks if the co-processor contains better hardware than the CPU
  • 17. 1/ /faculty of Electrical Engineering eindhoven university of technology ’Closely coupled' co-processors • Keep track of instructions executed by main CPU – Are actually controlled by these instructions • Some instructions are treated as 'no-operation' by main CPU • These trigger the co-processor to start a specific operation – Data transfer is done with DMA • The address may be provided by main CPU using a 'dummy' read cycle during execution of the 'no-operation' instruction – Result codes transferred with DMA or special I/O ports