Skip to content

Commit 789097c

Browse files
committed
Add quit_on_klayout_drc and QUIT_ON_KLAYOUT_DRC
1 parent 0e3de27 commit 789097c

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

configuration/checkers.tcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ set ::env(QUIT_ON_LVS_ERROR) 1
4141

4242
# Klayout
4343
set ::env(QUIT_ON_XOR_ERROR) 1
44+
set ::env(QUIT_ON_KLAYOUT_DRC) 1

docs/source/reference/configuration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ These variables worked initially, but they were too sky130 specific and will be
391391
| `QUIT_ON_LINTER_WARNINGS` <a id="QUIT_ON_LINTER_WARNINGS"></a> | Quit on warnings generated by linter (currently Verilator) <br> (Default: `0`)|
392392
| `QUIT_ON_LINTER_ERRORS` <a id="QUIT_ON_LINTER_ERRORS"></a> | Quit on errors generated by linter (currently Verilator) <br> (Default: `1`)|
393393
| `QUIT_ON_XOR_ERROR` <a id="QUIT_ON_XOR_ERROR"></a> | Quit on XOR differences between GDSII generated by Magic and KLayout <br> (Default: `1`)|
394+
| `QUIT_ON_KLAYOUT_DRC` <a id="QUIT_ON_KLAYOUT_DRC"></a> | Checks for DRC violations after KLayout DRC is executed and exits the flow if any was found. 1 = Enabled, 0 = Disabled <br> (Default: `1`)|
394395

395396
## Misc.
396397

scripts/tcl_commands/checkers.tcl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,4 +387,32 @@ proc quit_on_unconnected_pdn_nodes {args} {
387387
}
388388
}
389389

390+
proc get_violations_count {report_file} {
391+
package require json
392+
393+
set total_violations_count 0
394+
395+
set fp [open $report_file r]
396+
set violations_json [read $fp]
397+
close $fp
398+
399+
set violations_dict [json::json2dict $violations_json]
400+
foreach count [dict values $violations_dict] {
401+
set total_violations_count [expr $total_violations_count + $count]
402+
}
403+
return $total_violations_count
404+
}
405+
406+
proc quit_on_klayout_drc {report_file} {
407+
set violations_count [get_violations_count $report_file]
408+
if { $::env(QUIT_ON_KLAYOUT_DRC) && $violations_count != 0} {
409+
puts_err "There are violations in the design after KLayout DRC."
410+
puts_err "Total Number of violations is $violations_count"
411+
throw_error
412+
} elseif { $violations_count != 0 } {
413+
puts_warn "There are violations in the design after KLayout DRC."
414+
puts_warn "Total Number of violations is $violations_count"
415+
}
416+
}
417+
390418
package provide openlane 0.9

scripts/tcl_commands/klayout.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ proc run_klayout_drc {args} {
8282
run_klayout_drc_sky130
8383
}
8484
}
85-
8685
proc run_klayout_drc_sky130 {args} {
8786
if { [info exists ::env(KLAYOUT_DRC_RUNSET)] && [info exists ::env(KLAYOUT_DRC_OPTIONS)] } {
8887
set drc_script_path "$::env(KLAYOUT_DRC_RUNSET)"
@@ -131,6 +130,7 @@ proc run_klayout_drc_sky130 {args} {
131130
--xml-file $xml_report \
132131
--json-file $json_report
133132
TIMER::timer_stop
133+
quit_on_klayout_drc $json_report
134134
}
135135
}
136136

0 commit comments

Comments
 (0)