Skip to content

Commit 1d52235

Browse files
committed
feat(auxmodules): Allow helper modules that enable easy refinement proofs:
- `AuxModule`: an external Module that is hooked up at the top level: - allows addition of auxilliary (extra) signals - specifications can refer to these signals - example: `designs/counter` and `specs/counter.py` fix(onetrace): One trace verification needs to only dump properties with one instance TODO: clean-up the PyConfig and TaskMgr classes, they can most probably be combined, making interfaces simpler Signed-off-by: Adwait Godbole <[email protected]>
1 parent 2312469 commit 1d52235

13 files changed

+407
-67
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ dump
1212

1313
# SVA intermediate files
1414
*.pyc.sv
15+
reset.rseq
1516

1617
# Jasper directory
1718
jgproject/

designs/counter/config.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"jasper" : {
3+
"jdir" : "designs/counter",
4+
"script" : "counter.tcl",
5+
"pycfile" : "counter.pyc.sv",
6+
"context" : "<embedded>::einter"
7+
},
8+
"spec" : {
9+
"pycspec" : "counter",
10+
"k" : 3
11+
}
12+
}

designs/counter/counter.sv

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
3+
module counter (
4+
input clk,
5+
input rst,
6+
output [7:0] counter
7+
);
8+
9+
// Counter that increments by 1
10+
logic [7:0] counter_internal;
11+
12+
always_ff @(posedge clk or posedge rst) begin
13+
if (rst) begin
14+
counter_internal <= 8'h00;
15+
end else begin
16+
counter_internal <= counter_internal + 1;
17+
end
18+
end
19+
20+
assign counter = counter_internal;
21+
22+
endmodule
23+
24+
25+
module parity (
26+
input clk,
27+
input rst,
28+
input [7:0] counter
29+
);
30+
31+
// OddEven parity
32+
logic parity;
33+
34+
// toggle parity bit
35+
always_ff @(posedge clk or posedge rst) begin
36+
if (rst) begin
37+
parity <= 1'b0;
38+
end else begin
39+
parity <= ~parity;
40+
end
41+
end
42+
43+
endmodule

designs/counter/counter.tcl

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
set banner "========== New session =========="
2+
puts $banner
3+
4+
clear -all
5+
6+
# Disable some info messages and warning messages
7+
# set_message -disable VERI-9033 ; # array automatically black-boxed
8+
# set_message -disable WNL008 ; # module is undefined. All instances will be black-boxed
9+
# set_message -disable VERI-1002 ; # Can't disable this error message (net does not have a driver)
10+
# set_message -disable VERI-1407 ; # attribute target identifier not found in this scope
11+
set_message -disable VERI-1018 ; # info
12+
set_message -disable VERI-1328 ; # info
13+
set_message -disable VERI-2571 ; # info
14+
# set_message -disable VERI-2571 ; # info: disabling old hierarchical reference handler
15+
set_message -disable INL011 ; # info: processing file
16+
# set_message -disable VERI-1482 ; # analyzing verilog file
17+
set_message -disable VERI-1141 ; # system task is not supported
18+
set_message -disable VERI-1060 ; # 'initial' construct is ignored
19+
set_message -disable VERI-1142 ; # system task is ignored for synthesis
20+
# set_message -disable ISW003 ; # top module name
21+
# set_message -disable HIER-8002 ; # disabling old hierarchical reference handler
22+
set_message -disable WNL046 ; # renaming embedded assertions due to name conflicts
23+
set_message -disable VERI-1995 ; # unique/priority if/case is not full
24+
# (we check these conditions with the elaborate
25+
# option -extract_case_assertions)
26+
27+
set JASPER_FILES {
28+
one_trace.sv
29+
}
30+
31+
set env(DESIGN_HOME) [pwd]
32+
set err_status [catch {analyze -sv12 +define+JASPER +define+SYNTHESIS +libext+.v+.sv+.vh+.svh+ -f design.lst {*}$JASPER_FILES} err_msg]
33+
if $err_status {error $err_msg}
34+
35+
elaborate \
36+
-top einter \
37+
-extract_case_assertions \
38+
-no_preconditions \
39+
40+
proc write_reset_seq {file} {
41+
puts $file "fvreset 1'b1"
42+
puts $file 1
43+
puts $file "fvreset 1'b0"
44+
puts $file {$}
45+
close $file
46+
}
47+
48+
proc reset_formal {} {
49+
write_reset_seq [open "reset.rseq" w]
50+
# reset -expression fvreset
51+
reset -sequence "reset.rseq"
52+
}
53+
54+
55+
clock clk
56+
57+
# Constrain primary inputs to only change on @(posedge eph1)
58+
clock -rate -default clk
59+
60+
reset_formal
61+
62+
# Set default Jasper proof engines (overrides use_nb engine settings)
63+
#set_engine_mode {Ht Hp B K I N D AG AM Tri}
64+
set_engine_mode {Ht}
65+
66+
set_max_trace_length 4
67+
68+
# Adds $prefix to each string in $list
69+
proc map_prefix {prefix list} {
70+
set out {}
71+
foreach s $list {
72+
lappend out "${prefix}${s}"
73+
}
74+
return $out
75+
}
76+
77+
# The input signals of a module instance
78+
proc instance_inputs {inst} {
79+
map_prefix "${inst}." [get_design_info -instance $inst -list input -silent]
80+
}
81+
82+
# The output signals of a module instance
83+
proc instance_outputs {inst} {
84+
map_prefix "${inst}." [get_design_info -instance $inst -list output -silent]
85+
}

designs/counter/design.lst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
${DESIGN_HOME}/counter.sv

designs/counter/one_trace.sv

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Parent module with a miter with different inputs
2+
module einter (
3+
input wire clk
4+
);
5+
6+
counter a (
7+
.clk(clk)
8+
);
9+
10+
default clocking cb @(posedge clk);
11+
endclocking // cb
12+
13+
logic fvreset;
14+
15+
`include "counter.pyc.sv"
16+
17+
endmodule

pycaliper/per/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
PERHole,
1515
CtrAlignHole,
1616
SVFunc,
17+
AuxPort,
18+
AuxModule,
1719
rose,
1820
fell,
1921
)

0 commit comments

Comments
 (0)