Skip to content

Commit

Permalink
Add quit_on_klayout_drc and QUIT_ON_KLAYOUT_DRC
Browse files Browse the repository at this point in the history
  • Loading branch information
kareefardi committed Dec 6, 2023
1 parent 0e3de27 commit 789097c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions configuration/checkers.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ set ::env(QUIT_ON_LVS_ERROR) 1

# Klayout
set ::env(QUIT_ON_XOR_ERROR) 1
set ::env(QUIT_ON_KLAYOUT_DRC) 1
1 change: 1 addition & 0 deletions docs/source/reference/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ These variables worked initially, but they were too sky130 specific and will be
| `QUIT_ON_LINTER_WARNINGS` <a id="QUIT_ON_LINTER_WARNINGS"></a> | Quit on warnings generated by linter (currently Verilator) <br> (Default: `0`)|
| `QUIT_ON_LINTER_ERRORS` <a id="QUIT_ON_LINTER_ERRORS"></a> | Quit on errors generated by linter (currently Verilator) <br> (Default: `1`)|
| `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`)|
| `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`)|

## Misc.

Expand Down
28 changes: 28 additions & 0 deletions scripts/tcl_commands/checkers.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -387,4 +387,32 @@ proc quit_on_unconnected_pdn_nodes {args} {
}
}

proc get_violations_count {report_file} {
package require json

set total_violations_count 0

set fp [open $report_file r]
set violations_json [read $fp]
close $fp

set violations_dict [json::json2dict $violations_json]
foreach count [dict values $violations_dict] {
set total_violations_count [expr $total_violations_count + $count]
}
return $total_violations_count
}

proc quit_on_klayout_drc {report_file} {
set violations_count [get_violations_count $report_file]
if { $::env(QUIT_ON_KLAYOUT_DRC) && $violations_count != 0} {
puts_err "There are violations in the design after KLayout DRC."
puts_err "Total Number of violations is $violations_count"
throw_error
} elseif { $violations_count != 0 } {
puts_warn "There are violations in the design after KLayout DRC."
puts_warn "Total Number of violations is $violations_count"
}
}

package provide openlane 0.9
2 changes: 1 addition & 1 deletion scripts/tcl_commands/klayout.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ proc run_klayout_drc {args} {
run_klayout_drc_sky130
}
}

proc run_klayout_drc_sky130 {args} {
if { [info exists ::env(KLAYOUT_DRC_RUNSET)] && [info exists ::env(KLAYOUT_DRC_OPTIONS)] } {
set drc_script_path "$::env(KLAYOUT_DRC_RUNSET)"
Expand Down Expand Up @@ -131,6 +130,7 @@ proc run_klayout_drc_sky130 {args} {
--xml-file $xml_report \
--json-file $json_report
TIMER::timer_stop
quit_on_klayout_drc $json_report
}
}

Expand Down

0 comments on commit 789097c

Please sign in to comment.