Skip to content

Commit 5ad9b98

Browse files
authored
Merge pull request #2385 from Pinata-Consulting/scripts-cleanup
Scripts cleanup
2 parents e58a24f + 1b48670 commit 5ad9b98

14 files changed

+58
-121
lines changed

flow/scripts/cts.tcl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ if {[info exist ::env(CTS_SNAPSHOTS)]} {
7171
save_progress 4_1_pre_repair_hold_setup
7272
}
7373

74-
if {[info exists ::env(SKIP_CTS_REPAIR_TIMING)] == 0 || $::env(SKIP_CTS_REPAIR_TIMING) == 0} {
74+
if {![env_var_equals SKIP_CTS_REPAIR_TIMING 1]} {
7575
if {$::env(EQUIVALENCE_CHECK)} {
7676
write_eqy_verilog 4_before_rsz.v
7777
}
@@ -94,7 +94,7 @@ if {[info exists ::env(SKIP_CTS_REPAIR_TIMING)] == 0 || $::env(SKIP_CTS_REPAIR_T
9494

9595
report_metrics 4 "cts final"
9696

97-
if { [info exists ::env(POST_CTS_TCL)] } {
97+
if { [env_var_exists_and_non_empty POST_CTS_TCL] } {
9898
source $::env(POST_CTS_TCL)
9999
}
100100

flow/scripts/detail_place.tcl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ source $::env(PLATFORM_DIR)/setRC.tcl
66

77
proc do_dpl {} {
88
# Only for use with hybrid rows
9-
if {[info exists ::env(BALANCE_ROWS)] && $::env(BALANCE_ROWS)} {
9+
if {[env_var_equals BALANCE_ROWS 1]} {
1010
balance_row_usage
1111
}
1212

@@ -15,7 +15,7 @@ proc do_dpl {} {
1515
-right $::env(CELL_PAD_IN_SITES_DETAIL_PLACEMENT)
1616
detailed_placement
1717

18-
if {[info exists ::env(ENABLE_DPO)] && $::env(ENABLE_DPO)} {
18+
if {[env_var_equals ENABLE_DPO 1]} {
1919
if {[info exist ::env(DPO_MAX_DISPLACEMENT)]} {
2020
improve_placement -max_displacement $::env(DPO_MAX_DISPLACEMENT)
2121
} else {

flow/scripts/detail_route.tcl

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,15 @@ load_design 5_1_grt.odb 4_cts.sdc
1010
set_propagated_clock [all_clocks]
1111

1212
set additional_args ""
13-
if { [info exists ::env(dbProcessNode)]} {
14-
append additional_args " -db_process_node $::env(dbProcessNode)"
15-
}
16-
if { [info exists ::env(OR_SEED)]} {
17-
append additional_args " -or_seed $::env(OR_SEED)"
18-
}
19-
if { [info exists ::env(OR_K)]} {
20-
append additional_args " -or_k $::env(OR_K)"
21-
}
22-
23-
if { [info exists ::env(MIN_ROUTING_LAYER)]} {
24-
append additional_args " -bottom_routing_layer $::env(MIN_ROUTING_LAYER)"
25-
}
26-
if { [info exists ::env(MAX_ROUTING_LAYER)]} {
27-
append additional_args " -top_routing_layer $::env(MAX_ROUTING_LAYER)"
28-
}
29-
if { [info exists ::env(VIA_IN_PIN_MIN_LAYER)]} {
30-
append additional_args " -via_in_pin_bottom_layer $::env(VIA_IN_PIN_MIN_LAYER)"
31-
}
32-
if { [info exists ::env(VIA_IN_PIN_MAX_LAYER)]} {
33-
append additional_args " -via_in_pin_top_layer $::env(VIA_IN_PIN_MAX_LAYER)"
34-
}
35-
if { [info exists ::env(DISABLE_VIA_GEN)]} {
36-
append additional_args " -disable_via_gen"
37-
}
38-
if { [info exists ::env(REPAIR_PDN_VIA_LAYER)]} {
39-
append additional_args " -repair_pdn_vias $::env(REPAIR_PDN_VIA_LAYER)"
40-
}
13+
append_env_var additional_args dbProcessNode -db_process_node 1
14+
append_env_var additional_args OR_SEED -or_seed 1
15+
append_env_var additional_args OR_K -or_k 1
16+
append_env_var additional_args MIN_ROUTING_LAYER -bottom_routing_layer 1
17+
append_env_var additional_args MAX_ROUTING_LAYER -top_routing_layer 1
18+
append_env_var additional_args VIA_IN_PIN_MIN_LAYER -via_in_pin_bottom_layer 1
19+
append_env_var additional_args VIA_IN_PIN_MAX_LAYER -via_in_pin_top_layer 1
20+
append_env_var additional_args DISABLE_VIA_GEN -disable_via_gen 0
21+
append_env_var additional_args REPAIR_PDN_VIA_LAYER -repair_pdn_vias 1
4122

4223
append additional_args " -save_guide_updates -verbose 1"
4324

@@ -55,7 +36,7 @@ append additional_args " -save_guide_updates -verbose 1"
5536
# having to go spelunking in Tcl or modify configuration scripts, while
5637
# not having to wait too long or generating large useless reports.
5738

58-
set arguments [expr {[info exists ::env(DETAILED_ROUTE_ARGS)] ? $::env(DETAILED_ROUTE_ARGS) : \
39+
set arguments [expr {[env_var_exists_and_non_empty DETAILED_ROUTE_ARGS] ? $::env(DETAILED_ROUTE_ARGS) : \
5940
[concat $additional_args {-drc_report_iter_step 5}]}]
6041

6142
set all_args [concat [list \
@@ -79,7 +60,7 @@ if {![info exist ::env(SKIP_ANTENNA_REPAIR_POST_DRT)]} {
7960
}
8061
}
8162

82-
if { [info exists ::env(POST_DETAIL_ROUTE_TCL)] } {
63+
if { [env_var_exists_and_non_empty POST_DETAIL_ROUTE_TCL] } {
8364
source $::env(POST_DETAIL_ROUTE_TCL)
8465
}
8566

flow/scripts/generate_abstract.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
source $::env(SCRIPTS_DIR)/load.tcl
22

3-
set stem [expr {[info exists ::env(ABSTRACT_SOURCE)] ? $::env(ABSTRACT_SOURCE) : "6_final"}]
3+
set stem [expr {[env_var_exists_and_non_empty ABSTRACT_SOURCE] ? $::env(ABSTRACT_SOURCE) : "6_final"}]
44

55
set result [find_sdc_file $stem.odb]
66
set design_stage [lindex $result 0]

flow/scripts/global_place_skip_io.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ source $::env(SCRIPTS_DIR)/load.tcl
22
load_design 2_floorplan.odb 2_floorplan.sdc
33

44

5-
if { [info exists ::env(FLOORPLAN_DEF)] } {
5+
if { [env_var_exists_and_non_empty FLOORPLAN_DEF] } {
66
puts "FLOORPLAN_DEF is set. Skipping global placement without IOs"
77
} else {
88
source $::env(SCRIPTS_DIR)/set_place_density.tcl

flow/scripts/global_route.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ proc global_route_helper {} {
1919
# GLOBAL_ROUTE_ARGS specifies.
2020
proc do_global_route {} {
2121
set all_args [concat [list -congestion_report_file $::env(REPORTS_DIR)/congestion.rpt] \
22-
[expr {[info exists ::env(GLOBAL_ROUTE_ARGS)] ? $::env(GLOBAL_ROUTE_ARGS) : \
22+
[expr {[env_var_exists_and_non_empty GLOBAL_ROUTE_ARGS] ? $::env(GLOBAL_ROUTE_ARGS) : \
2323
{-congestion_iterations 30 -congestion_report_iter_step 5 -verbose}}]]
2424

2525
log_cmd global_route {*}$all_args

flow/scripts/io_placement_util.tcl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
if {[info exists ::env(FLOORPLAN_DEF)]} {
1+
if {[env_var_exists_and_non_empty FLOORPLAN_DEF]} {
22
puts "Skipping IO placement as DEF file was used to initialize floorplan."
33
} else {
4-
if {[info exists ::env(IO_CONSTRAINTS)]} {
4+
if {[env_var_exists_and_non_empty IO_CONSTRAINTS]} {
55
source $::env(IO_CONSTRAINTS)
66
}
77
set args [list -hor_layer $::env(IO_PLACER_H) \

flow/scripts/klayout.tcl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
if {[info exists ::env(FILL_CONFIG)]} {
1+
if {[env_var_exists_and_non_empty FILL_CONFIG]} {
22
set fill_config $::env(FILL_CONFIG)
33
} else {
44
set fill_config ""
55
}
66

7-
if {[info exists ::env(SEAL_GDS)]} {
7+
if {[env_var_exists_and_non_empty SEAL_GDS]} {
88
set seal_gds $::env(SEAL_GDS)
99
} else {
1010
set seal_gds ""

flow/scripts/load.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ proc load_design {design_file sdc_file} {
3636

3737
source $::env(PLATFORM_DIR)/setRC.tcl
3838

39-
if { [info exists ::env(LIB_MODEL)] && $::env(LIB_MODEL) == "CCS" } {
39+
if { [env_var_equals LIB_MODEL CCS] } {
4040
puts "Using CCS delay calculation"
4141
set_delay_calculator prima
4242
}

flow/scripts/macro_place_util.tcl

Lines changed: 25 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ proc find_macros {} {
1717
if {[find_macros] != ""} {
1818
# If wrappers defined replace macros with their wrapped version
1919
# # ----------------------------------------------------------------------------
20-
if {[info exists ::env(MACRO_WRAPPERS)]} {
20+
if {[env_var_exists_and_non_empty MACRO_WRAPPERS]} {
2121
source $::env(MACRO_WRAPPERS)
2222

2323
set wrapped_macros [dict keys [dict get $wrapper around]]
@@ -40,92 +40,48 @@ if {[find_macros] != ""} {
4040
set blockage_width [expr max($halo_max, $channel_max/2)]
4141

4242

43-
if {[info exists ::env(MACRO_BLOCKAGE_HALO)]} {
43+
if {[env_var_exists_and_non_empty MACRO_BLOCKAGE_HALO]} {
4444
set blockage_width $::env(MACRO_BLOCKAGE_HALO)
4545
}
4646

47-
if {[info exists ::env(MACRO_PLACEMENT_TCL)]} {
47+
if {[env_var_exists_and_non_empty MACRO_PLACEMENT_TCL]} {
4848
source $::env(MACRO_PLACEMENT_TCL)
4949
puts "Using manual macro placement file $::env(MACRO_PLACEMENT_TCL)"
50-
} elseif {[info exists ::env(MACRO_PLACEMENT)]} {
50+
} elseif {[env_var_exists_and_non_empty MACRO_PLACEMENT]} {
5151
source $::env(SCRIPTS_DIR)/read_macro_placement.tcl
5252
puts "Using manual macro placement file $::env(MACRO_PLACEMENT)"
5353
read_macro_placement $::env(MACRO_PLACEMENT)
54-
} elseif {[info exists ::env(RTLMP_FLOW)]} {
54+
} elseif {[env_var_equals RTLMP_FLOW 1]} {
5555
puts "HierRTLMP Flow enabled..."
5656
set additional_rtlmp_args ""
57-
if { [info exists ::env(RTLMP_MAX_LEVEL)]} {
58-
append additional_rtlmp_args " -max_num_level $env(RTLMP_MAX_LEVEL)"
59-
}
60-
if { [info exists ::env(RTLMP_MAX_INST)]} {
61-
append additional_rtlmp_args " -max_num_inst $env(RTLMP_MAX_INST)"
62-
}
63-
if { [info exists ::env(RTLMP_MIN_INST)]} {
64-
append additional_rtlmp_args " -min_num_inst $env(RTLMP_MIN_INST)"
65-
}
66-
if { [info exists ::env(RTLMP_MAX_MACRO)]} {
67-
append additional_rtlmp_args " -max_num_macro $env(RTLMP_MAX_MACRO)"
68-
}
69-
if { [info exists ::env(RTLMP_MIN_MACRO)]} {
70-
append additional_rtlmp_args " -min_num_macro $env(RTLMP_MIN_MACRO)"
71-
}
72-
57+
append_env_var additional_rtlmp_args RTLMP_MAX_LEVEL -max_num_level 1
58+
append_env_var additional_rtlmp_args RTLMP_MAX_INST -max_num_inst 1
59+
append_env_var additional_rtlmp_args RTLMP_MIN_INST -min_num_inst 1
60+
append_env_var additional_rtlmp_args RTLMP_MAX_MACRO -max_num_macro 1
61+
append_env_var additional_rtlmp_args RTLMP_MIN_MACRO -min_num_macro 1
7362
append additional_rtlmp_args " -halo_width $halo_x"
7463
append additional_rtlmp_args " -halo_height $halo_y"
75-
76-
if { [info exists ::env(RTLMP_MIN_AR)]} {
77-
append additional_rtlmp_args " -min_ar $env(RTLMP_MIN_AR)"
78-
}
79-
if { [info exists ::env(RTLMP_SIGNATURE_NET_THRESHOLD)]} {
80-
append additional_rtlmp_args \
81-
" -signature_net_threshold $env(RTLMP_SIGNATURE_NET_THRESHOLD)"
82-
}
83-
if { [info exists ::env(RTLMP_AREA_WT)]} {
84-
append additional_rtlmp_args " -area_weight $env(RTLMP_AREA_WT)"
85-
}
86-
if { [info exists ::env(RTLMP_WIRELENGTH_WT)]} {
87-
append additional_rtlmp_args " -wirelength_weight $env(RTLMP_WIRELENGTH_WT)"
88-
}
89-
if { [info exists ::env(RTLMP_OUTLINE_WT)]} {
90-
append additional_rtlmp_args " -outline_weight $env(RTLMP_OUTLINE_WT)"
91-
}
92-
if { [info exists ::env(RTLMP_BOUNDARY_WT)]} {
93-
append additional_rtlmp_args " -boundary_weight $env(RTLMP_BOUNDARY_WT)"
94-
}
95-
96-
if { [info exists ::env(RTLMP_NOTCH_WT)]} {
97-
append additional_rtlmp_args " -notch_weight $env(RTLMP_NOTCH_WT)"
98-
}
99-
100-
if { [info exists ::env(RTLMP_DEAD_SPACE)]} {
101-
append additional_rtlmp_args " -dead_space $env(RTLMP_DEAD_SPACE)"
102-
}
103-
if { [info exists ::env(RTLMP_CONFIG_FILE)]} {
104-
append additional_rtlmp_args " -config_file $env(RTLMP_CONFIG_FILE)"
105-
}
106-
if { [info exists ::env(RTLMP_RPT_DIR)]} {
107-
append additional_rtlmp_args " -report_directory $env(RTLMP_RPT_DIR)"
108-
}
109-
110-
if { [info exists ::env(RTLMP_FENCE_LX)]} {
111-
append additional_rtlmp_args " -fence_lx $env(RTLMP_FENCE_LX)"
112-
}
113-
if { [info exists ::env(RTLMP_FENCE_LY)]} {
114-
append additional_rtlmp_args " -fence_ly $env(RTLMP_FENCE_LY)"
115-
}
116-
if { [info exists ::env(RTLMP_FENCE_UX)]} {
117-
append additional_rtlmp_args " -fence_ux $env(RTLMP_FENCE_UX)"
118-
}
119-
if { [info exists ::env(RTLMP_FENCE_UY)]} {
120-
append additional_rtlmp_args " -fence_uy $env(RTLMP_FENCE_UY)"
121-
}
64+
append_env_var additional_rtlmp_args RTLMP_MIN_AR -min_ar 1
65+
append_env_var additional_rtlmp_args RTLMP_SIGNATURE_NET_THRESHOLD -signature_net_threshold 1
66+
append_env_var additional_rtlmp_args RTLMP_AREA_WT -area_weight 1
67+
append_env_var additional_rtlmp_args RTLMP_WIRELENGTH_WT -wirelength_weight 1
68+
append_env_var additional_rtlmp_args RTLMP_OUTLINE_WT -outline_weight 1
69+
append_env_var additional_rtlmp_args RTLMP_BOUNDARY_WT -boundary_weight 1
70+
append_env_var additional_rtlmp_args RTLMP_NOTCH_WT -notch_weight 1
71+
append_env_var additional_rtlmp_args RTLMP_DEAD_SPACE -dead_space 1
72+
append_env_var additional_rtlmp_args RTLMP_CONFIG_FILE -config_file 1
73+
append_env_var additional_rtlmp_args RTLMP_RPT_DIR -report_directory 1
74+
append_env_var additional_rtlmp_args RTLMP_FENCE_LX -fence_lx 1
75+
append_env_var additional_rtlmp_args RTLMP_FENCE_LY -fence_ly 1
76+
append_env_var additional_rtlmp_args RTLMP_FENCE_UX -fence_ux 1
77+
append_env_var additional_rtlmp_args RTLMP_FENCE_UY -fence_uy 1
12278

12379
source $::env(SCRIPTS_DIR)/set_place_density.tcl
12480
append additional_rtlmp_args " -target_util $place_density"
12581

12682
set all_args $additional_rtlmp_args
12783

128-
if { [info exists ::env(RTLMP_ARGS)] } {
84+
if { [env_var_exists_and_non_empty RTLMP_ARGS] } {
12985
set all_args $::env(RTLMP_ARGS)
13086
}
13187

0 commit comments

Comments
 (0)