Skip to content

Commit 020154f

Browse files
committed
Makefile: use ln -fs instead of cp to save space
this starts to matter for .odb files in the gigabytes size, which will happen e.g. in exploration of mm^2 sized ASAP7 designs with lots of empty space. Empty space on a die can be common when exploring floorplans and starting with an overgenerous placement of macros. make works with softlinks: when the date is identical to the target, i.e. it is up to date. Files are only copied "forward" in the flow, so this is safe. tar works with hardlinks and softlinks: if the file does not exist in the archive, then the full file is archived. Subsequent references to the same file gets a hardlink. This should see "make issue" sizes reduced. A symlink is overwritten when a file is opened in write & truncate mode, thus not changing the file that the symlink points to. This is unlike a hard link. Relative paths are used, such that the results folder can be moved. Signed-off-by: Øyvind Harboe <[email protected]>
1 parent 515f43b commit 020154f

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

flow/Makefile

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -399,11 +399,11 @@ $(RESULTS_DIR)/1_1_yosys.v: $(DONT_USE_LIBS) $(WRAPPED_LIBS) $(DONT_USE_SC_LIB)
399399

400400
$(RESULTS_DIR)/1_synth.v: $(RESULTS_DIR)/1_1_yosys.v
401401
mkdir -p $(RESULTS_DIR) $(LOG_DIR) $(REPORTS_DIR)
402-
cp $< $@
402+
ln -sf $(shell realpath --relative-to=$(dir $@) $<) $@
403403

404404
$(RESULTS_DIR)/1_synth.sdc: $(SDC_FILE)
405405
mkdir -p $(RESULTS_DIR) $(LOG_DIR) $(REPORTS_DIR)
406-
cp $< $@
406+
ln -sf $(shell realpath --relative-to=$(dir $@) $<) $@
407407

408408
clean_synth:
409409
rm -f $(RESULTS_DIR)/1_*.v $(RESULTS_DIR)/1_synth.sdc
@@ -443,7 +443,7 @@ $(RESULTS_DIR)/2_2_floorplan_io.odb: $(RESULTS_DIR)/2_1_floorplan.odb $(IO_CONST
443443
ifndef IS_CHIP
444444
($(TIME_CMD) $(OPENROAD_CMD) $(SCRIPTS_DIR)/io_placement_random.tcl -metrics $(LOG_DIR)/2_2_floorplan_io.json) 2>&1 | tee $(LOG_DIR)/2_2_floorplan_io.log
445445
else
446-
cp $< $@
446+
ln -sf $(shell realpath --relative-to=$(dir $@) $<) $@
447447
endif
448448

449449
# STEP 3: Timing Driven Mixed Sized Placement
@@ -453,7 +453,7 @@ ifeq ($(MACRO_PLACEMENT),)
453453
($(TIME_CMD) $(OPENROAD_CMD) $(SCRIPTS_DIR)/tdms_place.tcl -metrics $(LOG_DIR)/2_3_tdms.json) 2>&1 | tee $(LOG_DIR)/2_3_tdms_place.log
454454
else
455455
$(info [INFO][FLOW] Using manual macro placement file $(MACRO_PLACEMENT))
456-
cp $< $@
456+
ln -sf $(shell realpath --relative-to=$(dir $@) $<) $@
457457
endif
458458

459459
# STEP 4: Macro Placement
@@ -473,7 +473,7 @@ $(RESULTS_DIR)/2_6_floorplan_pdn.odb: $(RESULTS_DIR)/2_5_floorplan_tapcell.odb $
473473
($(TIME_CMD) $(OPENROAD_CMD) $(SCRIPTS_DIR)/pdn.tcl -metrics $(LOG_DIR)/2_6_pdn.json) 2>&1 | tee $(LOG_DIR)/2_6_pdn.log
474474

475475
$(RESULTS_DIR)/2_floorplan.odb: $(RESULTS_DIR)/2_6_floorplan_pdn.odb
476-
cp $< $@
476+
ln -sf $(shell realpath --relative-to=$(dir $@) $<) $@
477477

478478
$(RESULTS_DIR)/2_floorplan.sdc: $(RESULTS_DIR)/2_1_floorplan.odb
479479

@@ -506,7 +506,7 @@ $(RESULTS_DIR)/3_2_place_iop.odb: $(RESULTS_DIR)/3_1_place_gp_skip_io.odb $(IO_C
506506
ifndef IS_CHIP
507507
($(TIME_CMD) $(OPENROAD_CMD) $(SCRIPTS_DIR)/io_placement.tcl -metrics $(LOG_DIR)/3_2_place_iop.json) 2>&1 | tee $(LOG_DIR)/3_2_place_iop.log
508508
else
509-
cp $< $@
509+
ln -sf $(shell realpath --relative-to=$(dir $@) $<) $@
510510
endif
511511

512512
# STEP 3: Global placement with placed IOs, timing-driven, and routability-driven.
@@ -529,10 +529,10 @@ $(RESULTS_DIR)/3_5_place_dp.odb: $(RESULTS_DIR)/3_4_place_resized.odb
529529
($(TIME_CMD) $(OPENROAD_CMD) $(SCRIPTS_DIR)/detail_place.tcl -metrics $(LOG_DIR)/3_5_opendp.json) 2>&1 | tee $(LOG_DIR)/3_5_opendp.log
530530

531531
$(RESULTS_DIR)/3_place.odb: $(RESULTS_DIR)/3_5_place_dp.odb
532-
cp $< $@
532+
ln -sf $(shell realpath --relative-to=$(dir $@) $<) $@
533533

534534
$(RESULTS_DIR)/3_place.sdc: $(RESULTS_DIR)/2_floorplan.sdc
535-
cp $< $@
535+
ln -sf $(shell realpath --relative-to=$(dir $@) $<) $@
536536

537537
# Clean Targets
538538
#-------------------------------------------------------------------------------
@@ -570,7 +570,7 @@ $(RESULTS_DIR)/4_2_cts_fillcell.odb: $(RESULTS_DIR)/4_1_cts.odb
570570
$(RESULTS_DIR)/4_cts.sdc: $(RESULTS_DIR)/4_cts.odb
571571

572572
$(RESULTS_DIR)/4_cts.odb: $(RESULTS_DIR)/4_2_cts_fillcell.odb
573-
cp $< $@
573+
ln -sf $(shell realpath --relative-to=$(dir $@) $<) $@
574574

575575
.PHONY: clean_cts
576576
clean_cts:
@@ -608,10 +608,10 @@ endif
608608
($(TIME_CMD) $(OPENROAD_CMD) $(SCRIPTS_DIR)/detail_route.tcl -metrics $(LOG_DIR)/5_2_TritonRoute.json) 2>&1 | tee $(LOG_DIR)/5_2_TritonRoute.log
609609

610610
$(RESULTS_DIR)/5_route.odb: $(RESULTS_DIR)/5_2_route.odb
611-
cp $< $@
611+
ln -sf $(shell realpath --relative-to=$(dir $@) $<) $@
612612

613613
$(RESULTS_DIR)/5_route.sdc: $(RESULTS_DIR)/4_cts.sdc
614-
cp $< $@
614+
ln -sf $(shell realpath --relative-to=$(dir $@) $<) $@
615615

616616
$(RESULTS_DIR)/5_route.v:
617617
@export OR_DB=5_route ;\
@@ -666,14 +666,14 @@ $(RESULTS_DIR)/6_1_fill.odb: $(RESULTS_DIR)/5_route.odb $(FILL_CONFIG)
666666
($(TIME_CMD) $(OPENROAD_CMD) $(SCRIPTS_DIR)/density_fill.tcl -metrics $(LOG_DIR)/6_density_fill.json) 2>&1 | tee $(LOG_DIR)/6_density_fill.log
667667
else
668668
$(RESULTS_DIR)/6_1_fill.odb: $(RESULTS_DIR)/5_route.odb
669-
cp $< $@
669+
ln -sf $(shell realpath --relative-to=$(dir $@) $<) $@
670670
endif
671671

672672
$(RESULTS_DIR)/6_1_fill.sdc: $(RESULTS_DIR)/5_route.sdc
673-
cp $< $@
673+
ln -sf $(shell realpath --relative-to=$(dir $@) $<) $@
674674

675675
$(RESULTS_DIR)/6_final.sdc: $(RESULTS_DIR)/5_route.sdc
676-
cp $< $@
676+
ln -sf $(shell realpath --relative-to=$(dir $@) $<) $@
677677

678678
$(LOG_DIR)/6_report.log: $(RESULTS_DIR)/6_1_fill.odb $(RESULTS_DIR)/6_1_fill.sdc
679679
($(TIME_CMD) $(OPENROAD_CMD) $(SCRIPTS_DIR)/final_report.tcl -metrics $(LOG_DIR)/6_report.json) 2>&1 | tee $(LOG_DIR)/6_report.log
@@ -690,17 +690,17 @@ skip_resize: $(RESULTS_DIR)/3_3_place_gp.odb
690690
.PHONY: skip_cts
691691
skip_cts: $(RESULTS_DIR)/3_place.odb $(RESULTS_DIR)/3_place.sdc
692692
# mock all intermediate results
693-
cp $(RESULTS_DIR)/3_place.odb $(RESULTS_DIR)/4_1_cts.odb
694-
cp $(RESULTS_DIR)/3_place.odb $(RESULTS_DIR)/4_2_cts_fillcell.odb
695-
cp $(RESULTS_DIR)/3_place.sdc $(RESULTS_DIR)/4_cts.sdc
696-
cp $(RESULTS_DIR)/3_place.odb $(RESULTS_DIR)/4_cts.odb
693+
cd $(RESULTS_DIR) && ln -sf 3_place.odb 4_1_cts.odb
694+
cd $(RESULTS_DIR) && ln -sf 3_place.odb 4_2_cts_fillcell.odb
695+
cd $(RESULTS_DIR) && ln -sf 3_place.sdc 4_cts.sdc
696+
cd $(RESULTS_DIR) && ln -sf 3_place.odb 4_cts.odb
697697

698698
# Skipping route can be useful to create a mock abstract
699699
.PHONY: skip_route
700700
skip_route: $(RESULTS_DIR)/4_cts.odb $(RESULTS_DIR)/4_cts.sdc
701-
cp $(RESULTS_DIR)/3_place.odb $(RESULTS_DIR)/5_1_grt.odb
702-
cp $(RESULTS_DIR)/3_place.odb $(RESULTS_DIR)/5_2_route.odb
703-
cp $(RESULTS_DIR)/3_place.odb $(RESULTS_DIR)/6_1_fill.odb
701+
cd $(RESULTS_DIR) && ln -sf 3_place.odb 5_1_grt.odb
702+
cd $(RESULTS_DIR) && ln -sf 3_place.odb 5_2_route.odb
703+
cd $(RESULTS_DIR) && ln -sf 3_place.odb 6_1_fill.odb
704704
touch $(RESULTS_DIR)/6_final.spef
705705

706706
# To create a mock abstract quickly, good enough to iterate quickly on
@@ -743,7 +743,7 @@ $(GDS_MERGED_FILE): $(RESULTS_DIR)/6_final.def $(OBJECTS_DIR)/klayout.lyt $(GDSO
743743
$(RESULTS_DIR)/6_final.v: $(LOG_DIR)/6_report.log
744744

745745
$(GDS_FINAL_FILE): $(GDS_MERGED_FILE)
746-
cp $< $@
746+
ln -sf $(shell realpath --relative-to=$(dir $@) $<) $@
747747

748748
.PHONY: drc
749749
drc: $(REPORTS_DIR)/6_drc.lyrdb

0 commit comments

Comments
 (0)