How zero-day-labs/riscv-aia works
Project Type and Purpose
• The project is a hardware RTL implementation of the RISC-V AIA specification. Its purpose is to support interrupt management through different microarchitectural configurations – namely APLIC IP and IMSIC IP – that can operate in direct, distributed, or embedded modes. This makes it particularly interesting for SoC designs and mixed-criticality systems.
File Structure
• Notice the top-level directories:
• The “rtl/” folder is the heart of the project with SystemVerilog files. Here you find separate files for APLIC (e.g., aplic_domain_top.sv, aplic_top.sv) and IMSIC (e.g., imsic_top.sv) along with registers maps and protocol packages.
• The “rtl/package/” subfolder holds configuration packages (like aia_pkg.sv, imsic_pkg.sv) that dictate the IP’s parameterization.
• The “test/” folder includes cocotb-based tests that simulate both the APLIC and IMSIC components, showing how they integrate.
• Additional directories (.github, vendor) support metadata, contributions, and vendor-specific RTL modules.
• Main Components to Represent:
a. APLIC IP Block(s):
• Core APLIC modules (e.g., aplic_domain_top, aplic_regmap) which manage different interrupt domains and their parameters.
• That the APLIC can operate in different modes (direct vs. MSI mode), based on parameters configured in the package files.
b. IMSIC IP Block(s):
• IMSIC modules (e.g., imsic_top) and consider the different microarchitectures (Vanilla, IMSIC Island, Embedded). The interaction between IMSIC and APLIC (for managing harts and interrupt distribution) should be clear.
c. Configuration and Parameterization Packages:
d. Verification Environment:
e. Documentation and External Interfaces:
• A note about external interfaces or integration points as described in the documentation and README. This might involve the bus interfaces where the IP is integrated into a larger SoC.
• Relationships and Interactions:
• How the configuration packages feed into and parameterize the RTL components.
• Feedback loops or synchronization mechanisms, which could be represented by utilities (such as synchronizer.sv in rtl/util).
Architectural Patterns and Design Principles
• Separation of concerns: distinct blocks for APLIC and IMSIC.
• Configurability: use of parameter and package files to allow different microarchitectures.
• Hierarchical organization: for example, separate submodules for domain management within APLIC and multiple harts management in IMSIC.
Putting It All Together
• Core IP Blocks: APLIC (with submodules such as domain control, regmap, etc.) and IMSIC (with its different microarchitecture variants).
• Configuration Layer: Show how the SystemVerilog packages (aia_pkg.sv, imsic_pkg.sv, etc.) feed into these blocks.
• Verification: Illustrate the connection to the cocotb test framework and the simulation environment.