0
0
ARM Architectureknowledge~10 mins

Exception priority levels in ARM Architecture - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Exception priority levels
Exception Occurs
Check Exception Type
Determine Priority Level
Compare with Current Exception
Preempt
Handle Exception
Return to Normal Execution
When an exception occurs, the system checks its priority. If it is higher than the current one, it interrupts and handles it immediately; otherwise, it waits.
Execution Sample
ARM Architecture
Exception occurs: IRQ
Current exception: NMI
IRQ priority: 3
NMI priority: 2
Compare priorities
IRQ (3) > NMI (2)? No
Wait
This example shows how an IRQ exception with priority 3 does not preempt an NMI with priority 2.
Analysis Table
StepCurrent ExceptionNew ExceptionNew PriorityCurrent PriorityCompareAction
1NoneReset0 (highest)NoneNo current exceptionHandle Reset
2ResetNMI202 > 0? YesWait
3ResetIRQ303 > 0? YesWait
4ResetHardFault101 > 0? YesWait
5ResetReset000 > 0? NoWait
6ResetNoneN/A0No new exceptionContinue handling Reset
7NoneNMI2NoneNo current exceptionHandle NMI
8NMIIRQ323 > 2? YesWait
9NMIPendSV15 (lowest)215 > 2? YesWait
10NMINoneN/A2No new exceptionContinue handling NMI
11NoneNoneN/ANoneNo exceptionsNormal execution
💡 Execution stops when no new exceptions occur and current exception handling completes.
State Tracker
VariableStartAfter Step 1After Step 7After Step 10Final
Current ExceptionNoneResetNMINMINone
Current PriorityN/A022N/A
New ExceptionN/AResetNMINoneNone
New PriorityN/A02N/AN/A
Key Insights - 2 Insights
Why does an IRQ with priority 3 not preempt an NMI with priority 2?
Because in ARM architecture, lower numerical priority values mean higher priority. Here, 3 is a higher number than 2, so IRQ (3) has lower priority and does not preempt NMI (2).
What happens if a new exception has the same priority as the current one?
The new exception does not preempt the current one and waits. This is shown in execution_table row 5 where Reset (0) tries to preempt Reset (0) but does not.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at step 8. What is the current exception after handling the new IRQ?
AReset
BNMI
CIRQ
DPendSV
💡 Hint
Check the 'Action' and 'Current Exception' columns at step 8 in execution_table.
At which step does the system handle the first exception with the highest priority?
AStep 1
BStep 7
CStep 4
DStep 9
💡 Hint
Look at the first time an exception is handled when no current exception exists in execution_table.
If a new exception has a priority number higher than the current one, what happens?
AIt cancels the current exception
BIt preempts the current exception
CIt waits until current exception finishes
DIt merges with the current exception
💡 Hint
Refer to the 'Compare' and 'Action' columns in execution_table rows where new priority is higher number than current.
Concept Snapshot
Exception Priority Levels in ARM:
- Lower number = higher priority
- New exception preempts current only if priority number is lower
- Equal or higher number waits
- Priority order: Reset(0) > HardFault(1) > NMI(2) > IRQ(3) ... PendSV(15)
- System handles highest priority exception first
Full Transcript
In ARM architecture, exceptions have priority levels represented by numbers. A lower number means a higher priority. When an exception occurs, the system compares its priority with the currently handled exception. If the new exception has a higher priority (lower number), it preempts the current one and is handled immediately. Otherwise, it waits until the current exception finishes. For example, Reset has the highest priority with 0, while PendSV has the lowest with 15. This priority system ensures critical exceptions are handled first. The execution table shows step-by-step how exceptions are compared and handled based on their priority numbers.