Modified readspice to support the CDL "*.PININFO" line for annotating

layouts with pin class (direction) from CDL files.
This commit is contained in:
Tim Edwards 2020-06-29 21:13:57 -04:00
parent f6de28c760
commit 6812e7cd10
1 changed files with 31 additions and 0 deletions

View File

@ -57,6 +57,12 @@ proc readspice {netfile} {
set fdata {} set fdata {}
set lastline "" set lastline ""
while {[gets $fnet line] >= 0} { while {[gets $fnet line] >= 0} {
# Handle CDL format *.PININFO (convert to .PININFO ...)
if {$is_cdl && ([string range $line 0 1] == "*.")} {
if {[string tolower [string range $line 2 8]] == "pininfo"} {
set line [string range $line 1 end]
}
}
if {[string index $line 0] != "*"} { if {[string index $line 0] != "*"} {
if {[string index $line 0] == "+"} { if {[string index $line 0] == "+"} {
if {[string range $line end end] != " "} { if {[string range $line end end] != " "} {
@ -74,6 +80,9 @@ proc readspice {netfile} {
# Now look for all ".subckt" lines # Now look for all ".subckt" lines
set cell ""
set status 0
suspendall suspendall
foreach line $fdata { foreach line $fdata {
set ftokens [split $line] set ftokens [split $line]
@ -90,6 +99,7 @@ proc readspice {netfile} {
if {$keyword == ".subckt"} { if {$keyword == ".subckt"} {
set cell [lindex $ftokens 1] set cell [lindex $ftokens 1]
set status [cellname list exists $cell] set status [cellname list exists $cell]
set pindict [dict create]
if {$status != 0} { if {$status != 0} {
load $cell load $cell
box values 0 0 0 0 box values 0 0 0 0
@ -142,6 +152,8 @@ proc readspice {netfile} {
set changed true set changed true
} }
incr n incr n
# Record the original and modified pin names
dict set pindict $pin $testpin
} else { } else {
set layer [goto $pin] set layer [goto $pin]
if {$layer != ""} { if {$layer != ""} {
@ -149,6 +161,8 @@ proc readspice {netfile} {
incr n incr n
set changed true set changed true
} }
# Record the pin name as unmodified
dict set pindict $pin $pin
} }
} }
if {$changed} { if {$changed} {
@ -157,6 +171,23 @@ proc readspice {netfile} {
} else { } else {
puts stdout "Cell $cell in netlist has not been loaded." puts stdout "Cell $cell in netlist has not been loaded."
} }
} elseif {$keyword == ".pininfo"} {
if {($cell != "") && ($status != 0)} {
foreach pininfo [lrange $ftokens 1 end] {
set infopair [split $pininfo :]
set pinname [lindex $infopair 0]
set pindir [lindex $infopair 1]
set pin [dict get $pindict $pinname]
case $pindir {
B {port $pin class inout}
I {port $pin class input}
O {port $pin class output}
}
}
}
} elseif {$keyword == ".ends"} {
set cell ""
set status 0
} }
} }
resumeall resumeall