File size: 5,253 Bytes
34292e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
utl::set_metrics_stage "globalroute__{}"
source $::env(SCRIPTS_DIR)/load.tcl
erase_non_stage_variables grt
load_stage_input 4_cts.odb

source_step_tcl PRE GLOBAL_ROUTE

set res_aware ""
append_env_var res_aware ENABLE_RESISTANCE_AWARE -resistance_aware 0

set use_cugr ""
append_env_var use_cugr GLOBAL_ROUTE_USE_CUGR -use_cugr 0

# The flow's choice to accept congestion, from GLOBAL_ROUTE_ARGS, passed
# to every incremental reroute and to repair_antennas: each call decides
# for itself, and one without -allow_congestion reroutes a congested route
# harder and then fails on it.
set allow_congestion ""
if { [lsearch -exact $::env(GLOBAL_ROUTE_ARGS) -allow_congestion] >= 0 } {
  set allow_congestion -allow_congestion
}

proc set_grt_seed { } {
  set seed_arg [env_var_or_empty GRT_SEED]
  if { $seed_arg ne "" } {
    log_cmd set_global_routing_random -seed $seed_arg
  }
}

proc do_global_route { res_aware use_cugr } {
  set_grt_seed
  # CUGR runs a full 3D maze pass per iteration; use a tighter default.
  set cong_iters "-congestion_iterations 30"
  if { $use_cugr ne "" } {
    set cong_iters "-congestion_iterations 10"
  }
  set all_args [concat [list \
    -congestion_report_file $::global_route_congestion_report] \
    $cong_iters $::env(GLOBAL_ROUTE_ARGS) {*}$res_aware {*}$use_cugr]

  log_cmd global_route {*}$all_args
}
set additional_args ""
append_env_var additional_args dbProcessNode -db_process_node 1
append_env_var additional_args VIA_IN_PIN_MIN_LAYER -via_in_pin_bottom_layer 1
append_env_var additional_args VIA_IN_PIN_MAX_LAYER -via_in_pin_top_layer 1

log_cmd pin_access {*}$additional_args

do_global_route $res_aware $use_cugr

use_ccs_delay_calculator
set_placement_padding -global \
  -left $::env(CELL_PAD_IN_SITES_DETAIL_PLACEMENT) \
  -right $::env(CELL_PAD_IN_SITES_DETAIL_PLACEMENT)

set_propagated_clock [all_clocks]
log_cmd estimate_parasitics

if { [env_var_exists_and_non_empty DONT_USE_CELLS] } {
  set_dont_use $::env(DONT_USE_CELLS)
}

if { !$::env(SKIP_INCREMENTAL_REPAIR) } {
  if { $::env(DETAILED_METRICS) } {
    report_metrics 5 "global route pre repair design"
  }

  # Repair design using global route parasitics
  repair_design_helper
  if { $::env(DETAILED_METRICS) } {
    report_metrics 5 "global route post repair design"
  }

  # Running DPL to fix overlapped instances
  # Run to get modified net by DPL
  utl::push_metrics_stage "globalroute__repair_design__{}"
  log_cmd global_route -start_incremental {*}$allow_congestion
  detailed_placement_helper -quiet
  # Route only the modified net by DPL
  log_cmd global_route -end_incremental {*}$res_aware \
    {*}$allow_congestion \
    -congestion_report_file $::env(REPORTS_DIR)/congestion_post_repair_design.rpt
  utl::pop_metrics_stage

  # Repair timing using global route parasitics
  puts "Repair setup and hold violations..."
  log_cmd estimate_parasitics

  repair_timing_helper

  if { $::env(DETAILED_METRICS) } {
    report_metrics 5 "global route post repair timing"
  }

  utl::push_metrics_stage "globalroute__repair_timing__{}"
  log_cmd global_route -start_incremental {*}$allow_congestion
  detailed_placement_helper -quiet
  log_cmd check_placement -placeable -verbose
  # Route only the modified net by DPL
  log_cmd global_route -end_incremental {*}$res_aware \
    {*}$allow_congestion \
    -congestion_report_file $::env(REPORTS_DIR)/congestion_post_repair_timing.rpt
  utl::pop_metrics_stage

  log_cmd estimate_parasitics

  if { $::env(OPT_POST_GRT_WNS) } {
    set repair_timing_args \
      [list -setup -sequence "vt_swap reroute" -skip_last_gasp -repair_tns 0 -verbose]
    if { [env_var_exists_and_non_empty MATCH_CELL_FOOTPRINT] } {
      lappend repair_timing_args -match_cell_footprint
    }
    if { $::env(SETUP_SLACK_MARGIN) != 0 } {
      lappend repair_timing_args -setup_margin $::env(SETUP_SLACK_MARGIN)
    }
    log_cmd repair_timing {*}$repair_timing_args

    if { $::env(DETAILED_METRICS) } {
      report_metrics 5 "global route post repair timing_opt_wns"
    }
  }
}

if { !$::env(OPT_POST_GRT_WNS) } {
  utl::push_metrics_stage "globalroute__recover_power__{}"
  log_cmd global_route -start_incremental {*}$allow_congestion
  recover_power_helper
  # Route the modified nets by rsz journal restore
  log_cmd global_route -end_incremental {*}$res_aware \
    {*}$allow_congestion \
    -congestion_report_file $::env(REPORTS_DIR)/congestion_post_recover_power.rpt
  utl::pop_metrics_stage
}

if {
  !$::env(SKIP_ANTENNA_REPAIR) &&
  [env_var_exists_and_non_empty MAX_REPAIR_ANTENNAS_ITER_GRT]
} {
  puts "Repair antennas..."
  repair_antennas -iterations $::env(MAX_REPAIR_ANTENNAS_ITER_GRT) \
    {*}$allow_congestion
  # repair antennas calls DPL internally
  log_cmd check_placement -placeable -verbose
  check_antennas -report_file $::env(REPORTS_DIR)/grt_antennas.log
}

puts "Estimate parasitics..."
log_cmd estimate_parasitics

report_metrics 5 "global route"

# Write SDC to results with updated clock periods that are just failing.
# Use make target update_sdc_clock to install the updated sdc.
source [file join $::env(SCRIPTS_DIR) "write_ref_sdc.tcl"]

write_guides $::env(RESULTS_DIR)/route.guide
source_step_tcl POST GLOBAL_ROUTE
orfs_write_db $::env(RESULTS_DIR)/5_1_grt.odb