1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268 | ###############################################################################
# Copyright (c) 2017-2024 by Altair Engineering, Inc.
# All rights reserved.
#
# Altair Engineering, Inc. makes this software available as part of the Vision
# tool platform. As long as you are a licensee of the Vision tool platform
# you may make copies of the software and modify it to be used within the
# Vision tool platform, but you must include all of this notice on any copy.
# Redistribution without written permission to any third party, with or
# without modification, is not permitted.
# Altair Engineering, Inc. does not warrant that this software is error free
# or fit for any purpose. Altair Engineering, Inc. disclaims any liability for
# all claims, expenses, losses, damages and costs any user may incur as a
# result of using, copying or modifying the software.
# =============================================================================
# @plugin
# Calculate the Pin-to-Pin Resistance
# @namespace
# PinToPinRes
# @section
# Analyze the Loaded Database
# @description
# Report the pin-to-pin resistance for two given pins on the same net
# without opening the Parasitic window.
# Select two pins on the same net and access this function from the
# extended Popup menu.
# @license
# permit spice
# available gv-spf
# @files
# parasitic/pinToPinRes.tcl
# @example
# demo/dspf/example.dspf
# @cmdline
# -readDSPF @example[0]
# -userware @files[0]
# @tag
# parasitic spf dspf
###############################################################################
# =============================================================================
# Init - Initialize the plugin.
# =============================================================================
#
proc PinToPinRes:Init {} {
##
# Extend the Popup menu.
#
gui popup append "Pin-to-Pin Resistance" "PinToPinRes:Start"
}
# =============================================================================
# Finit - Finalize the plugin.
# =============================================================================
#
proc PinToPinRes:Finit {} {
##
# Undo modifications of the Popup menu.
#
gui popup remove "Pin-to-Pin Resistance"
}
# =============================================================================
# Start - Report the pin-to-pin resistance for two given pins on the same net.
# =============================================================================
#
proc PinToPinRes:Start {oidList} {
set db [gui database get]
##
# Check that exactly two objects are selected.
#
if {[llength $oidList] != 2} {
zmessage print WAR "Please select exactly two pins."
return
}
##
# Get the two selected pins.
#
set pin1 [lindex $oidList 0]
set pin2 [lindex $oidList 1]
zmessage print DBG "Calculate pin-to-pin resistance: $pin1 => $pin2"
zmessage print DBG " PIN1: $pin1"
zmessage print DBG " PIN2: $pin2"
##
# Get the signal connected to both selected pins.
#
set signal [PinToPinRes:_getConnectedSignal $db $pin1 $pin2]
if {[$db oid isnull $signal]} {
return
}
zmessage print DBG " SIGNAL: $signal"
##
# Search for the parasitic module containing the RC-network.
#
set parasitic [$db search parasitic [$db oid oname $signal]]
if {[$db oid isnull $parasitic]} {
set path [$db oid path $signal]
lappend path [$db oid oname $signal]
set parasitic [$db search parasitic [join $path /]]
}
if {[$db oid isnull $parasitic]} {
zmessage print ERR "Cannot find parasitic net for $signal"
return
}
##
# Fill the parasitic contents of the selected signal.
#
if {![PinToPinRes:_fillParasitic $db $parasitic]} {
return
}
##
# Convert the two pins into ports at the parasitic module.
#
set start [PinToPinRes:_convertToParasiticPort $db $parasitic $pin1]
set target [PinToPinRes:_convertToParasiticPort $db $parasitic $pin2]
if {[$db oid isnull $start] || [$db oid isnull $target]} {
return
}
##
# Calculate the resistance between the two parasitic ports.
#
set instCount [$db report objCount -inst $parasitic]
zmessage print DBG "Start resistance calculation ($instCount instances)."
set portList [list $start $target]
set begTime [zos currentRuntime]
set res [$db oper reduceres -nomodify -calc -nomesh $parasitic $portList]
set endTime [zos currentRuntime]
set runtime [expr {($endTime - $begTime) / double(1000)}]
zmessage print DBG "Calculate resistance in $runtime seconds."
destroy .p2p
toplevel .p2p
wm title .p2p "Pin-to-Pin Resistance"
ttk::label .p2p.value1 -text "The total pin-to-pin resistance between:"
ttk::label .p2p.value2 -text $pin1
ttk::label .p2p.value3 -text $pin2
ttk::label .p2p.value4 -text "= [format %.2f $res]"
ttk::button .p2p.ok -text "OK" -command "destroy .p2p"
pack .p2p.value1 .p2p.value2 .p2p.value3 .p2p.value4 .p2p.ok -side top
}
# -----------------------------------------------------------------------------
# _fillParasitic - Fill the given parasitic module depending on the file type.
# -----------------------------------------------------------------------------
#
proc PinToPinRes:_fillParasitic {db parasitic} {
set fname ""
$db spos foreach $parasitic fname beg end {
break
}
if {$fname == ""} {
zmessage print ERR \
"Cannot get filename for parasitic module '$parasitic'."
return false
}
set cmd {}
set type [$db spos filetype $fname]
switch -exact -- $type {
Dspf {
set cmd zdspf
}
Spef {
set cmd zspef
}
default {
zmessage print ERR "File type '$type' not supported"
return false
}
}
$cmd -into $db -fillParasitic [$db oid oname $parasitic]
return true
}
# -----------------------------------------------------------------------------
# _convertToParasiticPort - Convert a pin into a port at the parasitic module.
# -----------------------------------------------------------------------------
#
proc PinToPinRes:_convertToParasiticPort {db parasitic pin} {
zmessage print DBG "Convert pin $pin into a parasitic port."
##
# Get the divider and delimiter character.
#
set divider [$db attr -db getValue "@DIVIDER"]
set delim [$db attr -db getValue "@DELIMITER"]
set hiersep [$db oper hiersep get]
set pinName [$db oid print $pin -notype -noroot -hiersep $divider \
-delim $delim]
zmessage print DBG " Pin name: $pinName"
if {[catch {
set port [$db oid createFromString "port" $parasitic $pinName $hiersep \
-delim $delim -guess]
} msg]} {
zmessage print ERR " Cannot find parasitic port for pin $pin ($msg)"
set port [$db oid create null]
}
zmessage print DBG " Parasitic port: $port"
return $port
}
# -----------------------------------------------------------------------------
# _getConnectedSignal - Return the signal connected to both selected pins.
# -----------------------------------------------------------------------------
#
proc PinToPinRes:_getConnectedSignal {db pin1 pin2} {
set type1 [$db oid type $pin1]
set type2 [$db oid type $pin2]
if {($type1 != "pin") && ($type1 != "port")} {
zmessage print ERR \
"Selected object ([$db oid print $pin1]) is not a pin or port."
return [$db oid create null]
}
if {($type2 != "pin") && ($type2 != "port")} {
zmessage print ERR \
"Selected object ([$db oid print $pin2]) is not a pin or port."
return [$db oid create null]
}
if {(![$db isConnected $pin1]) || (![$db isConnected $pin2])} {
zmessage print ERR "One pin is not connected."
return [$db oid create null]
}
##
# Get the signal connected to the selected pins.
#
set signal1 [$db oid convertTo signal [$db connectedNet $pin1]]
set signal2 [$db oid convertTo signal [$db connectedNet $pin2]]
##
# Both pins need to connect to the same signal.
#
if {![$db oid isequal $signal1 $signal2]} {
zmessage print ERR "Selected pin are not on the same net."
return [$db oid create null]
}
return $signal1
}
# =============================================================================
# Call the initialization procedure.
# =============================================================================
#
PinToPinRes:Init
|