From bf061f0012301361ec14ded93692f127d1f418b1 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Fri, 29 May 2020 11:55:30 -0400 Subject: [PATCH] Additional change to readspice script to handle various issues with pins not matching between netlist and layout due to delimiter changes or case sensitivity. --- lef/lefWrite.c | 2 +- tcltk/readspice.tcl | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/lef/lefWrite.c b/lef/lefWrite.c index a57e8f0d..94c35430 100644 --- a/lef/lefWrite.c +++ b/lef/lefWrite.c @@ -1254,7 +1254,7 @@ lefWriteMacro(def, f, scale, hide) lefWriteGeometry, (ClientData) &lc) == 1) { /* needHeader was set and there was something to write, */ - /* so write the headr and then re-run the search. */ + /* so write the header and then re-run the search. */ ispwrrail = LefWritePinHeader(f, lab); if (ispwrrail == FALSE) diff --git a/tcltk/readspice.tcl b/tcltk/readspice.tcl index 4fe8d78b..ee1fab83 100644 --- a/tcltk/readspice.tcl +++ b/tcltk/readspice.tcl @@ -87,6 +87,9 @@ proc readspice {netfile} { set n 1 set changed false foreach pin [lrange $ftokens 2 end] { + # Tcl "split" will not group spaces and tabs but leaves + # empty strings. + if {$pin == {}} {continue} # NOTE: Should probably check for CDL-isms, global bang # characters, case insensitive matches, etc. This routine @@ -98,9 +101,34 @@ proc readspice {netfile} { # name, only the one triggered by "goto" will be made into # a port. - set pinidx [port $pin index] + set testpin $pin + set pinidx [port $testpin index] + + # Test a few common delimiter translations. This list + # is by no means exhaustive. + + if {$pinidx == ""} { + set testpin [string map {\[ < \] >]} $pin + set pinidx [port $testpin index] + } + if {$pinidx == ""} { + set testpin [string map {< \[ > \]} $pin + set pinidx [port $testpin index] + } + + # Also test some case sensitivity issues (also not exhaustive) + + if {$pinidx == ""} { + set testpin [string tolower $pin] + set pinidx [port $testpin index] + } + if {$pinidx == ""} { + set testpin [string toupper $pin] + set pinidx [port $testpin index] + } + if {$pinidx != ""} { - port $pin index $n + port $testpin index $n if {$pinidx != $n} { set changed true }