Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a "mode" option to cfg file #28

Merged
merged 3 commits into from Aug 9, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -33,6 +33,7 @@
dumpsmt2 = False
sbycmd = "sby"
config = dict()
mode = "bmc"

if len(sys.argv) > 1:
assert len(sys.argv) == 2
@@ -83,6 +84,11 @@
assert len(line) == 1
dumpsmt2 = True

elif line[0] == "mode":
assert len(line) == 2
if line[1] == "prove":
mode = line[1]

else:
print(line)
assert 0
@@ -119,6 +125,7 @@ def print_hfmt(f, text, **kwargs):
hargs["xlen"] = xlen
hargs["ilen"] = ilen
hargs["append"] = 0
hargs["mode"] = mode

instruction_checks = set()
consistency_checks = set()
@@ -178,7 +185,7 @@ def check_insn(insn, chanidx, csr_mode=False):
with open("%s/%s.sby" % (cfgname, check), "w") as sby_file:
print_hfmt(sby_file, """
: [options]
: mode bmc
: mode @mode@
: expect pass,fail
: append @append@
: tbtop wrapper.uut
@@ -231,6 +238,9 @@ def check_insn(insn, chanidx, csr_mode=False):
: `define RISCV_FORMAL_CHANNEL_IDX @channel@
""", **hargs)

if mode == "prove":
print("`define RISCV_FORMAL_UNBOUNDED", file=sby_file)

for csr in sorted(csrs):
print("`define RISCV_FORMAL_CSR_%s" % csr.upper(), file=sby_file)

@@ -337,7 +347,7 @@ def check_cons(check, chanidx=None, start=None, trig=None, depth=None, csr_mode=
with open("%s/%s.sby" % (cfgname, check), "w") as sby_file:
print_hfmt(sby_file, """
: [options]
: mode bmc
: mode @mode@
: expect pass,fail
: append @append@
: tbtop wrapper.uut
@@ -386,6 +396,9 @@ def check_cons(check, chanidx=None, start=None, trig=None, depth=None, csr_mode=
: `define RISCV_FORMAL_CHECK_CYCLE @depth@
""", **hargs)

if mode == "prove":
print("`define RISCV_FORMAL_UNBOUNDED", file=sby_file)

for csr in sorted(csrs):
print("`define RISCV_FORMAL_CSR_%s" % csr.upper(), file=sby_file)

@@ -467,4 +480,3 @@ def checks_key(check):
print(".PHONY: %s" % check, file=mkfile)

print("Generated %d checks." % (len(consistency_checks) + len(instruction_checks)))

@@ -13,6 +13,14 @@
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

module rvfi_testbench (
`ifdef RISCV_FORMAL_UNBOUNDED
`ifdef RISCV_FORMAL_TRIG_CYCLE
input trig,
`endif
`ifdef RISCV_FORMAL_CHECK_CYCLE
input check,
`endif
`endif
input clock, reset
);
`RVFI_WIRES
@@ -32,10 +40,18 @@ module rvfi_testbench (
.clock (clock),
.reset (cycle < `RISCV_FORMAL_RESET_CYCLES),
`ifdef RISCV_FORMAL_TRIG_CYCLE
`ifdef RISCV_FORMAL_UNBOUNDED
.trig (trig),
`else
.trig (cycle == `RISCV_FORMAL_TRIG_CYCLE),
`endif
`endif
`ifdef RISCV_FORMAL_CHECK_CYCLE
`ifdef RISCV_FORMAL_UNBOUNDED
.check (check),
`else
.check (cycle == `RISCV_FORMAL_CHECK_CYCLE),
`endif
`endif
`RVFI_CONN
);
ProTip! Use n and p to navigate between commits in a pull request.