diff --git a/docs-rtd/source/hdk/README.rst b/docs-rtd/source/hdk/README.rst index 40bdef752..1799ddf82 100644 --- a/docs-rtd/source/hdk/README.rst +++ b/docs-rtd/source/hdk/README.rst @@ -186,6 +186,13 @@ A few more notes on source code and DCPs. Encryption, enabled by default, may impede debugging as errors from encrypted envelope do not provide meaningful information. +- Use ``--package-only -t `` with + ``--clock_recipe_a``, ``--clock_recipe_b``, ``--clock_recipe_c``, and + ``--clock_recipe_hbm`` to skip Vivado and package an existing post-route + DCP. The tag must match the checkpoint filename + (``..post_route.dcp`` in ``$CL_DIR/build/checkpoints``). + All four recipes must be passed explicitly; the script does not assume + defaults or derive clock info from the DCP. - The script also allows developers to pass different Vivado directives as shown below: diff --git a/hdk/README.md b/hdk/README.md index 0a2b79ae5..3b93013ad 100644 --- a/hdk/README.md +++ b/hdk/README.md @@ -109,6 +109,7 @@ A few more notes on [aws_build_dcp_from_cl.py](https://github.com/aws/aws-fpga/b - Use `--cl ` option to build a different CL design. This is default to `cl_dram_hbm_dma`. - Use `--aws_clk_gen` option to annotate the use of [AWS clock generation block](./docs/AWS_CLK_GEN_spec.md) and [customer clock recipes](./docs/Clock_Recipes_User_Guide.md). - Use `--no-encrypt` option to disable encryption of the design's source code and DCPs. Encryption, enabled by default, may impede debugging as errors from encrypted envelope do not provide meaningful information. +- Use `--package-only -t ` with `--clock_recipe_a`, `--clock_recipe_b`, `--clock_recipe_c`, and `--clock_recipe_hbm` to skip Vivado and package an existing post-route DCP. The tag must match the checkpoint filename (`..post_route.dcp` in `$CL_DIR/build/checkpoints`). All four recipes must be passed explicitly; the script does not assume defaults or derive clock info from the DCP. - The script also allows developers to pass different Vivado directives as shown below: - `--place `: Default to `SSI_SpreadLogic_high` placement strategy. Please refer to [Vivado User Guide](https://docs.amd.com/r/en-US/ug904-vivado-implementation/Available-Directives) for supported directives. - `--phy_opt ` : Default to `AggressiveExplore` physical optimization strategy. Please refer to [Vivado User Guide](https://docs.amd.com/r/en-US/ug904-vivado-implementation/Using-Directives?tocId=9xJiGeSV35ApxUsX7pAVDg) for supported directives diff --git a/hdk/common/shell_stable/build/scripts/aws_build_dcp_from_cl.py b/hdk/common/shell_stable/build/scripts/aws_build_dcp_from_cl.py index ee85b1109..40a7d268e 100755 --- a/hdk/common/shell_stable/build/scripts/aws_build_dcp_from_cl.py +++ b/hdk/common/shell_stable/build/scripts/aws_build_dcp_from_cl.py @@ -28,6 +28,20 @@ TIMESTAMP_LOG_FORMAT = "%Y-%m-%d %H:%M:%S" TIMESTAMP_FILE_FORMAT = "%Y_%m_%d-%H%M%S" +CLOCK_RECIPE_OPTS = ( + "--clock_recipe_a", + "--clock_recipe_b", + "--clock_recipe_c", + "--clock_recipe_hbm", +) + + +def option_on_argv(option_name): + for arg in sys.argv[1:]: + if arg == option_name or arg.startswith(option_name + "="): + return True + return False + ############################################################# # Print error message and exit @@ -256,6 +270,14 @@ def main(): default=True, ) + parser.add_option( + "--package-only", + dest="package_only", + action="store_true", + default=False, + help="Skip Vivado and package an existing post-route DCP. Requires --tag matching the checkpoint timestamp and all four of --clock_recipe_a/b/c/hbm passed explicitly (recipes are not defaulted or derived from the DCP).", + ) + (options, args) = parser.parse_args() print("==================================================") @@ -317,24 +339,36 @@ def main(): build_tag = now.strftime(TIMESTAMP_FILE_FORMAT) os.environ["BUILD_TAG"] = build_tag - # Last check before build in case the user sets clock recipes without the aws_clk_gen IP - if not options.aws_clk_gen and "clock_recipe" in str(sys.argv): + # Last check before build in case the user sets clock recipes without the aws_clk_gen IP. + # --package-only only records recipes in the tarball manifest, so --aws_clk_gen is not required. + if not options.package_only and not options.aws_clk_gen and "clock_recipe" in str(sys.argv): print_error("""The aws_clk_gen IP is required for setting custom clock recipes. Custom `clock_recipe` arguments were detected, please add `--aws_clk_gen` to continue.""") - # Run the Vivado job - cmd = ( - f"vivado -mode batch -source build_all.tcl -log {build_tag}.vivado.log " - + f"-tclargs {options.place_direct} {options.phy_opt_direct} {options.route_direct} " - + f"{options.clock_recipe_a} {options.clock_recipe_b} {options.clock_recipe_c} {options.clock_recipe_hbm} " - ) - start_time = datetime.datetime.now() print(f"\nAWS FPGA: {start_time.strftime(TIMESTAMP_LOG_FORMAT)} - Build starts\n") - sys.stdout.flush() - os.system(cmd) + + if options.package_only: + if not options.build_tag: + print_error( + "--package-only requires --tag matching an existing post-route DCP (for example -t YYYY_MM_DD-HHMMSS)" + ) + _missing_recipes = [opt for opt in CLOCK_RECIPE_OPTS if not option_on_argv(opt)] + if _missing_recipes: + print_error( + "--package-only requires all four clock recipes to be passed explicitly " + "(--clock_recipe_a, --clock_recipe_b, --clock_recipe_c, and --clock_recipe_hbm)" + ) + print(f"AWS FPGA: --package-only set, skipping Vivado and packaging tag {build_tag}\n") + else: + cmd = ( + f"vivado -mode batch -source build_all.tcl -log {build_tag}.vivado.log " + + f"-tclargs {options.place_direct} {options.phy_opt_direct} {options.route_direct} " + + f"{options.clock_recipe_a} {options.clock_recipe_b} {options.clock_recipe_c} {options.clock_recipe_hbm} " + ) + os.system(cmd) if options.flow == "BuildAll": generate_dcp_tarball(