Changed the script drc.tcl into two routines for DRC load and save,

and merged the contents into drcmgr.tcl, with a new button in the
DRC manager for saving the DRC contents.  Loading is somewhat less
useful since the DRC error tiles are interactive.  The DRC manager
still has the issue that every checked edge becomes a separate
entry;  this is an artifact of the way the DRC checker works, but
it creates large numbers of error areas, many of which are redundant.
This commit is contained in:
Tim Edwards 2020-02-17 10:25:45 -05:00
parent ed8117784e
commit 715843ca2a
4 changed files with 107 additions and 49 deletions

View File

@ -24,7 +24,6 @@ TCL_FILES = \
tools.tcl \
mazeroute.tcl \
strip_reflibs.tcl \
drc.tcl \
toolkit.tcl \
toolkit_rev0.tcl \
bsitools.tcl \

View File

@ -1,46 +0,0 @@
#!/bin/tclsh
#----------------------------------------------
# Dump a file of DRC errors from magic
#----------------------------------------------
namespace path {::tcl::mathop ::tcl::mathfunc}
magic::suspendall
set fout [open "drc.out" w]
set oscale [cif scale out]
select top cell
set origcell [cellname list self]
drc check
set celllist [drc list count]
puts stdout "celllist is $celllist"
puts stdout ""
flush stdout
foreach pair $celllist {
set cellname [lindex $pair 0]
set count [lindex $pair 1]
puts stdout "loading $cellname"
flush stdout
load $cellname
select top cell
puts $fout "$cellname $count"
puts $fout "----------------------------------------"
set drcresult [drc listall why]
foreach {errtype coordlist} $drcresult {
puts $fout $errtype
puts $fout "----------------------------------------"
foreach coord $coordlist {
set bllx [* $oscale [lindex $coord 0]]
set blly [* $oscale [lindex $coord 1]]
set burx [* $oscale [lindex $coord 2]]
set bury [* $oscale [lindex $coord 3]]
set coords [format "%.3f %.3f %.3f %.3f" $bllx $blly $burx $bury]
puts $fout "$coords"
}
puts $fout "----------------------------------------"
}
puts $fout ""
}
close $fout
load $origcell
magic::resumeall

View File

@ -101,11 +101,13 @@ proc magic::makedrcmanager { mgrpath } {
-command {magic::drccallback update}
button ${mgrpath}.actionbar.last -text "Last" -command {magic::drccallback last}
button ${mgrpath}.actionbar.next -text "Next" -command {magic::drccallback next}
button ${mgrpath}.actionbar.save -text "Save" -command {magic::drc_save_report}
button ${mgrpath}.actionbar.zoom -text "Zoom" -command {magic::drccallback zoom}
pack ${mgrpath}.actionbar.update -side left
pack ${mgrpath}.actionbar.last -side left
pack ${mgrpath}.actionbar.next -side left
pack ${mgrpath}.actionbar.save -side left
pack ${mgrpath}.actionbar.zoom -side right
label ${mgrpath}.target.name -text "Target window:"
@ -150,7 +152,6 @@ proc magic::adddrcentry {key valuelist} {
}
}
#--------------------------------------------------------------
# The cell manager window main callback function
#--------------------------------------------------------------
@ -193,3 +194,107 @@ proc magic::drcmanager {{option "update"}} {
} ;# (if Tk version 8.5)
#---------------------------------------------------
# Alternative way to view/save DRC errors in magic.
# Dump a text file of errors and positions. Note
# that the dump, using "drc listall why", enumerates
# every single edge check and is therefore more
# detailed than the areas declared by "drc count"
# or enumerated in "drc find".
#---------------------------------------------------
proc magic::drc_save_report {{cellname ""} {outfile ""}} {
if {$outfile == ""} {set outfile "drc.out"}
set fout [open $outfile w]
set oscale [cif scale out]
# magic::suspendall
if {$cellname == ""} {
select top cell
set cellname [cellname list self]
set origname ""
} else {
set origname [cellname list self]
puts stdout "loading $cellname\n"
flush stdout
load $cellname
select top cell
}
drc check
set count [drc list count]
puts $fout "$cellname $count"
puts $fout "----------------------------------------"
set drcresult [drc listall why]
foreach {errtype coordlist} $drcresult {
puts $fout $errtype
puts $fout "----------------------------------------"
foreach coord $coordlist {
set bllx [expr {$oscale * [lindex $coord 0]}]
set blly [expr {$oscale * [lindex $coord 1]}]
set burx [expr {$oscale * [lindex $coord 2]}]
set bury [expr {$oscale * [lindex $coord 3]}]
set coords [format " %.3f %.3f %.3f %.3f" $bllx $blly $burx $bury]
puts $fout "$coords"
}
puts $fout "----------------------------------------"
}
puts $fout ""
if {$origname != ""} {
load $origname
}
# magic::resumeall
close $fout
puts stdout "done with $outfile\n"
flush stdout
}
#---------------------------------------------------
# Read back a dumped file of DRC errors. This is of
# limited use, as any layout should have DRC errors
# already marked. This routine loads errors into
# "feedback" areas, which is redundant to the error
# tiles. However, feedback areas are more precise,
# as they mark the error area at each checked edge
#---------------------------------------------------
proc magic::drc_load_report {{drc_file ""}} {
if {$drc_file == ""} {
set drc_file "drc.out"
}
set fin [open $drc_file r]
puts stdout "Reading $drc_file\n"
flush stdout
magic::suspendall
set error_text ""
while {[gets $fin line] >= 0} {
if {[string first " " $line] == 0} {
if [regexp { ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+)} $line lmatch llx lly urx ury] {
feedback add "$error_text" vert_highlights ${llx}um ${lly}um \
${llx}um ${ury}um ${urx}um ${ury}um ${urx}um ${lly}um
}
} elseif {[string first "-" $line] != 0} {
set error_text $line
}
}
magic::resumeall
close $fin
puts stdout "Done.\n"
puts stdout "Use \"feedback find\" to enumerate errors.\n"
flush stdout
}

View File

@ -1,5 +1,5 @@
# This is the "Magic wrapper".
# It's main purpose is to redefine the "openwindow" command in magic so that
# Its main purpose is to redefine the "openwindow" command in magic so that
# opening a new window creates a window wrapped by a GUI interface.
#
# Written by Tim Edwards, August 23, 2002.