Commit 92d4c7f
[dv/formal] Introduce an Open Source Formal Flow
This commit introduces a formal flow for Ibex that does not depend on
Jasper, instead using yosys and our fork of the yosys-slang frontend to
produce an aiger file, which the rIC3 model checker, under the
instruction of conductor.py, can then verify. Just one aiger file is
created, and is subsequently reconfigured by the Rust aig-manip tool.
See dv/formal/README.md for more details, but in general:
1. We generate the specification module and psgen RTL in roughly the
same way as the Jasper flow, with small changes to the psgen output
in particular.
2. We use a fork of yosys-slang as the frontend for yosys. It has
comprehensive SystemVerilog support, and handles both the
specification and Ibex easily. It lacks SVA support by default, hence
the need for the fork, though hopefully this will be upstreamed soon.
The RTL source list is constructed by fusesoc in the same way as for
Jasper.
3. The yosys build script is then specified in build_all.ys. It makes
use of three custom passes, which may be found in yosys_formal. See
their source files for more explanation of what they do. Yosys takes
~10 minutes to build an aiger file. See aig-manip/src/main.rs for
more description of aiger files.
4. In order to prove a property, the rIC3 model checker can be used.
However, the aiger file produced by yosys in step 3 contains all
properties as assertions. To focus on just one, and to take all prior
steps as assumptions the aig-manip tool is used. After this
invocation of rIC3 is straightforward for IC3, k-induction or BMC.
If a CEX is discovered it may be analysed by the aig-manip tool,
which can lift the AIW (aiger witness) into a VCD file, for use in
gtkwave etc.
5. When considering the proof as a whole, the conductor.py script is
used to discover proof strategies, and then run proofs while
maximising memory usage. It caches proofs for each step under
strategies/step*.json.
Additonal notes:
1. The actual proof is relatively unchanged, with just a couple of new
properties.
2. The proof is fast (it takes 40 minutes or so on a good machine)
3. smt2 based proofs are also available, e.g. for k-induction, since
the build script (build_all.ys) will produce an smt2 file, which can
be manipulated by smt2manip.py in the same that aig-manip does for
an aiger file.
4. The transformation made to a global clock will confuse clock gating.
It *should* be fine, since the clock signal it generates is
essentially ignored anyway.
5. This commit also switches from poetry to UV.
6. This runs on a small memory bound (the smallest possible bound). See
check/protocol/mem.sv1 parent 4958b35 commit 92d4c7f
File tree
55 files changed
+5110
-215
lines changed- dv/formal
- aig-manip
- src
- check
- protocol
- spec
- strategies
- thm
- yosys_formal
- nix
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
55 files changed
+5110
-215
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
1 | 5 | | |
2 | 6 | | |
3 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
1 | 6 | | |
2 | 7 | | |
3 | | - | |
| 8 | + | |
| 9 | + | |
4 | 10 | | |
5 | 11 | | |
6 | 12 | | |
| |||
9 | 15 | | |
10 | 16 | | |
11 | 17 | | |
12 | | - | |
| 18 | + | |
13 | 19 | | |
14 | 20 | | |
15 | 21 | | |
| |||
23 | 29 | | |
24 | 30 | | |
25 | 31 | | |
26 | | - | |
| 32 | + | |
27 | 33 | | |
28 | 34 | | |
29 | 35 | | |
30 | 36 | | |
31 | | - | |
32 | | - | |
33 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
34 | 40 | | |
35 | 41 | | |
36 | 42 | | |
| |||
39 | 45 | | |
40 | 46 | | |
41 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
42 | 60 | | |
43 | | - | |
44 | | - | |
| 61 | + | |
| 62 | + | |
45 | 63 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
50 | 69 | | |
51 | | - | |
52 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
53 | 76 | | |
54 | | - | |
| 77 | + | |
| 78 | + | |
55 | 79 | | |
| 80 | + | |
56 | 81 | | |
57 | | - | |
| 82 | + | |
58 | 83 | | |
59 | 84 | | |
60 | | - | |
| 85 | + | |
61 | 86 | | |
62 | | - | |
| 87 | + | |
63 | 88 | | |
64 | 89 | | |
65 | 90 | | |
66 | 91 | | |
67 | 92 | | |
68 | 93 | | |
69 | | - | |
70 | | - | |
71 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
31 | 40 | | |
32 | 41 | | |
33 | 42 | | |
34 | 43 | | |
35 | 44 | | |
36 | | - | |
37 | | - | |
| 45 | + | |
| 46 | + | |
38 | 47 | | |
39 | 48 | | |
40 | 49 | | |
| |||
44 | 53 | | |
45 | 54 | | |
46 | 55 | | |
47 | | - | |
| 56 | + | |
48 | 57 | | |
49 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
50 | 65 | | |
51 | 66 | | |
52 | 67 | | |
| |||
66 | 81 | | |
67 | 82 | | |
68 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
69 | 89 | | |
70 | 90 | | |
71 | 91 | | |
| |||
77 | 97 | | |
78 | 98 | | |
79 | 99 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | 100 | | |
84 | 101 | | |
85 | 102 | | |
| |||
0 commit comments