Course: Computer Architectures
Professor: E. Sanchez
Source: Exceptions and interrupts in pipelined processors, Politecnico di Torino, ASE 2026/27, 26 slides
Numbering: Local vault sequence after Lecture 05 - Multicycle Operations; the PDF does not specify a lecture number.
PDF: Exceptions and interrupts in pipelined processors.pdf
Lecture summary
The pipeline must remain correct when normal execution is redirected. Begin with the event, then determine which instruction effects the handler is allowed to observe.
Overlapping execution must also cope with events that redirect control to a handler. An instruction may fault, or an external device may request attention. The processor must decide what work can finish and what state to preserve so execution can resume or terminate correctly. Exceptions and Interrupts
A handler needs a coherent view of the interrupted program. Precise exceptions present state consistent with a defined instruction boundary: required older effects are complete and younger effects have not become visible. Internal execution order can vary only if that architectural view is preserved. Precise Exceptions
The detailed notes below retain the lecture’s examples, timing diagrams or comparisons, and source references. Continue afterward with Lecture 07 - Instruction-Level Parallelism.
Lecture map
| Slides | Material | Study note |
|---|---|---|
| 1-4 | Exceptions, interrupts, and event sources | Exceptions and Interrupts |
| 5-10 | Five classification dimensions | Exceptions and Interrupts > Classification |
| 11-13 | Restartable machines; stopping and restarting | Exceptions and Interrupts > Handling and restarting |
| 14-15 | 80x86 and ARM interrupt protocols | Exceptions and Interrupts > Architecture examples |
| 16-19 | Precise/imprecise exceptions and implementation choices | Precise Exceptions |
| 20 | Exception sources by pipeline stage | Exceptions and Interrupts > Sources by pipeline stage |
| 21-23 | Simultaneous faults, reversed detection order, status flags | Precise Exceptions > Worked examples from slides 18 and 21-23 |
| 24-26 | Commit, early side effects, condition codes, complex instructions | Precise Exceptions > Instruction-set complications |
Exceptions and their classifications (slides 2-10)
The slides use exception both as an umbrella for exceptional events and, more narrowly, for an internal CPU event. Interrupt usually means an external event, such as a device request. Terminology depends on the architecture.
Sources include system calls, tracing, breakpoints, arithmetic anomalies, page faults, alignment/protection violations, illegal instructions, hardware malfunctions, and power failures. The classification dimensions are synchronous/asynchronous, requested/coerced, maskable/nonmaskable, within/between instructions, and resume/terminate.
These dimensions answer different questions; they are not five mutually exclusive classes. See Exceptions and Interrupts > Classification.
Restartable machines and handling (slides 11-15)
A restartable machine preserves enough state to handle an event and resume correctly. The lecture’s pipeline mechanism inserts a trap at the next IF stage, disables writes by the faulting and younger instructions, and saves the faulting PC when the handler receives control. Special return instructions restore the PC and restart execution.
Clarification: The faulting-PC restart rule describes retryable synchronous faults. A completed system-call instruction or an interrupt between instructions can require a different return address. The specific ISA defines that behavior.
Slide 14 gives the legacy 80x86 sequence: request, detection, interrupt type N, saved PSW and CS/IP, flags changed, vector-table lookup, and ISR entry. Slide 15 describes an ARM example saving eight registers including PC and status.
Architecture scope: Eight-register hardware stacking matches Cortex-M; it is not a universal ARM rule. See the official reference linked in Exceptions and Interrupts > Architecture examples.
Precise exceptions (slides 16-19)
The handler should see a state consistent with the program stopping at an instruction boundary: earlier instructions completed, the faulting instruction has no committed partial effects for a retryable fault, and younger instructions have no committed effects.
Multicycle operations make this difficult because completion can occur out of order. The slide 18 DIV.D / ADD.D / SUB.D example illustrates a younger fault detected before an older divide completes.
The slide 19 alternatives are accepting imprecision, providing a slow precise mode, early exception determination before allowing later instructions, or buffering results until older instructions finish. Slide 17 reports an approximately tenfold slowdown for historical debug-mode examples (Alpha 21064 and the slide’s “MIPS R800”); this is a historical lecture claim, not a general performance rule.
Fault detection versus fault handling (slides 20-23)
An instruction can fault at IF, ID, EX, or MEM in the teaching model. Several faults may be detected in one cycle, or a younger instruction may fault first. Precise handling follows program order, rather than the timing of detection.
The proposed solution carries an exception status with each instruction, prevents its writes, and triggers the exception at the last stage. To make the complete machine precise, younger instructions’ visible writes must also be blocked, while older instructions can finish. See Precise Exceptions > Status flags and ordered handling.
ISA scope: Slide 20 is headed RISC-V but includes generic arithmetic-trap examples. Standard RISC-V FP operations set fflags without automatically trapping; its integer division also does not trap for division by zero or overflow. The DADD, LD, and DIV.D examples are the lecture’s MIPS-style teaching notation, not RISC-V assembly to paste into ASE Studio.
Instruction-set complications (slides 24-26)
The slides call an instruction committed when it is guaranteed to complete. Autoincrement addressing can alter state before that point, requiring rollback if the instruction is aborted. Implicit condition-code updates add dependencies and recovery state. Complex instructions with different internal lengths complicate a uniform pipeline; microinstructions may be pipelined instead.
How to study this lecture
Read Exceptions and Interrupts first, then follow the three worked examples in Precise Exceptions. Connect out-of-order completion to Multicycle Operations and compare exception recovery with the branch flush in Pipelining. Quiz practice is deferred.
Source and clarification policy
Primary course source: the linked PDF, slides 1-26; PDF page numbers match slide numbers. Worked timing and state tables are explanatory reconstructions, with assumptions stated explicitly. ISA clarifications are separately labeled and linked to official references in the concept notes.