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
###############################################################################
# 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.
# =============================================================================
#   @userware
#       Highlight and Annotate Timing Values
#   @section
#       Read Side Files and Annotate Data
#   @description
#       Userware example to highlight objects and annotate timing values.
#   @files
#       oem/bus85-primetime.tcl
#   @tag
#       zdb
###############################################################################


# =============================================================================
# Add "Primetime" menu to the main menu bar.  The "Primetime" menu displays
# commands to create a dialog box for one of 4 paths.
# =============================================================================
#
gui menu command {"Userware" "Path _1"} {InitPath 1}
gui menu command {"Userware" "Path _2"} {InitPath 2}


# =============================================================================
# InitPath - The InitPath procedure loops over the entries of the
#            primetime-like static timing report as found in the global
#            PathInfo variable and:
#            (1) adds flat attributes to each pin.
#            (2) adds display attributes for schematic windows.
#            (3) creates dialog box for the given cone.
# =============================================================================
#
proc InitPath {no} {
    global PathInfo

    set db [gui database get]

    set oidList {}
    foreach {oid cap trans incr path edge} $PathInfo($no) {
        lappend oidList $oid
        $db flatattr $oid set cap=$cap trans=$trans incr=$incr path=$path
    }

    ##
    # In order to have the $path attributes visible at all pins and
    # ports in the Schem and Cone windows, we add the "@nlv:pin" and
    # "@nlv:port" meta attributes to the database root.
    #
    $db attr -db add {@nlv:pin=$path}
    $db attr -db add {@nlv:port=$path}

    gui attribute changed


    ##
    # Create dialog box
    #
    createDialog $no $oidList
}


# -----------------------------------------------------------------------------
# createDialog - The createDialog procedure creates a dialog box with a label,
#                and  Cone and Highlight buttons.
#
#                The given pins in $oidList are converted into netSegments.
#                (1) The Cone button calls doLoadCone with the netSegments.
#                (2) The Highlight button calls doHighlight with pins and
#                    netSegments.
# -----------------------------------------------------------------------------
#
proc createDialog {no oidList} {
    global Hilight

    set f .primetime
    if {![winfo exists $f]} {
        ttk::frame $f -relief ridge -borderwidth 3
        label  $f.label
        ttk::button $f.cone -text Cone
        ttk::checkbutton $f.highlight -text Highlight
        ttk::button $f.close -text X -command "destroy $f"
        pack $f.label $f.cone $f.highlight $f.close -side left -padx 4 -pady 4
        place $f -relx 1 -rely 1 -anchor se
    }
    $f.label configure -text "Path#$no"

    ##
    # convert pin pairs to net segments pin and highlight them also.
    #
    set db [gui database get]
    set segList {}
    foreach {from to} $oidList {
        set net [$db connectedNet $from]
        if {($to == "") || ($net != [$db connectedNet $to])} {
            zmessage print ERR "cannot create netSeg between $from and $to"
            continue
        }
        set netSeg [lreplace $net 0 0 netSeg]
        foreach oid [list $from $to] {
            switch -exact -- [$db oid type $oid] {
                "pin"   {
                    lappend netSeg [$db oid oname $oid] [$db oid pname $oid]
                }
                "port"  {
                    lappend netSeg "" [$db oid oname $oid]
                }
                default {return -code error "cannot convert $oid to netSeg"}
            }
        }
        lappend segList $netSeg
    }

    ##
    # Set command to "Cone" and "Highlight" button
    #
    set hiCmd [list doHighlight [concat $oidList $segList]]

    $f.cone      configure -command [list doLoadCone $segList]
    $f.highlight configure -variable Hilight -command $hiCmd
    if {$Hilight} {
        $hiCmd
    }
}


# -----------------------------------------------------------------------------
# doLoadCone -
# -----------------------------------------------------------------------------
#
proc doLoadCone {segList} {
    gui window show Tree
    gui window show Cone
    gui cone load $segList
}


# -----------------------------------------------------------------------------
# doHighlight -
# -----------------------------------------------------------------------------
#
proc doHighlight {oidList} {
    global Hilight

    gui settings set "nlv:greymode" $Hilight
    gui settings changed

    set db   [gui database get]

    $db highlight all deleteAll
    if {$Hilight} {
        $db highlight $oidList setList 0
    }
    gui highlight changed
}


# =============================================================================
# Extend context Right-Mouse menu by a "complete" function
# to fill all contents of the selected module instance into
# the Cone window.
# =============================================================================
#
gui popup append "Complete in Cone" "_completeInCone"


# -----------------------------------------------------------------------------
# _completeInCone -
# -----------------------------------------------------------------------------
#
proc _completeInCone {oidList} {
    set db  [gui database get]
    set loadList {}
    foreach oid $oidList {
        if {([$db oid type $oid] != "inst") || (![$db isModule $oid])} {
            zmessage print ERR "_completeInCone: ignore [list $oid]"
        }
        set mod [$db moduleOf $oid]
        foreach type {inst net netBus} {
            $db foreach $type $mod o { lappend loadList $o }
        }
    }
    gui cone append $loadList
}


##
#                                  Cap     Trans       Incr       Path
#
set PathInfo(1) {
    {port gl85 CLK}                  {}    0.00        0.00       3.00 f
    {pin  gl85 IR CLK}            12.00    0.57        0.00       3.00 f
    {port gl85 IR CLK}            12.00    0.57        0.00       3.00 f
    {pin  gl85 IR NR C}            3.10    0.23        0.67       3.67 r
    {port gl85 IR NR C}            3.10    0.23        0.67       3.67 r
    {pin  gl85 IR NR m17 g}        1.90    0.27        0.43       4.10 r
    {pin  gl85 IR NR m17 s}        2.10    0.48        2.40       6.50 f
    {port gl85 IR NR O}            3.50    0.23        0.55       7.05 f
    {pin  gl85 IR NR O}            3.50    0.23        0.55       7.05 f
    {pin  gl85 IR B8 WRENABLE}     2.57    0.56        0.65         {} f
    {port gl85 IR B8 WRENABLE}     2.57    0.56        0.65       8.05 f
    {pin  gl85 IR B8 U8 B}         3.12    1.30        2.05       9.75 r
    {port gl85 IR B8 U8 B}         3.12    1.30        2.05       9.75 r
    {pin  gl85 IR B8 U8 m10 g}     1.10    0.55        0.01       9.76 {}
    {pin  gl85 IR B8 U8 m10 s}     0.45    1.00        0.02       9.78 {}
    {pin  gl85 IR B8 U8 m6  g}     3.07    0.55        0.03       9.81 {}
    {pin  gl85 IR B8 U8 m6  d}     1.10    0.55        0.04       9.85 {}
    {port gl85 IR B8 U8 O}         2.05    1.10        0.02       9.86 {}
    {pin  gl85 IR B8 U8 O}         2.05    1.00        0.00       9.86 {}
    {pin  gl85 IR B8 R0 CK}        1.04    2.81        0.01       9.87 r
    {port gl85 IR B8 R0 CK}        1.04    2.81        0.00       9.87 r
    {pin  gl85 IR B8 R0 m31 g}     3.07    1.00        0.04       9.91 {}
    {pin  gl85 IR B8 R0 m31 s}     2.05    1.20        0.01       9.92 {}
    {pin  gl85 IR B8 R0 m12 g}     0.45    1.30        0.02       9.95 {}
    {pin  gl85 IR B8 R0 m12 d}     0.87    1.10        0.12      10.08 {}
    {pin  gl85 IR B8 R0 m28 g}     0.77    0.55        0.06      10.14 {}
    {pin  gl85 IR B8 R0 m28 d}     1.10    0.60        0.06      10.20 {}
    {pin  gl85 IR B8 R0 m29 s}     0.77    0.50        0.10      10.30 {}
    {pin  gl85 IR B8 R0 m29 d}     0.45    0.54        0.11      10.41 {}
    {pin  gl85 IR B8 R0 m9  g}     1.10    0.90        0.09      10.50 {}
    {pin  gl85 IR B8 R0 m9  d}     5.88    0.92        0.03      10.53 {}
    {pin  gl85 IR B8 R0 m10 s}     3.07    1.05        0.12      10.65 {}
    {pin  gl85 IR B8 R0 m10 d}     1.10    1.15        0.05      10.70 {}
    {pin  gl85 IR B8 R0 m11 s}     0.48    0.90        0.02      10.72 {}
    {pin  gl85 IR B8 R0 m11 d}     3.57    0.30        0.02      10.74 {}
    {pin  gl85 IR B8 R0 m19 g}     3.37    0.35        0.03      10.77 {}
    {pin  gl85 IR B8 R0 m19 s}     1.07    0.30        0.01      10.78 {}
    {port gl85 IR B8 R0 Q}         1.45    0.20        0.02      10.80 r
    {pin  gl85 IR B8 R0 Q}         1.45    0.20        0.00      10.80 r
    {pin  gl85 IR B8 U9 {I[7]}}    1.10    0.70        0.03      10.83 r
}

##
#                                  Cap     Trans       Incr       Path
#
set PathInfo(2) {
    {port gl85 CLK}                  {}    0.00        0.00       3.00 f
    {pin  gl85 IR CLK}            12.00    0.57        0.00       3.00 f
    {port gl85 IR CLK}            12.00    0.57        0.00       3.00 f
    {pin  gl85 IR NR C}            3.10    0.23        0.67       3.67 r
    {port gl85 IR NR C}            3.10    0.23        0.67       3.67 r
    {pin  gl85 IR NR m17 g}        1.90    0.27        0.43       4.10 r
    {pin  gl85 IR NR m17 s}        2.10    0.48        2.40       6.50 f
    {port gl85 IR NR O}            3.50    0.23        0.55       7.05 f
    {pin  gl85 IR NR O}            3.50    0.23        0.55       7.05 f
    {pin  gl85 IR B8 WRENABLE}     2.57    0.56        0.65         {} f
    {port gl85 IR B8 WRENABLE}     2.57    0.56        0.65       8.05 f
    {pin  gl85 IR B8 U8 B}         3.12    1.30        2.05       9.75 r
    {port gl85 IR B8 U8 B}         3.12    1.30        2.05       9.75 r
    {pin  gl85 IR B8 U8 m7  g}     1.10    0.55        0.01       9.76 {}
    {pin  gl85 IR B8 U8 m7  s}     0.45    1.00        0.02       9.78 {}
    {pin  gl85 IR B8 U8 m8  d}     0.45    1.00        0.01       9.79 {}
    {pin  gl85 IR B8 U8 m8  s}     0.45    1.00        0.01       9.80 {}
    {pin  gl85 IR B8 U8 m6  g}     3.07    0.55        0.02       9.82 {}
    {pin  gl85 IR B8 U8 m6  d}     1.10    0.55        0.03       9.85 {}
    {port gl85 IR B8 U8 O}         2.05    1.10        0.02       9.86 {}
    {pin  gl85 IR B8 U8 O}         2.05    1.00        0.00       9.86 {}
    {pin  gl85 IR B8 R0 CK}        1.04    2.81        0.01       9.87 r
    {port gl85 IR B8 R0 CK}        1.04    2.81        0.00       9.87 r
    {pin  gl85 IR B8 R0 m31 g}     3.07    1.00        0.04       9.91 {}
    {pin  gl85 IR B8 R0 m31 s}     2.05    1.20        0.01       9.92 {}
    {pin  gl85 IR B8 R0 m12 g}     0.45    1.30        0.02       9.95 {}
    {pin  gl85 IR B8 R0 m12 d}     0.87    1.10        0.12      10.08 {}
    {pin  gl85 IR B8 R0 m28 g}     0.77    0.55        0.06      10.14 {}
    {pin  gl85 IR B8 R0 m28 d}     1.10    0.60        0.06      10.20 {}
    {pin  gl85 IR B8 R0 m29 s}     0.77    0.50        0.10      10.30 {}
    {pin  gl85 IR B8 R0 m29 d}     0.45    0.54        0.11      10.41 {}
    {pin  gl85 IR B8 R0 m9  g}     1.10    0.90        0.09      10.50 {}
    {pin  gl85 IR B8 R0 m9  d}     5.88    0.92        0.03      10.53 {}
    {pin  gl85 IR B8 R0 m10 s}     3.07    1.05        0.12      10.65 {}
    {pin  gl85 IR B8 R0 m10 d}     1.10    1.15        0.05      10.70 {}
    {pin  gl85 IR B8 R0 m11 s}     0.48    0.90        0.02      10.72 {}
    {pin  gl85 IR B8 R0 m11 d}     3.57    0.30        0.02      10.74 {}
    {pin  gl85 IR B8 R0 m19 g}     3.37    0.35        0.03      10.77 {}
    {pin  gl85 IR B8 R0 m19 s}     1.07    0.30        0.01      10.78 {}
    {port gl85 IR B8 R0 Q}         1.45    0.20        0.02      10.80 r
    {pin  gl85 IR B8 R0 Q}         1.45    0.20        0.00      10.80 r
    {pin  gl85 IR B8 U9 {I[7]}}    1.10    0.70        0.03      10.83 r
}