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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818 | ###############################################################################
# Copyright (c) 2003-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
# Parse PathMill Reports
# @namespace
# PathMill
# @section
# Read Side Files and Annotate Data
# @description
# Parse a Pathmill report file and load the paths into the Cone window.
# On click, the values are displayed on the schematic.
#
# Select Pathmill->Open Pathmill File (from main menu) and open the
# report file.
# @test
# ModuleTest
# @files
# pathmill/pathmill.tcl
# pathmill/compound.out
# pathmill/compound.spi
# pathmill/gl85.out
# @example
# demo/spice/gl85.sp
# @cmdline
# -hspice @example[0]
# -userware @files[0]
# @tag
# spice verilog netlist gui
###############################################################################
# =============================================================================
# Init - Initialize the plugin.
# =============================================================================
#
proc PathMill:Init {argc argv} {
global PathMill
set db [gui database get]
PathMill:ResetVariables $db
gui menu command {"Userware" "Open Pathmill File"} \
[list PathMill:OpenFile $db]
##
# Show net attributes at pins.
#
gui settings set "nlv:netattrpin" 1
gui settings set "cone:autohide" 1
gui settings changed
if {$argc == 1} {
set PathMill(cmd) \
[list PathMill:_resetVariablesAndLoadFile [lindex $argv 0]]
} else {
set PathMill(cmd) [list PathMill:ResetVariables]
}
gui database registerChangedCallback $PathMill(cmd)
}
# =============================================================================
# Finit - Finalize the plugin.
# =============================================================================
#
proc PathMill:Finit {} {
global PathMill
gui menu removeEntry {"Userware" "Open Pathmill File"}
gui database removeChangedCallback [lindex $PathMill(cmd) 0]
}
# -----------------------------------------------------------------------------
# _resetVariablesAndLoadFile - Reset variables and load the given file.
# -----------------------------------------------------------------------------
#
proc PathMill:_resetVariablesAndLoadFile {file db} {
PathMill:ResetVariables $db
##
# If db is close do no load file again.
#
if {$db != {}} {
PathMill:ShowDialog $file
}
}
# =============================================================================
# ResetVariables - Unset old values and initialize PrimeTime array.
# =============================================================================
#
proc PathMill:ResetVariables {db} {
global PathMill
set PathMill(db) $db
set PathMill(showDelay) 1
set PathMill(showDelta) 0
set PathMill(showRFTime) 0
set PathMill(showCap) 1
set PathMill(displayEdges) 1
if {$db == {}} {
return
}
$db foreach top top {
set PathMill(top) $top
break
}
}
# =============================================================================
# ParseFile - Parse the Pathmill file and store the index of each path.
# =============================================================================
#
proc PathMill:ParseFile {file} {
global PathMill
##
# Remember the filename and open the file for reading in binary mode.
#
set PathMill(file) $file
set in [open $file r]
chan configure $in -translation binary
##
# Read the file line by line.
#
set n 0
set lastFilePos -1
while {![eof $in]} {
gets $in line
##
# Look for "Total number of" and store the number of paths found.
#
if {[string match "Total number of*" $line]} {
set nPath [lindex $line end]
}
##
# Store the start index of a path in the file.
#
if {[string match "Path (*" $line]} {
lappend PathMill(pathList) "Path [incr n]"
set pathNo [string trim [lindex $line 1] ()]
set PathMill($pathNo:fileIndex) $lastFilePos
}
set lastFilePos [tell $in]
}
if {$nPath != $n} {
zmessage print ERR "Found $n path(s) but expect $nPath."
}
set PathMill([incr n]:fileIndex) [file size $file]
##
# Close the input file and show the dialog.
#
close $in
}
# =============================================================================
# ShowDialog - Create a dialog window to display:
#
# (1) A listbox with all paths found in the file.
# (2) A text widget with the source of the pathmill file.
# (3) Radio buttons to select display attributes
# (4) Buttons to highlight a path or load a path into the Cone
# Window.
# =============================================================================
#
proc PathMill:ShowDialog {file} {
global PathMill
##
# Create a new toplevel dialog window.
#
if {[winfo exists .pm]} {
destroy .pm
}
toplevel .pm -class Dialog
wm title .pm "PathMill: $file"
wm transient .pm .
wm group .pm .
wm withdraw .pm
##
# Left frame with a listbox to display all paths. Also attach scrollbars
# to the listbox.
#
ttk::frame .pm.lf
listbox .pm.lf.pathList -xscrollcommand ".pm.lf.scrollx set" \
-yscrollcommand ".pm.lf.scrolly set" \
-listvariable PathMill(pathList) \
-exportselection false \
-selectmode single
ttk::scrollbar .pm.lf.scrollx -orient horizontal \
-command ".pm.lf.pathList xview"
ttk::scrollbar .pm.lf.scrolly -orient vertical \
-command ".pm.lf.pathList yview"
grid .pm.lf.pathList -row 0 -column 0 -sticky news
grid .pm.lf.scrolly -row 0 -column 1 -sticky ns
grid .pm.lf.scrollx -row 1 -column 0 -sticky we
grid rowconfigure .pm.lf 0 -weight 1
grid rowconfigure .pm.lf 1 -weight 0
grid columnconfigure .pm.lf 0 -weight 1
grid columnconfigure .pm.lf 1 -weight 0
##
# Right frame with a text widget to display the Pathmill source file.
# Also attach scrollbars to the text widget.
#
ttk::frame .pm.rf
text .pm.rf.src -xscrollcommand ".pm.rf.scrollx set" \
-yscrollcommand ".pm.rf.scrolly set" \
-cursor {} \
-font TkFixedFont \
-state disabled \
-wrap none
ttk::scrollbar .pm.rf.scrollx -orient horizontal \
-command ".pm.rf.src xview"
ttk::scrollbar .pm.rf.scrolly -orient vertical \
-command ".pm.rf.src yview"
##
# Remove all default bindings and bind only what's really needed.
#
foreach clsBind [bind Text] {
bind .pm.rf.src $clsBind {
break
}
}
bind .pm.rf.src <KeyPress> {
}
set PathMill(selColor) \
[option get .pm.rf.src selectBackground SelectBackground]
if {$PathMill(selColor) == {}} {
set PathMill(selColor) "#c7c7c7"
}
grid .pm.rf.src -row 0 -column 0 -sticky news
grid .pm.rf.scrolly -row 0 -column 1 -sticky ns
grid .pm.rf.scrollx -row 1 -column 0 -sticky we
grid .pm.rf.scrollx -row 1 -column 0 -sticky we
grid rowconfigure .pm.rf 0 -weight 1
grid rowconfigure .pm.rf 1 -weight 0
grid columnconfigure .pm.rf 0 -weight 1
grid columnconfigure .pm.rf 1 -weight 0
##
# Create a frame with the display attribute selection radio buttons
# and with the "Highlight Path" and "Load Path into Cone" button.
#
ttk::frame .pm.bf
ttk::frame .pm.bf.radio
label .pm.bf.radio.showLabel -text "Show: "
ttk::checkbutton .pm.bf.radio.showDelay -text "Delay" \
-variable PathMill(showDelay) \
-command PathMill:_displayAttr
ttk::checkbutton .pm.bf.radio.showDelta -text "Delta" \
-variable PathMill(showDelta) \
-command PathMill:_displayAttr
ttk::checkbutton .pm.bf.radio.showRFtime -text "RF time" \
-variable PathMill(showRFTime) \
-command PathMill:_displayAttr
ttk::checkbutton .pm.bf.radio.showCap -text "Cap" \
-variable PathMill(showCap) \
-command PathMill:_displayAttr
ttk::checkbutton .pm.bf.radio.edges -text "Raise/Fall Edges" \
-variable PathMill(displayEdges) \
-command PathMill:_displayAttr
grid .pm.bf.radio.showLabel -row 0 -column 0 -padx 5
grid .pm.bf.radio.showDelay -row 0 -column 1 -padx 5
grid .pm.bf.radio.showDelta -row 0 -column 2 -padx 5
grid .pm.bf.radio.showRFtime -row 0 -column 3 -padx 5
grid .pm.bf.radio.showCap -row 0 -column 4 -padx 5
grid .pm.bf.radio.edges -row 0 -column 5 -padx 5
ttk::frame .pm.bf.btn
ttk::button .pm.bf.btn.highl -text "Highlight Path" \
-command "PathMill:HighlightPath"
ttk::button .pm.bf.btn.cone -text "Load Path into Cone" \
-command "PathMill:LoadCone"
ttk::button .pm.bf.btn.close -text "Close" \
-command "destroy .pm"
grid .pm.bf.btn.highl -row 0 -column 1 -sticky e -padx 5 -pady 2
grid .pm.bf.btn.cone -row 0 -column 2 -sticky e -padx 5 -pady 2
grid .pm.bf.btn.close -row 0 -column 3 -sticky e -padx 5 -pady 2
grid .pm.bf.radio -row 0 -column 0 -sticky w
grid .pm.bf.btn -row 0 -column 1 -sticky e
grid columnconfigure .pm.bf 0 -weight 1
grid columnconfigure .pm.bf 1 -weight 1
##
# Grid all together.
#
grid .pm.lf -row 0 -column 0 -sticky news
grid .pm.rf -row 0 -column 1 -sticky news
grid .pm.bf -row 1 -column 0 -sticky news -columnspan 2
grid rowconfigure .pm 0 -weight 1
grid rowconfigure .pm 1 -weight 0
grid columnconfigure .pm 0 -weight 1
grid columnconfigure .pm 1 -weight 2
##
# Bind single mouse click in listbox.
#
bind .pm.lf.pathList <Button-1> {
PathMill:ScanAndShowPath [expr {[%W index @%x,%y] + 1}] .pm.rf.src
}
PathMill:ParseFile $file
##
# Always select the first entry.
#
.pm.lf.pathList selection set 0
PathMill:ScanAndShowPath 1 .pm.rf.src
wm deiconify .pm
}
# =============================================================================
# ScanAndShowPath - Scans the path given by $index and shows it in $text.
# =============================================================================
#
proc PathMill:ScanAndShowPath {index text} {
global PathMill
##
# Delete all attributes from the last displayed path.
#
if {[info exists PathMill(currentPath)]} {
foreach oid $PathMill($PathMill(currentPath):nodeList) {
$PathMill(db) flatattr $oid delete
}
}
set PathMill(currentPath) $index
set PathMill($index:nodeList) {}
set PathMill($index:elemList) {}
$text configure -state normal
$text delete 1.0 end
set in [open $PathMill(file) r]
chan configure $in -translation binary
set startPos $PathMill($index:fileIndex)
set endPos $PathMill([expr {$index + 1}]:fileIndex)
seek $in $startPos
set idxFlag 0
set lineNo 0
while {![eof $in]} {
set bytes [gets $in line]
incr startPos $bytes
if {$startPos >= $endPos} {
break
}
$text insert insert ${line}\n
incr lineNo
if {[llength $line] == 0} {
continue
}
if {[string match "Path *" $line]} {
continue
}
if {[string match "*-----*" $line]} {
continue
}
if {[string match "*Delay*" $line]} {
continue
}
if {[string match "*Acc*" $line]} {
set accCol [string first "Acc" $line]
set deltaCol [string first "Delta" $line]
set timeCol [string first "time" $line]
set capCol [string first "Cap" $line]
set nodeNameCol [string first "Name" $line]
set elemNameCol [string last "Name" $line]
set idxFlag 1
continue
}
if {$idxFlag} {
##
# Node Name
#
set end [expr {$elemNameCol - 1}]
while {[string index $line $end] == " "} {
incr end -1
}
set start $end
while {([string index $line $start] != " ") && \
([string index $line $start] != ")")} {
incr start -1
}
incr start
set nodeName [string range $line $start $end]
if {$nodeName != ""} {
incr end
set oid {}
catch {
set oid [$PathMill(db) oid createFromString net \
$PathMill(top) $nodeName "."]
}
if {$oid != ""} {
lappend PathMill($index:nodeList) $oid
if {[info exists accCol] && [info exists deltaCol]} {
set accEnd [expr {$deltaCol - 1}]
set accVal [string range $line $accCol $accEnd]
set accVal [string trim $accVal]
if {$accVal != ""} {
set PathMill($index:$oid:Acc) $accVal
}
}
if {[info exists deltaCol] && [info exists timeCol]} {
set delEnd [expr {$timeCol - 1}]
set delVal [string range $line $deltaCol $delEnd]
set delVal [string trim $delVal]
if {$delVal != ""} {
set PathMill($index:$oid:Delta) $delVal
}
}
if {[info exists timeCol] && [info exists capCol]} {
set timeEnd [expr {$capCol - 1}]
set rfVal [string range $line $timeCol $timeEnd]
set rfVal [string trim $rfVal]
set rORf [string index $rfVal end]
set rfVal [string range $rfVal 0 end-2]
set rfVal [string trim $rfVal]
if {$rfVal != ""} {
set PathMill($index:$oid:$rORf) $rfVal
}
}
if {[info exists capCol]} {
set capVal ""
set pos $capCol
while {[set char [string index $line $pos]] != " "} {
append capVal $char
incr pos
}
if {$capVal != ""} {
set PathMill($index:$oid:Cap) $capVal
}
}
$text tag add $nodeName $lineNo.$start $lineNo.$end
$text tag bind $nodeName <Double-1> \
"PathMill:_action $text goto $nodeName [list $oid]"
$text tag bind $nodeName <Button-1> \
"PathMill:_action $text select $nodeName [list $oid]"
}
}
##
# Element Name (last column)
#
set elemNameColEnd $elemNameCol
while {[string index $line $elemNameColEnd] != ""} {
incr elemNameColEnd
}
set elemName [string range $line $elemNameCol $elemNameColEnd]
if {$elemName != ""} {
set oid {}
catch {
set oid [$PathMill(db) oid createFromString inst \
$PathMill(top) $elemName "."]
}
if {$oid != ""} {
lappend PathMill($index:elemList) $oid
$text tag add $elemName $lineNo.$elemNameCol \
$lineNo.$elemNameColEnd
$text tag bind $elemName <Double-1> \
"PathMill:_action $text goto $elemName [list $oid]"
$text tag bind $elemName <Button-1> \
"PathMill:_action $text select $elemName [list $oid]"
}
}
}
}
close $in
$text configure -state disabled
PathMill:_displayAttr
}
# =============================================================================
# HighlightPath - Highlight path in GUI.
# =============================================================================
#
proc PathMill:HighlightPath {} {
global PathMill
set index $PathMill(currentPath)
set PathMill($index:pinList) {}
set PathMill($index:netSegList) {}
set PathMill($index:instList) {}
$PathMill(db) flat free
PathMill:FindPath $PathMill($index:nodeList) $index
PathMill:FindNetSeg $PathMill($index:pinList)
$PathMill(db) flathilight * deleteAll [gui settings get "hiColor"]
foreach oid [concat $PathMill($index:pinList) $PathMill($index:netSegList) \
$PathMill($index:instList)] {
$PathMill(db) flathilight $oid set [gui settings get "hiColor"]
}
if {[llength $PathMill($index:pinList)] == 0} {
foreach oid $PathMill($index:nodeList) {
$PathMill(db) flathilight $oid set [gui settings get "hiColor"]
}
}
gui highlight changed
}
# =============================================================================
# LoadCone - Load path into Cone Window.
# =============================================================================
#
proc PathMill:LoadCone {} {
global PathMill
set index $PathMill(currentPath)
set PathMill($index:pinList) {}
set PathMill($index:netSegList) {}
set PathMill($index:instList) {}
$PathMill(db) flat free
PathMill:FindPath $PathMill($index:nodeList) $index
PathMill:FindNetSeg $PathMill($index:pinList)
gui cone clear
PathMill:_displayAttr
gui window show Cone
gui cone load $PathMill($index:pinList)
}
# =============================================================================
# FindPath - Fill PathMill($index:pinList) and PathMill($index:instList).
# =============================================================================
#
proc PathMill:FindPath {nodes index} {
global PathMill
if {[llength $nodes] == 0} {
return
}
set startNode [lindex $nodes 0]
$PathMill(db) flat foreach pin $startNode pin {
set inst "inst [lrange $pin 1 end-1]"
$PathMill(db) foreach pin $inst iPin {
if {[$PathMill(db) flatflag $iPin is orange]} {
lappend PathMill($index:pinList) $iPin
lappend PathMill($index:pinList) $pin
lappend PathMill($index:instList) $inst
set connectedNet [$PathMill(db) connectedNet $iPin]
$PathMill(db) flat foreach pin $connectedNet prevPin {
$PathMill(db) flatflag $prevPin clear orange
}
break
}
}
$PathMill(db) flatflag $pin set orange
}
PathMill:FindPath [lrange $nodes 1 end] $index
}
# =============================================================================
# FindNetSeg - Fill Path($index:netSegList) and append ports/pins to
# Path($index:pinList).
# =============================================================================
#
proc PathMill:FindNetSeg {pinList} {
global PathMill
if {[llength $pinList] == 0} {
return
}
set index $PathMill(currentPath)
set pin [lindex $pinList 0]
set nextPin [lindex $pinList 1]
set nSegs {}
if {[llength $pinList] == 1} {
set connectedNet [$PathMill(db) connectedNet $pin]
set lastNet [lindex $PathMill($index:nodeList) end]
set pList {}
while {$connectedNet != $lastNet} {
$PathMill(db) foreach pin $connectedNet nextPin {
if {[$PathMill(db) oid type $nextPin] == "port"} {
set port [lreplace $nextPin 0 0 pin]
set connectedNet [$PathMill(db) connectedNet $port]
if {$connectedNet == $lastNet} {
lappend PathMill($index:pinList) $nextPin
lappend PathMill($index:pinList) $port
lappend pinList $pin
lappend pinList $nextPin
lappend pinList $port
break
}
}
}
break
}
} else {
catch {
$PathMill(db) flat foreach netseg $pin $nextPin netSeg {
set pin1 [PathMill:_netSeg2pinOid $netSeg 1]
set pin2 [PathMill:_netSeg2pinOid $netSeg 2]
if {$pin1 == $pin2} {
continue
}
lappend nSegs $netSeg
lappend PathMill($index:netSegList) $netSeg
}
}
if {[llength $nSegs] > 1} {
foreach netSeg $nSegs {
set pin1 [PathMill:_netSeg2pinOid $netSeg 1]
set pin2 [PathMill:_netSeg2pinOid $netSeg 2]
lappend PathMill($index:pinList) $pin1
lappend PathMill($index:pinList) $pin2
}
}
}
PathMill:FindNetSeg [lrange $pinList 1 end]
}
# -----------------------------------------------------------------------------
# _netSeg2pinOid - Returns a pin OID which is part of a netSeg OID
# ($num can be 1 or 2).
# -----------------------------------------------------------------------------
#
proc PathMill:_netSeg2pinOid {netSeg num} {
global PathMill
set root [$PathMill(db) oid root $netSeg]
set path [$PathMill(db) oid path $netSeg]
if {$num == 1} {
set inst [lindex $netSeg end-3]
set pin [lindex $netSeg end-2]
} elseif {$num == 2} {
set inst [lindex $netSeg end-1]
set pin [lindex $netSeg end]
}
set type "pin"
if {$inst == {}} {
set type "port"
}
if {$path == {}} {
set oid [list $type $root $inst $pin]
} else {
set oid [list $type $root]
foreach p $path {
lappend oid $p
}
if {$type == "pin"} {
lappend oid $inst
}
lappend oid $pin
}
return $oid
}
# -----------------------------------------------------------------------------
# _displayAttr - Display attributes in Schem and Cone Window.
# -----------------------------------------------------------------------------
#
proc PathMill:_displayAttr {} {
global PathMill
set index $PathMill(currentPath)
foreach oid $PathMill($index:nodeList) {
$PathMill(db) flatattr $oid delete
##
# Set Delay attribute.
#
if {[info exists PathMill($index:$oid:Acc)]} {
$PathMill(db) flatattr $oid set Delay=$PathMill($index:$oid:Acc)
}
##
# Set Delta attribute.
#
if {[info exists PathMill($index:$oid:Delta)]} {
$PathMill(db) flatattr $oid set Delta=$PathMill($index:$oid:Delta)
}
##
# Set R or F time attribute.
#
if {[info exists PathMill($index:$oid:R)]} {
$PathMill(db) flatattr $oid set RFTime=$PathMill($index:$oid:R)
$PathMill(db) foreach pin $oid pin {
$PathMill(db) flatattr $pin set "edge=er,+#00ff00"
}
} elseif {[info exists PathMill($index:$oid:F)]} {
$PathMill(db) flatattr $oid set RFTime=$PathMill($index:$oid:F)
$PathMill(db) foreach pin $oid pin {
$PathMill(db) flatattr $pin set "edge=ef,+#ff0000"
}
}
##
# Set Cap attribute.
#
if {[info exists PathMill($index:$oid:Cap)]} {
$PathMill(db) flatattr $oid set Cap=$PathMill($index:$oid:Cap)
}
}
##
# Set @nlv display attribute.
#
set show "%value\n"
foreach name {Delay Delta RFTime Cap} {
if {$PathMill(show$name)} {
append show "$name=%$name\n"
}
}
set show [string range $show 0 end-1]
$PathMill(db) attr -db set @nlv:net=$show
if {$PathMill(displayEdges)} {
$PathMill(db) attr -db set @nlv:marks=%edge
} else {
$PathMill(db) attr -db delete @nlv:marks
}
gui attribute changed -enableSaveSpice
}
# -----------------------------------------------------------------------------
# _action - select - Select an object in the text window.
# goto - Call goto to jump to the object.
# -----------------------------------------------------------------------------
#
proc PathMill:_action {text action name oid} {
global PathMill
foreach tagName [$text tag names] {
$text tag configure $tagName -background {} -foreground black
}
switch -- $action {
"select" {
$text tag configure $name -background $PathMill(selColor)
}
"goto" {
$text tag configure $name -foreground red \
-background $PathMill(selColor)
if {$oid != {}} {
gui goto -class Schem [list $oid]
gui goto -class Cone [list $oid]
}
}
default {}
}
}
# =============================================================================
# OpenFile - Show a browse file dialog to open a Pathmill file.
# =============================================================================
#
proc PathMill:OpenFile {{db {}}} {
global PathMill
if {![info exists PathMill(db)]} {
PathMill:ResetVariables $db
}
if {$PathMill(db) == {}} {
set msg "No database loaded."
zmessage print ERR $msg
tk_messageBox -message $msg -icon error -parent . -title "Error:"
return
}
set file [gui window fileDialog openFile "Load Pathmill" \
{{"Pathmill Files" {".out"}}}]
if {$file == "" } {
return
}
PathMill:ShowDialog $file
}
# =============================================================================
# Call the initialization procedure.
# =============================================================================
#
PathMill:Init $argc $argv
|