Hog v9.67.0
launch.tcl
Go to the documentation of this file.
1 #!/usr/bin/env tclsh
2 # @file
3 # Copyright 2018-2025 The University of Birmingham
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 
17 
18 # Launch Xilinx Vivado or ISE implementation and possibly write bitstream in text mode
19 
20 
21 
22 set default_commands {
23 
24  \^L(IST)?$ {
25  Msg Status "\n** The projects in this repository are:"
26  ListProjects $repo_path $list_all
27  Msg Status "\n"
28  exit 0
29  # NAME*: LIST or L
30  # DESCRIPTION: List the projects in the repository. To show hidden projects use the -all option
31  # OPTIONS: all, verbose
32  }
33 
34  \^H(ELP)?$ {
35  puts "$usage"
36  exit 0
37  # NAME: HELP or H
38  # DESCRIPTION: Display this help message or specific help for each directive
39  # OPTIONS:
40  }
41 
42  \^C(REATE)?$ {#
43  set do_create 1
44  set recreate 1
45  # NAME*: CREATE or C
46  # DESCRIPTION: Create the project, replace it if already existing.
47  # OPTIONS: ext_path.arg, lib.arg, vivado_only, verbose
48  }
49 
50  \^I(MPL(EMENT(ATION)?)?)?$ {#
51  set do_implementation 1
52  set do_bitstream 1
53  set do_compile 1
54  # NAME: IMPLEMENTATION or I
55  # DESCRIPTION: Runs only the implementation, the project must already exist and be synthesised.
56  # OPTIONS: check_syntax, ext_path.arg, njobs.arg, no_bitstream, no_reset, recreate, verbose
57  }
58 
59  \^SYNT(H(ESIS(E)?)?)? {#
60  set do_synthesis 1
61  set do_compile 1
62  # NAME: SYNTH
63  # DESCRIPTION: Run synthesis only, create the project if not existing.
64  # OPTIONS: check_syntax, ext_path.arg, njobs.arg, recreate, verbose
65  }
66 
67  \^S(IM(ULAT(ION|E)?)?)?$ {#
68  set do_simulation 1
69  set do_create 1
70  # NAME*: SIMULATION or S
71  # DESCRIPTION: Simulate the project, creating it if not existing, unless it is a GHDL simulation.
72  # OPTIONS: check_syntax, compile_only, ext_path.arg, lib.arg, recreate, scripts_only, simset.arg, verbose
73  }
74 
75  \^W(ORK(FLOW)?)?$ {#
76  set do_implementation 1
77  set do_synthesis 1
78  set do_bitstream 1
79  set do_compile 1
80  set do_vitis_build 0
81  # NAME*: WORKFLOW or W
82  # DESCRIPTION: Runs the full workflow, creates the project if not existing.
83  # OPTIONS: check_syntax, ext_path.arg, impl_only, bitstream_only, njobs.arg, no_bitstream, recreate, synth_only, vitis_only, xsa.arg verbose
84  }
85 
86  \^(CREATEWORKFLOW|CW)?$ {#
87  set do_implementation 1
88  set do_synthesis 1
89  set do_bitstream 1
90  set do_compile 1
91  set recreate 1
92  set do_vitis_build 1
93  # NAME: CREATEWORKFLOW or CW
94  # DESCRIPTION: Creates the project -even if existing- and launches the complete workflow.
95  # OPTIONS: check_syntax, ext_path.arg, njobs.arg, no_bitstream, synth_only, vivado_only, vitis_only, xsa.arg verbose
96  }
97 
98  \^(CHECKSYNTAX|CS)?$ {#proj
99  set do_check_syntax 1
100  # NAME: CECHSYNTAX or CS
101  # DESCRIPTION: Check the syntax of the project. Only for Vivado, Quartus and Libero projects.
102  # OPTIONS: ext_path.arg, recreate, verbose
103  }
104 
105  \^X(ML)?$ {#proj
106  set do_ipbus_xml 1
107  # NAME: XML or X
108  # DESCRIPTION: Copy, check or create the IPbus XMLs for the project.
109  # OPTIONS: dst_dir.arg, generate, verbose
110  }
111 
112  \^V(IEW)?$ {#proj
113  set do_list_file_parse 1
114  # NAME*: VIEW or V
115  # DESCRIPTION: Print Hog list file contents in a tree-like fashon.
116  # OPTIONS: verbose
117  }
118 
119  \^(CHECKYAML|YML)?$ {
120  set min_n_of_args -1
121  set max_n_of_args 1
122  set do_check_yaml_ref 1
123  # NAME: CHECKYML or YML
124  # DESCRIPTION: Check that the ref to Hog repository in the .gitlab-ci.yml file, matches the one in Hog submodule.
125  # OPTIONS: verbose
126  }
127 
128  \^B(UTTONS)?$ {
129  set min_n_of_args -1
130  set max_n_of_args 1
131  set do_buttons 1
132  # NAME: BUTTONS or B
133  # DESCRIPTION: Add Hog buttons to the Vivado GUI, to check and recreate Hog list and configuration files.
134  # OPTIONS: verbose
135  }
136 
137  \^(CHECKLIST|CL)?$ {#proj
138  set do_check_list_files 1
139  # NAME: CHECKLIST or CL
140  # DESCRIPTION: Check that list and configuration files on disk match what is on the project.
141  # OPTIONS: ext_path.arg, verbose
142  }
143 
144  \^COMPSIM(LIB)?$ {
145  set do_compile_lib 1
146  set argument_is_no_project 1
147  # NAME: COMPSIMLIB or COMPSIM
148  # DESCRIPTION: Compiles the simulation library for the chosen simulator with Vivado.
149  # OPTIONS: dst_dir.arg, verbose
150  }
151 
152  \^RTL(ANALYSIS)?$ {#
153  set do_rtl 1
154  # NAME: RTL or RTLANALYSIS
155  # DESCRIPTION: Elaborate the RTL analysis report for the chosen project.
156  # OPTIONS: check_syntax, recreate, verbose
157  }
158 
159  \^SIG(ASI)?$ {#
160  set do_sigasi 1
161  # NAME: SIGASI or SIG
162  # DESCRIPTION: Create a .csv file to be used in Sigasi.
163  # OPTIONS: verbose
164  }
165 
166  default {
167  if {$directive != ""} {
168  Msg Status "ERROR: Unknown directive $directive.\n\n"
169  puts $usage
170  exit 1
171  } else {
172  puts "$usage"
173  exit 0
174  }
175  }
176 }
177 
178 # Add this bit above!
179 # \^NEW_DIRECTIVE?$ {
180 # set do_new_directive 1
181 # }
182 
183 
184 #parsing command options
185 set parameters {
186  {no_bitstream "If set, the bitstream file will not be produced."}
187  {recreate "If set, the project will be re-created if it already exists."}
188  {no_reset "If set, runs (synthesis and implementation) won't be reset before launching them."}
189  {check_syntax "If set, the HDL syntax will be checked at the beginning of the workflow."}
190  {njobs.arg 4 "Number of jobs. Default: 4"}
191  {ext_path.arg "" "Sets the absolute path for the external libraries."}
192  {lib.arg "" "Simulation library path, compiled or to be compiled"}
193  {synth_only "If set, only the synthesis will be performed."}
194  {impl_only "If set, only the implementation will be performed. This assumes synthesis was already done."}
195  {scripts_only "If set, the simulation scripts will be generated, but the simulation will not be run."}
196  {compile_only "If set, the simulation libraries will be compiled, but not run."}
197  {bitstream_only "If set, only the bitstream will be produced. This assumes implementation was already done. For a Vivado-Vitis\
198  project this command can be used to generate the boot artifacts including the ELF file(s) without running the\
199  full Vivado workflow."}
200  {vivado_only "If set, and project is vivado-vitis, vitis project will not be created."}
201  {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."}
202  {xsa.arg "" "If set, and project is vivado-vitis, use this xsa for creating platforms without a defined hw."}
203  {simset.arg "" "Simulation sets, separated by commas, to be run."}
204  {all "List all projects, including test projects. Test projects have #test on the second line of hog.conf."}
205  {generate "For IPbus XMLs, it will re create the VHDL address decode files."}
206  {dst_dir.arg "" "For reports, IPbus XMLs, set the destination folder (default is in the ./bin folder)."}
207  {verbose "If set, launch the script in verbose mode"}
208 }
209 
210 set tcl_path [file normalize "[file dirname [info script]]"]
211 source $tcl_path/hog.tcl
212 source $tcl_path/create_project.tcl
213 
214 # Quartus needs extra packages and treats the argv in a different way
215 if {[IsQuartus]} {
216  load_package report
217  set argv $quartus(args)
218 }
219 
220 # Msg Debug "s: $::argv0 a: $argv"
221 
222 set commands_path [file normalize "$tcl_path/../../hog-commands/"]
223 ### CUSTOM COMMANDS ###
224 set custom_commands [GetCustomCommands $commands_path 1]
225 set custom_usage [GetCustomCommands $commands_path]
226 # append usage "\n** Options:"
227 
228 lassign [InitLauncher $::argv0 $tcl_path $parameters $default_commands $argv $custom_usage] \
229 directive project project_name group_name repo_path old_path bin_dir top_path usage short_usage cmd ide list_of_options
230 
231 array set options $list_of_options
232 Msg Debug "Returned by InitLauncher: \
233 $project $project_name $group_name $repo_path $old_path $bin_dir $top_path $cmd"
234 
235 set ext_path ""
236 if {$options(ext_path) != ""} {
237  set ext_path $options(ext_path)
238 }
239 set simlib_path ""
240 
241 
242 if {$options(verbose) == 1} {
243  setDebugMode 1
244 }
245 # printDebugMode
246 # Msg Info "Number of jobs set to $options(njobs)."
247 
248 
249 
250 ######## DEFAULTS #########
251 set do_rtl 0
252 set do_implementation 0; set do_synthesis 0; set do_bitstream 0
253 set do_create 0; set do_compile 0; set do_simulation 0; set recreate 0
254 set do_reset 1; set do_list_all 2; set do_check_syntax 0; set do_vitis_build 0;
255 set scripts_only 0; set compile_only 0
256 ### Hog stand-alone directives ###
257 # The following directives are used WITHOUT ever calling the IDE, they are run in tclsh
258 # A place holder called new_directive can be followed to add new commands
259 
260 set do_ipbus_xml 0
261 set do_list_file_parse 0
262 set do_check_yaml_ref 0
263 set do_buttons 0
264 set do_check_list_files 0
265 set do_compile_lib 0
266 set do_sigasi 0
267 
268 Msg Debug "Looking for a $directive in : $default_commands $custom_commands"
269 switch -regexp -- $directive "$default_commands $custom_commands"
270 
271 if {$options(all) == 1} {
272  set do_list_all 1
273 } else {
274  set do_list_all 2
275 }
276 
277 if {$options(dst_dir) == "" && ($do_ipbus_xml == 1 || $do_check_list_files == 1) && $project != ""} {
278  # Getting all the versions and SHAs of the repository
279  lassign [GetRepoVersions [file normalize $repo_path/Top/$group_name/$project] \
280  $repo_path $ext_path] commit version hog_hash hog_ver top_hash top_ver libs hashes vers \
281  cons_ver cons_hash ext_names ext_hashes xml_hash xml_ver user_ip_repos \
282  user_ip_hashes user_ip_vers
283  cd $repo_path
284 
285  set describe [GetHogDescribe $commit $repo_path]
286  set dst_dir [file normalize "$repo_path/bin/$group_name/$project\-$describe"]
287 }
288 
289 if {$cmd == -1} {
290  #This is if the project was not found
291  Msg Status "\n\nPossible projects are:"
292  ListProjects $repo_path $do_list_all
293  Msg Status "\n"
294  exit 1
295 } elseif {$cmd == -2} {
296  # Project not given but needed
297  Msg Status "ERROR: You must specify a project with directive $directive."
298  # \n\n[cmdline::usage $parameters $usage]"
299  Msg Status "Possible projects are:"
300  ListProjects $repo_path $do_list_all
301  exit 1
302 } elseif {$cmd == 0} {
303  #This script was launched within the IDE,: Vivado, Quartus, etc
304  Msg Info "$::argv0 was launched from the IDE."
305 } else {
306  # This script was launched with Tclsh, we need to check the arguments
307  # and if everything is right launch the IDE on this script and return
308 
309 
310 
311 
312  #### Directives to be handled in tclsh should be here ###
313  ### IMPORTANT: Each if block should either end with "exit 0" or
314  ### set both $ide and $cmd to be executed when this script is run again
315 
316  if {$do_ipbus_xml == 1} {
317  Msg Info "Handling IPbus XMLs for $project_name..."
318 
319  set proj_dir $repo_path/Top/$project_name
320 
321  if {$options(generate) == 1} {
322  set xml_gen 1
323  } else {
324  set xml_gen 0
325  }
326 
327 
328  set xml_dst "$dst_dir/xml"
329 
330 
331  if {[llength [glob -nocomplain $proj_dir/list/*.ipb]] > 0} {
332  if {![file exists $xml_dst]} {
333  Msg Info "$xml_dst directory not found, creating it..."
334  file mkdir $xml_dst
335  }
336  } else {
337  Msg Error "No .ipb files found in $proj_dir/list/"
338  exit
339  }
340 
341  set ret [GetRepoVersions $proj_dir $repo_path ""]
342  set sha [lindex $ret 13]
343  set hex_ver [lindex $ret 14]
344 
345  set ver [HexVersionToString $hex_ver]
346  CopyIPbusXMLs $proj_dir $repo_path $xml_dst $ver $sha 1 $xml_gen
347 
348  exit 0
349  }
350 
351  if {$do_list_file_parse == 1} {
352  set proj_dir $repo_path/Top/$project_name
353  set proj_list_dir $repo_path/Top/$project_name/list
354  GetHogFiles -print_log -list_files {.src,.con,.sim,.ext,.ipb} $proj_list_dir $repo_path
355  Msg Status " "
356  Msg Info "All Done."
357  exit 0
358  }
359 
360  if {$do_check_yaml_ref == 1} {
361  Msg Info "Checking if \"ref\" in .gitlab-ci.yml actually matches the included yml file in Hog submodule"
362  CheckYmlRef $repo_path false
363  exit 0
364  }
365 
366  if {$do_buttons == 1} {
367  Msg Info "Adding Hog buttons to Vivado bar (will use the vivado currently in PATH)..."
368  set ide vivado
369  set cmd "vivado -mode batch -notrace -source $repo_path/Hog/Tcl/utils/add_hog_custom_button.tcl"
370  }
371 
372  if {$do_compile_lib == 1} {
373  if {$project eq ""} {
374  Msg Error "You need to specify a simulator as first argument."
375  exit 1
376  } else {
377  set simulator $project
378  Msg Info "Selecting $simulator simulator..."
379  }
380  if {$options(dst_dir) != ""} {
381  set output_dir $options(dst_dir)
382  } else {
383  Msg Info "No destination directory defined. Using default: SimulationLib/"
384  set output_dir "SimulationLib"
385  }
386 
387  set ide vivado
388  set cmd "vivado -mode batch -notrace -source $repo_path/Hog/Tcl/utils/compile_simlib.tcl -tclargs -simulator $simulator -output_dir $output_dir"
389  }
390 
391  set simsets ""
392  if {$do_simulation == 1} {
393  # Get all simsets in the project that run with GHDL
394  set ghdl_simsets [GetSimSets $project_name $repo_path "$options(simset)" 1]
395  set ghdl_import 0
396  dict for {simset_name simset_dict} $ghdl_simsets {
397  if {$ghdl_import == 0} {
398  ImportGHDL $project_name $repo_path $simset_name $simset_dict $ext_path
399  set ghdl_import 1
400  }
401  LaunchGHDL $project_name $repo_path $simset_name $simset_dict $ext_path
402  # dict unset simsets_dict $simset_name
403  }
404  set ide_simsets [GetSimSets $project_name $repo_path $options(simset) 0 1]
405 
406  if {[dict size $ide_simsets] == 0} {
407  # All simulations have been run, exiting
408  Msg Info "All simulations have been run, exiting..."
409  exit 0
410  }
411  }
412 
413  # if {$do_new_directive ==1 } {
414  #
415  # # Do things here
416  #
417  # exit 0
418  #}
419 
420  #### END of tclsh commands ####
421  Msg Info "Launching command: $cmd..."
422 
423  # Check if the IDE is actually in the path...
424  set ret [catch {exec which $ide}]
425  if {$ret != 0} {
426  Msg Error "$ide not found in your system. Make sure to add $ide to your PATH enviromental variable."
427  exit $ret
428  }
429 
430  if {[string first libero $cmd] >= 0} {
431  # The SCRIPT_ARGS: flag of libero makes tcl crazy...
432  # Let's pipe the command into a shell script and remove it later
433  set libero_script [open "launch-libero-hog.sh" w]
434  puts $libero_script "#!/bin/sh"
435  puts $libero_script $cmd
436  close $libero_script
437  set cmd "sh launch-libero-hog.sh"
438  }
439 
440  set ret [catch {exec -ignorestderr {*}$cmd >@ stdout} result]
441 
442  if {$ret != 0} {
443  Msg Error "IDE returned an error state."
444  } else {
445  Msg Info "All done."
446  exit 0
447  }
448 
449  if {[string first libero $cmd] >= 0} {
450  file delete "launch-libero-hog.sh"
451  }
452 
453  exit $ret
454 }
455 
456 #After this line, we are in the IDE
457 ##################################################################################
458 
459 
460 # We need to Import tcllib if we are using Libero
461 if {[IsLibero] || [IsDiamond]} {
462  if {[info exists env(HOG_TCLLIB_PATH)]} {
463  lappend auto_path $env(HOG_TCLLIB_PATH)
464  } else {
465  puts "ERROR: To run Hog with Microsemi Libero SoC or Lattice Diamond,\
466  you need to define the HOG_TCLLIB_PATH variable."
467  return
468  }
469 }
470 
471 if {[catch {package require cmdline} ERROR] || [catch {package require struct::matrix} ERROR]} {
472  puts "$ERROR\n Tcllib not found. If you are running this script on tclsh for debuggin purpose ONLY, you can fix this by installing 'tcllib'"
473  exit 1
474 }
475 
476 set run_folder [file normalize "$repo_path/Projects/$project_name/$project.runs/"]
477 if {[IsLibero]} {
478  set run_folder [file normalize "$repo_path/Projects/$project_name/"]
479 }
480 
481 # Only for quartus, not used otherwise
482 set project_path [file normalize "$repo_path/Projects/$project_name/"]
483 
484 # Get IDE name from project config file
485 set proj_conf [ProjectExists $project_name $repo_path]
486 set ide_name_and_ver [string tolower [GetIDEFromConf $proj_conf]]
487 set ide_name [lindex [regexp -all -inline {\S+} $ide_name_and_ver] 0]
488 
489 if {$options(no_bitstream) == 1} {
490  set do_bitstream 0
491  set do_compile 0
492 }
493 
494 if {$options(recreate) == 1} {
495  set recreate 1
496 }
497 
498 if {$options(synth_only) == 1} {
499  set do_implementation 0
500  set do_synthesis 1
501  set do_bitstream 0
502  set do_create 1
503  set do_compile 1
504 }
505 
506 if {$options(impl_only) == 1} {
507  set do_implementation 1
508  set do_synthesis 0
509  set do_bitstream 0
510  set do_create 0
511  set do_compile 1
512 }
513 
514 
515 if {$options(vitis_only) == 1 || $ide_name eq "vitis_classic"} {
516  set do_vitis_build 1
517  set do_implementation 0
518  set do_synthesis 0
519  set do_bitstream 0
520  set do_create 0
521  set do_compile 0
522 }
523 
524 if {$options(bitstream_only) == 1} {
525  set do_bitstream_only 1
526  set do_bitstream 0
527  set do_implementation 0
528  set do_synthesis 0
529  set do_create 0
530  set do_compile 0
531 } else {
532  set do_bitstream_only 0
533 }
534 
535 if {$options(vivado_only) == 1} {
536  set do_vitis_build 0
537 }
538 
539 if {$options(no_reset) == 1} {
540  set do_reset 0
541 }
542 
543 if {$options(check_syntax) == 1} {
544  set do_check_syntax 1
545 }
546 
547 if {$options(scripts_only) == 1} {
548  set scripts_only 1
549 }
550 
551 if {$options(compile_only) == 1} {
552  set compile_only 1
553 }
554 
555 
556 
557 if {$options(lib) != ""} {
558  set lib_path [file normalize $options(lib)]
559 } else {
560  if {[info exists env(HOG_SIMULATION_LIB_PATH)]} {
561  set lib_path $env(HOG_SIMULATION_LIB_PATH)
562  } else {
563  if {[file exists "$repo_path/SimulationLib"]} {
564  set lib_path [file normalize "$repo_path/SimulationLib"]
565  } else {
566  set lib_path ""
567  }
568  }
569 }
570 
571 
572 Msg Info "Number of jobs set to $options(njobs)."
573 
574 ############## Quartus ########################
575 set argv ""
576 
577 ############# CREATE or OPEN project ############
578 if {[IsISE]} {
579  cd $tcl_path
580  set project_file [file normalize $repo_path/Projects/$project_name/$project.ppr]
581 } elseif {[IsVivado]} {
582  cd $tcl_path
583  set project_file [file normalize $repo_path/Projects/$project_name/$project.xpr]
584 } elseif {[IsVitisClassic]} {
585  cd $tcl_path
586  set project_file [file normalize $repo_path/Projects/$project_name/vitis_classic/.metadata/]
587  Msg Info "Setting project file for Vitis Classic project $project_name to $project_file"
588 } elseif {[IsQuartus]} {
589  if {[catch {package require ::quartus::project} ERROR]} {
590  Msg Error "$ERROR\n Can not find package ::quartus::project"
591  cd $old_path
592  return 1
593  } else {
594  Msg Info "Loaded package ::quartus::project"
595  load_package flow
596  }
597  set project_file "$project_path/$project.qpf"
598 } elseif {[IsLibero]} {
599  set project_file [file normalize $repo_path/Projects/$project_name/$project.prjx]
600 } elseif {[IsDiamond]} {
601  sys_install version
602  set project_file [file normalize $repo_path/Projects/$project_name/$project.ldf]
603 }
604 
605 if {[file exists $project_file]} {
606  Msg Info "Found project file $project_file for $project_name."
607  set proj_found 1
608 } else {
609  Msg Info "Project file not found for $project_name."
610  set proj_found 0
611 }
612 
613 if {($proj_found == 0 || $recreate == 1)} {
614  Msg Info "Creating (possibly replacing) the project $project_name..."
615  Msg Debug "launch.tcl: calling GetConfFiles with $repo_path/Top/$project_name"
616  lassign [GetConfFiles $repo_path/Top/$project_name] conf sim pre post
617 
618  if {[file exists $conf]} {
619  # Still not sure of the difference between project and project_name
620  if {$options(vivado_only) == 1} {
621  CreateProject -simlib_path $lib_path -xsa $options(xsa) -vivado_only $project_name $repo_path
622  } else {
623  CreateProject -simlib_path $lib_path -xsa $options(xsa) $project_name $repo_path
624  }
625  Msg Info "Done creating project $project_name."
626  } else {
627  Msg Error "Project $project_name is incomplete: no hog.conf file found, please create one..."
628  }
629 } else {
630  Msg Info "Opening existing project file $project_file..."
631  if {[IsXilinx]} {
632  file mkdir "$repo_path/Projects/$project_name/$project.gen/sources_1"
633  }
634 
635  if {[IsVitisClassic]} {
636  set vitis_workspace [file normalize $repo_path/Projects/$project_name/vitis_classic/]
637  Msg Info "Setting workspace to $vitis_workspace"
638  setws $vitis_workspace
639 
640  } else {
641  OpenProject $project_file $repo_path
642  }
643 }
644 
645 
646 ########## CHECK SYNTAX ###########
647 if {$do_check_syntax == 1} {
648  Msg Info "Checking syntax for project $project_name..."
649  CheckSyntax $project_name $repo_path $project_file
650 }
651 
652 
653 ######### RTL ANALYSIS ########
654 if {$do_rtl == 1} {
656 }
657 
658 if {$do_vitis_build == 1} {
659  if {[IsVitisClassic]} {
660  LaunchVitisBuild $project_name $repo_path
661  } else {
662  set xsct_cmd "xsct $tcl_path/launch.tcl W -vitis_only $project_name"
663  set ret [catch {exec -ignorestderr {*}$xsct_cmd >@ stdout} result]
664  if {$ret != 0} {
665  Msg Error "xsct (vitis classic) returned an error state."
666  }
667  }
668 }
669 
670 ######### LaunchSynthesis ########
671 if {$do_synthesis == 1} {
672  LaunchSynthesis $do_reset $do_create $run_folder $project_name $repo_path $ext_path $options(njobs)
673 }
674 
675 if {$do_implementation == 1} {
676  LaunchImplementation $do_reset $do_create $run_folder $project_name $repo_path $options(njobs) $do_bitstream
677 }
678 
679 if {$do_bitstream_only == 1 && [IsXilinx]} {
680  GenerateBitstreamOnly $project_name $repo_path
681 } elseif {$do_bitstream_only == 1 && ![IsXilinx]} {
682  Msg Error "Bitstream only option is not supported for this IDE."
683 }
684 
685 if {$do_bitstream == 1 && ![IsXilinx]} {
686  GenerateBitstream $run_folder $repo_path $options(njobs)
687 }
688 
689 if {$do_simulation == 1} {
690  # set simsets $options(simset)
691  set simsets [GetSimSets $project_name $repo_path $options(simset)]
692  LaunchSimulation $project_name $lib_path $simsets $repo_path $scripts_only $compile_only
693 }
694 
695 
696 if {$do_check_list_files} {
697  Msg Info "Running list file checker..."
698 
699  #if {![file exists $dst_dir]} {
700  # Msg Info "$dst_dir directory not found, creating it..."
701  # file mkdir $dst_dir
702  # }
703 
704 
705  set argv0 check_list_files
706  if {$ext_path ne ""} {
707  set argv [list "-ext_path" "$ext_path" "-outDir" "$dst_dir" "-pedantic"]
708  } else {
709  set argv [list "-outDir" "$dst_dir" "-pedantic"]
710  }
711 
712  source $tcl_path/utils/check_list_files.tcl
713 }
714 
715 
716 if {$do_sigasi} {
717  Msg Info "Creating Sigasi file for $project..."
718 
719  #Simulation
720  set csv_name "${project}_sigasi_sim.csv"
721  #Create IPs here
722  Msg Info "Generating IP targets for simulations..."
723  foreach ip [get_ips] {
724  set targets [list_targets [get_files [file tail [get_property IP_FILE $ip]]]]
725  if {[lsearch -exact $targets simulation] >= 0} {
726  generate_target simulation $ip
727  } else {
728  Msg Warning "IP $ip is not a simulation target, skipping..."
729  }
730  }
731 
732  # tclint-disable-next-line line-length
733  set source_files [get_files -filter {(FILE_TYPE == VHDL || FILE_TYPE == "VHDL 2008" || FILE_TYPE == "VHDL 2019" || FILE_TYPE == VERILOG || FILE_TYPE == SYSTEMVERILOG) && USED_IN_SIMULATION == 1 }]
734  if {$options(dst_dir) == ""} {
735  set dst_path "$repo_path"
736  } else {
737  set dst_path $repo_path/$options(dst_dir)
738  if {![file exists $dst_path]} {
739  Msg Info "Creating $dst_path..."
740  file mkdir $dst_path
741  }
742  }
743 
744  Msg Info "Creating sigasi csv file for simulation $dst_path/$csv_name..."
745  set csv_file [open $dst_path/$csv_name w]
746 
747  foreach source_file $source_files {
748  puts $csv_file [concat [get_property LIBRARY $source_file] "," $source_file]
749  }
750  close $csv_file
751 
752  #Synthesis
753  set csv_name "${project}_sigasi_synth.csv"
754  Msg Info "Generating IP targets for synthesis..."
755  foreach ip [get_ips] {
756  generate_target synthesis $ip
757  }
758  # tclint-disable-next-line line-length
759  set source_files [get_files -filter {(FILE_TYPE == VHDL || FILE_TYPE == "VHDL 2008" || FILE_TYPE == "VHDL 2019" || FILE_TYPE == VERILOG || FILE_TYPE == SYSTEMVERILOG) && USED_IN_SYNTHESIS == 1 }]
760  Msg Info "Creating sigasi csv file for synthesis $dst_path/$csv_name..."
761  set csv_file [open $dst_path/$csv_name w]
762  foreach source_file $source_files {
763  puts $csv_file [concat [get_property LIBRARY $source_file] "," $source_file]
764  }
765  close $csv_file
766 }
767 
768 ## CLOSE Project
770 
771 Msg Info "All done."
772 cd $old_path