Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
1489474
implemented scripts/auto_timing_fix.tcl
phlfm Sep 10, 2025
87f8044
scripts/adi_project_xilinx.tcl: added ADI_POST_ROUTE_SCRIPT flag
phlfm Sep 10, 2025
beda6b0
scripts/adi_project_xilinx.tcl: added documentation for run flags
phlfm Sep 10, 2025
f2d6cf0
projects/fmcomms2: auto timing fix added as post route script
phlfm Sep 10, 2025
c485f42
projects/fmcomms2: change strategy to Congestion_SpreadLogic_high
phlfm Sep 10, 2025
ebdd90f
projects/fmcomms2: refactor system_project.tcl as Factory Method
phlfm Sep 10, 2025
711ecfb
projects/ad9081_fmca_ebz/vcu118: auto timing fix added as post route …
phlfm Sep 10, 2025
e96efa8
projects/ad9081_fmca_ebz/vcu118: change strategy to Congestion_Spread…
phlfm Sep 10, 2025
2cc0018
projects/fmcomms2: update copyright header
phlfm Sep 10, 2025
d9f795f
move build docs from adi_project_xilinx.tcl to build_hdl.rst
phlfm Sep 19, 2025
dcd4b10
projects/scripts/adi_project_xilinx.tcl: fixed typo
phlfm Sep 19, 2025
dbddf29
projects/scripts/adi_project_xilinx.tcl: removed redundant elsif
phlfm Sep 19, 2025
19827c5
scripts/auto_timing_fix.tcl: fixed typo
phlfm Sep 19, 2025
ba61f00
projects/fmcomms5: added ATF as post-route script
phlfm Sep 25, 2025
8c4ef13
projects/fmcomms5: refactor system_project.tcl as Factory Method
phlfm Sep 25, 2025
4d9f047
scripts/auto_timing_fix.tcl: removed checkpoint for each iteration
phlfm Sep 25, 2025
7a59b76
projects/fmcomms5: change strategy to Congestion_SpreadLogic_high
phlfm Sep 25, 2025
175a371
projects/daq2: refactor system_project.tcl as Factory Method
phlfm Sep 25, 2025
73d1d5d
projects/daq2: auto timing fix added as post route script
phlfm Sep 25, 2025
0c62f70
projects/daq2: removing trailing ws from system_project.tcl
phlfm Sep 25, 2025
734c73a
projects/daq2: change strategy to Congestion_SpreadLogic_high
phlfm Sep 25, 2025
ac0b807
projects/daq2: updating copyright header
phlfm Sep 25, 2025
7fed80d
projects/fmcomms5: updating copyright header
phlfm Sep 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions projects/ad9081_fmca_ebz/vcu118/system_project.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
source ../../../scripts/adi_env.tcl
source $ad_hdl_dir/projects/scripts/adi_project_xilinx.tcl
source $ad_hdl_dir/projects/scripts/adi_board.tcl
set ADI_POST_ROUTE_SCRIPT [file normalize $ad_hdl_dir/scripts/auto_timing_fix.tcl]

# get_env_param retrieves parameter value from the environment if exists,
# other case use the default value
Expand Down Expand Up @@ -95,4 +96,6 @@ if {$ADI_USE_OOC_SYNTHESIS == 1} {
set_property used_in_synthesis false [get_files timing_constr.xdc]
}

set_property strategy Congestion_SpreadLogic_high [get_runs impl_1]

adi_project_run ad9081_fmca_ebz_vcu118
18 changes: 10 additions & 8 deletions projects/fmcomms2/kcu105/system_project.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@
source ../../../scripts/adi_env.tcl
source $ad_hdl_dir/projects/scripts/adi_project_xilinx.tcl
source $ad_hdl_dir/projects/scripts/adi_board.tcl
set ADI_POST_ROUTE_SCRIPT [file normalize $ad_hdl_dir/scripts/auto_timing_fix.tcl]
set BOARD_NAME kcu105

adi_project fmcomms2_kcu105
adi_project_files fmcomms2_kcu105 [list \
adi_project fmcomms2_${BOARD_NAME}
adi_project_files fmcomms2_${BOARD_NAME} [list \
"system_top.v" \
"system_constr.xdc"\
"$ad_hdl_dir/library/common/ad_iobuf.v" \
"$ad_hdl_dir/projects/common/kcu105/kcu105_system_constr.xdc" \
"$ad_hdl_dir/projects/common/kcu105/kcu105_system_lutram_constr.xdc" ]
"$ad_hdl_dir/projects/common/${BOARD_NAME}/${BOARD_NAME}_system_constr.xdc" \
"$ad_hdl_dir/projects/common/${BOARD_NAME}/${BOARD_NAME}_system_lutram_constr.xdc" ]

## To improve timing in DDR4 MIG
set_property strategy Performance_RefinePlacement [get_runs impl_1]
set_property STEPS.PHYS_OPT_DESIGN.ARGS.DIRECTIVE ExploreWithAggressiveHoldFix [get_runs impl_1]
## fmcomms2 design is presenting hold time violations on some paths
## set the strategy to spread logic and help with hold time fixes
set_property strategy Congestion_SpreadLogic_high [get_runs impl_1]

adi_project_run fmcomms2_kcu105
adi_project_run fmcomms2_${BOARD_NAME}
source $ad_hdl_dir/library/axi_ad9361/axi_ad9361_delay.tcl
16 changes: 10 additions & 6 deletions projects/fmcomms2/zc702/system_project.tcl
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
###############################################################################
## Copyright (C) 2014-2023 Analog Devices, Inc. All rights reserved.
## Copyright (C) 2014-2023, 2025 Analog Devices, Inc. All rights reserved.
### SPDX short identifier: ADIBSD
###############################################################################

source ../../../scripts/adi_env.tcl
source $ad_hdl_dir/projects/scripts/adi_project_xilinx.tcl
source $ad_hdl_dir/projects/scripts/adi_board.tcl
set ADI_POST_ROUTE_SCRIPT [file normalize $ad_hdl_dir/scripts/auto_timing_fix.tcl]
set BOARD_NAME zc702

adi_project fmcomms2_zc702
adi_project_files fmcomms2_zc702 [list \
adi_project fmcomms2_${BOARD_NAME}
adi_project_files fmcomms2_${BOARD_NAME} [list \
"system_top.v" \
"system_constr.xdc" \
"$ad_hdl_dir/library/common/ad_iobuf.v" \
"$ad_hdl_dir/projects/common/zc702/zc702_system_constr.xdc" ]
"$ad_hdl_dir/projects/common/${BOARD_NAME}/${BOARD_NAME}_system_constr.xdc" ]

set_property strategy Performance_Explore [get_runs impl_1]
## fmcomms2 design is presenting hold time violations on some paths
## set the strategy to spread logic and help with hold time fixes
set_property strategy Congestion_SpreadLogic_high [get_runs impl_1]

adi_project_run fmcomms2_zc702
adi_project_run fmcomms2_${BOARD_NAME}
source $ad_hdl_dir/library/axi_ad9361/axi_ad9361_delay.tcl

16 changes: 11 additions & 5 deletions projects/fmcomms2/zc706/system_project.tcl
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
###############################################################################
## Copyright (C) 2014-2023 Analog Devices, Inc. All rights reserved.
## Copyright (C) 2014-2023, 2025 Analog Devices, Inc. All rights reserved.
### SPDX short identifier: ADIBSD
###############################################################################

source ../../../scripts/adi_env.tcl
source $ad_hdl_dir/projects/scripts/adi_project_xilinx.tcl
source $ad_hdl_dir/projects/scripts/adi_board.tcl
set ADI_POST_ROUTE_SCRIPT [file normalize $ad_hdl_dir/scripts/auto_timing_fix.tcl]
set BOARD_NAME zc706

adi_project fmcomms2_zc706
adi_project_files fmcomms2_zc706 [list \
adi_project fmcomms2_${BOARD_NAME}
adi_project_files fmcomms2_${BOARD_NAME} [list \
"system_top.v" \
"system_constr.xdc"\
"$ad_hdl_dir/library/common/ad_iobuf.v" \
"$ad_hdl_dir/projects/common/zc706/zc706_system_constr.xdc" ]
"$ad_hdl_dir/projects/common/${BOARD_NAME}/${BOARD_NAME}_system_constr.xdc" ]

adi_project_run fmcomms2_zc706
## fmcomms2 design is presenting hold time violations on some paths
## set the strategy to spread logic and help with hold time fixes
set_property strategy Congestion_SpreadLogic_high [get_runs impl_1]

adi_project_run fmcomms2_${BOARD_NAME}
source $ad_hdl_dir/library/axi_ad9361/axi_ad9361_delay.tcl

16 changes: 11 additions & 5 deletions projects/fmcomms2/zcu102/system_project.tcl
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
###############################################################################
## Copyright (C) 2016-2023 Analog Devices, Inc. All rights reserved.
## Copyright (C) 2014-2023, 2025 Analog Devices, Inc. All rights reserved.
### SPDX short identifier: ADIBSD
###############################################################################

source ../../../scripts/adi_env.tcl
source $ad_hdl_dir/projects/scripts/adi_project_xilinx.tcl
source $ad_hdl_dir/projects/scripts/adi_board.tcl
set ADI_POST_ROUTE_SCRIPT [file normalize $ad_hdl_dir/scripts/auto_timing_fix.tcl]
set BOARD_NAME zcu102

adi_project fmcomms2_zcu102
adi_project_files fmcomms2_zcu102 [list \
adi_project fmcomms2_${BOARD_NAME}
adi_project_files fmcomms2_${BOARD_NAME} [list \
"system_top.v" \
"system_constr.xdc"\
"$ad_hdl_dir/library/common/ad_iobuf.v" \
"$ad_hdl_dir/projects/common/zcu102/zcu102_system_constr.xdc" ]
"$ad_hdl_dir/projects/common/${BOARD_NAME}/${BOARD_NAME}_system_constr.xdc" ]

adi_project_run fmcomms2_zcu102
## fmcomms2 design is presenting hold time violations on some paths
## set the strategy to spread logic and help with hold time fixes
set_property strategy Congestion_SpreadLogic_high [get_runs impl_1]

adi_project_run fmcomms2_${BOARD_NAME}
source $ad_hdl_dir/library/axi_ad9361/axi_ad9361_delay.tcl

17 changes: 11 additions & 6 deletions projects/fmcomms2/zed/system_project.tcl
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
###############################################################################
## Copyright (C) 2014-2023 Analog Devices, Inc. All rights reserved.
## Copyright (C) 2014-2023, 2025 Analog Devices, Inc. All rights reserved.
### SPDX short identifier: ADIBSD
###############################################################################

source ../../../scripts/adi_env.tcl
source $ad_hdl_dir/projects/scripts/adi_project_xilinx.tcl
source $ad_hdl_dir/projects/scripts/adi_board.tcl
set ADI_POST_ROUTE_SCRIPT [file normalize $ad_hdl_dir/scripts/auto_timing_fix.tcl]
set BOARD_NAME zed

adi_project fmcomms2_zed
adi_project_files fmcomms2_zed [list \
adi_project fmcomms2_${BOARD_NAME}
adi_project_files fmcomms2_${BOARD_NAME} [list \
"system_top.v" \
"system_constr.xdc"\
"$ad_hdl_dir/library/common/ad_iobuf.v" \
"$ad_hdl_dir/projects/common/zed/zed_system_constr.xdc" ]
"$ad_hdl_dir/projects/common/${BOARD_NAME}/${BOARD_NAME}_system_constr.xdc" ]

adi_project_run fmcomms2_zed
source $ad_hdl_dir/library/axi_ad9361/axi_ad9361_delay.tcl
## fmcomms2 design is presenting hold time violations on some paths
## set the strategy to spread logic and help with hold time fixes
set_property strategy Congestion_SpreadLogic_high [get_runs impl_1]

adi_project_run fmcomms2_${BOARD_NAME}
source $ad_hdl_dir/library/axi_ad9361/axi_ad9361_delay.tcl
40 changes: 40 additions & 0 deletions projects/scripts/adi_project_xilinx.tcl
Copy link
Contributor

@caosjr caosjr Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo line 321: existing.

Add source files to an existing project.

Copy link
Contributor

@caosjr caosjr Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it is not related to this commit, but maybe it could be added as well. It is not necessary the elseif in line 332, just an else satisfies the filter for constrs_1 and sources_1.

    if {[string range $pfile [expr 1 + [string last . $pfile]] end] == "xdc"} {
      add_files -norecurse -fileset constrs_1 $pfile
    } else {
      add_files -norecurse -fileset sources_1 $pfile
    }

Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ proc adi_project_create {project_name mode parameter_list device {board "not-app
# \param[project_files] - list of project files
#
proc adi_project_files {project_name project_files} {
global ADI_POST_ROUTE_SCRIPT

foreach pfile $project_files {
if {[string range $pfile [expr 1 + [string last . $pfile]] end] == "xdc"} {
Expand All @@ -335,6 +336,10 @@ proc adi_project_files {project_name project_files} {
}
}

if {[info exists ADI_POST_ROUTE_SCRIPT]} {
add_files -fileset utils_1 -norecurse ${ADI_POST_ROUTE_SCRIPT}
}

# NOTE: top file name is always system_top
set_property top system_top [current_fileset]
}
Expand All @@ -343,6 +348,31 @@ proc adi_project_files {project_name project_files} {
#
# \param[project_name] - name of the project
#
# Additional configuration flags are:
# - ADI_EXTRACT_PORTS - If set, extracts port properties from a predefined list
# of IPs into 'ports_properties.txt'.
# - ADI_GENERATE_BIN - If set, generates a binary bitstream file (.bin)
# in addition to the .xsa hardware platform.
# - ADI_GENERATE_UTILIZATION - If set, generates CSV and log files detailing
# resource utilization for the design and specific IPs.
# - ADI_GENERATE_XPA - If set, runs a Xilinx Power Analysis (XPA) and generates
# a summary report.
# - ADI_MAX_OOC_JOBS - Specifies the number of parallel jobs to use for
# Out-of-Context (OOC) synthesis.
# - ADI_MAX_THREADS - Specifies the maximum number of threads for Vivado
# operations. Default value is 8.
# - ADI_NO_BITSTREAM_COMPRESSION - If set, disables compression of the final
# bitstream file.
# - ADI_POST_ROUTE_SCRIPT - Specifies the path to a Tcl script to be executed
# after the routing design step.
# - ADI_POWER_OPTIMIZATION - If set to 1, enables power optimization during the
# implementation run.
# - ADI_PROJECT_DIR - Specifies a base directory for output files such as logs
# and reports.
# - ADI_SKIP_SYNTHESIS - If set, the entire procedure will exit before starting
# synthesis.
# - ADI_USE_OOC_SYNTHESIS - If set to 1, launches synthesis for OOC IP modules
# in parallel.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have all of those described on the rst doc (build_hdl.rst), not all of them are there

proc adi_project_run {project_name} {

global ad_project_dir
Expand All @@ -351,6 +381,12 @@ proc adi_project_run {project_name} {
global ADI_USE_OOC_SYNTHESIS
global ADI_MAX_OOC_JOBS
global ADI_GENERATE_BIN
global ADI_POST_ROUTE_SCRIPT

if {[info exists ::env(ADI_MAX_THREADS)]} {
set_param general.maxThreads ${::env(ADI_MAX_THREADS)}
puts "INFO: maxThreads set to ${::env(ADI_MAX_THREADS)}"
}

if {![info exists ::env(ADI_PROJECT_DIR)]} {
set actual_project_name $project_name
Expand Down Expand Up @@ -384,6 +420,10 @@ proc adi_project_run {project_name} {

set_param board.repoPaths [get_property LOCAL_ROOT_DIR [xhub::get_xstores xilinx_board_store]]

if {[info exists ADI_POST_ROUTE_SCRIPT]} {
set_property STEPS.ROUTE_DESIGN.TCL.POST [ get_files ${ADI_POST_ROUTE_SCRIPT} -of [get_fileset utils_1] ] [get_runs impl_1]
}

launch_runs impl_1 -to_step write_bitstream
wait_on_run impl_1
open_run impl_1
Expand Down
79 changes: 79 additions & 0 deletions scripts/auto_timing_fix.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
###############################################################################
## Copyright (C) 2025 Analog Devices, Inc. All rights reserved.
### SPDX short identifier: ADIBSD
###############################################################################
# This script attempts to automatically fix timing violations after routing
# using phys_opt_design. It will make multiple attempts up to a maximum number
# of tries, or until no violations remain. It can be configured via the
# ADI_AUTOFIX_WNS_THRESHOLD and ADI_AUTOFIX_MAX_ATTEMPTS environment variables.
#
# ADI_AUTOFIX_WNS_THRESHOLD limits the worst negative slack (WNS) that will be
# automatically fixed. If the WNS is worse than this threshold, no automatic fix
# will be attempted. The threshold should be a negative number and the value is
# in nanoseconds. For example, a threshold of -1.0 means that only violations
# where "0 > WNS > -1.0 ns" will be automatically fixed.
#
puts "INFO: starting auto timing fix (ATF)..."
set attempt 0

# Set default values if not provided
if {![info exists ADI_AUTOFIX_WNS_THRESHOLD]} {
set ADI_AUTOFIX_WNS_THRESHOLD -1.0
puts "INFO: ATF: ADI_AUTOFIX_WNS_THRESHOLD not set, using default of $ADI_AUTOFIX_WNS_THRESHOLD"
}
if {![info exists ADI_AUTOFIX_MAX_ATTEMPTS]} {
set ADI_AUTOFIX_MAX_ATTEMPTS 5
puts "INFO: ATF: ADI_AUTOFIX_MAX_ATTEMPTS not set, using default of $ADI_AUTOFIX_MAX_ATTEMPTS"
}

while {$attempt < $ADI_AUTOFIX_MAX_ATTEMPTS} {
# Get the single worst timing path object in the design
set worst_path [get_timing_paths -nworst 1 -max_paths 1 -delay_type min_max]
if {[llength $worst_path] == 0} { break } ; # No paths found
set wns [get_property SLACK $worst_path]
if {${wns} >= 0.0} { break } ; # No violations remain
set delay_type [get_property DELAY_TYPE $worst_path] ;# Returns "max" for Setup, "min" for Hold
# Check if autofix should attempt based on WNS threshold
if {$wns > $ADI_AUTOFIX_WNS_THRESHOLD} {
incr attempt
puts "INFO: ATF: WNS = ${wns} ns of type $delay_type. Attempting automatic fix (${attempt} of ${ADI_AUTOFIX_MAX_ATTEMPTS})."
report_timing_summary -delay_type min_max -max_paths 5 -nworst 1 -file "AutoTimingFix_${attempt}_before_timing_summary.txt"
} else {
break ; # Abort automatic fix due to WNS threshold
}
# Attempt fix via phys_opt_design
write_checkpoint -force "AutoTimingFix_${attempt}_before_system_top_placed.dcp"
if {$delay_type eq "min"} {
phys_opt_design -hold_fix
} elseif {$delay_type eq "max"} {
phys_opt_design
} else {
puts "ERROR: ATF: Unknown path type '${delay_type}'. Aborting automatic fix."
break
}
}

write_checkpoint -force "AutoTimingFix_${attempt}_final_system_top_placed.dcp"
report_timing_summary -delay_type min_max -max_paths 5 -nworst 1 -file "AutoTimingFix_${attempt}_final_timing_summary.txt"

# Print a final report
if {[llength $worst_path] == 0} {
# Loop broke early due to no paths found
puts "ERROR: ATF: No constrained timing paths found. Exiting."
} elseif {${attempt} == 0 && ${wns} >= 0.0} {
# Loop broke early due to no violations on first check
puts "INFO: ATF: No timing violations detected on first check. No action required."
} else {
# Loop broke after at least one attempt
set worst_path [get_timing_paths -nworst 1 -max_paths 1 -delay_type min_max]
set final_wns [get_property SLACK $worst_path]
if {$final_wns >= 0} {
puts "INFO: ATF: auto timing fix SUCCESS after ${attempt} attempts - final WNS is ${final_wns} ns."
} elseif {$final_wns <= $ADI_AUTOFIX_WNS_THRESHOLD} {
puts "WARNING: ATF: WNS (${wns} ns) excedes threshold (${ADI_AUTOFIX_WNS_THRESHOLD} ns). Automatic fix aborted."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: exceeds.

puts "WARNING: ATF: WNS (${wns} ns) exceeds threshold (${ADI_AUTOFIX_WNS_THRESHOLD} ns). Automatic fix aborted."

} else {
puts "WARNING: ATF: auto timing fix FAILURE after ${attempt} attempts - final WNS is ${final_wns} ns."
}
}

puts "INFO: auto timing fix (ATF) finished."