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 | ###############################################################################
# Copyright (c) 2009-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.
# =============================================================================
# @script
# Get Arcs
# files
# getarcs.tcl
# example
# cust13/arc/test.v
# cmdline
# -verilog @example[0]
# -userware @files[0]
###############################################################################
##
# Path and name of the generated report file.
#
set _static(arcsFile) "timing.arcs"
# -----------------------------------------------------------------------------
# _defineArcs - read arc file line by line.
# collect all arcs with same cell/startport.
# call 'zdb cone definearc' API function.
#
# file format:
# cellname from-port to-port
# -----------------------------------------------------------------------------
#
proc _defineArcs {} {
global _static
set dir [file dirname [info script]]
##
# read file
#
set fname [file join $dir $_static(arcsFile)]
set fp [open $fname r]
set size [file size $fname]
set prg 0
array set arcs {}
zprogress push "Read $fname" 0.8
while {![eof $fp]} {
set line [gets $fp]
incr prg [string length $line]
incr prg
if {[zprogress update "" $prg $size]} {
break
}
set line [string trim $line]
if {($line == "") || [string match "#*" $line]} {
continue
}
if {[llength $line] != 3} {
return -code error "Expect 3 columns in file $fname."
}
set cellName [lindex $line 0]
set from [lindex $line 1]
set to [lindex $line 2]
lappend arcs($cellName:$from) $to
lappend arcs($cellName:$to) $from ;# create arcs in both directions
}
close $fp
if {[zprogress pop]} {
return
}
##
# use API to add arc settings
#
zdb cone cleararc
zprogress push "Read $fname" 1.0
set keys [array names arcs]
set cnt [llength $keys]
set i 0
foreach key $keys {
if {[zprogress update "" $i $cnt]} {
break
}
set k [split $key :]
set cellname [lindex $k 0]
set from [lindex $k 1]
set toList $arcs($key)
incr i
gui console print " Define Arc $cellname $from -> $toList"
zdb cone definearc $cellname $from $toList
}
if {[zprogress pop]} {
return
}
}
# -----------------------------------------------------------------------------
# _getCone - get first top level input port.
# and show cone.
# -----------------------------------------------------------------------------
#
proc _getCone {db} {
if {$db == {}} {
return
}
##
# get top design
#
set top {}
$db foreach top top { break }
##
# check for top module
#
if {$top == {}} {
gui console print -type w "No top module found"
return
}
##
# get start port
#
set start {}
$db foreach port $top p {
if {[$db directionOf $p] == "input"} {
set start $p
break
}
}
##
# check for input port
#
if {$start == {}} {
gui console print "No input start port found" w
return
}
gui console print "Extract cone starting from $start"
set res [$db cone -out -targetIO -checkArcs $start]
gui cone load $res
gui window show Cone
after 1 {
gui schem zoom fullfit
gui cone zoom fullfit
}
##
# Remove _getCone from 'RegisteredDataBaseChanged' and update the GUI
#
gui database removeChangedCallback "_getCone"
}
# -----------------------------------------------------------------------------
# read arc definition and call API
# -----------------------------------------------------------------------------
#
_defineArcs
##
# Use gui database runOrRegisterChangedCallback to immediately run _getCone
# if we have a database, or otherwise register the proc to be executed after
# the database is available.
#
gui database runOrRegisterChangedCallback _getCone
gui settings changed
|