How lowrisc/sonata-system works
Main Components
• FPGA Hardware Platform: At the hardware level, you have the FPGA design (the RTL folder). This includes:
– The CHERIoT Ibex core and its related “sonata.core” and “sonata_system.core” files.
– Peripheral modules implemented as IP blocks in the rtl/ip folder (for example, GPIO, I2C, SPI, USB, PWM, revocation control, pinmux, etc.).
– Bus interconnections (see rtl/bus for bus packages, crossbars, and related service protocols).
– Additional system-level infrastructure (top-level files in rtl/system, pinmux, clock generation, reset logic, JTAG, etc.).
• Simulation and Verification Environment:
– Verification environments using Verilator and DPI tests found in dv/verilator, dv/dpi, and related simulation test files.
– Flow scripts (in the flow directory) that prepare the FPGA design for synthesis and place-and-route.
• Software and Embedded Applications:
– The sw directory contains the firmware, tests, bootloader, and drivers written for the microcontroller. It includes parts specific to CHERI in “sw/cheri,” legacy support, and example/demo applications.
– Build system integrations (CMake files, linker scripts, and the use of Nix/flake configurations).
• Documentation and Utility Tools:
– mdBook documentation (doc folder and util/mdbook) along with scripts that automate tasks such as generating top-level configurations, peripheral registers, or even the UF2 boot images.
Relationships and Interactions
• Around that, add blocks for each peripheral IP (e.g., GPIO, SPI, I2C, USB, UART, PWM, HyperRAM, etc.) showing connections (likely via a common bus or crossbar – see rtl/bus and autogen rv_plic components).
• Bus interconnect (an “Xbar” for fetching instructions/data) and show how the processor communicates with the peripherals.
• A block for “System IP & Control” that groups elements like system information, pinmux, revocation control, and other system-level controllers.
• On the verification side, illustrate a simulation environment block that links back to the hardware system. This block represents the Verilator simulation (dv/verilator) and DPI test components.
• For the software side, add a separate layer that represents the firmware/RTOS/bootloader stack along with drivers. Show its connection to the hardware (i.e., how the software interacts via registers or API calls with peripheral logic).
Architectural Patterns and Design Principles
• Documentation and utility integration: while not part of the runtime system, these components (mdBook docs, scripts in util/) should be annotated as supporting tools that aid in design generation, configuration, and deployment.
Relevant Technologies and Frameworks
• FPGA design: Verilog/SystemVerilog (RTL directory), Vivado tool flows (flow folder script hooks), and simulation tools (Verilator, DPI).
• Build and dependency management: Nix/flake configurations, CMake scripts found in sw/cheri and other directories.
• Software development: Integration with CHERIoT RTOS, provided bootloaders (with drag-and-drop programming via UF2 files), and examples for real-world testing.
• Documentation: mdBook for documentation generation.