fpga: tools: Add ability to run commands before route

Original-commit: a617ff132fef4a28370d8b10b42463a459d44f6b
This commit is contained in:
Wade Fife
2021-06-03 10:22:04 -05:00
committed by Aaron Rossetto
parent cfb4ba7f0b
commit d6397f8f5e
+11 -5
View File
@@ -72,13 +72,13 @@ proc ::vivado_strategies::get_impl_preset {preset} {
# --------------------------------------------------- # ---------------------------------------------------
proc ::vivado_strategies::implement_design {strategy} { proc ::vivado_strategies::implement_design {strategy} {
variable g_viv_version variable g_viv_version
# Check strategy for validity and print # Check strategy for validity and print
vivado_strategies::check_strategy $strategy vivado_strategies::check_strategy $strategy
puts "BUILDER: Running implementation strategy with:" puts "BUILDER: Running implementation strategy with:"
vivado_strategies::print_strategy $strategy vivado_strategies::print_strategy $strategy
# Optimize the current netlist. # Optimize the current netlist.
# This will perform the retarget, propconst, sweep and bram_power_opt optimizations by default. # This will perform the retarget, propconst, sweep and bram_power_opt optimizations by default.
if [dict get $strategy "opt_design.is_enabled"] { if [dict get $strategy "opt_design.is_enabled"] {
set opt_dir [dict get $strategy "opt_design.directive"] set opt_dir [dict get $strategy "opt_design.directive"]
@@ -105,6 +105,12 @@ proc ::vivado_strategies::implement_design {strategy} {
phys_opt_design -directive $pp_physopt_dir phys_opt_design -directive $pp_physopt_dir
} }
# Option to run commands before route
if {[dict exist $strategy "route_design.pre_hook"]} {
set pre_route_cmds [dict get $strategy "route_design.pre_hook"]
eval $pre_route_cmds
}
# Route the current design # Route the current design
set rt_dir [dict get $strategy "route_design.directive"] set rt_dir [dict get $strategy "route_design.directive"]
puts "BUILDER: Choosing routing directive: $rt_dir" puts "BUILDER: Choosing routing directive: $rt_dir"
@@ -128,7 +134,7 @@ proc ::vivado_strategies::implement_design {strategy} {
# --------------------------------------------------- # ---------------------------------------------------
proc ::vivado_strategies::check_strategy {strategy} { proc ::vivado_strategies::check_strategy {strategy} {
variable g_viv_version variable g_viv_version
set strategy_options [dict keys $strategy] set strategy_options [dict keys $strategy]
set required_options {\ set required_options {\
opt_design.is_enabled \ opt_design.is_enabled \
@@ -142,7 +148,7 @@ proc ::vivado_strategies::check_strategy {strategy} {
post_route_phys_opt_design.is_enabled \ post_route_phys_opt_design.is_enabled \
post_route_phys_opt_design.directive \ post_route_phys_opt_design.directive \
} }
set invalid 0 set invalid 0
foreach req $required_options { foreach req $required_options {
if [expr [lsearch $strategy_options $req] < 0] { if [expr [lsearch $strategy_options $req] < 0] {