-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompound_tool.tcl
More file actions
375 lines (329 loc) · 9.09 KB
/
compound_tool.tcl
File metadata and controls
375 lines (329 loc) · 9.09 KB
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
set DESIGN c2670_xor_ant
set_db information_level 0
set init_verilog ../netlist/${DESIGN}.v
set init_lib {/export/designkits/tsmc/tsmc65/ip/msrflp/STDCELL/tcbn65lp_220a/FE/TSMCHOME/digital/Front_End/timing_power_noise/NLDM/tcbn65lp_220a/tcbn65lptc.lib}
set init_hdl_search_path ../rtl/
set init_lib_search_path /export/designkits/tsmc/tsmc65/ip/msrflp/STDCELL/tcbn65lp_220a/FE/TSMCHOME/digital/Front_End/timing_power_noise/NLDM/tcbn65lp_220a/
set_db hdl_error_on_latch true
read_libs ${init_lib}
read_hdl ${init_verilog}
set_dont_use *SDF*
set_dont_use *SEDF*
set_dont_use LH*
set_dont_use LN*
set_dont_use CK*
set_dont_use HA*
set_dont_use *FA1D*
set_dont_use *HA1D*
set_dont_use *BENCD*
set_dont_use *HICIND*
set_dont_use *HICOND*
set_dont_use *FICIND*
set_dont_use *FICOND*
set_dont_use *HICOND*
set_dont_use *FIICOND*
set_dont_use *CMPE42D*
set_dont_use *HCOSCIND*
set_dont_use *HCOSCOND*
set_dont_use *FCSICIND*
set_dont_use *FCSICOND*
set_dont_use *DFCND*
set_dont_use *SDFCNQ*
set_dont_use *AOI3*
set_dont_use *AOI2*
set_dont_use *OAI3*
set_dont_use *OAI2*
set_dont_use *OA3*
set_dont_use *OA2*
set_dont_use *AO3*
set_dont_use *AO2*
set_dont_use *NR4*
set_dont_use *NR3*
set_dont_use *ND4*
set_dont_use *ND3*
set_dont_use *OR4*
set_dont_use *OR3*
set_dont_use MUX*
set_dont_use XOR3*
set_dont_use XOR4*
set_dont_use AN3*
set_dont_use AN4*
# Elaborate the top level
elaborate $DESIGN
check_design -unresolved
dc::set_time_unit -picoseconds
dc::create_clock -name "clk_name" -period 2
#*Synthesis
#
# GENERIC SYNTHESIS ###
set_db syn_generic_effort low
syn_generic
# MAPPING ###
set_db syn_map_effort low
syn_map
# ###############synthesize -to_mapped
set keyports [get_ports key*]
set a [sizeof_collection $keyports]
set keys [get_object_name $keyports]
set outputports [all_outputs]
set b [sizeof_collection $outputports]
set output [get_object_name $outputports]
set inputsports [all_inputs]
set c [sizeof_collection $inputsports]
set inputs [get_object_name $inputsports]
set search "Cell"
set diff_output {}
set item {}
set inputs {}
set result [open file.txt w+]
# Report all the paths between keys and all outputs
for {set t 0} {$t < $a} {incr t} {
#lappend item [lindex $input $t]
set count($t) 0
for {set w 0} {$w < $b} {incr w} {
report_timing -from [lindex $keys $t] -to [lindex $output $w] -unconstrained > report.txt
set file [open report.txt]
while {[gets $file line] != -1} {
if {[string match *[string toupper $search]* [string toupper $line]]} {
lappend item [lindex $output $w]
incr count($t)
} else {
}
}
close $file
}
lappend item $count($t)
lappend diff_output $item
set item {}
puts $result "Key $t has arrived in $count($t) outputs!"
}
close $result
for {set c 0} {$c < $t} {incr c} {
if {$count(0) != $count($c)} {
set c $t
set num_tech 1
} else {
set num_tech 0
}
}
if {$num_tech == 0} {
puts "The design has only one technique"
} else {
puts "The design has more than one technique"
}
# Return all the outputs for the same number of outputs arrived by a key
set unique [lsort -unique $diff_output]
set newcnt 0
foreach f $unique {
set cnt 0
foreach item $diff_output {
if {$item == $f} {
incr cnt
}
}
if {$cnt > $newcnt} {
set newcnt $cnt
set list $f
}
}
set d 0
set keyinputs {}
foreach c $diff_output {
if {$c == $list} {
puts "keyinput$d"
lappend keyinputs [lindex $keys $d]
incr d
} else {
incr d
}
}
#List of keyinputs that is not part of the keyinputs
#This will be my keyprove
set provekey {}
foreach item $keys {
if {$item ni $keyinputs} {
lappend provekey $item
}
}
set keysRLL2output {}
set psll_keys {}
set rll_keys {}
set psll_final {}
set rll_final {}
set path {}
set pathPSLL {}
set pathRLL {}
set vartmp12 ""
set num_psll 0
set num_rll 0
for {set g 0} {$g < [llength $provekey]} {incr g} {
report_timing -from [lindex $provekey $g] -to [lindex $list 0] -unconstrained > report_key.txt
set filekeyRLL [open report_key.txt]
while {[gets $filekeyRLL linePin] != -1} {
if {[string match *[string toupper $search]* [string toupper $linePin]]} {
lappend keysRLL2output [lindex $provekey $g]
}
}
close $filekeyRLL
}
set finishRLL 0
set numRLL 0
if {[llength $keysRLL2output] != 0} {
set keysAll [lappend keyinputs $keysRLL2output]
set keysAll [join $keysAll]
set keysRLL2output [lsort -dictionary -unique $keysAll]
report_timing -from [lindex $keysRLL2output 0] -to [lindex $list 0] -unconstrained > gateRll.txt
set gateRll [open "|cat gateRll.txt"]
while {[gets $gateRll lineGateRLL] != -1 && $finishRLL != 1} {
if {[llength $lineGateRLL] != 11} {
#puts "Incorrect format in the line -> '$line'"
continue
} else {
foreach {var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11} $lineGateRLL {
if {$var5 == "(port)" || $var5 == "(arrival)"} {
#puts "Incorrect format in the gate -> '$var5'"
continue
} else {
set var [lindex [split $var1 /] 0]
puts $var
lappend pathRLL $var
}
for {set i 0} {$i < [llength $keysRLL2output]} {incr i} {
report_timing -from [lindex $keysRLL2output $i] -through $var -to [lindex $list 0] -unconstrained > gateCommomPathRLL.txt
set gateCommomPathRLL [open gateCommomPathRLL.txt]
while {[gets $gateCommomPathRLL lineRLL] != -1} {
if {[string match *[string toupper $search]* [string toupper $lineRLL]]} {
incr numRLL
}
}
close $gateCommomPathRLL
if {$numRLL == [llength $keysRLL2output]} {
puts "This is the commom gate between RLL techniques: $var"
set commomGateRLL $var
set finishRLL 1
}
}
set numRLL 0
}
}
}
close $gateRll
} else {
set commomGateRLL ""
set pathRLL {}
}
puts $commomGateRLL
set finishPSLL 0
set numPSLL 0
report_timing -from [lindex $keyinputs 0] -to [lindex $list 0] -unconstrained > gate.txt
set gate [open "|cat gate.txt"]
while {[gets $gate lineGate] != -1 && $finishPSLL != 1} {
if {[llength $lineGate] != 11} {
#puts "Incorrect format in the line -> '$line'"
continue
} else {
foreach {var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11} $lineGate {
if {$var5 == "(port)" || $var5 == "(arrival)"} {
#puts "Incorrect format in the gate -> '$var5'"
continue
} else {
set var [lindex [split $var1 /] 0]
puts $var
lappend pathPSLL $var
}
for {set i 0} {$i < [llength $keyinputs]} {incr i} {
report_timing -from [lindex $keyinputs $i] -through $var -to [lindex $list 0] -unconstrained > gateCommomPath.txt
set gateCommomPath [open gateCommomPath.txt]
while {[gets $gateCommomPath line] != -1} {
if {[string match *[string toupper $search]* [string toupper $line]]} {
incr numPSLL
}
}
close $gateCommomPath
if {$numPSLL == [llength $keyinputs]} {
puts "This is the commom gate between both techniques: $var"
set commomGate $var
set finishPSLL 1
}
}
set numPSLL 0
}
}
}
close $gate
puts $commomGate
report_instance $commomGate > instance.txt
# Colect the pins related of the cell
set fileInstance [open "|tac instance.txt"]
while {[gets $fileInstance lineInstance] != -1} {
if {[llength $lineInstance] != 9} {
#puts "Incorrect format in the lineInstance -> '$lineInstance'"
continue
} else {
foreach {var12 var13 var14 var15 var16 var17 var18 var19 var20} $lineInstance {
if {$var12 == $vartmp12} {
continue
} else {
set vartmp12 $var12
puts '$commomGate/$var12'
for {set h 0} {$h < [llength $keyinputs]} {incr h} {
report_timing -from [lindex $keyinputs $h] -through $commomGate/$var12 -to [lindex $list 0] -unconstrained > report_pin.txt
set filePin [open report_pin.txt]
while {[gets $filePin linePin] != -1} {
if {[string match *[string toupper $search]* [string toupper $linePin]]} {
lappend psll_keys [lindex $keyinputs $h]
incr num_psll
}
}
close $filePin
}
}
foreach item $pathPSLL {
if {$item in $pathRLL} {
lappend path $item
}
}
puts $num_psll
if {([llength $path]) == 0 && ($num_psll == 0 || $num_psll == [llength $keyinputs])} {
puts "All the keys were classifyied correctly!"
set psll_final $keyinputs
} else {
if {$num_psll > ([llength $keyinputs]/5)} {
lappend psll_final $psll_keys
set num_psll_final $num_psll
set psll_keys {}
set num_psll 0
} else {
set rll_keys $psll_keys
set num_rll_final $num_psll
set psll_keys {}
set num_psll 0
}
}
}
}
}
close $fileInstance
set psll_final [join $psll_final]
set psll_final [lsort -dictionary -unique $psll_final]
foreach item $keys {
if {$item ni $psll_final} {
lappend rll_final $item
}
}
puts "########################################################"
puts "PSLL_KEYS:"
puts $psll_final
puts "RLL_KEYS:"
puts $rll_final
puts "COMMOM GATE:"
puts $var
size $psll_final
puts "########################################################"
echo keysPSLL: $psll_final > removal_list.log
echo keysRLL: $rll_final >> removal_list.log
echo gate: $var >> removal_list.log
echo outputs: $list >> removal_list.log
echo keys: $keys >> removal_list.log
echo techniques: $num_tech >> removal_list.log
exit