This repository has been archived by the owner on Aug 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
61 lines (51 loc) · 2.37 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Copyright (C) 2020 Robert Baruch <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Run via:
# make -s formal
#
# This will run formal verifications for all instructions that haven't
# yet passed formal verification. That is, if formal verification
# fails on an instruction, you can run make -s formal again, and it will
# skip all instrutions that already verified properly, and pick up where
# the failure happened.
#
# Note that this generally doesn't help, since fixing the problem usually
# involves modifying core.py, which will then cause formal verification
# to begin anew.
#
# You can also run formal verification on one or more specific instructions
# via make -s formal_<insn> formal_<insn> ...
formal_targets := $(patsubst formal/%.py, %, $(wildcard formal/formal_*.py))
.PHONY: formal
formal: $(formal_targets)
formal_%: formal/sby/%_bmc/PASS
$(info $(shell date '+%d %b %Y %H:%M:%S') Verified instruction '$*')
# Don't delete the status file if the user hits ctrl-C.
# .PRECIOUS: formal/sby/%_bmc/status
formal/sby/%_bmc/PASS: formal/sby/%.sby
$(info $(shell date '+%d %b %Y %H:%M:%S') Running formal verification on instruction '$*'...)
sby -f $< 2>&1 >/dev/null; if [ $$? -ne 0 ]; then \
echo `date '+%d %b %Y %H:%M:%S'` Formal verification FAILED for instruction \'$*\'; \
fi
formal/sby/%.sby: formal/sby/%.il formal/formal.sby
cat formal/formal.sby | sed --expression='s#rel_file#$*#g' | sed --expression='s#abs_file#formal/sby/$*#g' > $@
formal/sby/%.il: formal/formal_%.py core.py
$(info $(shell date '+%d %b %Y %H:%M:%S') Compiling instruction '$*'...)
mkdir -p formal/sby
python3 core.py --insn $* generate -t il > $@
formal/sby/alu8.il: alu8.py
$(info $(shell date '+%d %b %Y %H:%M:%S') Compiling alu...)
mkdir -p formal/sby
python3 alu8.py generate -t il > $@