yosys/backends/smt2
Jannis Harder e36c71b5b7 Use clk2fflogic attr on cells to track original FF names in witnesses
This makes clk2fflogic add an attr to $ff cells that carry the state of
the emulated async FF. The $ff output doesn't have any async updates
that happened in the current cycle, but the $ff input does, so the $ff
input corresponds to the async FF's output in the original design.

Hence this patch also makes the following changes to passes besides
clk2fflogic (but only for FFs with the clk2fflogic attr set):

  * opt_clean treats the input as a register name (instead of the
    output)

  * rename -witness ensures that the input has a public name

  * the formal backends (smt2, btor, aiger) will use the input's
    name for the initial state of the FF in witness files

  * when sim reads a yw witness that assigns an initial value to the
    input signal, the state update is redirected to the output

This ensures that yosys witness files for clk2fflogic designs have
useful and stable public signal names. It also makes it possible to
simulate a clk2fflogic witness on the original design (with some
limitations when the original design is already using $ff cells).

It might seem like setting the output of a clk2fflogic FF to update the
input's initial value might not work in general, but it works fine for
these reasons:

  * Witnesses for FFs are only present in the initial cycle, so we do
    not care about any later cycles.

  * The logic that clk2fflogic generates loops the output of the
    genreated FF back to the input, with muxes in between to apply any
    edge or level sensitive updates. So when there are no active updates
    in the current gclk cycle, there is a combinational path from the
    output back to the input.

  * The logic clk2fflogic generates makes sure that an edge sensitive
    update cannot be active in the first cycle (i.e. the past initial
    value is assumed to be whatever it needs to be to avoid an edge).

  * When a level sensitive update is active in the first gclk cycle, it
    is actively driving the output for the whole gclk cycle, so ignoring
    any witness initialization is the correct behavior.
2023-05-25 12:48:02 +02:00
..
.gitignore Various fixes and improvements in "write_smt2 -bv" 2014-12-25 20:28:34 +01:00
Makefile.inc smtbmc: Add native json based witness format + smt2 backend support 2022-08-16 13:37:30 +02:00
example.v Added smtbmc.py 2015-10-13 17:17:23 +02:00
example.ys Added smtbmc.py 2015-10-13 17:17:23 +02:00
smt2.cc Use clk2fflogic attr on cells to track original FF names in witnesses 2023-05-25 12:48:02 +02:00
smtbmc.py yosys-smtbmc: support -h/--help (and exit with code 0). 2023-02-27 20:31:00 +00:00
smtio.py smtbmc: Fix witness handling for k-induction failures 2022-10-18 19:51:36 +02:00
test_cells.sh Various fixes and improvements in "write_smt2 -bv" 2014-12-25 20:28:34 +01:00
witness.py sim: Improvements and fixes for yw cosim 2023-01-11 18:07:16 +01:00
ywio.py Support for BTOR witness to Yosys witness conversion 2023-01-11 18:07:16 +01:00