1 namespace eval Tools::Vivado {
6 description "AMD/Xilinx Vivado (and Vivado-Vitis classic + legacy PlanAhead) FPGA design suite."
7 ref_name {vivado vivado_vitis_classic planahead}
12 description "Create the project, replace it if already existing."
14 {ext_path.arg "" "Sets the absolute path for the external libraries."}
15 {lib.arg "" "Simulation library path, compiled or to be compiled"}
16 {vivado_only "If set, and project is vivado-vitis, vitis project will not be created."}
17 {vitis_only "If set, and project is vivado-vitis create only vitis project. If an xsa is not given, a pre-synth xsa will be created."}
18 {verbose "If set, launch the script in verbose mode"}
25 RegisterFlow SYNTHESIS {
26 aliases {synth synthesize}
27 stages {@CREATE Synthesize}
28 description "Run synthesis only, create the project if not existing."
30 {recreate "If set, the project will be re-created if it already exists."}
31 {check_syntax "If set, the HDL syntax will be checked at the beginning of the workflow."}
32 {njobs.arg 4 "Number of jobs."}
33 {no_reset "If set, runs (synthesis and implementation) won't be reset before launching them."}
37 RegisterFlow IMPLEMENTATION {
38 aliases {i impl implement}
39 description "Runs only the implementation, the project must already exist and be synthesised."
40 stages {@SYNTHESIS Implement}
42 {no_bitstream "If set, the bitstream file will not be produced."}
46 RegisterFlow WORKFLOW {
48 description "Runs the full workflow, creates the project if not existing."
50 {bitstream_only "If set, only the bitstream will be produced. This assumes implementation was already done. For a Vivado-Vitis\
51 project this command can be used to generate the boot artifacts including the ELF file(s) without running the\
52 full Vivado workflow."}
53 {synth_only "If set, only the synthesis will be performed."}
54 {impl_only "If set, only the implementation will be performed. This assumes synthesis was already done."}
56 stages {@IMPLEMENTATION GenerateBitstream}
60 RegisterStage Synthesize { description "Run the synthesis run." }
61 RegisterStage CreateProject { description "Create the Vivado project from the Top/ description." }
62 RegisterStage Implement { description "Run the implementation run." }
63 RegisterStage GenerateBitstream { description "Write the bitstream." }
67 source [
file join [
file dirname [
info script]] commands.tcl]
70 set script [Launcher::Get script]
71 puts "Launching vivado: \n vivado -nojournal -nolog -mode batch -notrace -source $script -tclargs {*}$::argv"
72 exec -ignorestderr vivado -nojournal -nolog -mode batch -notrace -source $script -tclargs {*}$::argv >@ stdout
77 set repo_path [Repo::Get repo_path]
78 set top_path [Repo::Get top_path]
81 set_msg_config -suppress -regexp -string {".*The IP file '.*' has been moved from its original location, as a result the outputs for this IP will now be \
82 generated in '.*'. Alternatively a copy of the IP can be imported into the project using one of the 'import_ip' or 'import_files' commands..*"}
83 set_msg_config -suppress -regexp -string {".*File '.*.xci' referenced by design '.*' could not be found..*"}
86 set_msg_config -suppress -id {IP_Flow 19-3664}
89 set_msg_config -suppress -id {Vivado 12-23660} -string {{ERROR: [Vivado 12-23660] Simulation is not supported for the target language VHDL when design \
90 contains NoC (Network-on-Chip) blocks} }
93 if {[
info exists env(HOG_EXTERNAL_PATH)]} {
94 CurrentProject::Set HOG_EXTERNAL_PATH $env(HOG_EXTERNAL_PATH)
96 CurrentProject::Set HOG_EXTERNAL_PATH ""
99 if {[CurrentProject::Exists project_name] == 0} {
104 set project_name [CurrentProject::Get project_name]
105 CurrentProject::Set project_file [
file normalize [
file join [CurrentProject::Get build_dir] [CurrentProject::Get project].xpr]]
106 CurrentProject::Set LIBERO_MANDATORY_VARIABLES {"FAMILY" "PACKAGE" "DIE" }
107 set proj_dir [
file normalize "${repo_path}/Top/${project_name}"]
110 if {[Launcher::GetOr options lib ""] != ""} {
112 CurrentProject::Set simlib_path "[Launcher::Get options lib]"
114 CurrentProject::Set simlib_path "${repo_path}/[Launcher::Get options lib]"
116 Msg Info "Simulation library path set to [CurrentProject::Get simlib_path]"
118 CurrentProject::Set simlib_path "${repo_path}/simlib"
119 Msg Info "Simulation library path set to default [CurrentProject::Get simlib_path]"
127 proc CreateProject {} {
130 CurrentProject::SaveJsonToFile [Repo::Get repo_path]/last_run.json 1
132 if {[
file exists [CurrentProject::Get project_file]] && [Launcher::GetOr options recreate 1] == 0} {
133 Msg Info "Project file found at [CurrentProject::Get project_file], opening project..."
135 OpenProject [CurrentProject::Get project_file] [Repo::Get repo_path]
141 Msg Info "Creating project with part: [CurrentProject::Get config main PART] at [CurrentProject::Get project_file]"
143 create_project -force [
file tail [CurrentProject::Get design]] [CurrentProject::Get build_dir] -part [CurrentProject::Get config main PART]
145 Msg Error "Failed to create project: $_err with options: $_opts"
146 Msg Warning "Failed to Create Project"
152 set obj [get_projects [
file tail [CurrentProject::Get design]]]
153 set_property "target_language" "VHDL" $obj
155 set_property "simulator_language" "Mixed" $obj
157 set_property "compxlib.${simulator}_compiled_library_dir" [CurrentProject::Get simlib_path] $obj
159 set_property "default_lib" "xil_defaultlib" $obj
161 set_param project.enableVHDL2008 1
162 set_property "enable_vhdl_2008" 1 $obj
164 set_property source_mgmt_mode All [current_project]
166 Msg Info "Setting PART = [CurrentProject::Get config main PART]"
167 set_property PART [CurrentProject::Get config main PART] [current_project]
171 Msg Info "Project created at [CurrentProject::Get project_file]"
173 Msg Info "Project files added to [CurrentProject::Get project_file]"
180 proc ConfigureProperties {} {
183 Msg Info "Setting project-wide properties..."
184 set proj_props [CurrentProject::Get config main]
185 dict for {prop_name prop_val} $proj_props {
186 if {[string tolower $prop_name] != "ip_repo_paths"} {
187 if {[string tolower $prop_name] != "part"} {
188 # Part is already set
189 Msg Debug "Setting $prop_name = $prop_val"
190 set_property -name $prop_name -value $prop_val -objects [current_project]
193 set ip_repo_list [regsub -all {\s+} $prop_val " [Repo::Get repo_path]/"]
194 set ip_repo_list [Repo::Get repo_path]/$ip_repo_list
196 Msg Info "Setting $ip_repo_list as user IP repository..."
198 set_property ip_repo_paths "$ip_repo_list" [current_fileset]
200 set_property ip_repo_paths "$ip_repo_list" [current_project]
207 foreach run [get_runs -quiet] {
208 if {[CurrentProject::Exists config $run]} {
209 Msg Info "Setting properties for run: $run..."
210 set run_props [CurrentProject::Get config $run]
211 set stragety_str "STRATEGY strategy Strategy"
212 Msg Debug "Setting Strategy and Flow for run $run (if specified in hog.conf)"
213 foreach s $stragety_str {
214 if {[tdict exists $run_props $s]} {
215 set prop [tdict getval $run_props $s]
216 set_property -name $s -value $prop -objects $run
217 set run_props [tdict remove $run_props $s]
218 Msg Warning "A strategy for run $run has been defined inside hog.conf. This prevents Hog to compare the project properties. \
219 Please regenerate your hog.conf file using the dedicated Hog button."
220 Msg Info "Setting $s = $prop"
224 dict for {prop_name prop_val} $run_props {
225 Msg Debug "Setting $prop_name = $prop_val"
226 if {[string trim $prop_val] == ""} {
227 Msg Warning "Property $prop_name has empty value. Skipping..."
230 if {[IsInList [string toupper $prop_name] [VIVADO_PATH_PROPERTIES] 1]} {
231 # Check that the file exists before setting these properties
232 set utility_file [Repo::Get repo_path]/$prop_val
233 if {[file exists $utility_file]} {
234 lassign [GetHogFiles -ext_path [CurrentProject::Get HOG_EXTERNAL_PATH] [CurrentProject::Get list_path] [Repo::Get repo_path]] lib prop dummy
237 lappend hog_files $ff:
240 if {[lsearch $hog_files $utility_file] < 0} {
241 Msg CriticalWarning "The file: $utility_file is set as a property in hog.conf, \
242 but is not added to the project in any list file. Hog cannot track it."
244 #Add file tu utils_1 to avoid warning
245 AddFile [Repo::Get repo_path]/$prop_val [get_filesets -quiet utils_1]
247 set_property -name $prop_name -value $utility_file -objects $run
249 Msg Warning "Impossible to set property $prop_name to $prop_val. File is missing"
252 set_property -name $prop_name -value $prop_val -objects $run
260 proc AddProjectFiles {} {
262 Msg Info "Project not open; run CreateProject first..."
265 if {[get_filesets -quiet sources_1] eq ""} { create_fileset -srcset sources_1}
266 if {[get_filesets -quiet constrs_1] eq ""} { create_fileset -constrset constrs_1}
269 tlist foreachval fs [CurrentProject::Get filesets] {
270 if {$fs in {sources_1 constrs_1}} { continue }
271 if {[get_filesets -quiet $fs] eq ""} {
272 create_fileset -simset $fs
273 current_fileset -simset [get_filesets $fs]
274 set sim [get_filesets $fs]
275 foreach simulator [GetSimulators] {
276 set_property -name "$simulator.compile.vhdl_syntax" -value 2008 -objects $sim
278 set_property SOURCE_SET sources_1 $sim
286 Msg Info "Modifying Added Files"
287 tlist foreachval fs [CurrentProject::Get filesets] {
288 # Get all files for this fileset, excluding Vitis app libraries.
289 set all_fs [Projects::GetProjectFiles $proj_ds -fileset "^${fs}$" -as tdict]
290 set all_fs [ListFile::HogFileObj::Filter $all_fs -library {^(?!app_)}]
292 if {[llength [tdict keys $all_fs]] == 0} { continue }
294 # Batch-add paths: regular sources first, IPs last (tool dependency order).
295 set regular [ListFile::HogFileObj::Filter $all_fs -library {^(?!ips\.src$)}]
296 set ip_files [ListFile::HogFileObj::Filter $all_fs -library {^ips\.src$}]
297 puts "Adding [llength [tdict keys $all_fs]] files and [llength [tdict keys $ip_files]] IPs to fileset $fs"
298 add_files -norecurse -fileset $fs [concat [tdict keys $regular] [tdict keys $ip_files]]
301 # Apply per-file properties.
302 tdict for {path fobj} $all_fs {
303 set ext [tdict getval $fobj ext]
304 set lib [tlist getval [tdict get $fobj libraries] 0]
305 set rootlib [file rootname [file tail $lib]]
306 set file_obj [get_files -of_objects [get_filesets $fs] [list "*$path"]]
308 if {$ext in {.vhd .vhdl}} {
309 set_property -name library -value $rootlib -objects $file_obj
313 Msg Info "Generating Target for [file tail $path]"
314 generate_target all [get_files $path]
317 tdict for {key val} [tdict get $fobj props] {
321 if {$ext in {.vhd .vhdl}} {
323 93 { Msg Debug "VHDL 93 for $path" }
325 if {[GetIDEVersion] >= 2023.2} {
326 set_property -name file_type -value "VHDL 2019" -objects $file_obj
328 Msg CriticalWarning "VHDL 2019 requires Vivado >= 2023.2; using 2008 for $path"
329 set_property -name file_type -value "VHDL 2008" -objects $file_obj
332 default { set_property -name file_type -value "VHDL 2008" -objects $file_obj }
336 SystemVerilog { set_property -name file_type -value SystemVerilog -objects $file_obj }
337 verilog_header { set_property file_type {Verilog Header} [get_files $path] }
338 verilog_template { set_property file_type {Verilog Template} [get_files $path] }
339 verilog { set_property file_type Verilog [get_files $path] }
340 nosynth { set_property -name used_in_synthesis -value false -objects $file_obj }
341 noimpl { set_property -name used_in_implementation -value false -objects $file_obj }
342 nosim { set_property -name used_in_simulation -value false -objects $file_obj }
344 Msg Info "Setting $v as top module for fileset $fs"
345 CurrentProject::Set synth_top_module $v
349 Msg Info "Locking IP $path"
350 set_property IS_MANAGED 0 [get_files $path]
354 if {$ext eq ".tcl"} {
355 Msg Info "Sourcing $path (excluded from synth/impl/sim)"
357 set_property -name used_in_synthesis -value false -objects $file_obj
358 set_property -name used_in_implementation -value false -objects $file_obj
359 set_property -name used_in_simulation -value false -objects $file_obj
362 scoped_to_ref { set_property SCOPED_TO_REF $v $file_obj }
363 scoped_to_cells { set_property SCOPED_TO_CELLS $v $file_obj }
364 topsim { Msg Warning "topsim is deprecated; use sim.conf top=$v" }
365 runtime { Msg Warning "runtime is deprecated; use sim.conf <sim>.simulate.runtime=$v" }
366 wavefile { Msg Warning "wavefile is deprecated; use sim.conf <sim>.simulate.custom_wave_do=$v" }
367 dofile { Msg Warning "dofile is deprecated; use sim.conf <sim>.simulate.custom_do=$v" }
373 if {[get_filesets -quiet sim_1] ne "" \
374 && [
llength [get_files -quiet -of_objects [get_filesets sim_1]]] == 0} {
375 delete_fileset -quiet [get_filesets sim_1]
386 proc ConfigureSynthesis {} {
388 if {[
string equal [get_runs -quiet synth_1] ""]} {
389 puts "create_run -name synth_1 -part [CurrentProject::Get config main PART] -constrset constrs_1"
390 create_run -name synth_1 -part [CurrentProject::Get config main PART] -constrset constrs_1
393 set obj [get_runs synth_1]
394 set_property "part" [CurrentProject::Get config main PART] $obj
397 if {[Repo::Get pre_synth] ne ""} {
399 if {[get_filesets -quiet utils_1] != ""} {
400 AddFile [ Repo::Get pre_synth] [get_filesets -quiet utils_1]
402 set_property STEPS.SYNTH_DESIGN.TCL.PRE [ Repo::Get pre_synth] $obj
404 Msg Debug "Setting [ Repo::Get pre_synth] to be run before synthesis"
408 if {[Repo::Get post_synth] ne ""} {
410 if {[get_filesets -quiet utils_1] != ""} {
411 AddFile [ Repo::Get post_synth] [get_filesets -quiet utils_1]
413 set_property STEPS.SYNTH_DESIGN.TCL.POST [ Repo::Get post_synth] $obj
415 Msg Debug "Setting [ Repo::Get post_synth] to be run after synthesis"
421 current_run -synthesis $obj
424 if {[
string equal [get_property -quiet report_strategy $obj] ""]} {
426 Msg Debug "No report strategy needed for synthesis"
429 set_property set_report_strategy_name 1 $obj
430 set_property report_strategy {Vivado Synthesis Default Reports} $obj
431 set_property set_report_strategy_name 0 $obj
433 if {[
string equal [get_report_configs -of_objects [get_runs synth_1] synth_1_synth_report_utilization_0] ""]} {
434 create_report_config -report_name synth_1_synth_report_utilization_0 -report_type report_utilization:1.0 -steps synth_design -runs synth_1
436 set reports [get_report_configs -of_objects [get_runs synth_1] synth_1_synth_report_utilization_0]
445 proc ConfigureImplementation {} {
447 if {[
string equal [get_runs -quiet impl_1] ""]} {
448 puts "create_run -name impl_1 -part [ CurrentProject::Get config main PART] -constrset constrs_1 -parent_run synth_1"
449 create_run -name impl_1 -part [ CurrentProject::Get config main PART] -constrset constrs_1 -parent_run synth_1
452 set obj [get_runs impl_1]
453 set_property "part" [ CurrentProject::Get config main PART] $obj
455 set_property "steps.[
BinaryStepName [ CurrentProject::Get config main PART]].args.readback_file" "0" $obj
456 set_property "steps.[
BinaryStepName [ CurrentProject::Get config main PART]].args.verbose" "0" $obj
459 if {[ Repo::Get pre_impl] ne ""} {
461 if {[get_filesets -quiet utils_1] != ""} {
462 AddFile [ Repo::Get pre_impl] [get_filesets -quiet utils_1]
464 set_property STEPS.INIT_DESIGN.TCL.POST [ Repo::Get pre_impl] $obj
466 Msg Debug "Setting [ Repo::Get pre_impl] to be run after implementation"
471 if {[ Repo::Get post_impl] ne ""} {
474 if {[get_filesets -quiet utils_1] != ""} {
475 AddFile [ Repo::Get post_impl] [get_filesets -quiet utils_1]
477 set_property STEPS.ROUTE_DESIGN.TCL.POST [ Repo::Get post_impl] $obj
479 Msg Debug "Setting [ Repo::Get post_impl] to be run after implementation"
483 if {[ Repo::Get pre_bit] ne ""} {
486 if {[get_filesets -quiet utils_1] != ""} {
487 AddFile [ Repo::Get pre_bit] [get_filesets -quiet utils_1]
489 set_property STEPS.[
BinaryStepName [ CurrentProject::Get config main PART]].TCL.PRE [ Repo::Get pre_bit] $obj
491 Msg Debug "Setting [ Repo::Get pre_bit] to be run before bitfile generation"
495 if {[ Repo::Get post_bit] ne ""} {
497 if {[get_filesets -quiet utils_1] != ""} {
498 AddFile [ Repo::Get post_bit] [get_filesets -quiet utils_1]
500 set_property STEPS.[
BinaryStepName [ CurrentProject::Get config main PART]].TCL.POST [ Repo::Get post_bit] $obj
502 Msg Debug "Setting [ Repo::Get post_bit] to be run after bitfile generation"
510 proc ConfigureSimulation {} {
511 set simsets_dict [
GetSimSets "[CurrentProject::Get group_name]/[CurrentProject::Get design]" [Repo::Get repo_path]]
516 Msg Debug "Setting load_glbl parameter to true for every fileset..."
517 foreach simset [get_filesets -quiet] {
518 if {[get_property FILESET_TYPE $simset] != "SimulationSrcs"} {
522 set_property -name {xsim.elaborate.load_glbl} -value {true} -objects [get_filesets $simset]
525 set sim_dict [
DictGet $simsets_dict $simset]
526 set sim_props [
DictGet $sim_dict "properties"]
528 if {$sim_props != ""} {
529 Msg Info "Setting properties for simulation set: $simset..."
530 dict for {prop_name prop_val} $sim_props {
531 set prop_name [string toupper $prop_name]
532 if {$prop_name == "ACTIVE" && $prop_val == 1} {
533 Msg Info "Setting $simset as active simulation set..."
534 current_fileset -simset [get_filesets $simset]
536 Msg Debug "Setting $prop_name = $prop_val"
537 if {[IsInList [string toupper $prop_name] [VIVADO_PATH_PROPERTIES] 1]} {
538 # Check that the file exists before setting these properties
539 if {[file exists [Repo::Get repo_path]/$prop_val]} {
540 set_property -name $prop_name -value [Repo::Get repo_path]/$prop_val -objects [get_filesets $simset]
542 Msg Warning "Impossible to set property $prop_name to $prop_val. File is missing"
545 set_property -name $prop_name -value $prop_val -objects [get_filesets $simset]
555 proc ConfigureProperties {} {
557 cd [Repo::Get repo_path]
560 if {[CurrentProject::Exists PROPERTIES]} {
561 if {[dict exists [ CurrentProject::Get PROPERTIES] main]} {
562 Msg Info "Setting project-wide properties..."
563 set proj_props [dict get [ CurrentProject::Get PROPERTIES] main]
564 dict for {prop_name prop_val} $proj_props {
565 if {[string tolower $prop_name] != "ip_repo_paths"} {
566 if {[string tolower $prop_name] != "part"} {
567 # Part is already set
568 Msg Debug "Setting $prop_name = $prop_val"
569 set_property -name $prop_name -value $prop_val -objects [current_project]
572 set ip_repo_list [regsub -all {\s+} $prop_val " [Repo::Get repo_path]/"]
573 set ip_repo_list [Repo::Get repo_path]/$ip_repo_list
575 Msg Info "Setting $ip_repo_list as user IP repository..."
577 set_property ip_repo_paths "$ip_repo_list" [current_fileset]
579 set_property ip_repo_paths "$ip_repo_list" [current_project]
586 foreach run [get_runs -quiet] {
587 if {[CurrentProject::Exists config $run]} {
588 Msg Info "Setting properties for run: $run..."
589 set run_props [dict get [ CurrentProject::Get config] $run]
591 set stragety_str "STRATEGY strategy Strategy"
592 Msg Debug "Setting Strategy and Flow for run $run (if specified in hog.conf)"
593 foreach s $stragety_str {
594 if {[dict exists $run_props $s]} {
595 set prop [dict get $run_props $s]
596 set_property -name $s -value $prop -objects $run
597 set run_props [dict remove $run_props $s]
598 Msg Warning "A strategy for run $run has been defined inside hog.conf. This prevents Hog to compare the project properties. \
599 Please regenerate your hog.conf file using the dedicated Hog button."
600 Msg Info "Setting $s = $prop"
604 dict for {prop_name prop_val} $run_props {
605 Msg Debug "Setting $prop_name = $prop_val"
606 if {[string trim $prop_val] == ""} {
607 Msg Warning "Property $prop_name has empty value. Skipping..."
610 if {[IsInList [string toupper $prop_name] [VIVADO_PATH_PROPERTIES] 1]} {
611 # Check that the file exists before setting these properties
612 set utility_file [Repo::Get repo_path]/$prop_val
613 if {[file exists $utility_file]} {
614 lassign [GetHogFiles -ext_path [CurrentProject::Get config HOG_EXTERNAL_PATH] [Repo::Get list_path] [Repo::Get repo_path]] lib prop dummy
617 lappend hog_files $ff
620 if {[lsearch $hog_files $utility_file] < 0} {
621 Msg CriticalWarning "The file: $utility_file is set as a property in hog.conf, \
622 but is not added to the project in any list file. Hog cannot track it."
624 #Add file tu utils_1 to avoid warning
625 AddFile [Repo::Get repo_path]/$prop_val [get_filesets -quiet utils_1]
627 set_property -name $prop_name -value $utility_file -objects $run
629 Msg Warning "Impossible to set property $prop_name to $prop_val. File is missing"
632 set_property -name $prop_name -value $prop_val -objects $run
644 set no_reset [Launcher::Get options no_reset]
645 set do_create [Launcher::Get options recreate]
646 set njobs [Launcher::Get options njobs]
647 set project [CurrentProject::Get project]
648 set project_name [CurrentProject::Get project_name]
649 set repo_path [Repo::Get repo_path]
650 set build_dir [CurrentProject::Get build_dir]
651 set run_folder "$build_dir/$project.runs/"
653 if {$no_reset == 0} {
654 Msg Info "Resetting run before launching synthesis..."
658 set prog [get_property PROGRESS [get_runs synth_1]]
659 set status [get_property STATUS [get_runs synth_1]]
660 if {$prog eq "100%"} {
661 Msg Info "Run: synth_1 progress: $prog, status : $status"
662 Msg Info "Synthesis already completed, skipping synthesis step..."
668 source [CurrentProject::Get config pre_synth]
671 launch_runs synth_1 -jobs $njobs -dir $run_folder
673 set prog [get_property PROGRESS [get_runs synth_1]]
674 set status [get_property STATUS [get_runs synth_1]]
675 Msg Info "Run: synth_1 progress: $prog, status : $status"
682 set describe [
GetHogDescribe [
file normalize ./Top/$project_name] $repo_path]
683 Msg Info "Git describe set to $describe"
686 set xci_file [get_property IP_FILE $ip]
688 set xci_path [
file dirname $xci_file]
689 set xci_ip_name [
file rootname [
file tail $xci_file]]
690 foreach rptfile [glob -nocomplain -directory $xci_path *.rpt] {
691 file copy $rptfile $repo_path/bin/$project_name-$describe/reports
695 if {$prog ne "100%"} {
696 Msg Error "Synthesis error, status is: $status"
704 Msg Info "Starting implementation flow..."
706 set no_reset [Launcher::Get options no_reset]
707 set do_create [Launcher::Get options recreate]
708 set njobs [Launcher::Get options njobs]
709 set no_bitstream [Launcher::Get options no_bitstream]
710 set project [CurrentProject::Get project]
711 set project_name [CurrentProject::Get project_name]
712 set repo_path [Repo::Get repo_path]
713 set build_dir [CurrentProject::Get build_dir]
714 set run_folder "$build_dir/$project.runs/"
718 if {$no_reset == 0} {
719 Msg Info "Resetting run before launching implementation..."
723 set prog [get_property PROGRESS [get_runs impl_1]]
724 set status [get_property STATUS [get_runs impl_1]]
725 if {$prog eq "100%" } {
726 Msg Info "Run: impl_1 progress: $prog, status : $status"
727 Msg Info "Implementation already completed, skipping implementation step..."
734 source $repo_path/Hog/Tcl/integrated/pre-implementation.tcl
737 if {$no_bitstream == 0} {
738 launch_runs impl_1 -to_step [
BinaryStepName [get_property PART [current_project]]] -jobs $njobs -dir $run_folder
740 launch_runs impl_1 -jobs $njobs -dir $run_folder
745 Msg Info "running post-implementation"
746 source $repo_path/Hog/Tcl/integrated/post-implementation.tcl
747 if {$no_bitstream == 0} {
748 Msg Info "running pre-bitstream"
749 source $repo_path/Hog/Tcl/integrated/pre-bitstream.tcl
750 Msg Info "running post-bitstream"
751 source $repo_path/Hog/Tcl/integrated/post-bitstream.tcl
755 set prog [get_property PROGRESS [get_runs impl_1]]
756 set status [get_property STATUS [get_runs impl_1]]
757 Msg Info "Run: impl_1 progress: $prog, status : $status"
761 set status_file [open "$run_folder/timing.txt" "w"]
762 puts $status_file "## $project_name Timing summary"
764 set f [open [
lindex [glob "$run_folder/impl_1/*.twr" 0]]]
766 while {[
gets $f line] >= 0} {
767 if {[
string match "Timing summary:" $line]} {
768 while {[
gets $f line] >= 0} {
769 if {[
string match "Timing errors:*" $line]} {
770 set errs [regexp -inline -- {[0-9]+} $line]
772 if {[
string match "*Footnotes*" $line]} {
775 puts $status_file "$line"
784 Msg Info "Time requirements are met"
785 file rename -force "$run_folder/timing.txt" "$run_folder/timing_ok.txt"
788 Msg CriticalWarning "Time requirements are NOT met"
789 file rename -force "$run_folder/timing.txt" "$run_folder/timing_error.txt"
795 set wns [get_property STATS.WNS [get_runs [current_run]]]
796 set tns [get_property STATS.TNS [get_runs [current_run]]]
797 set whs [get_property STATS.WHS [get_runs [current_run]]]
798 set ths [get_property STATS.THS [get_runs [current_run]]]
799 set tpws [get_property STATS.TPWS [get_runs [current_run]]]
801 if {$wns >= 0 && $whs >= 0 && $tpws >= 0} {
802 Msg Info "Time requirements are met"
803 set status_file [open "$run_folder/timing_ok.txt" "w"]
806 Msg CriticalWarning "Time requirements are NOT met"
807 set status_file [open "$run_folder/timing_error.txt" "w"]
811 Msg Status "*** Timing summary ***"
812 Msg Status "WNS: $wns"
813 Msg Status "TNS: $tns"
814 Msg Status "WHS: $whs"
815 Msg Status "THS: $ths"
816 Msg Status "TPWS: $tpws"
822 puts $status_file "## $project_name Timing summary"
824 m add row "| **Parameter** | \"**value (ns)**\" |"
825 m add row "| --- | --- |"
826 m add row "| WNS: | $wns |"
827 m add row "| TNS: | $tns |"
828 m add row "| WHS: | $whs |"
829 m add row "| THS: | $ths |"
830 m add row "| TPWS: | $tpws |"
832 puts $status_file [m format 2string]
833 puts $status_file "\n"
834 if {$timing_ok == 1} {
835 puts $status_file " Time requirements are met."
837 puts $status_file "Time requirements are **NOT** met."
839 puts $status_file "\n\n"
843 if {$prog ne "100%"} {
844 Msg Error "Implementation error"
849 set describe [
GetHogDescribe [
file normalize ./Top/$project_name] $repo_path]
850 Msg Info "Git describe set to $describe"
852 set dst_dir [
file normalize "$repo_path/bin/$project_name\-$describe"]
857 if {[
file exists $run_folder/versions.txt]} {
858 file copy -force $run_folder/versions.txt $dst_dir
860 Msg Warning "No versions file found in $run_folder/versions.txt"
863 set timing_files [glob -nocomplain "$run_folder/timing_*.txt"]
864 set timing_file [
file normalize [
lindex $timing_files 0]]
866 if {[
file exists $timing_file]} {
867 file copy -force $timing_file $dst_dir/
869 Msg Warning "No timing file found, not a problem if running locally"
873 if {[
IsVersal [get_property part [current_project]]]} {
874 if {[get_property segmented_configuration [current_project]] == 1} {
875 Msg Info "Versal Segmented configuration detected: exporting XSA file..."
876 set xsa_name "$dst_dir/[
file tail $project_name]\-$describe.xsa"
877 write_hw_platform -fixed -force -file $xsa_name
883 proc GenerateBitstream {} {
884 Msg Info "Generating bitstream..."
886 puts "Current Flow state:"
887 puts "[tobj tojson $FlowControl::_state -pretty]"
895 Msg Info "Running post-synthesis simulation..."
897 Msg Info "Running post-implementation simulation..."
899 Msg Info "Running RTL simulation..."
905 proc CheckSyntax {} {
906 Msg Info "Checking syntax..."
909 proc RtlAnalysis {} {
910 Msg Info "Running RTL analysis..."