labview-fpga-hdl-tools 2.0.0.dev0__tar.gz → 2.0.0.dev2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/PKG-INFO +26 -8
  2. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/README.md +24 -5
  3. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/__main__.py +150 -213
  4. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/check_syntax.py +8 -10
  5. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/command_config.py +57 -41
  6. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/command_hooks.py +8 -0
  7. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/common.py +41 -0
  8. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/compile_project.py +22 -10
  9. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/create_vivado_project.py +61 -27
  10. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/gen_labview_target_plugin.py +112 -28
  11. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/launch_modelsim.py +1 -13
  12. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/launch_vivado.py +1 -14
  13. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/nihdlsettings_default.py +1 -1
  14. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/process_constraints.py +129 -22
  15. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/pyproject.toml +2 -2
  16. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/LICENSE +0 -0
  17. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/.gitignore +0 -0
  18. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/__init__.py +0 -0
  19. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/compile_modelsim_lib.py +0 -0
  20. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/create_lvbitx.py +0 -0
  21. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/create_modelsim_project.py +0 -0
  22. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/generate_vhdl.py +0 -0
  23. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/get_window_netlist.py +0 -0
  24. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/install_dependencies.py +0 -0
  25. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/install_labview_target_plugin.py +0 -0
  26. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/migrate_clip.py +0 -0
  27. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/reporting.py +0 -0
  28. {labview_fpga_hdl_tools-2.0.0.dev0 → labview_fpga_hdl_tools-2.0.0.dev2}/labview_fpga_hdl_tools/sim_modelsim.py +0 -0
@@ -1,14 +1,13 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: labview-fpga-hdl-tools
3
- Version: 2.0.0.dev0
3
+ Version: 2.0.0.dev2
4
4
  Summary: LabVIEW FPGA HDL Tools
5
5
  License: MIT
6
6
  Author: Salvador Santolucito
7
7
  Author-email: salvador.santolucito@gmail.com
8
- Requires-Python: >=3.8,<4.0
8
+ Requires-Python: >=3.9,<4.0
9
9
  Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.8
12
11
  Classifier: Programming Language :: Python :: 3.9
13
12
  Classifier: Programming Language :: Python :: 3.10
14
13
  Classifier: Programming Language :: Python :: 3.11
@@ -24,8 +23,25 @@ Description-Content-Type: text/markdown
24
23
 
25
24
  Pre-release command-line tools (`nihdl`) for building customized FPGA designs
26
25
  for use with the ni/flexrio repository. They move, generate, and process the
27
- files needed to take a top-level HDL design through Vivado to a LabVIEW FPGA
28
- bitfile and to build hybrid LabVIEW + HDL targets.
26
+ files needed to take a top-level HDL design to a LabVIEW FPGA bitfile through
27
+ either of two compile flows (see below).
28
+
29
+ ## The two compile flows
30
+
31
+ `nihdl` supports two ways to turn a top-level HDL design into a LabVIEW FPGA
32
+ bitfile. Both start by extending the board's open-source top-level HDL, and both
33
+ run Vivado in the end — they differ in what compiles the bitfile:
34
+
35
+ - **Vivado compile flow** — extend the design in HDL and compile the bitfile
36
+ directly in Vivado (`gen-vivado` → `compile-vivado`). The host talks to your
37
+ logic over registers and DMA FIFOs via the NI-RIO driver — no LabVIEW required.
38
+ - **LabVIEW FPGA compile flow** — package your HDL as a custom LabVIEW FPGA
39
+ target (`gen-target` → `install-target`), then write a VI and let LabVIEW FPGA
40
+ compile the bitfile (it runs Vivado under the hood).
41
+
42
+ In short: in the **Vivado flow** you drive Vivado; in the **LabVIEW FPGA flow**
43
+ LabVIEW FPGA drives Vivado for you. See
44
+ [Theory of Operation](docs/TheoryOfOperation.md) for the full story.
29
45
 
30
46
  ## Documentation
31
47
 
@@ -35,6 +51,7 @@ bitfile — and to build hybrid LabVIEW + HDL targets.
35
51
  | [Command Reference](docs/CommandReference.md) | Every `nihdl` command, its options, the command flow, and per-command required settings. |
36
52
  | [Settings Reference](docs/SettingsReference.md) | The `nihdlsettings.py` model: hooks, context, `--set` overrides, and the full list of setters. |
37
53
  | [LVTargetCustomIO Reference](docs/LVTargetCustomIO-Reference.md) | The custom I/O CSV format used to define HDL ↔ LabVIEW FPGA signals. |
54
+ | [Window Netlist and Constraints](docs/WindowNetlistAndConstraints.md) | How the LabVIEW Window netlist is produced/consumed and how XDC constraints are processed for each compile flow (including the `current_instance` scoping rules). |
38
55
 
39
56
  ## Prerequisites
40
57
 
@@ -49,7 +66,8 @@ You need the external tools your flow uses:
49
66
  - **ModelSim** — only for simulation (`gen-modelsim`, `sim-modelsim`,
50
67
  `launch-modelsim`, `compile-modelsim-lib`). `compile-modelsim-lib` also needs
51
68
  Vivado to compile the Xilinx simulation libraries.
52
- - **Git** and **Python** (Python 3.11 is the officially tested version).
69
+ - **Git** and **Python** — the tools support Python 3.9+; CI tests on 3.9 and
70
+ 3.11 (3.11 is also used for static analysis).
53
71
 
54
72
  ### Installing the tools
55
73
 
@@ -100,7 +118,7 @@ step-by-step status with warnings and errors also shown inline; the end summary
100
118
  still appears, so verbose is additive to the default. See the
101
119
  [Command Reference](docs/CommandReference.md#output-and-verbosity) for details.
102
120
 
103
- ## Quickstart: HDL to Bitfile
121
+ ## Quickstart: the Vivado compile flow
104
122
 
105
123
  Run these from your target folder (the one with `nihdlsettings.py`), with the
106
124
  Python environment active (run `nisetup` once per terminal — see
@@ -124,7 +142,7 @@ nihdl compile-vivado
124
142
 
125
143
  Open the project interactively at any point with `nihdl launch-vivado`.
126
144
 
127
- ### Building a Custom LabVIEW FPGA Target (hybrid flow)
145
+ ### The LabVIEW FPGA compile flow (custom target)
128
146
 
129
147
  To expose your HDL to LabVIEW FPGA as a custom target, define your I/O in the
130
148
  [custom I/O CSV](docs/LVTargetCustomIO-Reference.md), then:
@@ -2,8 +2,25 @@
2
2
 
3
3
  Pre-release command-line tools (`nihdl`) for building customized FPGA designs
4
4
  for use with the ni/flexrio repository. They move, generate, and process the
5
- files needed to take a top-level HDL design through Vivado to a LabVIEW FPGA
6
- bitfile and to build hybrid LabVIEW + HDL targets.
5
+ files needed to take a top-level HDL design to a LabVIEW FPGA bitfile through
6
+ either of two compile flows (see below).
7
+
8
+ ## The two compile flows
9
+
10
+ `nihdl` supports two ways to turn a top-level HDL design into a LabVIEW FPGA
11
+ bitfile. Both start by extending the board's open-source top-level HDL, and both
12
+ run Vivado in the end — they differ in what compiles the bitfile:
13
+
14
+ - **Vivado compile flow** — extend the design in HDL and compile the bitfile
15
+ directly in Vivado (`gen-vivado` → `compile-vivado`). The host talks to your
16
+ logic over registers and DMA FIFOs via the NI-RIO driver — no LabVIEW required.
17
+ - **LabVIEW FPGA compile flow** — package your HDL as a custom LabVIEW FPGA
18
+ target (`gen-target` → `install-target`), then write a VI and let LabVIEW FPGA
19
+ compile the bitfile (it runs Vivado under the hood).
20
+
21
+ In short: in the **Vivado flow** you drive Vivado; in the **LabVIEW FPGA flow**
22
+ LabVIEW FPGA drives Vivado for you. See
23
+ [Theory of Operation](docs/TheoryOfOperation.md) for the full story.
7
24
 
8
25
  ## Documentation
9
26
 
@@ -13,6 +30,7 @@ bitfile — and to build hybrid LabVIEW + HDL targets.
13
30
  | [Command Reference](docs/CommandReference.md) | Every `nihdl` command, its options, the command flow, and per-command required settings. |
14
31
  | [Settings Reference](docs/SettingsReference.md) | The `nihdlsettings.py` model: hooks, context, `--set` overrides, and the full list of setters. |
15
32
  | [LVTargetCustomIO Reference](docs/LVTargetCustomIO-Reference.md) | The custom I/O CSV format used to define HDL ↔ LabVIEW FPGA signals. |
33
+ | [Window Netlist and Constraints](docs/WindowNetlistAndConstraints.md) | How the LabVIEW Window netlist is produced/consumed and how XDC constraints are processed for each compile flow (including the `current_instance` scoping rules). |
16
34
 
17
35
  ## Prerequisites
18
36
 
@@ -27,7 +45,8 @@ You need the external tools your flow uses:
27
45
  - **ModelSim** — only for simulation (`gen-modelsim`, `sim-modelsim`,
28
46
  `launch-modelsim`, `compile-modelsim-lib`). `compile-modelsim-lib` also needs
29
47
  Vivado to compile the Xilinx simulation libraries.
30
- - **Git** and **Python** (Python 3.11 is the officially tested version).
48
+ - **Git** and **Python** — the tools support Python 3.9+; CI tests on 3.9 and
49
+ 3.11 (3.11 is also used for static analysis).
31
50
 
32
51
  ### Installing the tools
33
52
 
@@ -78,7 +97,7 @@ step-by-step status with warnings and errors also shown inline; the end summary
78
97
  still appears, so verbose is additive to the default. See the
79
98
  [Command Reference](docs/CommandReference.md#output-and-verbosity) for details.
80
99
 
81
- ## Quickstart: HDL to Bitfile
100
+ ## Quickstart: the Vivado compile flow
82
101
 
83
102
  Run these from your target folder (the one with `nihdlsettings.py`), with the
84
103
  Python environment active (run `nisetup` once per terminal — see
@@ -102,7 +121,7 @@ nihdl compile-vivado
102
121
 
103
122
  Open the project interactively at any point with `nihdl launch-vivado`.
104
123
 
105
- ### Building a Custom LabVIEW FPGA Target (hybrid flow)
124
+ ### The LabVIEW FPGA compile flow (custom target)
106
125
 
107
126
  To expose your HDL to LabVIEW FPGA as a custom target, define your I/O in the
108
127
  [custom I/O CSV](docs/LVTargetCustomIO-Reference.md), then:
@@ -168,6 +168,28 @@ def hook_options(func):
168
168
  return func
169
169
 
170
170
 
171
+ def _run(command_name, command_func, *, config, settings_args, verbose, **command_kwargs):
172
+ """Execute a command through run_with_hooks with the shared error handling.
173
+
174
+ Centralizes the per-command boilerplate: parse the repeated ``--set``
175
+ overrides, run the command wrapped in nihdlsettings hooks, and turn any
176
+ exception into a non-zero exit while letting run_with_hooks own the error
177
+ reporting (its end-of-run summary already recorded the failure).
178
+ """
179
+ try:
180
+ return command_hooks.run_with_hooks(
181
+ command_name,
182
+ command_func,
183
+ command_config_path=config,
184
+ settings_args=_parse_set(settings_args),
185
+ verbose=verbose,
186
+ **command_kwargs,
187
+ )
188
+ except Exception as e:
189
+ handle_exception(e)
190
+ return 1
191
+
192
+
171
193
  # ---------------------------------------------------------------------------
172
194
  # Workspace Setup
173
195
  # ---------------------------------------------------------------------------
@@ -181,21 +203,16 @@ def hook_options(func):
181
203
  @click.pass_context
182
204
  def install_deps_cmd(ctx, delete, pre, latest, config, settings_args, verbose):
183
205
  """Install GitHub dependencies from dependencies.toml."""
184
- try:
185
- result = command_hooks.run_with_hooks(
186
- "install_deps",
187
- install_dependencies.install_dependencies,
188
- command_config_path=config,
189
- settings_args=_parse_set(settings_args),
190
- verbose=verbose,
191
- delete_allowed=delete,
192
- allow_prerelease=pre,
193
- use_latest=latest,
194
- )
195
- return result
196
- except Exception as e:
197
- handle_exception(e)
198
- return 1
206
+ return _run(
207
+ "install_deps",
208
+ install_dependencies.install_dependencies,
209
+ config=config,
210
+ settings_args=settings_args,
211
+ verbose=verbose,
212
+ delete_allowed=delete,
213
+ allow_prerelease=pre,
214
+ use_latest=latest,
215
+ )
199
216
 
200
217
 
201
218
  # ---------------------------------------------------------------------------
@@ -210,20 +227,15 @@ def install_deps_cmd(ctx, delete, pre, latest, config, settings_args, verbose):
210
227
  @click.pass_context
211
228
  def gen_vivado_cmd(ctx, overwrite, update, config, settings_args, verbose):
212
229
  """Generate Vivado project."""
213
- try:
214
- result = command_hooks.run_with_hooks(
215
- "gen_vivado",
216
- create_vivado_project.create_project,
217
- command_config_path=config,
218
- settings_args=_parse_set(settings_args),
219
- verbose=verbose,
220
- overwrite=overwrite,
221
- update=update,
222
- )
223
- return result
224
- except Exception as e:
225
- handle_exception(e)
226
- return 1
230
+ return _run(
231
+ "gen_vivado",
232
+ create_vivado_project.create_project,
233
+ config=config,
234
+ settings_args=settings_args,
235
+ verbose=verbose,
236
+ overwrite=overwrite,
237
+ update=update,
238
+ )
227
239
 
228
240
 
229
241
  @cli.command("launch-vivado", help="Launch Vivado with the current project")
@@ -231,18 +243,13 @@ def gen_vivado_cmd(ctx, overwrite, update, config, settings_args, verbose):
231
243
  @click.pass_context
232
244
  def launch_vivado_cmd(ctx, config, settings_args, verbose):
233
245
  """Launch Vivado with the current project."""
234
- try:
235
- result = command_hooks.run_with_hooks(
236
- "launch_vivado",
237
- launch_vivado.launch_vivado,
238
- command_config_path=config,
239
- settings_args=_parse_set(settings_args),
240
- verbose=verbose,
241
- )
242
- return result
243
- except Exception as e:
244
- handle_exception(e)
245
- return 1
246
+ return _run(
247
+ "launch_vivado",
248
+ launch_vivado.launch_vivado,
249
+ config=config,
250
+ settings_args=settings_args,
251
+ verbose=verbose,
252
+ )
246
253
 
247
254
 
248
255
  @cli.command("check-vivado", help="Check Vivado RTL syntax and hierarchy quickly")
@@ -250,18 +257,13 @@ def launch_vivado_cmd(ctx, config, settings_args, verbose):
250
257
  @click.pass_context
251
258
  def check_vivado_cmd(ctx, config, settings_args, verbose):
252
259
  """Check Vivado RTL syntax and hierarchy using RTL elaboration."""
253
- try:
254
- result = command_hooks.run_with_hooks(
255
- "check_vivado",
256
- check_syntax.check_syntax,
257
- command_config_path=config,
258
- settings_args=_parse_set(settings_args),
259
- verbose=verbose,
260
- )
261
- return result
262
- except Exception as e:
263
- handle_exception(e)
264
- return 1
260
+ return _run(
261
+ "check_vivado",
262
+ check_syntax.check_syntax,
263
+ config=config,
264
+ settings_args=settings_args,
265
+ verbose=verbose,
266
+ )
265
267
 
266
268
 
267
269
  @cli.command("compile-vivado", help="Compile Vivado project and generate a LabVIEW FPGA bitfile")
@@ -269,18 +271,13 @@ def check_vivado_cmd(ctx, config, settings_args, verbose):
269
271
  @click.pass_context
270
272
  def compile_vivado_cmd(ctx, config, settings_args, verbose):
271
273
  """Compile Vivado project and generate a LabVIEW FPGA bitfile."""
272
- try:
273
- result = command_hooks.run_with_hooks(
274
- "compile_vivado",
275
- compile_project.compile_project,
276
- command_config_path=config,
277
- settings_args=_parse_set(settings_args),
278
- verbose=verbose,
279
- )
280
- return result
281
- except Exception as e:
282
- handle_exception(e)
283
- return 1
274
+ return _run(
275
+ "compile_vivado",
276
+ compile_project.compile_project,
277
+ config=config,
278
+ settings_args=settings_args,
279
+ verbose=verbose,
280
+ )
284
281
 
285
282
 
286
283
  # ---------------------------------------------------------------------------
@@ -293,18 +290,13 @@ def compile_vivado_cmd(ctx, config, settings_args, verbose):
293
290
  @click.pass_context
294
291
  def gen_window_cmd(ctx, config, settings_args, verbose):
295
292
  """Generate LabVIEW window netlist from Vivado project export."""
296
- try:
297
- result = command_hooks.run_with_hooks(
298
- "gen_window",
299
- get_window_netlist.get_window,
300
- command_config_path=config,
301
- settings_args=_parse_set(settings_args),
302
- verbose=verbose,
303
- )
304
- return result
305
- except Exception as e:
306
- handle_exception(e)
307
- return 1
293
+ return _run(
294
+ "gen_window",
295
+ get_window_netlist.get_window,
296
+ config=config,
297
+ settings_args=settings_args,
298
+ verbose=verbose,
299
+ )
308
300
 
309
301
 
310
302
  @cli.command(
@@ -315,18 +307,13 @@ def gen_window_cmd(ctx, config, settings_args, verbose):
315
307
  @click.pass_context
316
308
  def gen_hdl_cmd(ctx, config, settings_args, verbose):
317
309
  """Generate VHDL files from Mako templates only."""
318
- try:
319
- result = command_hooks.run_with_hooks(
320
- "gen_hdl",
321
- generate_vhdl.gen_generated_vhdl,
322
- command_config_path=config,
323
- settings_args=_parse_set(settings_args),
324
- verbose=verbose,
325
- )
326
- return result
327
- except Exception as e:
328
- handle_exception(e)
329
- return 1
310
+ return _run(
311
+ "gen_hdl",
312
+ generate_vhdl.gen_generated_vhdl,
313
+ config=config,
314
+ settings_args=settings_args,
315
+ verbose=verbose,
316
+ )
330
317
 
331
318
 
332
319
  @cli.command(
@@ -337,18 +324,13 @@ def gen_hdl_cmd(ctx, config, settings_args, verbose):
337
324
  @click.pass_context
338
325
  def gen_xdc_cmd(ctx, config, settings_args, verbose):
339
326
  """Generate XDC constraint files from templates."""
340
- try:
341
- result = command_hooks.run_with_hooks(
342
- "gen_xdc",
343
- process_constraints.process_constraints,
344
- command_config_path=config,
345
- settings_args=_parse_set(settings_args),
346
- verbose=verbose,
347
- )
348
- return result
349
- except Exception as e:
350
- handle_exception(e)
351
- return 1
327
+ return _run(
328
+ "gen_xdc",
329
+ process_constraints.process_constraints,
330
+ config=config,
331
+ settings_args=settings_args,
332
+ verbose=verbose,
333
+ )
352
334
 
353
335
 
354
336
  @cli.command(
@@ -359,18 +341,13 @@ def gen_xdc_cmd(ctx, config, settings_args, verbose):
359
341
  @click.pass_context
360
342
  def gen_lvbitx_cmd(ctx, config, settings_args, verbose):
361
343
  """Generate LabVIEW FPGA bitfile from Vivado output."""
362
- try:
363
- result = command_hooks.run_with_hooks(
364
- "gen_lvbitx",
365
- create_lvbitx.create_lv_bitx,
366
- command_config_path=config,
367
- settings_args=_parse_set(settings_args),
368
- verbose=verbose,
369
- )
370
- return result
371
- except Exception as e:
372
- handle_exception(e)
373
- return 1
344
+ return _run(
345
+ "gen_lvbitx",
346
+ create_lvbitx.create_lv_bitx,
347
+ config=config,
348
+ settings_args=settings_args,
349
+ verbose=verbose,
350
+ )
374
351
 
375
352
 
376
353
  # ---------------------------------------------------------------------------
@@ -390,18 +367,13 @@ def gen_guid_cmd(ctx, config, settings_args, verbose):
390
367
  reporter.success("Copy and paste this GUID into your nihdlsettings.py file.")
391
368
  return 0
392
369
 
393
- try:
394
- result = command_hooks.run_with_hooks(
395
- "gen_guid",
396
- _gen_guid,
397
- command_config_path=config,
398
- settings_args=_parse_set(settings_args),
399
- verbose=verbose,
400
- )
401
- return result
402
- except Exception as e:
403
- handle_exception(e)
404
- return 1
370
+ return _run(
371
+ "gen_guid",
372
+ _gen_guid,
373
+ config=config,
374
+ settings_args=settings_args,
375
+ verbose=verbose,
376
+ )
405
377
 
406
378
 
407
379
  @cli.command("gen-target", help="Generate LabVIEW FPGA target support files")
@@ -409,18 +381,13 @@ def gen_guid_cmd(ctx, config, settings_args, verbose):
409
381
  @click.pass_context
410
382
  def gen_target_cmd(ctx, config, settings_args, verbose):
411
383
  """Generate LabVIEW FPGA target support files."""
412
- try:
413
- result = command_hooks.run_with_hooks(
414
- "gen_target",
415
- gen_labview_target_plugin.gen_lv_target_support,
416
- command_config_path=config,
417
- settings_args=_parse_set(settings_args),
418
- verbose=verbose,
419
- )
420
- return result
421
- except Exception as e:
422
- handle_exception(e)
423
- return 1
384
+ return _run(
385
+ "gen_target",
386
+ gen_labview_target_plugin.gen_lv_target_support,
387
+ config=config,
388
+ settings_args=settings_args,
389
+ verbose=verbose,
390
+ )
424
391
 
425
392
 
426
393
  @cli.command("install-target", help="Install LabVIEW FPGA target support files")
@@ -428,18 +395,13 @@ def gen_target_cmd(ctx, config, settings_args, verbose):
428
395
  @click.pass_context
429
396
  def install_target_cmd(ctx, config, settings_args, verbose):
430
397
  """Install LabVIEW FPGA target support files."""
431
- try:
432
- result = command_hooks.run_with_hooks(
433
- "install_target",
434
- install_labview_target_plugin.install_lv_target_support,
435
- command_config_path=config,
436
- settings_args=_parse_set(settings_args),
437
- verbose=verbose,
438
- )
439
- return result
440
- except Exception as e:
441
- handle_exception(e)
442
- return 1
398
+ return _run(
399
+ "install_target",
400
+ install_labview_target_plugin.install_lv_target_support,
401
+ config=config,
402
+ settings_args=settings_args,
403
+ verbose=verbose,
404
+ )
443
405
 
444
406
 
445
407
  # ---------------------------------------------------------------------------
@@ -453,19 +415,14 @@ def install_target_cmd(ctx, config, settings_args, verbose):
453
415
  @click.pass_context
454
416
  def gen_modelsim_cmd(ctx, overwrite, config, settings_args, verbose):
455
417
  """Generate a ModelSim project for HDL simulation."""
456
- try:
457
- result = command_hooks.run_with_hooks(
458
- "gen_modelsim",
459
- create_modelsim_project.create_modelsim_project,
460
- command_config_path=config,
461
- settings_args=_parse_set(settings_args),
462
- verbose=verbose,
463
- overwrite=overwrite,
464
- )
465
- return result
466
- except Exception as e:
467
- handle_exception(e)
468
- return 1
418
+ return _run(
419
+ "gen_modelsim",
420
+ create_modelsim_project.create_modelsim_project,
421
+ config=config,
422
+ settings_args=settings_args,
423
+ verbose=verbose,
424
+ overwrite=overwrite,
425
+ )
469
426
 
470
427
 
471
428
  @cli.command("launch-modelsim", help="Launch ModelSim with the current project")
@@ -474,19 +431,14 @@ def gen_modelsim_cmd(ctx, overwrite, config, settings_args, verbose):
474
431
  @click.pass_context
475
432
  def launch_modelsim_cmd(ctx, batch, config, settings_args, verbose):
476
433
  """Launch ModelSim with the current project."""
477
- try:
478
- result = command_hooks.run_with_hooks(
479
- "launch_modelsim",
480
- launch_modelsim.launch_modelsim,
481
- command_config_path=config,
482
- settings_args=_parse_set(settings_args),
483
- verbose=verbose,
484
- batch=batch,
485
- )
486
- return result
487
- except Exception as e:
488
- handle_exception(e)
489
- return 1
434
+ return _run(
435
+ "launch_modelsim",
436
+ launch_modelsim.launch_modelsim,
437
+ config=config,
438
+ settings_args=settings_args,
439
+ verbose=verbose,
440
+ batch=batch,
441
+ )
490
442
 
491
443
 
492
444
  @cli.command("sim-modelsim", help="Run ModelSim simulation in batch mode")
@@ -495,19 +447,14 @@ def launch_modelsim_cmd(ctx, batch, config, settings_args, verbose):
495
447
  @click.pass_context
496
448
  def sim_modelsim_cmd(ctx, do_file, config, settings_args, verbose):
497
449
  """Run ModelSim simulation in batch mode and report results."""
498
- try:
499
- result = command_hooks.run_with_hooks(
500
- "sim_modelsim",
501
- sim_modelsim.sim_modelsim,
502
- command_config_path=config,
503
- settings_args=_parse_set(settings_args),
504
- verbose=verbose,
505
- do_file=do_file,
506
- )
507
- return result
508
- except Exception as e:
509
- handle_exception(e)
510
- return 1
450
+ return _run(
451
+ "sim_modelsim",
452
+ sim_modelsim.sim_modelsim,
453
+ config=config,
454
+ settings_args=settings_args,
455
+ verbose=verbose,
456
+ do_file=do_file,
457
+ )
511
458
 
512
459
 
513
460
  @cli.command(
@@ -519,19 +466,14 @@ def sim_modelsim_cmd(ctx, do_file, config, settings_args, verbose):
519
466
  @click.pass_context
520
467
  def compile_modelsim_lib_cmd(ctx, force, config, settings_args, verbose):
521
468
  """Compile the Xilinx simulation libraries used by ModelSim."""
522
- try:
523
- result = command_hooks.run_with_hooks(
524
- "compile_modelsim_lib",
525
- compile_modelsim_lib.compile_modelsim_lib,
526
- command_config_path=config,
527
- settings_args=_parse_set(settings_args),
528
- verbose=verbose,
529
- force=force,
530
- )
531
- return result
532
- except Exception as e:
533
- handle_exception(e)
534
- return 1
469
+ return _run(
470
+ "compile_modelsim_lib",
471
+ compile_modelsim_lib.compile_modelsim_lib,
472
+ config=config,
473
+ settings_args=settings_args,
474
+ verbose=verbose,
475
+ force=force,
476
+ )
535
477
 
536
478
 
537
479
  # ---------------------------------------------------------------------------
@@ -544,18 +486,13 @@ def compile_modelsim_lib_cmd(ctx, force, config, settings_args, verbose):
544
486
  @click.pass_context
545
487
  def migrate_clip_cmd(ctx, config, settings_args, verbose):
546
488
  """Migrate CLIP files for FlexRIO custom devices."""
547
- try:
548
- result = command_hooks.run_with_hooks(
549
- "migrate_clip",
550
- migrate_clip.migrate_clip,
551
- command_config_path=config,
552
- settings_args=_parse_set(settings_args),
553
- verbose=verbose,
554
- )
555
- return result
556
- except Exception as e:
557
- handle_exception(e)
558
- return 1
489
+ return _run(
490
+ "migrate_clip",
491
+ migrate_clip.migrate_clip,
492
+ config=config,
493
+ settings_args=settings_args,
494
+ verbose=verbose,
495
+ )
559
496
 
560
497
 
561
498
  # ---------------------------------------------------------------------------
@@ -32,18 +32,16 @@ def _generate_check_syntax_tcl(config, output_path):
32
32
 
33
33
  def _validate_ini(config):
34
34
  """Validate required configuration settings for check-syntax."""
35
- missing_settings = []
35
+ missing_settings = common.collect_missing_settings(
36
+ config,
37
+ [
38
+ ("vivado_project_folder", "VivadoProjectSettings.VivadoProjectFolder"),
39
+ ("top_level_entity", "VivadoProjectSettings.TopLevelEntity"),
40
+ ("fpga_part", "VivadoProjectSettings.FPGAPart"),
41
+ ],
42
+ )
36
43
  invalid_paths = []
37
44
 
38
- if not config.vivado_project_folder:
39
- missing_settings.append("VivadoProjectSettings.VivadoProjectFolder")
40
-
41
- if not config.top_level_entity:
42
- missing_settings.append("VivadoProjectSettings.TopLevelEntity")
43
-
44
- if not config.fpga_part:
45
- missing_settings.append("VivadoProjectSettings.FPGAPart")
46
-
47
45
  if not config.vivado_tcl_scripts_folder:
48
46
  missing_settings.append("VivadoProjectSettings.VivadoTclScriptsFolder")
49
47
  else: