leonardt / fault

A Python package for testing hardware (part of the magma ecosystem)
BSD 3-Clause "New" or "Revised" License
41 stars 13 forks source link

Fault fails with wrong circt version #328

Open phanrahan opened 1 year ago

phanrahan commented 1 year ago

Fault fails with wrong circt version.

def circt_opt_version() -> str:
        circt_home = _circt_home()
        circt_opt_binary = _circt_opt_binary(circt_home)
        ostream = io.TextIOWrapper(io.BytesIO())
        returncode = _run_subprocess(
            [circt_opt_binary, "--version"],
            stdin=io.BytesIO(),
            stdout=ostream.buffer,
        )
        ostream.seek(0)
        version = ostream.read()
        match = re.search(_CIRCT_VERSION_RE_PATTERN, version, re.MULTILINE)
        if match is None:
>           raise BadCirctOptVersionStringError(version)
E           magma.backend.mlir.mlir_to_verilog.BadCirctOptVersionStringError: LLVM (http://llvm.org/):
E             LLVM version 17.0.0git
E             DEBUG build with assertions.
E           CIRCT unknown git version

../../magma/magma/backend/mlir/mlir_to_verilog.py:123: BadCirctOptVersionStringError

Trying to disable the check as follows doesn't work.

tester.compile_and_run("verilator", disp_type="realtime",
                           magma_output="mlir-verilog",
                           check_circt_opt_version=False)
rsetaluri commented 1 year ago

I would upgrade magma, either through a global upgrade: python -m pip install -e --upgrade or magma-specific upgrade: python -m pip install magma-lang --upgrade. If you do python -m pip freeze | grep magma you should ideally see version >= 2.3.0.

For future reference, passing options to magma compilation is done through the magma_opts kwarg, so like:

tester.compile_and_run(..., magma_output="mlir-verilog", magma_opts={"check_circt_opt_version": False})