Skip to content

Commit df042b8

Browse files
Noam Cohennanocoh
authored andcommitted
sec check
Signed-off-by: Noam Cohen <noam.chn1@gmail.com>
1 parent 88d10b0 commit df042b8

8 files changed

Lines changed: 79 additions & 13 deletions

File tree

docs/user/FlowVariables.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ configuration file.
170170
| <a name="KLAYOUT_TECH_FILE"></a>KLAYOUT_TECH_FILE| A mapping from LEF/DEF to GDS using the KLayout tool.| |
171171
| <a name="LATCH_MAP_FILE"></a>LATCH_MAP_FILE| Optional mapping file supplied to Yosys to map latches| |
172172
| <a name="LAYER_PARASITICS_FILE"></a>LAYER_PARASITICS_FILE| Path to per layer parasitics file. Defaults to $(PLATFORM_DIR)/setRC.tcl.| |
173-
| <a name="LEC_AUX_VERILOG_FILES"></a>LEC_AUX_VERILOG_FILES| Additional Verilog files (e.g. blackbox stubs) to include in LEC equivalence checks. Appended to the generated Verilog netlist before running the formal equivalence check.| |
173+
| <a name="LEC_AUX_VERILOG_FILES"></a>LEC_AUX_VERILOG_FILES| Additional Verilog files (e.g. blackbox stubs) to include in generated netlists for formal equivalence checks.| |
174174
| <a name="LEC_CHECK"></a>LEC_CHECK| Perform formal equivalence checks between before and after netlists. This checks CTS repair timing and the initial synthesis netlist against the final netlist. If this fails, report an issue to OpenROAD.| 0|
175175
| <a name="LIB_FILES"></a>LIB_FILES| A Liberty file of the standard cell library with PVT characterization, input and output characteristics, timing and power definitions for each cell.| |
176176
| <a name="MACRO_BLOCKAGE_HALO"></a>MACRO_BLOCKAGE_HALO| Distance beyond the edges of a macro that will also be covered by the blockage generated for that macro. Note that the default macro blockage halo comes from the largest of the specified MACRO_PLACE_HALO x or y values. This variable overrides that calculation.| |
@@ -268,6 +268,7 @@ configuration file.
268268
| <a name="SDC_FILE"></a>SDC_FILE| The path to design constraint (SDC) file.| |
269269
| <a name="SDC_GUT"></a>SDC_GUT| Load design and remove all internal logic before doing synthesis. This is useful when creating a mock .lef abstract that has a smaller area than the amount of logic would allow. bazel-orfs uses this to mock SRAMs, for instance.| |
270270
| <a name="SEAL_GDS"></a>SEAL_GDS| Seal macro to place around the design.| |
271+
| <a name="SEC_CHECK"></a>SEC_CHECK| Perform a sequential equivalence check between the initial synthesis netlist and final netlist with the Kepler Formal PDR engine. If this fails, report an issue to OpenROAD.| 0|
271272
| <a name="SETUP_MOVE_SEQUENCE"></a>SETUP_MOVE_SEQUENCE| Passed as -sequence to repair_timing. This should be a string of move keywords separated by commas.| |
272273
| <a name="SETUP_SLACK_MARGIN"></a>SETUP_SLACK_MARGIN| Specifies a time margin for the slack when fixing setup violations. This option allows you to overfix or underfix(negative value, terminate retiming before 0 or positive slack). See HOLD_SLACK_MARGIN for more details.| 0|
273274
| <a name="SET_RC_TCL"></a>SET_RC_TCL| Metal & Via RC definition file path.| |
@@ -342,12 +343,14 @@ configuration file.
342343
- [DFF_LIB_FILE](#DFF_LIB_FILE)
343344
- [DFF_MAP_FILE](#DFF_MAP_FILE)
344345
- [LATCH_MAP_FILE](#LATCH_MAP_FILE)
346+
- [LEC_AUX_VERILOG_FILES](#LEC_AUX_VERILOG_FILES)
345347
- [LEC_CHECK](#LEC_CHECK)
346348
- [MIN_BUF_CELL_AND_PORTS](#MIN_BUF_CELL_AND_PORTS)
347349
- [POST_SYNTH_TCL](#POST_SYNTH_TCL)
348350
- [PRE_SYNTH_TCL](#PRE_SYNTH_TCL)
349351
- [SDC_FILE](#SDC_FILE)
350352
- [SDC_GUT](#SDC_GUT)
353+
- [SEC_CHECK](#SEC_CHECK)
351354
- [SLANG_PLUGIN_PATH](#SLANG_PLUGIN_PATH)
352355
- [SYNTH_ARGS](#SYNTH_ARGS)
353356
- [SYNTH_BLACKBOXES](#SYNTH_BLACKBOXES)
@@ -589,6 +592,7 @@ configuration file.
589592
- [CDL_FILE](#CDL_FILE)
590593
- [GDS_ALLOW_EMPTY](#GDS_ALLOW_EMPTY)
591594
- [GND_NETS_VOLTAGES](#GND_NETS_VOLTAGES)
595+
- [LEC_AUX_VERILOG_FILES](#LEC_AUX_VERILOG_FILES)
592596
- [LEC_CHECK](#LEC_CHECK)
593597
- [MAX_ROUTING_LAYER](#MAX_ROUTING_LAYER)
594598
- [MIN_ROUTING_LAYER](#MIN_ROUTING_LAYER)
@@ -599,6 +603,7 @@ configuration file.
599603
- [PWR_NETS_VOLTAGES](#PWR_NETS_VOLTAGES)
600604
- [REPORT_CLOCK_SKEW](#REPORT_CLOCK_SKEW)
601605
- [ROUTING_LAYER_ADJUSTMENT](#ROUTING_LAYER_ADJUSTMENT)
606+
- [SEC_CHECK](#SEC_CHECK)
602607
- [SKIP_DETAILED_ROUTE](#SKIP_DETAILED_ROUTE)
603608
- [SKIP_REPORT_METRICS](#SKIP_REPORT_METRICS)
604609

flow/scripts/cts.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
utl::set_metrics_stage "cts__{}"
22
source $::env(SCRIPTS_DIR)/load.tcl
3-
source $::env(SCRIPTS_DIR)/lec_check.tcl
3+
source $::env(SCRIPTS_DIR)/formal_check.tcl
44
erase_non_stage_variables cts
55
load_design 3_place.odb 3_place.sdc
66
source_step_tcl PRE CTS

flow/scripts/final_report.tcl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
utl::set_metrics_stage "finish__{}"
22
source $::env(SCRIPTS_DIR)/load.tcl
3-
source $::env(SCRIPTS_DIR)/lec_check.tcl
3+
source $::env(SCRIPTS_DIR)/formal_check.tcl
44
erase_non_stage_variables final
55
load_design 6_1_fill.odb 6_1_fill.sdc
66
source_step_tcl PRE FINAL_REPORT
@@ -20,8 +20,16 @@ write_def $::env(RESULTS_DIR)/6_final.def
2020
write_verilog $::env(RESULTS_DIR)/6_final.v \
2121
-remove_cells [find_physical_only_masters]
2222

23+
if { $::env(LEC_CHECK) || $::env(SEC_CHECK) } {
24+
write_lec_verilog 6_final_lec.v
25+
}
26+
2327
if { $::env(LEC_CHECK) } {
24-
run_lec_test 6_final 1_synth_lec.v 6_final.v
28+
run_lec_test 6_final 1_synth_lec.v 6_final_lec.v
29+
}
30+
31+
if { $::env(SEC_CHECK) } {
32+
run_sec_test 6_final 1_synth_lec.v 6_final_lec.v
2533
}
2634

2735
# Run extraction and STA
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,22 @@ proc write_lec_script { step file1 file2 } {
3838
close $outfile
3939
}
4040

41+
proc write_sec_script { step file1 file2 } {
42+
set outfile [open "$::env(OBJECTS_DIR)/${step}_sec_test.yml" w]
43+
puts $outfile "format: verilog"
44+
puts $outfile "verification: sec"
45+
puts $outfile "sec_engine: pdr"
46+
puts $outfile "input_paths:"
47+
puts $outfile " - $::env(RESULTS_DIR)/${file1}"
48+
puts $outfile " - $::env(RESULTS_DIR)/${file2}"
49+
puts $outfile "liberty_files:"
50+
foreach libFile $::env(LIB_FILES) {
51+
puts $outfile " - $libFile"
52+
}
53+
puts $outfile "log_file: $::env(LOG_DIR)/${step}_sec_check.log"
54+
close $outfile
55+
}
56+
4157
proc run_lec_test { step file1 file2 } {
4258
write_lec_script $step $file1 $file2
4359
# tclint-disable-next-line command-args
@@ -54,3 +70,20 @@ proc run_lec_test { step file1 file2 } {
5470
puts "Repair timing output passed lec test"
5571
}
5672
}
73+
74+
proc run_sec_test { step file1 file2 } {
75+
write_sec_script $step $file1 $file2
76+
# tclint-disable-next-line command-args
77+
eval exec $::env(KEPLER_FORMAL_EXE) --config $::env(OBJECTS_DIR)/${step}_sec_test.yml
78+
try {
79+
set count [exec grep -c "SEC found a counterexample" $::env(LOG_DIR)/${step}_sec_check.log]
80+
} trap CHILDSTATUS {results options} {
81+
# This block executes if grep returns a non-zero exit code
82+
set count 0
83+
}
84+
if { $count > 0 } {
85+
error "Global output failed sec test"
86+
} else {
87+
puts "Global output passed sec test"
88+
}
89+
}

flow/scripts/synth_odb.tcl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
utl::set_metrics_stage "floorplan__{}"
22
source $::env(SCRIPTS_DIR)/load.tcl
3+
source $::env(SCRIPTS_DIR)/formal_check.tcl
34
erase_non_stage_variables synth
45
load_design 1_2_yosys.v 1_2_yosys.sdc
56
source_step_tcl PRE SYNTH
@@ -31,7 +32,6 @@ orfs_write_db $::env(RESULTS_DIR)/1_synth.odb
3132
# which are read in here and a canonicalized version is written
3233
# out by OpenSTA that has no dependencies.
3334
orfs_write_sdc $::env(RESULTS_DIR)/1_synth.sdc
34-
if { $::env(LEC_CHECK) } {
35-
write_verilog $::env(RESULTS_DIR)/1_synth_lec.v \
36-
-remove_cells [find_physical_only_masters]
35+
if { $::env(LEC_CHECK) || $::env(SEC_CHECK) } {
36+
write_lec_verilog 1_synth_lec.v
3737
}

flow/scripts/variables.json

Lines changed: 12 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flow/scripts/variables.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,13 +1556,23 @@ LEC_CHECK:
15561556
- synth
15571557
- cts
15581558
- final
1559+
SEC_CHECK:
1560+
description: >
1561+
Perform a sequential equivalence check between the initial synthesis
1562+
netlist and final netlist with the Kepler Formal PDR engine. If this
1563+
fails, report an issue to OpenROAD.
1564+
default: 0
1565+
stages:
1566+
- synth
1567+
- final
15591568
LEC_AUX_VERILOG_FILES:
15601569
description: >
1561-
Additional Verilog files (e.g. blackbox stubs) to include in LEC
1562-
equivalence checks. Appended to the generated Verilog netlist before
1563-
running the formal equivalence check.
1570+
Additional Verilog files (e.g. blackbox stubs) to include in generated
1571+
netlists for formal equivalence checks.
15641572
stages:
1573+
- synth
15651574
- cts
1575+
- final
15661576
REMOVE_CELLS_FOR_LEC:
15671577
description: >
15681578
String patterns directly passed to write_verilog -remove_cells <> for

tools/kepler-formal

Submodule kepler-formal updated 105 files

0 commit comments

Comments
 (0)