Академический Документы
Профессиональный Документы
Культура Документы
INTERRUPTS
ECE 445 Computer Organization
Dr. Craig Lorie
Electrical and Computer Engineering
Lecture #16
Spring 2016
Learning Objectives
Interrupts, exceptions, and traps.
Maskable and non-maskable interrupts.
Non-vectored, vectored, and auto-vectored interrupts.
Interrupt priorities.
Interrupt handling and interrupt service routines (ISR).
Spring 2016
Assigned Reading
H/P 4.9
Spring 2016
INTERRUPTS
Interrupts, exceptions, and traps.
Maskable and non-maskable interrupts.
Non-vectored and vectored interrupts.
Interrupt priorities.
Spring 2016
Interrupts
An interrupt is a signal, generated by hardware or software, to
Interrupts
2. Exceptions
3. Traps
1.
Handling a Discontinuity
Spring 2016
Spring 2016
Interrupts
An event caused by an external (I/O) device.
A device, such as the keyboard or mouse, requests service.
A hardware device fails (i.e. hardware failure).
An external signal (from the device to the processor) indicates
Spring 2016
Exceptions
An event generated internally by the processor.
The result of an erroneous condition encountered during
program execution.
Divide-by-zero.
Illegal instruction.
Spring 2016
Traps
An event generated internally by the processor.
Also known as a software interrupt.
The program requests service from the system
For example, to communicate with the disk controller.
System call
Uses special (i.e. privileged) instructions.
An internal signal indicates the occurrence of a trap.
The operating system must handle traps.
Traps cannot be handled by the executing program.
Spring 2016
10
Non-maskable Interrupts
Cannot be masked (or disabled).
Thus, non-maskable interrupts are always serviced.
They are reserved for system critical events.
Spring 2016
Interrupt Handling
1.
2.
3.
4.
5.
6.
11
Spring 2016
12
Detecting Interrupts
Exceptions
Illegal instructions are detected by the control unit.
Arithmetic overflow (V) is detected by the ALU.
Traps
A trap is detected when a system call (i.e. special instruction) is executed.
Interrupts (external)
Additional signals must be included in the datapath to support interrupts.
Interrupt Request (IRQ or INTR)
Interrupt Acknowledge (IACK or INTA)
Detecting a Discontinuity
Spring 2016
13
Detecting a Discontinuity
The processor should check for interrupts only after
the current instruction has completed execution.
The processor samples the INT line to determine if
there is a pending interrupt.
If there is a pending interrupt it must be handled.
If not, the processor continues executing program
instructions normally.
Spring 2016
14
Decode
INT = no
Execute
INT = yes
INT
15
Spring 2016
16
Introduction to Embedded Systems using Microcontrollers and the MSP430; Jimenez, Palomera, Couvertier; p. 305
Spring 2016
17
Spring 2016
18
Spring 2016
19
Spring 2016
20
Spring 2016
21
Spring 2016
22
Spring 2016
23
Spring 2016
24
Introduction to Embedded Systems using Microcontrollers and the MSP430; Jimenez, Palomera, Couvertier; p. 307
Spring 2016
25
Introduction to Embedded Systems using Microcontrollers and the MSP430; Jimenez, Palomera, Couvertier; p. 309
Handling Interrupts
Spring 2016
26
Cascaded Interrupts
Disable interrupts while handling the first.
However, processor must be able to handle
multiple interrupts.
So, disable interrupts while in INT state.
should be disabled implicitly by hardware.
Spring 2016
27
Spring 2016
MIPS (MULTI-CYCLE)
Interrupt (exception) handling.
28
Spring 2016
29
MIPS (Multi-Cycle)
The multi-cycle implementation of the MIPS processor has
Spring 2016
MIPS (Multi-Cycle)
Computer Organization and Design, 3rd Edition; Hennessey and Patterson; p. 344
30
Spring 2016
31
Spring 2016
32
Spring 2016
33
Computer Organization and Design, 3rd Edition; Hennessey and Patterson; p. 345
Spring 2016
Arithmetic Overflow
Illegal Instruction
34
Spring 2016
35
instruction processing.
An illegal instruction is detected after the instruction is decoded.
An arithmetic overflow is detected after the calculation is performed.
Spring 2016
MIPS (PIPELINED)
Interrupt (exception) handling.
36
Spring 2016
37
Spring 2016
Questions?
38