From 525c0689932c430899e02c3512a868575ee6a467 Mon Sep 17 00:00:00 2001 From: Laszlo Nagy Date: Wed, 17 Apr 2019 11:33:17 +0100 Subject: [PATCH] scripts: Support for incremental compilation The scripts are looking for a previous run result, a routed design checkpoint to use it as a reference during the incremental build flow. Before clearing the project files, the scrips will save the reference dcp file in the project folder. If the reference dcp does not exists the build continues normally. Proposed workflow: 1. Build your project normally with 'make' or place manually a reference.dcp file in the Vivado project folder. 2. Do some minor modifications 3. Run the make with the following option: make MODE=incr 4. Repeat steps 2-3 --- .gitignore | 1 + projects/scripts/adi_project.tcl | 12 +++++++++++- projects/scripts/project-xilinx.mk | 17 ++++++++++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 2c8a12ca0..099fb07d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ ipcache *.ip_user_files +*.dcp *.cache *.data *.xpr diff --git a/projects/scripts/adi_project.tcl b/projects/scripts/adi_project.tcl index b7ec6cd80..dce199ef9 100644 --- a/projects/scripts/adi_project.tcl +++ b/projects/scripts/adi_project.tcl @@ -22,6 +22,8 @@ if {[info exists ::env(ADI_USE_OOC_SYNTHESIS)]} { set ADI_USE_OOC_SYNTHESIS 0 } +set ADI_USE_INCR_COMP 1 + set p_board "not-applicable" set p_device "none" set sys_zynq 1 @@ -37,6 +39,7 @@ proc adi_project_xilinx {project_name {mode 0}} { global REQUIRED_VIVADO_VERSION global IGNORE_VERSION_CHECK global ADI_USE_OOC_SYNTHESIS + global ADI_USE_INCR_COMP if [regexp "_ac701$" $project_name] { set p_device "xc7a200tfbg676-2" @@ -165,6 +168,13 @@ proc adi_project_xilinx {project_name {mode 0}} { } else { write_hwdef -file "$project_name.data/$project_name.hwdef" } + + if {$ADI_USE_INCR_COMP == 1} { + if {[file exists ./reference.dcp]} { + set_property incremental_checkpoint ./reference.dcp [get_runs impl_1] + } + } + } proc adi_project_files {project_name project_files} { @@ -176,7 +186,7 @@ proc adi_project_files {project_name project_files} { proc adi_project_run {project_name} { global ADI_POWER_OPTIMIZATION global ADI_USE_OOC_SYNTHESIS - + if {$ADI_USE_OOC_SYNTHESIS == 1} { launch_runs -jobs 4 system_*_synth_1 synth_1 } else { diff --git a/projects/scripts/project-xilinx.mk b/projects/scripts/project-xilinx.mk index 517de9fd5..925896ba3 100644 --- a/projects/scripts/project-xilinx.mk +++ b/projects/scripts/project-xilinx.mk @@ -33,13 +33,15 @@ M_DEPS += $(wildcard system_constr.xdc) # Not all projects have this file M_DEPS += $(HDL_PROJECT_PATH)scripts/adi_project.tcl M_DEPS += $(HDL_PROJECT_PATH)scripts/adi_env.tcl M_DEPS += $(HDL_PROJECT_PATH)scripts/adi_board.tcl +M_DEPS += prepare_incremental_compile M_DEPS += $(foreach dep,$(LIB_DEPS),$(HDL_LIBRARY_PATH)$(dep)/component.xml) -.PHONY: all lib clean clean-all +.PHONY: all lib clean clean-all prepare_incremental_compile all: lib $(PROJECT_NAME).sdk/system_top.hdf clean: + -rm -f reference.dcp $(call clean, \ $(CLEAN_TARGET), \ $(HL)$(PROJECT_NAME)$(NC) project) @@ -49,6 +51,19 @@ clean-all: clean $(MAKE) -C $(HDL_LIBRARY_PATH)$${lib} clean; \ done +MODE ?= "default" + +prepare_incremental_compile: + @if [ $(MODE) = incr ]; then \ + if [ -f */impl_1/system_top_routed.dcp ]; then \ + echo Found previous run result at `ls */impl_1/system_top_routed.dcp`; \ + cp -u */impl_1/system_top_routed.dcp ./reference.dcp ; \ + fi; \ + if [ -f ./reference.dcp ]; then \ + echo Using reference checkpoint for incremental compilation; \ + fi; \ + fi; + $(PROJECT_NAME).sdk/system_top.hdf: $(M_DEPS) -rm -rf $(CLEAN_TARGET) $(call build, \