|
<< Click to Display Table of Contents >> Navigation: ASA-EMulatR Reference Guide > Introduction > Architecture Overview > Chapter 7 - Exceptions, Faults, and Interrupts > 7.4 Exception Detection Points |
Faults are detected primarily in the Execute (EX) stage, during grain->execute(). Detection sources include:
•MBox — translation faults (DTB miss, ITB miss), alignment faults, access violations, fault-on-read/write/execute
•EBox — integer arithmetic exceptions (overflow, divide by zero)
•FBox — floating-point exceptions (overflow, underflow, inexact, invalid, divide by zero), detected via handleFPTrap() and FPCR trap-enable checks
•Pipeline control logic — illegal instruction (null grain in EX), privileged instruction violation (PAL-mode-only instruction executed in user mode)
When a fault is detected, the detecting code sets slot.faultPending = true, slot.trapCode, and slot.faultVA in the PipelineSlot. Faults are never speculative — a fault detected in EX is guaranteed to be delivered precisely.
Interrupts are sampled during the pre-cycle phase of the run loop, via AlphaCPU::checkInterrupts(). This occurs before pipeline advancement, after barrier release checks, and only when interrupts are enabled.
The check is fast: IRQPendingState::hasDeliverable(currentIPL) tests whether any pending interrupt level exceeds the current IPL. If deliverable, claimNext() atomically claims the highest-priority pending interrupt and returns a ClaimedInterrupt with the source, IPL, and vector. The interrupt is then delivered via PalService::deliverInterrupt().
Interrupts are not taken mid-instruction.
See Also: cpuCoreLib/AlphaCPU.h (checkInterrupts); coreLib/IRQPendingState.h.