Skip to content

Commit 87b9142

Browse files
committed
flow: refactor io_placement to avoid propagating intermediate ODB
This change modifies io_placement to write a script with pin locations rather than passing a messy intermediate ODB to global placement. Since io_placement.tcl writes a pin placement script without persisting its intermediate database state to the next stage, POST_IO_PLACEMENT is moot. Furthermore, if FLOORPLAN_DEF is set, no design is even loaded, causing POST_IO_PLACEMENT to fail if a script tries to use it. Any placement modifications should be done in PRE_GLOBAL_PLACE instead. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
1 parent 9768f0f commit 87b9142

6 files changed

Lines changed: 46 additions & 60 deletions

File tree

‎flow/Makefile‎

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -484,37 +484,35 @@ clean_floorplan:
484484
place: $(RESULTS_DIR)/3_place.odb \
485485
$(RESULTS_DIR)/3_place.sdc
486486
# ==============================================================================
487-
# STEP 1: Global placement without placed IOs, timing-driven, and routability-driven.
487+
# STEP 1: IO placement
488488
#-------------------------------------------------------------------------------
489-
$(eval $(call do-step,3_1_place_gp_skip_io,$(RESULTS_DIR)/2_floorplan.odb $(RESULTS_DIR)/2_floorplan.sdc $(LIB_FILES),global_place_skip_io))
489+
$(eval $(call do-step,3_1_place_iop,$(RESULTS_DIR)/2_floorplan.odb $(RESULTS_DIR)/2_floorplan.sdc $(LIB_FILES),io_placement,.tcl))
490490

491-
$(eval $(call do-step,3_2_place_iop,$(RESULTS_DIR)/3_1_place_gp_skip_io.odb,io_placement))
492-
493-
# STEP 3: Global placement with placed IOs, timing-driven, and routability-driven.
491+
# STEP 2: Global placement with placed IOs, timing-driven, and routability-driven.
494492
#-------------------------------------------------------------------------------
495-
$(eval $(call do-step,3_3_place_gp,$(RESULTS_DIR)/3_2_place_iop.odb $(RESULTS_DIR)/2_floorplan.sdc $(LIB_FILES),global_place))
493+
$(eval $(call do-step,3_2_place_gp,$(RESULTS_DIR)/2_floorplan.odb $(RESULTS_DIR)/3_1_place_iop.tcl $(RESULTS_DIR)/2_floorplan.sdc $(LIB_FILES),global_place))
496494

497-
# STEP 4: Resizing & Buffering
495+
# STEP 3: Resizing & Buffering
498496
#-------------------------------------------------------------------------------
499-
$(eval $(call do-step,3_4_place_resized,$(RESULTS_DIR)/3_3_place_gp.odb $(RESULTS_DIR)/2_floorplan.sdc,resize))
497+
$(eval $(call do-step,3_3_place_resized,$(RESULTS_DIR)/3_2_place_gp.odb $(RESULTS_DIR)/2_floorplan.sdc,resize))
500498

501499
.PHONY: clean_resize
502500
clean_resize:
503-
rm -f $(RESULTS_DIR)/3_4_place_resized.odb
501+
rm -f $(RESULTS_DIR)/3_3_place_resized.odb
504502

505-
# STEP 5: Detail placement
503+
# STEP 4: Detail placement
506504
#-------------------------------------------------------------------------------
507-
$(eval $(call do-step,3_5_place_dp,$(RESULTS_DIR)/3_4_place_resized.odb,detail_place))
505+
$(eval $(call do-step,3_4_place_dp,$(RESULTS_DIR)/3_3_place_resized.odb,detail_place))
508506

509-
$(eval $(call do-copy,3_place,3_5_place_dp.odb,))
507+
$(eval $(call do-copy,3_place,3_4_place_dp.odb,))
510508

511-
# detail_place writes 3_place.sdc alongside 3_5_place_dp.odb (constraints
509+
# detail_place writes 3_place.sdc alongside 3_4_place_dp.odb (constraints
512510
# are unchanged during placement), mirroring how synth writes 1_synth.sdc.
513-
$(RESULTS_DIR)/3_place.sdc: $(RESULTS_DIR)/3_5_place_dp.odb
511+
$(RESULTS_DIR)/3_place.sdc: $(RESULTS_DIR)/3_4_place_dp.odb
514512

515513
.PHONY: do-place
516514
do-place:
517-
$(UNSET_AND_MAKE) do-3_1_place_gp_skip_io do-3_2_place_iop do-3_3_place_gp do-3_4_place_resized do-3_5_place_dp do-3_place
515+
$(UNSET_AND_MAKE) do-3_1_place_iop do-3_2_place_gp do-3_3_place_resized do-3_4_place_dp do-3_place
518516

519517
# Clean Targets
520518
#-------------------------------------------------------------------------------

‎flow/scripts/detail_place.tcl‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
utl::set_metrics_stage "detailedplace__{}"
22
source $::env(SCRIPTS_DIR)/load.tcl
33
erase_non_stage_variables place
4-
load_design 3_4_place_resized.odb 2_floorplan.sdc
4+
load_design 3_3_place_resized.odb 2_floorplan.sdc
55
source_step_tcl PRE DETAIL_PLACE
66

77
source $::env(PLATFORM_DIR)/setRC.tcl
@@ -34,13 +34,13 @@ proc do_dpl { } {
3434

3535
set result [catch { do_dpl } errMsg]
3636
if { $result != 0 } {
37-
orfs_write_db $::env(RESULTS_DIR)/3_5_place_dp-failed.odb
37+
orfs_write_db $::env(RESULTS_DIR)/3_4_place_dp-failed.odb
3838
error $errMsg
3939
}
4040

4141
report_metrics 3 "detailed place" true false
4242

4343
source_step_tcl POST DETAIL_PLACE
4444

45-
orfs_write_db $::env(RESULTS_DIR)/3_5_place_dp.odb
45+
orfs_write_db $::env(RESULTS_DIR)/3_4_place_dp.odb
4646
orfs_write_sdc $::env(RESULTS_DIR)/3_place.sdc

‎flow/scripts/global_place.tcl‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
utl::set_metrics_stage "globalplace__{}"
22
source $::env(SCRIPTS_DIR)/load.tcl
33
erase_non_stage_variables place
4-
load_design 3_2_place_iop.odb 2_floorplan.sdc
4+
load_design 2_floorplan.odb 2_floorplan.sdc
5+
source $::env(RESULTS_DIR)/3_1_place_iop.tcl
56
source_step_tcl PRE GLOBAL_PLACE
67

78
set_dont_use $::env(DONT_USE_CELLS)
@@ -46,8 +47,6 @@ if { $min_phi > $max_phi } {
4647
MAX_PLACE_STEP_COEF ($max_phi)"
4748
}
4849

49-
lappend global_placement_args -force_center_initial_place
50-
5150
lappend global_placement_args -min_phi_coef $::env(MIN_PLACE_STEP_COEF)
5251
lappend global_placement_args -max_phi_coef $::env(MAX_PLACE_STEP_COEF)
5352

@@ -64,7 +63,7 @@ proc do_placement { global_placement_args } {
6463

6564
set result [catch { do_placement $global_placement_args } errMsg]
6665
if { $result != 0 } {
67-
orfs_write_db $::env(RESULTS_DIR)/3_3_place_gp-failed.odb
66+
orfs_write_db $::env(RESULTS_DIR)/3_2_place_gp-failed.odb
6867
error $errMsg
6968
}
7069

@@ -79,4 +78,4 @@ report_metrics 3 "global place" false false
7978

8079
source_step_tcl POST GLOBAL_PLACE
8180

82-
orfs_write_db $::env(RESULTS_DIR)/3_3_place_gp.odb
81+
orfs_write_db $::env(RESULTS_DIR)/3_2_place_gp.odb

‎flow/scripts/global_place_skip_io.tcl‎

Lines changed: 0 additions & 25 deletions
This file was deleted.

‎flow/scripts/io_placement.tcl‎

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,36 @@ source $::env(SCRIPTS_DIR)/load.tcl
22
erase_non_stage_variables place
33

44
if {
5-
![env_var_exists_and_non_empty FLOORPLAN_DEF] &&
6-
![env_var_exists_and_non_empty FOOTPRINT] &&
7-
![env_var_exists_and_non_empty FOOTPRINT_TCL]
5+
[env_var_exists_and_non_empty FLOORPLAN_DEF] ||
6+
[env_var_exists_and_non_empty FOOTPRINT] ||
7+
[env_var_exists_and_non_empty FOOTPRINT_TCL]
88
} {
9-
load_design 3_1_place_gp_skip_io.odb 2_floorplan.sdc
10-
source_step_tcl PRE IO_PLACEMENT
9+
puts "Pin placement already provided by floorplan initialization. Writing empty placeholder script."
10+
close [open $::env(RESULTS_DIR)/3_1_place_iop.tcl w]
11+
} else {
12+
load_design 2_floorplan.odb 2_floorplan.sdc
13+
14+
set global_placement_args {}
15+
append_env_var global_placement_args GPL_RANDOM_SEED -random_seed 1
16+
17+
log_cmd global_placement -skip_io -density [place_density_with_lb_addon] \
18+
-pad_left $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) \
19+
-pad_right $::env(CELL_PAD_IN_SITES_GLOBAL_PLACEMENT) \
20+
{*}[env_var_or_empty GLOBAL_PLACEMENT_ARGS] \
21+
{*}$global_placement_args
22+
1123
log_cmd place_pins \
1224
-hor_layers $::env(IO_PLACER_H) \
1325
-ver_layers $::env(IO_PLACER_V) \
1426
{*}[env_var_or_empty PLACE_PINS_ARGS]
27+
1528
report_design_area
1629

17-
orfs_write_db $::env(RESULTS_DIR)/3_2_place_iop.odb
18-
write_pin_placement $::env(RESULTS_DIR)/3_2_place_iop.tcl
19-
} else {
20-
orfs_copy_db $::env(RESULTS_DIR)/3_1_place_gp_skip_io.odb $::env(RESULTS_DIR)/3_2_place_iop.odb
30+
write_pin_placement $::env(RESULTS_DIR)/3_1_place_iop.tcl
31+
32+
if { [env_var_exists_and_non_empty DEBUG_IO_PLACEMENT_ODB] } {
33+
orfs_write_db $::env(RESULTS_DIR)/3_1_place_iop_debug.odb
34+
}
2135
}
2236

23-
source_step_tcl POST IO_PLACEMENT
37+

‎flow/scripts/resize.tcl‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
utl::set_metrics_stage "placeopt__{}"
22
source $::env(SCRIPTS_DIR)/load.tcl
33
erase_non_stage_variables place
4-
load_design 3_3_place_gp.odb 2_floorplan.sdc
4+
load_design 3_2_place_gp.odb 2_floorplan.sdc
55
source_step_tcl PRE RESIZE
66

77
log_cmd estimate_parasitics -placement
@@ -44,4 +44,4 @@ puts "Pin count before $pin_count_before, after [sta::network_leaf_pin_count]"
4444

4545
source_step_tcl POST RESIZE
4646

47-
orfs_write_db $::env(RESULTS_DIR)/3_4_place_resized.odb
47+
orfs_write_db $::env(RESULTS_DIR)/3_3_place_resized.odb

0 commit comments

Comments
 (0)