RISC-V Fast Interrupt Controller Hardware Context Management
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing RISC-V interrupt controller solutions face issues with slow interrupt response speed, inability to support nested interrupts, and cumbersome operations, leading to difficulties in software development and low working efficiency, especially in real-time fields.
Innovation Solution
An interrupt control system and method that utilizes a fast interrupt controller to quickly save and restore context by storing Caller-save type general-purpose registers in a hardware memory area, allowing for efficient handling of interrupts and nested interrupt events, with a programmable fast interrupt control register to manage memory areas and interrupt enable bits.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Ease of operation
If software-based context saving and restoring is used in standard RISC-V interrupt handling, then the interrupt control is flexible and compatible with standard calling conventions, but the interrupt response speed becomes slow and the number of instructions increases
Solution Approach 1:
The patent introduces a hardware stack pointer register (ssp) and hardware stack management mechanisms as intermediaries between the interrupt controller and the processor core. This hardware intermediary automatically saves and restores caller-save register values during interrupt handling, reducing the instruction overhead while maintaining compatibility with standard RISC-V calling conventions. The hardware stack pointer acts as a mediator that bridges software interrupt handlers and the actual register state management.
Solution Approach 2:
The patent replaces the software-based mechanical process of manual register saving and restoring with a hardware-based automatic stack management system. Instead of using software instructions to push and pop register values onto the stack, the hardware automatically performs these operations through dedicated circuitry and control logic, significantly reducing the time and instruction count required for interrupt context management.
2Device complexity
If standard PLIC centralized interrupt management is used, then the interrupt management is centralized and simple in structure, but nested interrupts cannot be supported in the same privileged mode
Solution Approach 1:
The patent segments the interrupt management functionality by introducing separate interrupt controller modules (such as CLIC - Core-Local Interrupt Controller) that operate alongside the centralized PLIC. Each interrupt controller handles specific types of interrupts independently, allowing nested interrupts to be supported by dividing the interrupt management into hierarchical segments. This segmentation enables different privileged modes to have their own interrupt controllers that can nest interrupts independently.
Solution Approach 2:
The patent implements nested interrupt capability by allowing interrupt controllers to be nested within each other hierarchically. The CLIC can be nested within the PLIC structure, where the CLIC handles core-local interrupts that can nest within externally triggered interrupts managed by the PLIC. This nested doll structure enables multiple levels of interrupt nesting while maintaining a relatively simple overall architecture.
3Adaptability or versatility
If CLIC core-local interrupt controller is used to solve nesting problem, then nested interrupt capability is provided, but software operation becomes complicated and interrupt handling slows down
Solution Approach 1:
The patent enables the interrupt controller to perform self-service operations by automatically managing the stack pointer and register state saving/restoring processes. The hardware stack pointer register (ssp) and associated control logic automatically update the stack pointer, save caller-save register values, and restore them upon interrupt return, without requiring complex software intervention. This self-service capability reduces software operation complexity while maintaining nested interrupt functionality.
Solution Approach 2:
The patent changes the operational parameters of the interrupt controller by introducing hardware-managed stack pointer registers and automatic context saving/restoring mechanisms. Instead of relying on software to manage stack pointers and register states, the hardware parameters are configured to automatically perform these operations, simplifying the software interface while enabling nested interrupts. The parameter change from software-managed to hardware-managed stack operations reduces complexity.
4Reliability
If prologue and epilogue instructions are added to interrupt service functions for saving and restoring registers, then the calling convention compliance is ensured, but the interrupt handling time increases and real-time performance deteriorates
Solution Approach 1:
The patent performs preliminary action by pre-configuring hardware stack pointer registers and automatic context management mechanisms before interrupts occur. The hardware is pre-programmed with the necessary logic to automatically save and restore caller-save registers during interrupt handling, eliminating the need for runtime prologue and epilogue instructions. This preliminary hardware configuration ensures calling convention compliance while reducing interrupt handling time.
Solution Approach 2:
The patent substitutes the mechanical software-based prologue and epilogue instruction sequences with a hardware-based automatic context management system. Instead of executing multiple software instructions to save and restore registers, the hardware automatically performs these operations through dedicated circuitry, significantly reducing the time required for interrupt handling while maintaining compliance with RISC-V calling conventions.
Data Source
AI summary
A interrupt control system and method based on RISC-V comprises a processor, a fast interrupt controller, a Caller-save type general-purpose register, and a hardware memory area; the hardware memory area is used for storing a value of the Caller-save type general-purpose register during an interrupt response; and the fast interrupt controller is used for storing the value of the Caller-save type general-purpose register into the hardware memory area, or loading back a content from the hardware memory area into the Caller-save type general-purpose register, and further storing a value of a control and status register set into the hardware memory area when a nested interrupt occurs; which improve an interrupt handling speed of a RISC-V architecture processor, simplify the program development difficulty, expand an application field of the RISC-V as a core single chip microcomputer, and particularly have a wide prospect in the embedded application field.

