3.3.6.1.1. Machine Status Register (mstatus)
3.3.6.1.2. Machine Trap-Vector Base-Address Register (mtvec)
3.3.6.1.3. Machine Interrupt Register (mip and mie)
3.3.6.1.4. Machine Exception Program Counter Register (mepc)
3.3.6.1.5. Machine Cause Register (mcause)
3.3.6.1.6. Machine Trap Value Register (mtval)
4.3.1. General-Purpose Register File
4.3.2. Shadow Register
4.3.3. Arithmetic Logic Unit
4.3.4. Multipy and Divide Units
4.3.5. Floating-Point Unit
4.3.6. Custom Instruction
4.3.7. Instruction Cycles
4.3.8. Reset and Debug Signals
4.3.9. Control and Status Registers
4.3.10. Trap Controller (CLINT)
4.3.11. Trap Controller (CLIC)
4.3.12. Memory and I/O Organization
4.3.13. RISC-V based Debug Module
4.3.14. Error Correction Code (ECC)
4.3.15. Branch Prediction
4.3.16. Lockstep Module
4.3.10.1.1. Machine Status Register (mstatus)
4.3.10.1.2. Machine Trap-Vector Base-Address Register (mtvec)
4.3.10.1.3. Machine Interrupt Register (mip and mie)
4.3.10.1.4. Machine Exception Program Counter Register (mepc)
4.3.10.1.5. Machine Cause Register (mcause)
4.3.10.1.6. Machine Trap Value Register (mtval)
4.3.10.1.7. Machine Second Trap Value Register (mtval2)
4.3.11.1.3.1. Machine Trap-handler Vector Table base address Register (mtvt)
4.3.11.1.3.2. Machine Next Interrupt Handler Address and Interrupt Enable Register (mnxti)
4.3.11.1.3.3. Machine Interrupt Status Register (mintstatus)
4.3.11.1.3.4. Machine Interrupt-Level Threshold Register (mintthresh)
4.3.11.1.3.5. Machine Scratch Swap for Interrupt-Level Register (mscratchcswl)
4.3.11.1.1.2. CLIC Interrupt Input Control (clicintctl)
clicintctl[i] is an 8-bit control register to specify interrupt level and interrupt priority. The most significant bit specifies the interrupt level while the least significant bit specifies the interrupt priority. If fewer than 8 bits are needed to specify interrupt and priority, the least significant bits of clicintctl[i] are WARL 1.
The processor selects the interrupt with the highest level by adhering to this procedure:
- The CLIC hardware picks the global maximum across all pending-and-enabled interrupts based on clicintctl.
- The interrupt level of this selected interrupt is compared with the interrupt-level threshold (mintthresh.threshold) to determine whether:
- The level is qualified (Accepts interrupt), or
- The level is masked (Ignores interrupt).
Phase 1: Assume the following settings is made in the Nios V processor IP Parameter Editor.
Case | # of Levels Supported | # of Priorities Supported | Possible Interrupt Levels | Possible Interrupt Priorities |
---|---|---|---|---|
A | 256 levels | 1 priority | 0, 1, 2, …, 253 , 254, 255 | 255 |
B | 17 levels (16 levels + Level 0) | 16 priorities | 0, 15, 31, 47, 63, 79, 95, 111, 127, 143, 159, 175, 191, 207, 223, 239, 255 | 15, 31, 47, 63, 79, 95, 111, 127, 143, 159, 175, 191, 207, 223, 239, 255 |
C | 3 levels (2 levels + Level 0) | 128 priorities | 0, 127, 255 | 1, 3, 5, …, 251, 253, 255 |
D | 9 levels (8 levels + Level 0) | 16 priorities | 0, 31, 63, 95, 127, 159, 191, 223, 255 | 15, 31, 47, 63, 79, 95, 111, 127, 143, 159, 175, 191, 207, 223, 239, 255 |
E | 9 levels (8 levels + Level 0) | 8 priorities | 0, 31, 63, 95, 127, 159, 191, 223, 255 | 31, 63, 95, 127, 159, 191, 223, 255 |
F | 2 levels (1 level + Level 0) | 1 priority | 0, 255 | 255 |
At any given time, the Nios® V processor CLIC implements the specified number of interrupt levels plus an additional level 0 for application code. With non-zero interrupt levels as the only options for interrupts, the application code is always at a lower level than any interrupts.
Note: In Case A, the interrupt level 0 corresponds to the execution of application code, and must not be assigned to an interrupt. Assigning the interrupt level 0 disables the interrupt.
Phase 2: Writing clicintctl register with 0x85 or binary value of 10000101,
Case | Valid bits in clicintctl | WARL bits | Configuration made for this interrupt | ||
---|---|---|---|---|---|
Level | Priority | Level | Priority | ||
A | 8 bits | 0 bit | 0 | 133 (binary = 10000101 ) | 255 (binary = 11111111) |
B | 4 bits | 4 bits | 0 | 143 (binary = 1000 1111) | 95 (binary = 0101 1111) |
C | 1 bit | 7 bits | 0 | 255 (binary = 1 1111111) | 11 (binary = 0000101 1) |
D | 3 bits | 4 bits | 1 bit | 159 (binary = 100 11111) | 47 (binary = 0010 1111) |
E | 3 bits | 3 bits | 2 bits | 159 (binary = 100 11111) | 63 (binary = 001 11111) |
F | 0 bit | 0 bit | 8 bits | 255 (binary = 11111111) | 255 (binary = 11111111) |