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 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

add RISCV_FORMAL_UNBOUNDED variable

  • Loading branch information
thales
thales committed Aug 8, 2019
commit 158e07ba0088e280c29d8f8628e7ccc01fda3214
@@ -33,7 +33,7 @@
dumpsmt2 = False
sbycmd = "sby"
config = dict()
mode = "bmc" # bmc/prove/live/cover/equiv/synth
mode = "bmc"

if len(sys.argv) > 1:
assert len(sys.argv) == 2
@@ -83,10 +83,11 @@
elif line[0] == "dumpsmt2":
assert len(line) == 1
dumpsmt2 = True

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

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

instruction_checks = set()
consistency_checks = set()
@@ -237,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)

@@ -392,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)

@@ -439,6 +446,7 @@ def check_cons(check, chanidx=None, start=None, trig=None, depth=None, csr_mode=
check_cons("unique", chanidx=i, start=0, trig=1, depth=2)
check_cons("causal", chanidx=i, start=0, depth=1)
check_cons("ill", chanidx=i, depth=0)
check_cons("const_2_time", chanidx=i, start=0, trig=1, depth=2)

This comment has been minimized.

@cliffordwolf

cliffordwolf Aug 8, 2019
Collaborator

What is const_2_time?

This comment has been minimized.

@AlAlves

AlAlves Aug 8, 2019
Author Contributor

Oops, my bad, I mixed this version with my custom version.

I fixed it.


check_cons("hang", start=0, depth=1)

@@ -473,4 +481,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.