Skip to content

Commit f739d81

Browse files
committed
example: Hazard3 CPU
The Hazard3 RISC-V CPU comes with SVA assertions. This script downloads the RTL, and runs ebmc to check them.
1 parent cdcc95f commit f739d81

File tree

1 file changed

+95
-0
lines changed

1 file changed

+95
-0
lines changed

examples/Hazard3/Hazard3.sh

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#!/bin/sh
2+
3+
# abort on error
4+
set -e
5+
6+
# clone Hazard3 repo if not done yet
7+
if [ ! -e Hazard3/.git ] ; then
8+
git clone https://github.com/Wren6991/Hazard3
9+
(cd Hazard3 ; git checkout v1.0)
10+
fi
11+
12+
cd Hazard3
13+
14+
ebmc -I hdl \
15+
-D HAZARD3_ASSERTIONS --bound 0 --top hazard3_alu \
16+
hdl/arith/hazard3_alu.v \
17+
hdl/arith/hazard3_priority_encode.v \
18+
hdl/arith/hazard3_onehot_encode.v \
19+
hdl/arith/hazard3_onehot_priority.v \
20+
hdl/arith/hazard3_shift_barrel.v
21+
22+
# expected elaboration-time constant, but got `hazard3_muldiv_seq.properties.i'
23+
# $past, for loop
24+
# ebmc -I hdl -D HAZARD3_ASSERTIONS --systemverilog --bound 0 hdl/arith/hazard3_muldiv_seq.v
25+
26+
ebmc -I hdl \
27+
-D HAZARD3_ASSERTIONS --bound 0 \
28+
hdl/arith/hazard3_shift_barrel.v
29+
30+
# conflicting assignment types
31+
if false ; then
32+
ebmc -I hdl -I test/formal/riscv-formal/tb -I test/formal/instruction_fetch_match \
33+
-D HAZARD3_ASSERTIONS --systemverilog --bound 0 --top hazard3_core \
34+
hdl/hazard3_core.v \
35+
hdl/arith/hazard3_alu.v \
36+
hdl/arith/hazard3_priority_encode.v \
37+
hdl/arith/hazard3_onehot_priority.v \
38+
hdl/arith/hazard3_onehot_priority_dynamic.v \
39+
hdl/arith/hazard3_onehot_encode.v \
40+
hdl/arith/hazard3_shift_barrel.v \
41+
hdl/arith/hazard3_branchcmp.v \
42+
hdl/hazard3_csr.v \
43+
hdl/hazard3_irq_ctrl.v \
44+
hdl/hazard3_decode.v \
45+
hdl/hazard3_instr_decompress.v \
46+
hdl/hazard3_frontend.v
47+
fi
48+
49+
# conflicting assignment types
50+
if false ; then
51+
ebmc -I hdl -I test/formal/riscv-formal/tb -I test/formal/instruction_fetch_match \
52+
-D HAZARD3_ASSERTIONS --systemverilog --bound 0 \
53+
hdl/hazard3_cpu_2port.v \
54+
hdl/hazard3_core.v \
55+
hdl/arith/hazard3_alu.v \
56+
hdl/arith/hazard3_branchcmp.v \
57+
hdl/arith/hazard3_priority_encode.v \
58+
hdl/arith/hazard3_onehot_encode.v \
59+
hdl/arith/hazard3_onehot_priority.v \
60+
hdl/arith/hazard3_onehot_priority_dynamic.v \
61+
hdl/arith/hazard3_shift_barrel.v \
62+
hdl/hazard3_csr.v \
63+
hdl/hazard3_irq_ctrl.v \
64+
hdl/hazard3_decode.v \
65+
hdl/hazard3_instr_decompress.v \
66+
hdl/hazard3_frontend.v
67+
fi
68+
69+
# four properties fail
70+
if false ; then
71+
ebmc -I hdl -D HAZARD3_ASSERTIONS --systemverilog --bound 0 --top hazard3_csr \
72+
hdl/hazard3_csr.v \
73+
hdl/hazard3_irq_ctrl.v \
74+
hdl/arith/hazard3_onehot_encode.v \
75+
hdl/arith/hazard3_onehot_priority.v \
76+
hdl/arith/hazard3_onehot_priority_dynamic.v
77+
fi
78+
79+
ebmc -I hdl \
80+
-D HAZARD3_ASSERTIONS --bound 0 --top hazard3_decode \
81+
hdl/hazard3_decode.v \
82+
hdl/hazard3_instr_decompress.v
83+
84+
# conflicting assignment types
85+
# ebmc -I hdl -D HAZARD3_ASSERTIONS --systemverilog --bound 0 hdl/hazard3_frontend.v
86+
87+
# property disabled by config
88+
# ebmc -I hdl -D HAZARD3_ASSERTIONS --bound 0 hdl/hazard3_instr_decompress.v
89+
90+
# property fails
91+
if false ; then
92+
ebmc -I hdl \
93+
-D HAZARD3_ASSERTIONS --bound 0 \
94+
hdl/hazard3_power_ctrl.v
95+
fi

0 commit comments

Comments
 (0)