-
Notifications
You must be signed in to change notification settings - Fork 0
/
flow.tcl
331 lines (257 loc) · 11.3 KB
/
flow.tcl
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
############################################################################
##
## Copyright (c) 2019, The Regents of the University of California
## All rights reserved.
##
## BSD 3-Clause License
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted provided that the following conditions are met:
##
## * Redistributions of source code must retain the above copyright notice, this
## list of conditions and the following disclaimer.
##
## * Redistributions in binary form must reproduce the above copyright notice,
## this list of conditions and the following disclaimer in the documentation
## and/or other materials provided with the distribution.
##
## * Neither the name of the copyright holder nor the names of its
## contributors may be used to endorse or promote products derived from
## this software without specific prior written permission.
##
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
## POSSIBILITY OF SUCH DAMAGE.
##
############################################################################
# Assumes flow_helpers.tcl has been read.
read_libraries
read_verilog $synth_verilog
link_design $top_module
read_sdc $sdc_file
set_thread_count [exec getconf _NPROCESSORS_ONLN]
# Temporarily disable sta's threading due to random failures
sta::set_thread_count 1
utl::metric "IFP::ord_version" [ord::openroad_git_describe]
# Note that sta::network_instance_count is not valid after tapcells are added.
utl::metric "IFP::instance_count" [sta::network_instance_count]
initialize_floorplan -site $site \
-die_area $die_area \
-core_area $core_area
source $tracks_file
# remove buffers inserted by synthesis
remove_buffers
################################################################
# IO Placement (random)
place_pins -random -hor_layers $io_placer_hor_layer -ver_layers $io_placer_ver_layer
################################################################
# Macro Placement
if { [have_macros] } {
global_placement -density $global_place_density
macro_placement -halo $macro_place_halo -channel $macro_place_channel
}
################################################################
# Tapcell insertion
eval tapcell $tapcell_args
################################################################
# Power distribution network insertion
source $pdn_cfg
pdngen
################################################################
# Global placement
foreach layer_adjustment $global_routing_layer_adjustments {
lassign $layer_adjustment layer adjustment
set_global_routing_layer_adjustment $layer $adjustment
}
set_routing_layers -signal $global_routing_layers \
-clock $global_routing_clock_layers
set_macro_extension 2
global_placement -routability_driven -density $global_place_density \
-pad_left $global_place_pad -pad_right $global_place_pad
# IO Placement
place_pins -hor_layers $io_placer_hor_layer -ver_layers $io_placer_ver_layer
# checkpoint
set global_place_db [make_result_file ${design}_${platform}_global_place.db]
write_db $global_place_db
################################################################
# Repair max slew/cap/fanout violations and normalize slews
source $layer_rc_file
set_wire_rc -signal -layer $wire_rc_layer
set_wire_rc -clock -layer $wire_rc_layer_clk
set_dont_use $dont_use
estimate_parasitics -placement
repair_design -slew_margin $slew_margin -cap_margin $cap_margin
repair_tie_fanout -separation $tie_separation $tielo_port
repair_tie_fanout -separation $tie_separation $tiehi_port
set_placement_padding -global -left $detail_place_pad -right $detail_place_pad
detailed_placement
# post resize timing report (ideal clocks)
report_worst_slack -min -digits 3
report_worst_slack -max -digits 3
report_tns -digits 3
# Check slew repair
report_check_types -max_slew -max_capacitance -max_fanout -violators
utl::metric "RSZ::repair_design_buffer_count" [rsz::repair_design_buffer_count]
utl::metric "RSZ::max_slew_slack" [expr [sta::max_slew_check_slack_limit] * 100]
utl::metric "RSZ::max_fanout_slack" [expr [sta::max_fanout_check_slack_limit] * 100]
utl::metric "RSZ::max_capacitance_slack" [expr [sta::max_capacitance_check_slack_limit] * 100]
################################################################
# Clock Tree Synthesis
# Clone clock tree inverters next to register loads
# so cts does not try to buffer the inverted clocks.
repair_clock_inverters
clock_tree_synthesis -root_buf $cts_buffer -buf_list $cts_buffer \
-sink_clustering_enable \
-sink_clustering_max_diameter $cts_cluster_diameter
# CTS leaves a long wire from the pad to the clock tree root.
repair_clock_nets
# place clock buffers
detailed_placement
# checkpoint
set cts_db [make_result_file ${design}_${platform}_cts.db]
write_db $cts_db
################################################################
# Setup/hold timing repair
set_propagated_clock [all_clocks]
# Global routing is fast enough for the flow regressions.
# It is NOT FAST ENOUGH FOR PRODUCTION USE.
set repair_timing_use_grt_parasitics 0
if { $repair_timing_use_grt_parasitics } {
# Global route for parasitics - no guide file requied
global_route -congestion_iterations 100
estimate_parasitics -global_routing
} else {
estimate_parasitics -placement
}
repair_timing -skip_gate_cloning
# Post timing repair.
report_worst_slack -min -digits 3
report_worst_slack -max -digits 3
report_tns -digits 3
report_check_types -max_slew -max_capacitance -max_fanout -violators -digits 3
utl::metric "RSZ::worst_slack_min" [sta::worst_slack -min]
utl::metric "RSZ::worst_slack_max" [sta::worst_slack -max]
utl::metric "RSZ::tns_max" [sta::total_negative_slack -max]
utl::metric "RSZ::hold_buffer_count" [rsz::hold_buffer_count]
################################################################
# Detailed Placement
detailed_placement
# Capture utilization before fillers make it 100%
utl::metric "DPL::utilization" [format %.1f [expr [rsz::utilization] * 100]]
utl::metric "DPL::design_area" [sta::format_area [rsz::design_area] 0]
# checkpoint
set dpl_db [make_result_file ${design}_${platform}_dpl.db]
write_db $dpl_db
set verilog_file [make_result_file ${design}_${platform}.v]
write_verilog $verilog_file
################################################################
# Global routing
pin_access -bottom_routing_layer $min_routing_layer \
-top_routing_layer $max_routing_layer
set route_guide [make_result_file ${design}_${platform}.route_guide]
global_route -guide_file $route_guide \
-congestion_iterations 100 -verbose
set verilog_file [make_result_file ${design}_${platform}.v]
write_verilog -remove_cells $filler_cells $verilog_file
################################################################
# Repair antennas post-GRT
utl::set_metrics_stage "grt__{}"
repair_antennas -iterations 5
check_antennas
utl::clear_metrics_stage
utl::metric "GRT::ANT::errors" [ant::antenna_violation_count]
################################################################
# Detailed routing
# Run pin access again after inserting diodes and moving cells
pin_access -bottom_routing_layer $min_routing_layer \
-top_routing_layer $max_routing_layer
detailed_route -output_drc [make_result_file "${design}_${platform}_route_drc.rpt"] \
-output_maze [make_result_file "${design}_${platform}_maze.log"] \
-no_pin_access \
-save_guide_updates \
-bottom_routing_layer $min_routing_layer \
-top_routing_layer $max_routing_layer \
-verbose 0
write_guides [make_result_file "${design}_${platform}_output_guide.mod"]
set drv_count [detailed_route_num_drvs]
utl::metric "DRT::drv" $drv_count
set routed_db [make_result_file ${design}_${platform}_route.db]
write_db $routed_db
set routed_def [make_result_file ${design}_${platform}_route.def]
write_def $routed_def
################################################################
# Repair antennas post-DRT
set repair_antennas_iters 0
utl::set_metrics_stage "drt__repair_antennas__pre_repair__{}"
while {[check_antennas] && $repair_antennas_iters < 5} {
utl::set_metrics_stage "drt__repair_antennas__iter_${repair_antennas_iters}__{}"
repair_antennas
detailed_route -output_drc [make_result_file "${design}_${platform}_ant_fix_drc.rpt"] \
-output_maze [make_result_file "${design}_${platform}_ant_fix_maze.log"] \
-save_guide_updates \
-bottom_routing_layer $min_routing_layer \
-top_routing_layer $max_routing_layer \
-verbose 0
incr repair_antennas_iters
}
utl::set_metrics_stage "drt__{}"
check_antennas
utl::clear_metrics_stage
utl::metric "DRT::ANT::errors" [ant::antenna_violation_count]
if {![design_is_routed]} {
error "Design has unrouted nets."
}
set repair_antennas_db [make_result_file ${design}_${platform}_repaired_route.odb]
write_db $repair_antennas_db
################################################################
# Filler placement
filler_placement $filler_cells
check_placement -verbose
# checkpoint
set fill_db [make_result_file ${design}_${platform}_fill.db]
write_db $fill_db
################################################################
# Extraction
if { $rcx_rules_file != "" } {
define_process_corner -ext_model_index 0 X
extract_parasitics -ext_model_file $rcx_rules_file
set spef_file [make_result_file ${design}_${platform}.spef]
write_spef $spef_file
read_spef $spef_file
} else {
# Use global routing based parasitics inlieu of rc extraction
estimate_parasitics -global_routing
}
################################################################
# Final Report
report_checks -path_delay min_max -format full_clock_expanded \
-fields {input_pin slew capacitance} -digits 3
report_worst_slack -min -digits 3
report_worst_slack -max -digits 3
report_tns -digits 3
report_check_types -max_slew -max_capacitance -max_fanout -violators -digits 3
report_clock_skew -digits 3
report_power -corner $power_corner
report_floating_nets -verbose
report_design_area
utl::metric "DRT::worst_slack_min" [sta::worst_slack -min]
utl::metric "DRT::worst_slack_max" [sta::worst_slack -max]
utl::metric "DRT::tns_max" [sta::total_negative_slack -max]
utl::metric "DRT::clock_skew" [expr abs([sta::worst_clock_skew -setup])]
# slew/cap/fanout slack/limit
utl::metric "DRT::max_slew_slack" [expr [sta::max_slew_check_slack_limit] * 100]
utl::metric "DRT::max_fanout_slack" [expr [sta::max_fanout_check_slack_limit] * 100]
utl::metric "DRT::max_capacitance_slack" [expr [sta::max_capacitance_check_slack_limit] * 100];
# report clock period as a metric for updating limits
utl::metric "DRT::clock_period" [get_property [lindex [all_clocks] 0] period]
# not really useful without pad locations
#set_pdnsim_net_voltage -net $vdd_net_name -voltage $vdd_voltage
#analyze_power_grid -net $vdd_net_name