labview-fpga-hdl-tools 2.0.0.dev4__tar.gz → 2.0.0.dev6__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.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/PKG-INFO +25 -10
  2. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/README.md +24 -9
  3. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/install_labview_target_plugin.py +36 -16
  4. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/pyproject.toml +1 -1
  5. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/LICENSE +0 -0
  6. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/.gitignore +0 -0
  7. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/__init__.py +0 -0
  8. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/__main__.py +0 -0
  9. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/check_syntax.py +0 -0
  10. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/command_config.py +0 -0
  11. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/command_hooks.py +0 -0
  12. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/common.py +0 -0
  13. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/compile_modelsim_lib.py +0 -0
  14. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/compile_project.py +0 -0
  15. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/create_lvbitx.py +0 -0
  16. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/create_modelsim_project.py +0 -0
  17. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/create_vivado_project.py +0 -0
  18. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/gen_labview_target_plugin.py +0 -0
  19. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/generate_vhdl.py +0 -0
  20. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/get_window_netlist.py +0 -0
  21. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/install_dependencies.py +0 -0
  22. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/launch_modelsim.py +4 -4
  23. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/launch_vivado.py +0 -0
  24. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/migrate_clip.py +0 -0
  25. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/nihdlsettings_default.py +0 -0
  26. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/process_constraints.py +0 -0
  27. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/reporting.py +0 -0
  28. {labview_fpga_hdl_tools-2.0.0.dev4 → labview_fpga_hdl_tools-2.0.0.dev6}/labview_fpga_hdl_tools/sim_modelsim.py +4 -4
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: labview-fpga-hdl-tools
3
- Version: 2.0.0.dev4
3
+ Version: 2.0.0.dev6
4
4
  Summary: LabVIEW FPGA HDL Tools
5
5
  License: MIT
6
6
  Author: Salvador Santolucito
@@ -39,6 +39,12 @@ run Vivado in the end — they differ in what compiles the bitfile:
39
39
  target (`gen-target` → `install-target`), then write a VI and let LabVIEW FPGA
40
40
  compile the bitfile (it runs Vivado under the hood).
41
41
 
42
+ > **Host-side note:** to communicate with the compiled `.lvbitx` from a LabVIEW FPGA
43
+ > host VI, open it with **Open Dynamic Bitfile Reference** (wire in the bitfile path and
44
+ > a matching FPGA Interface Dynamic Refnum) — the standard **Open FPGA VI Reference**
45
+ > node does **not** work with these custom targets. See
46
+ > [Vivado Compile Flow → Opening the bitfile from a LabVIEW FPGA host VI](docs/VivadoCompileFlow.md#opening-the-bitfile-from-a-labview-fpga-host-vi).
47
+
42
48
  In short: in the **Vivado flow** you drive Vivado; in the **LabVIEW FPGA flow**
43
49
  LabVIEW FPGA drives Vivado for you. See
44
50
  [Theory of Operation](docs/TheoryOfOperation.md) for the full story.
@@ -48,9 +54,13 @@ LabVIEW FPGA drives Vivado for you. See
48
54
  | Doc | What's in it |
49
55
  | --- | --- |
50
56
  | [Theory of Operation](docs/TheoryOfOperation.md) | The architecture, the supported workflows, and how the pieces fit together. Start here. |
57
+ | [Vivado Compile Flow](docs/VivadoCompileFlow.md) | End-to-end walkthrough: extend the HDL, generate a Vivado project, and compile a `.lvbitx` directly in Vivado. |
58
+ | [LabVIEW FPGA Target and Compile Flow](docs/LabVIEWFpgaTargetFlow.md) | End-to-end walkthrough: build and install a custom LabVIEW FPGA target, then compile in LabVIEW FPGA. |
59
+ | [ModelSim Simulation Flow](docs/ModelSimSimulationFlow.md) | End-to-end walkthrough: build the Xilinx sim libraries, create the ModelSim project, and run a testbench. |
51
60
  | [Command Reference](docs/CommandReference.md) | Every `nihdl` command, its options, the command flow, and per-command required settings. |
52
61
  | [Settings Reference](docs/SettingsReference.md) | The `nihdlsettings.py` model: hooks, context, `--set` overrides, and the full list of setters. |
53
62
  | [LVTargetCustomIO Reference](docs/LVTargetCustomIO-Reference.md) | The custom I/O CSV format used to define HDL ↔ LabVIEW FPGA signals. |
63
+ | [Generated VHDL](docs/GeneratedVHDL.md) | What VHDL the tools generate (window wrappers, `PkgNiHdlSettings`) and why — single-sourcing the facts shared by the HDL and the LabVIEW FPGA target. |
54
64
  | [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). |
55
65
 
56
66
  ## Prerequisites
@@ -142,6 +152,8 @@ nihdl compile-vivado
142
152
 
143
153
  Open the project interactively at any point with `nihdl launch-vivado`.
144
154
 
155
+ > **Full walkthrough:** [Vivado Compile Flow](docs/VivadoCompileFlow.md).
156
+
145
157
  ### The LabVIEW FPGA compile flow (custom target)
146
158
 
147
159
  To expose your HDL to LabVIEW FPGA as a custom target, define your I/O in the
@@ -151,23 +163,26 @@ To expose your HDL to LabVIEW FPGA as a custom target, define your I/O in the
151
163
  # Generate target support files (BoardIO/Clock XML, Window VHDL, plugin content)
152
164
  nihdl gen-target
153
165
 
154
- # Install the generated plugin into your LabVIEW FPGA install
166
+ # Close ALL LabVIEW instances, then install the generated plugin into your LabVIEW FPGA install
155
167
  nihdl install-target
156
168
  ```
157
169
 
170
+ > **Close LabVIEW around `install-target`.** Close all LabVIEW instances before running it, and
171
+ > (re)start LabVIEW afterward — LabVIEW only scans for target plugins at startup.
172
+
173
+ > **Full walkthrough:** [LabVIEW FPGA Target and Compile Flow](docs/LabVIEWFpgaTargetFlow.md).
174
+
158
175
  ### Simulating with ModelSim
159
176
 
160
177
  ```bash
161
- # Create the ModelSim project and compile all VHDL (vcom -autoorder -2008)
162
- # When XilinxSimLibFolder is configured, this also compiles the Xilinx
163
- # simulation libraries (unisim, secureip, ...) on the first run, which can
164
- # take several minutes. Run it standalone with: nihdl compile-modelsim-lib
165
- nihdl gen-modelsim
166
-
167
- # Launch the GUI, or run headless with --batch
168
- nihdl launch-modelsim
178
+ # Create the ModelSim project and compile all VHDL, then run the testbench
179
+ nihdl gen-modelsim --overwrite
180
+ nihdl sim-modelsim # or: nihdl launch-modelsim (GUI; --batch for headless)
169
181
  ```
170
182
 
183
+ > **Full walkthrough:** [ModelSim Simulation Flow](docs/ModelSimSimulationFlow.md)
184
+ > — including the Xilinx simulation libraries and how the pass/fail verdict works.
185
+
171
186
  For the complete command list, options, and required settings, see the
172
187
  [Command Reference](docs/CommandReference.md).
173
188
 
@@ -18,6 +18,12 @@ run Vivado in the end — they differ in what compiles the bitfile:
18
18
  target (`gen-target` → `install-target`), then write a VI and let LabVIEW FPGA
19
19
  compile the bitfile (it runs Vivado under the hood).
20
20
 
21
+ > **Host-side note:** to communicate with the compiled `.lvbitx` from a LabVIEW FPGA
22
+ > host VI, open it with **Open Dynamic Bitfile Reference** (wire in the bitfile path and
23
+ > a matching FPGA Interface Dynamic Refnum) — the standard **Open FPGA VI Reference**
24
+ > node does **not** work with these custom targets. See
25
+ > [Vivado Compile Flow → Opening the bitfile from a LabVIEW FPGA host VI](docs/VivadoCompileFlow.md#opening-the-bitfile-from-a-labview-fpga-host-vi).
26
+
21
27
  In short: in the **Vivado flow** you drive Vivado; in the **LabVIEW FPGA flow**
22
28
  LabVIEW FPGA drives Vivado for you. See
23
29
  [Theory of Operation](docs/TheoryOfOperation.md) for the full story.
@@ -27,9 +33,13 @@ LabVIEW FPGA drives Vivado for you. See
27
33
  | Doc | What's in it |
28
34
  | --- | --- |
29
35
  | [Theory of Operation](docs/TheoryOfOperation.md) | The architecture, the supported workflows, and how the pieces fit together. Start here. |
36
+ | [Vivado Compile Flow](docs/VivadoCompileFlow.md) | End-to-end walkthrough: extend the HDL, generate a Vivado project, and compile a `.lvbitx` directly in Vivado. |
37
+ | [LabVIEW FPGA Target and Compile Flow](docs/LabVIEWFpgaTargetFlow.md) | End-to-end walkthrough: build and install a custom LabVIEW FPGA target, then compile in LabVIEW FPGA. |
38
+ | [ModelSim Simulation Flow](docs/ModelSimSimulationFlow.md) | End-to-end walkthrough: build the Xilinx sim libraries, create the ModelSim project, and run a testbench. |
30
39
  | [Command Reference](docs/CommandReference.md) | Every `nihdl` command, its options, the command flow, and per-command required settings. |
31
40
  | [Settings Reference](docs/SettingsReference.md) | The `nihdlsettings.py` model: hooks, context, `--set` overrides, and the full list of setters. |
32
41
  | [LVTargetCustomIO Reference](docs/LVTargetCustomIO-Reference.md) | The custom I/O CSV format used to define HDL ↔ LabVIEW FPGA signals. |
42
+ | [Generated VHDL](docs/GeneratedVHDL.md) | What VHDL the tools generate (window wrappers, `PkgNiHdlSettings`) and why — single-sourcing the facts shared by the HDL and the LabVIEW FPGA target. |
33
43
  | [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). |
34
44
 
35
45
  ## Prerequisites
@@ -121,6 +131,8 @@ nihdl compile-vivado
121
131
 
122
132
  Open the project interactively at any point with `nihdl launch-vivado`.
123
133
 
134
+ > **Full walkthrough:** [Vivado Compile Flow](docs/VivadoCompileFlow.md).
135
+
124
136
  ### The LabVIEW FPGA compile flow (custom target)
125
137
 
126
138
  To expose your HDL to LabVIEW FPGA as a custom target, define your I/O in the
@@ -130,23 +142,26 @@ To expose your HDL to LabVIEW FPGA as a custom target, define your I/O in the
130
142
  # Generate target support files (BoardIO/Clock XML, Window VHDL, plugin content)
131
143
  nihdl gen-target
132
144
 
133
- # Install the generated plugin into your LabVIEW FPGA install
145
+ # Close ALL LabVIEW instances, then install the generated plugin into your LabVIEW FPGA install
134
146
  nihdl install-target
135
147
  ```
136
148
 
149
+ > **Close LabVIEW around `install-target`.** Close all LabVIEW instances before running it, and
150
+ > (re)start LabVIEW afterward — LabVIEW only scans for target plugins at startup.
151
+
152
+ > **Full walkthrough:** [LabVIEW FPGA Target and Compile Flow](docs/LabVIEWFpgaTargetFlow.md).
153
+
137
154
  ### Simulating with ModelSim
138
155
 
139
156
  ```bash
140
- # Create the ModelSim project and compile all VHDL (vcom -autoorder -2008)
141
- # When XilinxSimLibFolder is configured, this also compiles the Xilinx
142
- # simulation libraries (unisim, secureip, ...) on the first run, which can
143
- # take several minutes. Run it standalone with: nihdl compile-modelsim-lib
144
- nihdl gen-modelsim
145
-
146
- # Launch the GUI, or run headless with --batch
147
- nihdl launch-modelsim
157
+ # Create the ModelSim project and compile all VHDL, then run the testbench
158
+ nihdl gen-modelsim --overwrite
159
+ nihdl sim-modelsim # or: nihdl launch-modelsim (GUI; --batch for headless)
148
160
  ```
149
161
 
162
+ > **Full walkthrough:** [ModelSim Simulation Flow](docs/ModelSimSimulationFlow.md)
163
+ > — including the Xilinx simulation libraries and how the pass/fail verdict works.
164
+
150
165
  For the complete command list, options, and required settings, see the
151
166
  [Command Reference](docs/CommandReference.md).
152
167
 
@@ -34,11 +34,20 @@ def _run_as_admin():
34
34
  privileges live and die with that child process. The elevated instance
35
35
  performs the install and then exits, so admin rights are never retained
36
36
  by any process after installation completes.
37
- - The executable is always resolved to a fully-qualified path before being
38
- handed to ShellExecuteW. Passing a bare program name (e.g. "nihdl") would
39
- let Windows resolve it against the working directory / PATH in the
40
- elevated context, allowing an attacker-planted binary to run as admin
37
+ - Re-launch through the current Python interpreter (``sys.executable``, an
38
+ absolute, trusted path) running the tool as a module (``-m
39
+ labview_fpga_hdl_tools``). We deliberately do NOT re-invoke ``sys.argv[0]``
40
+ (the console-script launcher, e.g. nihdl.exe): those launcher stubs are
41
+ resolved for the *current* user's environment (venv / pyenv shims) and do
42
+ not reliably re-bootstrap their interpreter under the elevated (admin)
43
+ account, so the elevated child would exit without doing any work. Passing
44
+ a bare program name (e.g. "nihdl") is likewise avoided because Windows
45
+ would resolve it against the working directory / PATH in the elevated
46
+ context, allowing an attacker-planted binary to run as admin
41
47
  (CWE-426/CWE-427, untrusted search path).
48
+ - The elevated child is launched with its working directory pinned to the
49
+ current working directory so it discovers the same ``nihdlsettings.py``
50
+ the user invoked against (config is resolved relative to the cwd).
42
51
  """
43
52
  import ctypes
44
53
  import subprocess
@@ -49,23 +58,21 @@ def _run_as_admin():
49
58
  reporter.detail("Admin elevation only supported on Windows")
50
59
  return
51
60
 
52
- # Resolve the launcher to an absolute, trusted path. Never pass a bare
53
- # program name to ShellExecuteW "runas".
54
- launcher = os.path.abspath(sys.argv[0])
55
- if launcher.lower().endswith(".exe") and os.path.isfile(launcher):
56
- # pip-installed console entry point (e.g. nihdl.exe)
57
- command = launcher
58
- arguments = subprocess.list2cmdline(sys.argv[1:])
59
- else:
60
- # Running as a .py script under the current interpreter
61
- command = os.path.abspath(sys.executable)
62
- arguments = subprocess.list2cmdline([launcher, *sys.argv[1:]])
61
+ # Re-launch via the real interpreter running the package as a module. This
62
+ # is both trusted (absolute interpreter path, module named explicitly) and
63
+ # robust across launchers (venv exe, pyenv shim, editable install).
64
+ command = os.path.abspath(sys.executable)
65
+ arguments = subprocess.list2cmdline(["-m", "labview_fpga_hdl_tools", *sys.argv[1:]])
66
+
67
+ # Pin the elevated child's working directory to the current directory so it
68
+ # finds the same nihdlsettings.py the user invoked against.
69
+ working_dir = os.getcwd()
63
70
 
64
71
  reporter.detail("Requesting administrator privileges...")
65
72
 
66
73
  # Execute with elevation
67
74
  result = ctypes.windll.shell32.ShellExecuteW( # type: ignore
68
- None, "runas", command, arguments, None, 1
75
+ None, "runas", command, arguments, working_dir, 1
69
76
  )
70
77
 
71
78
  # Check if the elevation was successful
@@ -160,6 +167,14 @@ def install_lv_target_support(config=None):
160
167
 
161
168
  # If we need admin and don't have it, relaunch with elevated privileges
162
169
  if needs_admin and not _is_admin():
170
+ # Always-visible notice: the actual install runs in a separate elevated
171
+ # process (a UAC prompt will appear). Without this, the command appears
172
+ # to do nothing because the elevated child owns the success output.
173
+ reporter.success(
174
+ f"Installing '{config.lv_target_name}' to '{install_folder}' requires "
175
+ "administrator rights. Approve the Windows UAC prompt; the install "
176
+ "completes in a separate elevated window."
177
+ )
163
178
  _run_as_admin()
164
179
  return # Exit current instance as the elevated instance will continue
165
180
 
@@ -200,6 +215,11 @@ def install_lv_target_support(config=None):
200
215
  reporter.success(
201
216
  f"Successfully installed LabVIEW Target '{config.lv_target_name}' to {install_folder}"
202
217
  )
218
+ reporter.success(
219
+ "Reminder: close ALL open LabVIEW instances before installing, and (re)start "
220
+ "LabVIEW afterward. LabVIEW FPGA only scans for target plugins at startup, so a "
221
+ "running instance will not see this newly installed or updated target."
222
+ )
203
223
 
204
224
  except PermissionError:
205
225
  reporter.error("Error: Permission denied. Administrator privileges are required.")
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "labview-fpga-hdl-tools"
7
- version = "2.0.0.dev4"
7
+ version = "2.0.0.dev6"
8
8
  description = "LabVIEW FPGA HDL Tools"
9
9
  authors = [
10
10
  "Salvador Santolucito <salvador.santolucito@gmail.com>"
@@ -71,6 +71,10 @@ def launch_modelsim(batch=False, config=None):
71
71
  )
72
72
  return 1
73
73
 
74
+ if config.skip_modelsim:
75
+ reporter.success("SKIP MODELSIM: Validation successful, skipping ModelSim launch")
76
+ return 0
77
+
74
78
  vsim_exe = _get_vsim_executable(config.modelsim_tools_folder)
75
79
  if not vsim_exe or not os.path.exists(vsim_exe):
76
80
  reporter.error(f"Error: vsim executable not found at {vsim_exe}")
@@ -80,10 +84,6 @@ def launch_modelsim(batch=False, config=None):
80
84
  reporter.detail(f"Do file: {do_file}")
81
85
  reporter.detail(f"Working directory: {project_dir}")
82
86
 
83
- if config.skip_modelsim:
84
- reporter.success("SKIP MODELSIM: Validation successful, skipping ModelSim launch")
85
- return 0
86
-
87
87
  if batch:
88
88
  # Batch mode: run vsim -c -do <script> and wait for completion
89
89
  cmd = [vsim_exe, "-c", "-do", do_file]
@@ -90,6 +90,10 @@ def sim_modelsim(do_file=None, config=None):
90
90
  )
91
91
  return 1
92
92
 
93
+ if config.skip_modelsim:
94
+ reporter.success("SKIP MODELSIM: Validation successful, skipping simulation")
95
+ return 0
96
+
93
97
  vsim_exe = _get_vsim_executable(config.modelsim_tools_folder)
94
98
  if not vsim_exe or not os.path.exists(vsim_exe):
95
99
  reporter.error(f"Error: vsim executable not found at {vsim_exe}")
@@ -101,10 +105,6 @@ def sim_modelsim(do_file=None, config=None):
101
105
  reporter.detail(f" Working dir: {project_dir}")
102
106
  reporter.detail(f" Top entity: {entity_name}")
103
107
 
104
- if config.skip_modelsim:
105
- reporter.success("SKIP MODELSIM: Validation successful, skipping simulation")
106
- return 0
107
-
108
108
  # Build command: vsim in batch/command-line mode. Force the project
109
109
  # modelsim.ini so unisim/Xilinx library mappings are honored; an external
110
110
  # MODELSIM env var would otherwise override the local .ini.