-
Notifications
You must be signed in to change notification settings - Fork 510
Global SEC check #4329
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
base: master
Are you sure you want to change the base?
Global SEC check #4329
Changes from all commits
88d10b0
df042b8
5aacc64
ee50120
c1ae0cd
2bdc815
3df7271
f14142c
8d430f8
9b77168
69100d4
8b8a56d
1d8c95d
9b1f11c
9588dab
c09f3be
3f8cf84
ee305a2
ccefb71
50fc1e6
b9f76ae
dc55212
fe03e97
fc7720c
ebb8240
4035de1
16df2be
7908753
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,6 +46,29 @@ proc write_lec_script { step file1 file2 } { | |
| close $outfile | ||
| } | ||
|
|
||
| proc write_sec_script { step file1 file2 } { | ||
| set outfile [open "$::env(OBJECTS_DIR)/${step}_sec_test.yml" w] | ||
| puts $outfile "format: verilog" | ||
| puts $outfile "verification: sec" | ||
| puts $outfile "sec_engine: pdr" | ||
| puts $outfile "input_paths:" | ||
| puts $outfile " - $::env(RESULTS_DIR)/${file1}" | ||
| puts $outfile " - $::env(RESULTS_DIR)/${file2}" | ||
| puts $outfile "liberty_files:" | ||
| foreach libFile $::env(LIB_FILES) { | ||
| puts $outfile " - $libFile" | ||
| } | ||
| puts $outfile "log_file: $::env(LOG_DIR)/${step}_sec_check.log" | ||
| close $outfile | ||
| } | ||
|
|
||
| proc formal_check_label { step } { | ||
| if { [string equal $step 4_rsz] } { | ||
| return "Repair timing output" | ||
| } | ||
| return "Global output" | ||
| } | ||
|
Comment on lines
+65
to
+70
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a |
||
|
|
||
| proc run_lec_test { step file1 file2 } { | ||
| write_lec_script $step $file1 $file2 | ||
| # tclint-disable-next-line command-args | ||
|
|
@@ -56,9 +79,27 @@ proc run_lec_test { step file1 file2 } { | |
| # This block executes if grep returns a non-zero exit code | ||
| set count 0 | ||
| } | ||
| set label [formal_check_label $step] | ||
| if { $count > 0 } { | ||
| error "$label failed lec test" | ||
| } else { | ||
| puts "$label passed lec test" | ||
| } | ||
| } | ||
|
|
||
| proc run_sec_test { step file1 file2 } { | ||
| write_sec_script $step $file1 $file2 | ||
| # tclint-disable-next-line command-args | ||
| eval exec $::env(KEPLER_FORMAL_EXE) --config $::env(OBJECTS_DIR)/${step}_sec_test.yml | ||
| try { | ||
| set count [exec grep -c "SEC found a counterexample" $::env(LOG_DIR)/${step}_sec_check.log] | ||
| } trap CHILDSTATUS {results options} { | ||
| # This block executes if grep returns a non-zero exit code | ||
| set count 0 | ||
| } | ||
| if { $count > 0 } { | ||
| error "Repair timing output failed lec test" | ||
| error "Global output failed sec test" | ||
| } else { | ||
| puts "Repair timing output passed lec test" | ||
| puts "Global output passed sec test" | ||
| } | ||
| } | ||
|
Comment on lines
+90
to
105
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checking for a pattern in the log file using |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| utl::set_metrics_stage "synth__{}" | ||
| source $::env(SCRIPTS_DIR)/load.tcl | ||
| source $::env(SCRIPTS_DIR)/formal_check.tcl | ||
| erase_non_stage_variables synth | ||
| load_design 1_2_yosys.v 1_2_yosys.sdc | ||
| source_step_tcl PRE SYNTH | ||
|
|
@@ -34,3 +35,6 @@ orfs_write_db $::env(RESULTS_DIR)/1_synth.odb | |
| # which are read in here and a canonicalized version is written | ||
| # out by OpenSTA that has no dependencies. | ||
| orfs_write_sdc $::env(RESULTS_DIR)/1_synth.sdc | ||
| if { $::env(LEC_CHECK) || $::env(SEC_CHECK) } { | ||
| write_lec_verilog 1_synth_lec.v | ||
| } | ||
|
Comment on lines
+38
to
+40
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| utl::set_metrics_stage "synth__{}" | ||
| source $::env(SCRIPTS_DIR)/load.tcl | ||
| source $::env(SCRIPTS_DIR)/formal_check.tcl | ||
| erase_non_stage_variables synth | ||
|
|
||
| source_env_var_if_exists PLATFORM_TCL | ||
|
|
@@ -74,3 +75,6 @@ orfs_write_db $::env(RESULTS_DIR)/1_synth.odb | |
| # which are read in here and a canonicalized version is written | ||
| # out by OpenSTA that has no dependencies. | ||
| orfs_write_sdc $::env(RESULTS_DIR)/1_synth.sdc | ||
| if { $::env(LEC_CHECK) || $::env(SEC_CHECK) } { | ||
| write_lec_verilog 1_synth_lec.v | ||
| } | ||
|
Comment on lines
+78
to
+80
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| # Enable LEC (Logical Equivalence Check) only if kepler-formal is installed. | ||
| # Enable formal checks only if kepler-formal is installed. | ||
| # kepler-formal is primarily an OpenROAD/ORFS developer tool, not an end-user | ||
| # tool. End-users would typically run LEC transactionally at project completion, | ||
| # not in every CI run where it wastes CI time. | ||
| # tool. End-users would typically run these checks transactionally at project | ||
| # completion, not in every CI run where it wastes CI time. | ||
| export LEC_CHECK ?= $(if $(wildcard $(KEPLER_FORMAL_EXE)),1,0) | ||
| export SEC_CHECK ?= $(if $(wildcard $(KEPLER_FORMAL_EXE)),1,0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using raw environment variables like
$::env(LEC_CHECK)and$::env(SEC_CHECK)directly to guard formal check execution can cause crashes if they are set to 1 but the formal tool executable is missing or not executable. Use thelec_check_enabledandsec_check_enabledhelper functions to safely guard these steps.