Abstract
fault is a Python-embedded domain-specific language (DSL) designed to bring the power of metaprogramming to hardware verification. By allowing engineers to write high-level, portable testbenches, fault enables seamless execution across open-source simulators, commercial tools, formal verification engines, and analog SPICE simulators. This approach significantly reduces the effort required to verify complex hardware generators by decoupling test logic from specific vendor tools.
Introduction
The current "golden age" of computer architecture is driven by hardware generators—programs that automatically produce circuit designs based on input parameters. While these generators have accelerated design productivity, verification has become a primary bottleneck. Traditional verification often relies on vendor-specific languages like SystemVerilog, which lack the flexibility to adapt to the numerous variants a generator might produce. Furthermore, engineers are frequently locked into expensive commercial simulators, as moving tests to open-source tools often requires a complete rewrite.
The fault Framework
To address these challenges, the authors introduce fault, which leverages Python’s ecosystem to provide a flexible and portable verification environment. The system's architecture is built on several key innovations:
- Staged Metaprogramming: Users describe tests in Python, which are executed to generate a sequence of abstract test actions (an Intermediate Representation or IR). This IR is then "lowered" into a format specific to a target backend, such as C++ for Verilator or SystemVerilog for commercial tools.
- Actions IR: By decoupling test logic from the simulator, the Actions IR allows the same script to target diverse environments, from digital simulators to formal engines.
- Introspection with Magma:
faultintegrates withmagma, a hardware construction DSL, allowing testbenches to automatically discover ports and internal signals within the circuit under test.
Experimental Evaluation
The authors evaluated fault across several real-world hardware verification tasks, including:
- lassen: Unit tests for an open-source Coarse-Grained Reconfigurable Architecture (CGRA) processing element.
- OpenRAM SRAM: A 16x16 memory array for testing mixed-signal (digital + analog) verification.
- Stanford Garnet CGRA: A complex system-level integration test involving image processing applications.
- ALU Property Verification: A comparison of formal model checking against constrained random simulation.
Key Results and Insights
The evaluation demonstrated that metaprogramming is essential for scaling verification to match modern hardware complexity. Using standard Python features like loops and conditionals to generate test sequences allows for highly adaptable testbenches.
Performance and Portability
In unit tests for the CGRA processing element, the open-source Verilator backend performed comparably to high-end commercial simulators, proving that portability does not come at the cost of speed. This allows teams to prototype in fast, open-source environments before moving to commercial sign-off tools.
Efficiency Gains
For mixed-signal SRAM testing, the fault-based approach reduced the code required from 412 lines to just 136 lines—a 3.02x reduction in effort. In large-scale integration tests, the ability to switch between simulators allowed researchers to find the most efficient tool for specific tasks, saving significant simulation time. Additionally, the unified assume/guarantee interface enabled formal model checkers to identify bugs faster than traditional random sampling.
Conclusion and Future Work
fault demonstrates that a Python-based DSL can bridge the gap between hardware generation and verification. While the current implementation faces some constraints regarding complex runtime control flow and temporal logic, future work aims to integrate coroutines (similar to cocotb) to better model parallel hardware behavior. By providing a portable, high-level abstraction, fault serves as a productivity multiplier for modern hardware design.
Summary updated