Fault is a Python package for testing hardware designs, forming a core part of the magma ecosystem. It provides a unified, high-level interface to simulate and verify digital circuits directly from Python, supporting various hardware description languages and simulation targets like Verilator and Icarus. Currently at version 4.0.1, Fault is actively maintained with major versions typically introducing significant API improvements and architectural refactorings.
pip install faultVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to define a simple Magma circuit, create a `fault.Tester` for it, apply inputs (`poke`), verify outputs (`expect`), and run the simulation using a Verilator target. Note that external simulators like Verilator often require system-level installation in addition to Python packages.
Upgrade Magma to the latest 3.x version: `pip install --upgrade magma`.
Update import statements to use top-level `from fault import ...` or directly import from `fault-core` if low-level components are explicitly needed.
Consult the `fault` documentation for the 2.x API to adapt custom targets and `compile_and_run` calls.
Ensure the specific `fault-` Python package for your target is installed (e.g., `pip install fault-verilator`), and that the corresponding external simulator executable (e.g., `verilator`) is installed and available in your system's PATH.