Skip to content

Commit 2334114

Browse files
authored
Merge pull request #4812 from oharboe/flow-input-variant
flow: FLOW_INPUT_VARIANT, a stage reads the previous stage's result from another variant
2 parents 158a667 + 9ea4b42 commit 2334114

11 files changed

Lines changed: 69 additions & 18 deletions

File tree

‎docs/user/FlowVariables.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ configuration file.
151151
| <a name="FILL_CELLS"></a>FILL_CELLS| Fill cells are used to fill empty sites. If not set or empty, fill cell insertion is skipped.| |
152152
| <a name="FILL_CONFIG"></a>FILL_CONFIG| JSON rule file for metal fill during chip finishing.| |
153153
| <a name="FLOORPLAN_DEF"></a>FLOORPLAN_DEF| Use the DEF file to initialize floorplan. Mutually exclusive with FOOTPRINT or DIE_AREA/CORE_AREA or CORE_UTILIZATION.| |
154+
| <a name="FLOW_INPUT_VARIANT"></a>FLOW_INPUT_VARIANT| Flow variant a stage reads the previous stage's result from, the .odb and the .sdc beside it. Defaults to FLOW_VARIANT. A variant forked off another sets it to that variant for the first stage it runs, then leaves it at the default: the shared stages run once, and the fork writes only its own results. A stage's later steps read the stage's own results. A stage stops when its input is in both variants. Not with AUTO_MEMORIES=1, whose memories are read from the variant that synthesised them.| |
154155
| <a name="FLOW_VARIANT"></a>FLOW_VARIANT| Flow variant to use, used in the flow variant directory name.| base|
155156
| <a name="FOOTPRINT"></a>FOOTPRINT| Custom footprint definition file for ICeWall-based floorplan initialization. Mutually exclusive with FLOORPLAN_DEF or DIE_AREA/CORE_AREA or CORE_UTILIZATION.| |
156157
| <a name="FOOTPRINT_TCL"></a>FOOTPRINT_TCL| Specifies a Tcl script with custom footprint-related commands for floorplan setup.| |
@@ -420,6 +421,7 @@ configuration file.
420421
- [CORE_UTILIZATION](#CORE_UTILIZATION)
421422
- [DIE_AREA](#DIE_AREA)
422423
- [FLOORPLAN_DEF](#FLOORPLAN_DEF)
424+
- [FLOW_INPUT_VARIANT](#FLOW_INPUT_VARIANT)
423425
- [FOOTPRINT](#FOOTPRINT)
424426
- [FOOTPRINT_TCL](#FOOTPRINT_TCL)
425427
- [GLOBAL_CONNECT_TCL](#GLOBAL_CONNECT_TCL)
@@ -500,6 +502,7 @@ configuration file.
500502
- [ENABLE_DPO](#ENABLE_DPO)
501503
- [ENABLE_PLACE_REPAIR_TIMING](#ENABLE_PLACE_REPAIR_TIMING)
502504
- [FLOORPLAN_DEF](#FLOORPLAN_DEF)
505+
- [FLOW_INPUT_VARIANT](#FLOW_INPUT_VARIANT)
503506
- [GLOBAL_PLACEMENT_ARGS](#GLOBAL_PLACEMENT_ARGS)
504507
- [GPL_KEEP_OVERFLOW](#GPL_KEEP_OVERFLOW)
505508
- [GPL_PLACE_IOS](#GPL_PLACE_IOS)
@@ -543,6 +546,7 @@ configuration file.
543546
- [CTS_LIB_NAME](#CTS_LIB_NAME)
544547
- [DETAILED_METRICS](#DETAILED_METRICS)
545548
- [DETAIL_PLACEMENT_ARGS](#DETAIL_PLACEMENT_ARGS)
549+
- [FLOW_INPUT_VARIANT](#FLOW_INPUT_VARIANT)
546550
- [HOLD_SLACK_MARGIN](#HOLD_SLACK_MARGIN)
547551
- [LEC_AUX_VERILOG_FILES](#LEC_AUX_VERILOG_FILES)
548552
- [LEC_CHECK](#LEC_CHECK)
@@ -570,6 +574,7 @@ configuration file.
570574
- [DETAILED_METRICS](#DETAILED_METRICS)
571575
- [DETAIL_PLACEMENT_ARGS](#DETAIL_PLACEMENT_ARGS)
572576
- [ENABLE_RESISTANCE_AWARE](#ENABLE_RESISTANCE_AWARE)
577+
- [FLOW_INPUT_VARIANT](#FLOW_INPUT_VARIANT)
573578
- [GLOBAL_ROUTE_ARGS](#GLOBAL_ROUTE_ARGS)
574579
- [GLOBAL_ROUTE_USE_CUGR](#GLOBAL_ROUTE_USE_CUGR)
575580
- [GRT_SEED](#GRT_SEED)
@@ -605,6 +610,7 @@ configuration file.
605610
- [DETAILED_ROUTE_END_ITERATION](#DETAILED_ROUTE_END_ITERATION)
606611
- [DISABLE_VIA_GEN](#DISABLE_VIA_GEN)
607612
- [FILL_CELLS](#FILL_CELLS)
613+
- [FLOW_INPUT_VARIANT](#FLOW_INPUT_VARIANT)
608614
- [MATCH_CELL_FOOTPRINT](#MATCH_CELL_FOOTPRINT)
609615
- [MAX_REPAIR_ANTENNAS_ITER_DRT](#MAX_REPAIR_ANTENNAS_ITER_DRT)
610616
- [MAX_ROUTING_LAYER](#MAX_ROUTING_LAYER)
@@ -628,6 +634,7 @@ configuration file.
628634

629635
- [ADDITIONAL_GDS](#ADDITIONAL_GDS)
630636
- [CDL_FILE](#CDL_FILE)
637+
- [FLOW_INPUT_VARIANT](#FLOW_INPUT_VARIANT)
631638
- [GDS_ALLOW_EMPTY](#GDS_ALLOW_EMPTY)
632639
- [GND_NETS_VOLTAGES](#GND_NETS_VOLTAGES)
633640
- [LEC_AUX_VERILOG_FILES](#LEC_AUX_VERILOG_FILES)

‎flow/Makefile‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ endef
452452
# ==============================================================================
453453

454454
# Custom target to go from synthesis to placement in a single OpenROAD run
455-
$(eval $(call do-step,1_3_floorplan_to_place, $(RESULTS_DIR)/1_synth.odb,floorplan_to_place))
455+
$(eval $(call do-step,1_3_floorplan_to_place, $(INPUT_RESULTS_DIR)/1_synth.odb,floorplan_to_place))
456456

457457
$(eval $(call OPEN_GUI_SHORTCUT,yosys,1_2_yosys.v))
458458

@@ -488,7 +488,7 @@ ifneq ($(filter 1,$(LEC_CHECK) $(SEC_CHECK)),)
488488
$(RESULTS_DIR)/1_synth_lec.v: | check-kepler-formal
489489
endif
490490

491-
$(eval $(call do-step,2_1_floorplan,$(RESULTS_DIR)/1_synth.odb $(TECH_LEF) $(SC_LEF) $(ADDITIONAL_LEFS) $(FOOTPRINT) $(SIG_MAP_FILE) $(FOOTPRINT_TCL) $(LIB_FILES) $(IO_CONSTRAINTS),floorplan))
491+
$(eval $(call do-step,2_1_floorplan,$(INPUT_RESULTS_DIR)/1_synth.odb $(TECH_LEF) $(SC_LEF) $(ADDITIONAL_LEFS) $(FOOTPRINT) $(SIG_MAP_FILE) $(FOOTPRINT_TCL) $(LIB_FILES) $(IO_CONSTRAINTS),floorplan))
492492

493493
# STEP 2: Macro Placement
494494
#-------------------------------------------------------------------------------
@@ -526,7 +526,7 @@ place: $(RESULTS_DIR)/3_place.odb
526526
# ==============================================================================
527527
# STEP 1: Global placement without placed IOs, timing-driven, and routability-driven.
528528
#-------------------------------------------------------------------------------
529-
$(eval $(call do-step,3_1_place_gp_skip_io,$(RESULTS_DIR)/2_floorplan.odb $(LIB_FILES),global_place_skip_io))
529+
$(eval $(call do-step,3_1_place_gp_skip_io,$(INPUT_RESULTS_DIR)/2_floorplan.odb $(LIB_FILES),global_place_skip_io))
530530

531531
$(eval $(call do-step,3_2_place_iop,$(RESULTS_DIR)/3_1_place_gp_skip_io.odb,io_placement))
532532

@@ -580,7 +580,7 @@ ifeq ($(LEC_CHECK),1)
580580
DO_STEP_DEPS_4_1_cts += check-kepler-formal
581581
endif
582582

583-
$(eval $(call do-step,4_1_cts,$(RESULTS_DIR)/3_place.odb,cts))
583+
$(eval $(call do-step,4_1_cts,$(INPUT_RESULTS_DIR)/3_place.odb,cts))
584584

585585
ifeq ($(LEC_CHECK),1)
586586
$(RESULTS_DIR)/4_1_cts.odb: | check-kepler-formal
@@ -618,11 +618,11 @@ grt: $(RESULTS_DIR)/5_1_grt.odb
618618

619619
# STEP 1: Run global route
620620
#-------------------------------------------------------------------------------
621-
$(eval $(call do-step,5_1_grt,$(RESULTS_DIR)/4_cts.odb $(FASTROUTE_TCL) $(PRE_GLOBAL_ROUTE_TCL),global_route))
621+
$(eval $(call do-step,5_1_grt,$(INPUT_RESULTS_DIR)/4_cts.odb $(FASTROUTE_TCL) $(PRE_GLOBAL_ROUTE_TCL),global_route))
622622

623623
# STEP 2: Run detailed route
624624
#-------------------------------------------------------------------------------
625-
$(eval $(call do-step,5_2_route,$(RESULTS_DIR)/5_1_grt.odb,detail_route))
625+
$(eval $(call do-step,5_2_route,$(INPUT_RESULTS_DIR)/5_1_grt.odb,detail_route))
626626

627627
$(eval $(call do-step,5_3_fillcell,$(RESULTS_DIR)/5_2_route.odb,fillcell))
628628

@@ -680,7 +680,7 @@ elapsed:
680680
elapsed-all:
681681
@$(PYTHON_EXE) $(UTILS_DIR)/genElapsedTime.py -d $(shell find $(WORK_HOME)/logs/$(PLATFORM)/*/*/ -type d)
682682

683-
$(eval $(call do-step,6_1_fill,$(RESULTS_DIR)/5_route.odb $(FILL_CONFIG),density_fill))
683+
$(eval $(call do-step,6_1_fill,$(INPUT_RESULTS_DIR)/5_route.odb $(FILL_CONFIG),density_fill))
684684

685685
ifneq ($(filter 1,$(LEC_CHECK) $(SEC_CHECK)),)
686686
DO_STEP_DEPS_6_report += check-kepler-formal

‎flow/scripts/cts.tcl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ utl::set_metrics_stage "cts__{}"
22
source $::env(SCRIPTS_DIR)/load.tcl
33
source $::env(SCRIPTS_DIR)/formal_check.tcl
44
erase_non_stage_variables cts
5-
load_design 3_place.odb
5+
load_stage_input 3_place.odb
66
source_step_tcl PRE CTS
77

88
# Clone clock tree inverters next to register loads

‎flow/scripts/density_fill.tcl‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
source $::env(SCRIPTS_DIR)/load.tcl
22
erase_non_stage_variables final
3-
load_design 5_route.odb
3+
load_stage_input 5_route.odb
44
source_step_tcl PRE DENSITY_FILL
55

66
if { $::env(USE_FILL) } {
@@ -11,7 +11,7 @@ if { $::env(USE_FILL) } {
1111
write_verilog $::env(RESULTS_DIR)/6_1_fill.v
1212
orfs_write_db $::env(RESULTS_DIR)/6_1_fill.odb
1313
} else {
14-
orfs_copy_db $::env(RESULTS_DIR)/5_route.odb $::env(RESULTS_DIR)/6_1_fill.odb
14+
orfs_copy_db $::env(INPUT_RESULTS_DIR)/5_route.odb $::env(RESULTS_DIR)/6_1_fill.odb
1515
# There is no 5_route.v file to copy
1616
}
1717

‎flow/scripts/detail_route.tcl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
utl::set_metrics_stage "detailedroute__{}"
22
source $::env(SCRIPTS_DIR)/load.tcl
3-
load_design 5_1_grt.odb
3+
load_stage_input 5_1_grt.odb
44
source_step_tcl PRE DETAIL_ROUTE
55

66
if { !$::env(SKIP_DETAILED_ROUTE) } {

‎flow/scripts/floorplan.tcl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
utl::set_metrics_stage "floorplan__{}"
22
source $::env(SCRIPTS_DIR)/load.tcl
33
erase_non_stage_variables floorplan
4-
load_design 1_synth.odb
4+
load_stage_input 1_synth.odb
55

66
# The global connections, before any step can mark an instance
77
# dont_touch: global_connect skips one (ODB-0383). The rules stay in the

‎flow/scripts/global_place_skip_io.tcl‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
source $::env(SCRIPTS_DIR)/load.tcl
22
erase_non_stage_variables place
33
if { $::env(GPL_PLACE_IOS) } {
4-
orfs_copy_db $::env(RESULTS_DIR)/2_floorplan.odb \
4+
orfs_copy_db $::env(INPUT_RESULTS_DIR)/2_floorplan.odb \
55
$::env(RESULTS_DIR)/3_1_place_gp_skip_io.odb
66
return
77
}
8-
load_design 2_floorplan.odb
8+
load_stage_input 2_floorplan.odb
99
source_step_tcl PRE GLOBAL_PLACE_SKIP_IO
1010

1111
if { [env_var_exists_and_non_empty FLOORPLAN_DEF] } {

‎flow/scripts/global_route.tcl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
utl::set_metrics_stage "globalroute__{}"
22
source $::env(SCRIPTS_DIR)/load.tcl
33
erase_non_stage_variables grt
4-
load_design 4_cts.odb
4+
load_stage_input 4_cts.odb
55

66
source_step_tcl PRE GLOBAL_ROUTE
77

‎flow/scripts/load.tcl‎

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,31 @@ source $::env(SCRIPTS_DIR)/util.tcl
22

33
source $::env(SCRIPTS_DIR)/report_metrics.tcl
44

5+
# A step's input is the result of an earlier step of its stage.
56
proc load_design { design_file } {
7+
load_design_from $::env(RESULTS_DIR) $design_file
8+
}
9+
10+
# A stage's input is the previous stage's result, read from the
11+
# variant FLOW_INPUT_VARIANT names.
12+
proc load_stage_input { design_file } {
13+
if { $::env(INPUT_RESULTS_DIR) ne $::env(RESULTS_DIR) } {
14+
if { $::env(AUTO_MEMORIES) } {
15+
error "AUTO_MEMORIES=1 reads the memories synthesised in this variant,\
16+
$::env(FLOW_VARIANT), and FLOW_INPUT_VARIANT=$::env(FLOW_INPUT_VARIANT)\
17+
reads the design from another"
18+
}
19+
if { [file exists $::env(RESULTS_DIR)/$design_file] } {
20+
error "$design_file is in both FLOW_VARIANT=$::env(FLOW_VARIANT) and\
21+
FLOW_INPUT_VARIANT=$::env(FLOW_INPUT_VARIANT). Run the stage that\
22+
reads another variant alone, then the stages after it with\
23+
FLOW_INPUT_VARIANT unset, and remove a copy left from an earlier run."
24+
}
25+
}
26+
load_design_from $::env(INPUT_RESULTS_DIR) $design_file
27+
}
28+
29+
proc load_design_from { dir design_file } {
630
# Do not reload if design is already loaded
731
set db [ord::get_db]
832
if { [$db getChip] != "NULL" && [[$db getChip] getBlock] != "NULL" } {
@@ -27,15 +51,15 @@ proc load_design { design_file } {
2751
foreach lef [auto_memories_views .lef] {
2852
read_lef $lef
2953
}
30-
read_verilog $::env(RESULTS_DIR)/$design_file
54+
read_verilog $dir/$design_file
3155
log_cmd link_design {*}[hier_options] $::env(DESIGN_NAME)
3256
} elseif { $ext == ".odb" } {
33-
log_cmd read_db {*}[hier_options] $::env(RESULTS_DIR)/$design_file
57+
log_cmd read_db {*}[hier_options] $dir/$design_file
3458
} else {
3559
error "Unrecognized input file $design_file"
3660
}
3761

38-
log_cmd read_sdc $::env(RESULTS_DIR)/[sdc_file_of $design_file]
62+
log_cmd read_sdc $dir/[sdc_file_of $design_file]
3963

4064
if { [file exists $::env(PLATFORM_DIR)/derate.tcl] } {
4165
log_cmd source $::env(PLATFORM_DIR)/derate.tcl

‎flow/scripts/variables.mk‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ export LOG_DIR = $(WORK_HOME)/logs/$(PLATFORM)/$(DESIGN_NICKNAME)/$(FLOW_VAR
5454
export OBJECTS_DIR = $(WORK_HOME)/objects/$(PLATFORM)/$(DESIGN_NICKNAME)/$(FLOW_VARIANT)
5555
export REPORTS_DIR = $(WORK_HOME)/reports/$(PLATFORM)/$(DESIGN_NICKNAME)/$(FLOW_VARIANT)
5656
export RESULTS_DIR = $(WORK_HOME)/results/$(PLATFORM)/$(DESIGN_NICKNAME)/$(FLOW_VARIANT)
57+
# Where a stage reads the previous stage's result.
58+
export FLOW_INPUT_VARIANT ?= $(FLOW_VARIANT)
59+
export INPUT_RESULTS_DIR = $(WORK_HOME)/results/$(PLATFORM)/$(DESIGN_NICKNAME)/$(FLOW_INPUT_VARIANT)
5760

5861
#-------------------------------------------------------------------------------
5962
ifeq (,$(strip $(NUM_CORES)))

0 commit comments

Comments
 (0)