Skip to content

Main content

Interrupt Priority Preemption Bit Split Tool

Calculate interrupt priority preemption bit split from explicit caller-supplied inputs.

Loading tool…

Description

Split priority into preemption and subpriority using implementedBits - preemptionBits low bits for the latter.

A register mask selects bits within a fixed width. Read-clear and write-one-to-clear semantics describe state transitions that differ from ordinary assignment.

Split priority into preemption and subpriority using implementedBits - preemptionBits low bits for the latter.

When to use this tool

Use Interrupt Priority Preemption Bit Split when you need a deterministic fixed-width field or register-state calculation.

How to use the tool and how it works

  1. Enter priority, implementedBits, preemptionBits. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read preemption, subpriority. Use the output convention below.

Split priority into preemption and subpriority using implementedBits - preemptionBits low bits for the latter.1

Input fieldMeaning and unitsAccepted input
priorityPriorityRequired. Safe integer; minimum 0.
implementedBitsImplemented BitsRequired. Safe integer; minimum 1; maximum 8.
preemptionBitsPreemption BitsRequired. Safe integer; minimum 0.
Output fieldInterpretationReturned shape
preemptionPreemptionRequired. Safe integer.
subprioritySubpriorityRequired. Safe integer.
json
{
  "input": {
    "priority": 13,
    "implementedBits": 4,
    "preemptionBits": 2
  },
  "output": {
    "preemption": 3,
    "subpriority": 1
  }
}

Limitations and assumptions

  • Inputs are logical priority bits rather than a left-aligned register byte; the grouping and implemented width are supplied.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Use the device's access semantics and account for concurrent hardware changes before applying a register operation.

References

  1. Calculation and input contract: microcontroller/interrupt-priority-preemption-bit-split — tool.io

Similar or alternative tools

  • NVIC Priority Field Left Shift

    Left-align a logical priority with implementedBits in an eight-bit field by multiplying it by 2^(8 - implementedBits).

  • Interrupt Nesting Depth Margin

    A lower numeric candidate preempts the last active priority; increase depth only when it would preempt and subtract from depthLimit for depthMargin.