Hog v10.48.0
commands.tcl
Go to the documentation of this file.
1 #!/usr/bin/env tclsh
2 # @file
3 # Copyright 2018-2026 The University of Birmingham
4 # Copyright 2018-2026 Max-Planck-Institute for Physics
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 
18 # Developers Tip for new commands
19 # Add a hashtag sign # after the curly brake (e.g. \^C(REATE)?$ {# ...}) if the command requires a project name as an argument
20 
21 # Add this bit above!
22 # \^NEW_DIRECTIVE?$ {
23 # set do_new_directive 1
24 # }
25 
26 set default_commands {
27  \^L(IST)?$ {
28  Msg Status "\n** The projects in this repository are:"
29  ListProjects $repo_path $list_all
30  Msg Status "\n"
31  exit 0
32  # NAME*: LIST or L
33  # DESCRIPTION: List the projects in the repository. To show hidden projects use the -all option
34  # OPTIONS: all, verbose
35  }
36 
37  \^H(ELP)?$ {
38  puts "$usage"
39  exit 0
40  # NAME: HELP or H
41  # DESCRIPTION: Display this help message or specific help for each directive
42  # OPTIONS:
43  }
44 
45  \^(CHECKCI|CIE)?$ {
46  set do_check_ci_env 1
47  # NAME: CHECKCIENV or CIE
48  # DESCRIPTION: Check that the common environment variables needed for Hog-CI are set
49  # OPTIONS: verbose
50  }
51 
52  \^(CHECKPROJENV|CPE)?$ {#proj
53  set do_checkproj_env 1
54  # NAME: CHECKPROJENV or CPE
55  # DESCRIPTION: Check that the environment variables needed for Hog-CI to run the chosen project are set and point to valid paths
56  # OPTIONS: verbose
57  }
58 
59  \^(CHECKPROJVER|CPV)?$ {#proj
60  set allow_empty_proj 1
61  set do_checkproj_ver 1
62  # NAME: CHECKPROJVER or CPV
63  # DESCRIPTION: Check the project version just before creating the HDL project in Create_Project stage. \
64  The CI job will SKIP the project pipeline, if it the project has not been modified with respect to the target branch.
65  # OPTIONS: ext_path.arg, simcheck, verbose, ci_run
66  }
67 
68  \^C(REATE)?$ {#proj
69  set do_create 1
70  set recreate 1
71  # NAME*: CREATE or C
72  # DESCRIPTION: Create the project, replace it if already existing.
73  # OPTIONS: ext_path.arg, lib.arg, vivado_only, vitis_only, xsa.arg, verbose
74  }
75 
76  \^UPGRADE_IP$ {#proj
77  set do_upgrade_ips 1
78  # NAME: UPGRADE_IP
79  # DESCRIPTION: Upgrade locked IPs in an existing Vivado project.
80  # OPTIONS: verbose
81  }
82 
83  \^I(MPL(EMENT(ATION)?)?)?$ {#proj
84  set do_implementation 1
85  set do_bitstream 1
86  set do_compile 1
87  # NAME: IMPLEMENTATION or I
88  # DESCRIPTION: Runs only the implementation, the project must already exist and be synthesised.
89  # OPTIONS: check_syntax, ext_path.arg, njobs.arg, no_bitstream, no_reset, recreate, verbose
90  }
91 
92  \^SYNT(H(ESIS(E)?)?)? {#proj
93  set do_synthesis 1
94  set do_compile 1
95  # NAME: SYNTH
96  # DESCRIPTION: Run synthesis only, create the project if not existing.
97  # OPTIONS: check_syntax, ext_path.arg, njobs.arg, recreate, verbose
98  }
99 
100  \^S(IM(ULAT(ION|E)?)?)?$ {#proj
101  set do_simulation 1
102  set do_create 1
103  # NAME*: SIMULATION or S
104  # DESCRIPTION: Simulate the project, creating it if not existing, unless it is a GHDL simulation.
105  # OPTIONS: check_syntax, compile_only, ext_path.arg, lib.arg, recreate, scripts_only, simset.arg, verbose
106  }
107 
108  \^W(ORK(FLOW)?)?$ {#proj
109  set do_implementation 1
110  set do_synthesis 1
111  set do_bitstream 1
112  set do_compile 1
113  # NAME*: WORKFLOW or W
114  # DESCRIPTION: Runs the full workflow, creates the project if not existing.
115  # OPTIONS: bitstream_only, check_syntax, ext_path.arg, impl_only, njobs.arg, no_bitstream, recreate, synth_only, verbose, vitis_only, xsa.arg
116  }
117 
118  \^(CREATEWORKFLOW|CW)?$ {#proj
119  set do_implementation 1
120  set do_synthesis 1
121  set do_bitstream 1
122  set do_compile 1
123  set do_create 1
124  set recreate 1
125  # NAME: CREATEWORKFLOW or CW
126  # DESCRIPTION: Creates the project -even if existing- and launches the complete workflow.
127  # OPTIONS: check_syntax, ext_path.arg, njobs.arg, no_bitstream, synth_only, verbose, vivado_only, vitis_only, xsa.arg
128  }
129 
130  \^(CHECKSYNTAX|CS)?$ {#proj
131  set do_check_syntax 1
132  # NAME: CHECKSYNTAX or CS
133  # DESCRIPTION: Check the syntax of the project. Only for Vivado, Quartus and Libero projects.
134  # OPTIONS: ext_path.arg, recreate, verbose
135  }
136 
137  \^(IPB(US)?)|(X(ML)?)$ {#proj
138  set do_ipbus_xml 1
139  # NAME: IPBUS or IPB
140  # DESCRIPTION: Copy, check or create the IPbus XMLs for the project.
141  # OPTIONS: dst_dir.arg, generate, verbose
142  }
143 
144  \^CH(B|EBY)$ {#proj
145  set do_cheby 1
146  # NAME: CHEBY or CHB
147  # DESCRIPTION: Copy, check or generate the Cheby register-map outputs for the project.
148  # OPTIONS: dst_dir.arg, generate, profile.arg, strict, tool.arg, verbose
149  }
150 
151  \^V(IEW)?$ {#proj
152  set do_list_file_parse 1
153  # NAME*: VIEW or V
154  # DESCRIPTION: Print Hog list file contents in a tree-like fashon.
155  # OPTIONS: verbose
156  }
157 
158  \^(CHECKYAML|YML)?$ {
159  set min_n_of_args -1
160  set max_n_of_args 1
161  set do_check_yaml_ref 1
162  # NAME: CHECKYML or YML
163  # DESCRIPTION: Check that the ref to Hog repository in the .gitlab-ci.yml file, matches the one in Hog submodule.
164  # OPTIONS: verbose
165  }
166 
167  \^B(UTTONS)?$ {
168  set min_n_of_args -1
169  set max_n_of_args 1
170  set do_buttons 1
171  # NAME: BUTTONS or B
172  # DESCRIPTION: Add Hog buttons to the Vivado GUI, to check and recreate Hog list and configuration files.
173  # OPTIONS: verbose
174  }
175 
176  \^(CHECKLIST|CL)?$ {#proj
177  set do_check_list_files 1
178  # NAME: CHECKLIST or CL
179  # DESCRIPTION: Check that list and configuration files on disk match what is on the project.
180  # OPTIONS: ext_path.arg, verbose
181  }
182 
183  \^COMPSIM(LIB)?$ {
184  set do_compile_lib 1
185  set argument_is_no_project 1
186  # NAME: COMPSIMLIB or COMPSIM
187  # DESCRIPTION: Compiles the simulation library for the chosen simulator with Vivado.
188  # OPTIONS: dst_dir.arg, verbose
189  }
190 
191  \^RTL(ANALYSIS)?$ {#proj
192  set do_rtl 1
193  # NAME: RTL or RTLANALYSIS
194  # DESCRIPTION: Elaborate the RTL analysis report for the chosen project.
195  # OPTIONS: check_syntax, recreate, verbose
196  }
197 
198  \^SIG(ASI)?$ {#proj
199  set do_sigasi 1
200  # NAME: SIGASI or SIG
201  # DESCRIPTION: Create a .csv file to be used in Sigasi.
202  # OPTIONS: verbose
203  }
204 
205  \^T(REE)?$ {#proj
206  set do_hierarchy 1
207  # NAME: TREE or T
208  # DESCRIPTION: Print the design hierarchy for the chosen project.
209  # OPTIONS: compile_order, ext_path.arg, ignore.arg, include_gen_prods, include_ieee, light, output.arg, top.arg, verbose
210  }
211 
212  \^VHDL(LS)?$ {#proj
213  set do_vhdl_ls 1
214  # NAME: VHDL-LS or VHDL
215  # DESCRIPTION: Create a VHDL-LS configuration file for the chosen project.
216  # OPTIONS: verbose
217  }
218 
219  \^COCOTB$ {#proj
220  set do_cocotb 1
221  # NAME: COCOTB
222  # DESCRIPTION: Create a cocotb Python script to build VHDL/Verilog libraries using runner.build().
223  # OPTIONS: verbose, lib.arg
224  }
225 
226  \^VER(SION)?$ {#proj
227  set do_version 1
228  # NAME*: VERSION or VER
229  # DESCRIPTION: Print the version of the chosen Hog project. With -describe, prints the Hog describe string instead.
230  # OPTIONS: describe, verbose
231  }
232 
233  default {
234  if {$directive != ""} {
235  set NO_DIRECTIVE_FOUND 1
236  } else {
237  puts "$usage"
238  exit 0
239  }
240  }
241 }
242 
243 
244 set parameters {
245  {no_bitstream "If set, the bitstream file will not be produced."}
246  {recreate "If set, the project will be re-created if it already exists."}
247  {no_reset "If set, runs (synthesis and implementation) won't be reset before launching them."}
248  {check_syntax "If set, the HDL syntax will be checked at the beginning of the workflow."}
249  {njobs.arg 4 "Number of jobs. Default: 4"}
250  {ext_path.arg "" "Sets the absolute path for the external libraries."}
251  {lib.arg "" "Simulation library path, compiled or to be compiled"}
252  {synth_only "If set, only the synthesis will be performed."}
253  {impl_only "If set, only the implementation will be performed. This assumes synthesis was already done."}
254  {scripts_only "If set, the simulation scripts will be generated, but the simulation will not be run."}
255  {compile_only "If set, the simulation libraries will be compiled, but not run."}
256  {bitstream_only "If set, only the bitstream will be produced. This assumes implementation was already done. For a Vivado-Vitis\
257  project this command can be used to generate the boot artifacts including the ELF file(s) without running the\
258  full Vivado workflow."}
259  {vivado_only "If set, and project is vivado-vitis, vitis project will not be created."}
260  {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."}
261  {xsa.arg "" "If set, and project is vivado-vitis, use this xsa for creating platforms without a defined hw."}
262  {simset.arg "" "Simulation sets to run. HDL sets by name (e.g. sim_1), HLS\
263  (Vitis Unified) sets as csim:<component> or\
264  cosim:<component>. If empty, all enabled simulations are\
265  run."}
266  {all "List all projects, including test projects. Test projects have #test on the second line of hog.conf."}
267  {generate "For IPbus XMLs and Cheby register maps, it will re-create the generated artefacts."}
268  {dst_dir.arg "" "For reports, IPbus XMLs and Cheby outputs, set the destination folder (default is in the ./bin folder)."}
269  {profile.arg "all" "For Cheby, only process .chb lines whose profile= property matches (e.g. hdl, sw, doc, all)."}
270  {tool.arg "" "For Cheby, explicit path to the cheby executable (default: cheby from PATH)."}
271  {strict "For Cheby, fail on any warning-worthy mismatch or missing output."}
272  {output.arg "" "For tree hierarchy mode, set the output file (default is console)."}
273  {top.arg "" "For tree hierarchy mode, set the top module (default is the top module defined in hog.conf)."}
274  {ignore.arg "" "For tree hierarchy mode, filter's the printed hierarchy to exclude modules that match the given string."}
275  {include_ieee "" "For tree hierarchy mode, include IEEE/STD libraries in the printed hierarchy. (Default 0)"}
276  {include_gen_prods "" "For tree hierarchy mode, include IP generated products in the printed hierarchy. (Default 0)"}
277  {compile_order "" "For tree hierarchy mode, prints compile order instead of hierarchy."}
278  {verbose "If set, launch the script in verbose mode"}
279  {describe "If set, the Hog describe string is returned instead of the version."}
280  {light "For tree hierarchy mode, print a light version of the hierarchy (without file paths)."}
281  {simcheck "If set, checks also the version of the simulation files."}
282  {ci_run "If set, CheckProjVer will run only on the projects that are active in the CI's pipeline.\n\
283  It requires the glab or the gh package installed."}
284 }