Open gipsyh opened 1 month ago
I also tried some options in write_btor
, but the result are same.
In general, you need to run additional passes to prepare the design for the btor backend.
The recommended way to make sure you're always using the up to date flow for this (which can change from time to time) is to use SBY. You can use the engine none
and use the make_model btor
option. A working SBY config for this example (after fixing the clk
vs clock
typo in the verilog code) would be:
[options]
mode bmc
make_model btor
expect unknown
[engines]
none
[script]
read_verilog -formal example.v
prep -top main
[files]
example.v
Running sby -f example.sby
then results in a btor output in example/model/design_btor.btor
. This is generated by running the yosys scripts example/model/design.ys
, example/model/design_prep.ys
and example/model/design_btor.ys
in that order, and you can use these as reference for the passes of our current btor based FV flow. Note that some SBY options (like multiclock on
) do affect the generated scripts.
The change in behavior you observed is because you are missing either async2sync
(assume all FFs share the same clock that has an active edge for each single btor step, no matter what signal is actually connected to the clocks; also assume async resets are only asserted synchronized with that clock) or alternatively clk2fflogic
(don't make any assumptions and detect when a signal changes between btor steps to implement FFs). Running either has been the recommendation for a long time, but recently became a requirement. If for some reason you don't want to run either pass but otherwise get the exact same behavior as before you can run chformal -lower
instead.
If you do want to keep a rather minimal flow to produce btor, in addition to async2sync
or clk2fflogic
, you're also at least missing either a prep
(recommended) or a hierarchy -top main; proc
(a subset of prep
, more likely to leave the design in a still FV incompatible state) which should always be the first step after read_verilog
.
I'll still leave this issue open, since for this particular case, write_btor
could detect that the design isn't sufficiently prepared and produce a helpful error instead of silently producing something unexpected.
Thank you, I'll have a try.
Version
Yosys 0.41 (git sha1 c1ad37779, g++ 13.2.0-23ubuntu4 -fPIC -Os)
On which OS did this happen?
Linux
Reproduction Steps
./yosys -p "read_verilog -formal example.v; write_btor example.btor2"
example.v:
Expected Behavior
bad property in
example.btor2
yosys-0.35 has the bad property but 0.41 not
example.btor2
generated from 0.35 with the same command:Actual Behavior
not bad property in example.btor2 generated from 0.41