diff --git a/backends/aiger/aiger.cc b/backends/aiger/aiger.cc index 95f4c19e2..62c79f60b 100644 --- a/backends/aiger/aiger.cc +++ b/backends/aiger/aiger.cc @@ -931,6 +931,11 @@ struct AigerBackend : public Backend { log("\n"); log(" -ywmap \n"); log(" write a map file for conversion to and from yosys witness traces.\n"); + log(" The generated JSON map includes \"asserts\" and \"assumes\" arrays\n"); + log(" containing the hierarchical witness paths of the corresponding\n"); + log(" $assert and $assume cells. This enables downstream tools to map\n"); + log(" AIGER bad-state properties and invariant constraints back to\n"); + log(" individual formal properties by name.\n"); log("\n"); log(" -I, -O, -B, -L\n"); log(" If the design contains no input/output/assert/flip-flop then create one\n"); diff --git a/docs/source/using_yosys/more_scripting/model_checking.rst b/docs/source/using_yosys/more_scripting/model_checking.rst index 799c99b6f..da9193a6f 100644 --- a/docs/source/using_yosys/more_scripting/model_checking.rst +++ b/docs/source/using_yosys/more_scripting/model_checking.rst @@ -3,9 +3,9 @@ Symbolic model checking .. todo:: check text context -.. note:: - - While it is possible to perform model checking directly in Yosys, it +.. note:: + + While it is possible to perform model checking directly in Yosys, it is highly recommended to use SBY or EQY for formal hardware verification. Symbolic Model Checking (SMC) is used to formally prove that a circuit has (or @@ -117,3 +117,33 @@ Result with fixed :file:`axis_master.v`: Solving problem with 159144 variables and 441626 clauses.. SAT proof finished - no model found: SUCCESS! + +Witness framework and per-property tracking +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +When using AIGER-based formal verification flows (such as the ``abc`` engine in +SymbiYosys), Yosys provides infrastructure for tracking individual formal +properties through the verification pipeline. + +The ``rename -witness`` pass (run automatically by ``prep``) assigns public +names to all cells that participate in the witness framework: + +- Witness signal cells: ``$anyconst``, ``$anyseq``, ``$anyinit``, + ``$allconst``, ``$allseq`` +- Formal property cells: ``$assert``, ``$assume``, ``$cover``, ``$live``, + ``$fair``, ``$check`` + +These public names allow downstream tools to refer to individual properties by +their hierarchical path rather than by anonymous internal identifiers. + +The ``write_aiger -ywmap`` option generates a JSON map file that includes, among +other things, ``"asserts"`` and ``"assumes"`` arrays. Each entry contains the +hierarchical witness path of the corresponding ``$assert`` or ``$assume`` cell. +This lets tools such as SymbiYosys map AIGER bad-state properties and invariant +constraints back to individual formal properties, enabling features like +per-property pass/fail reporting (e.g. ``abc pdr`` with ``--keep-going`` mode). + +The ``write_smt2`` backend similarly uses the public witness names when emitting +``yosys-smt2-assert`` and ``yosys-smt2-assume`` comments. Cells whose +``hdlname`` attribute contains the ``_witness_`` marker are treated as having +private names for comment purposes, keeping solver output clean. diff --git a/passes/cmds/rename.cc b/passes/cmds/rename.cc index 078ffb769..f87396743 100644 --- a/passes/cmds/rename.cc +++ b/passes/cmds/rename.cc @@ -263,9 +263,14 @@ struct RenamePass : public Pass { log(" rename -witness\n"); log("\n"); log("Assigns auto-generated names to all $any*/$all* output wires and containing\n"); - log("cells that do not have a public name. This ensures that, during formal\n"); - log("verification, a solver-found trace can be fully specified using a public\n"); - log("hierarchical names.\n"); + log("cells that do not have a public name. Also renames formal property cells\n"); + log("($assert, $assume, $cover, $live, $fair, $check) that have private names,\n"); + log("giving them public witness-trackable names.\n"); + log("\n"); + log("This ensures that, during formal verification, a solver-found trace can be\n"); + log("fully specified using public hierarchical names, and that individual property\n"); + log("results can be tracked by name in flows that support per-property reporting\n"); + log("(e.g. SBY with abc pdr in --keep-going mode).\n"); log("\n"); log("\n"); log(" rename -hide [selection]\n");