devlab-fpga 0.1.4__tar.gz → 0.1.6__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.
- {devlab_fpga-0.1.4/devlab_fpga.egg-info → devlab_fpga-0.1.6}/PKG-INFO +5 -2
- {devlab_fpga-0.1.4 → devlab_fpga-0.1.6}/README.md +4 -1
- {devlab_fpga-0.1.4 → devlab_fpga-0.1.6}/devlab/__init__.py +1 -1
- {devlab_fpga-0.1.4 → devlab_fpga-0.1.6}/devlab/project.py +4 -2
- {devlab_fpga-0.1.4 → devlab_fpga-0.1.6}/devlab/toolchain.py +51 -9
- {devlab_fpga-0.1.4 → devlab_fpga-0.1.6/devlab_fpga.egg-info}/PKG-INFO +5 -2
- {devlab_fpga-0.1.4 → devlab_fpga-0.1.6}/pyproject.toml +1 -1
- {devlab_fpga-0.1.4 → devlab_fpga-0.1.6}/LICENSE +0 -0
- {devlab_fpga-0.1.4 → devlab_fpga-0.1.6}/MANIFEST.in +0 -0
- {devlab_fpga-0.1.4 → devlab_fpga-0.1.6}/devlab/__main__.py +0 -0
- {devlab_fpga-0.1.4 → devlab_fpga-0.1.6}/devlab/cli.py +0 -0
- {devlab_fpga-0.1.4 → devlab_fpga-0.1.6}/devlab/errors.py +0 -0
- {devlab_fpga-0.1.4 → devlab_fpga-0.1.6}/devlab/platforms.py +0 -0
- {devlab_fpga-0.1.4 → devlab_fpga-0.1.6}/devlab_fpga.egg-info/SOURCES.txt +0 -0
- {devlab_fpga-0.1.4 → devlab_fpga-0.1.6}/devlab_fpga.egg-info/dependency_links.txt +0 -0
- {devlab_fpga-0.1.4 → devlab_fpga-0.1.6}/devlab_fpga.egg-info/entry_points.txt +0 -0
- {devlab_fpga-0.1.4 → devlab_fpga-0.1.6}/devlab_fpga.egg-info/requires.txt +0 -0
- {devlab_fpga-0.1.4 → devlab_fpga-0.1.6}/devlab_fpga.egg-info/top_level.txt +0 -0
- {devlab_fpga-0.1.4 → devlab_fpga-0.1.6}/setup.cfg +0 -0
- {devlab_fpga-0.1.4 → devlab_fpga-0.1.6}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: devlab-fpga
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6
|
|
4
4
|
Summary: FPGA development helper for installing OSS CAD Suite and running build/flash flows.
|
|
5
5
|
Author-email: Mrju10 <name@email.com>
|
|
6
6
|
License: MIT
|
|
@@ -68,6 +68,7 @@ different directory.
|
|
|
68
68
|
OSS CAD Suite tools with the installed suite environment, including the
|
|
69
69
|
official `bin`, `py3bin`, `VIRTUAL_ENV`, `VERILATOR_ROOT`, and `GHDL_PREFIX`
|
|
70
70
|
settings. You do not need to manually source `environment` for those commands.
|
|
71
|
+
`devlab doctor` also checks that `ghdl` and the Yosys GHDL plugin are present.
|
|
71
72
|
|
|
72
73
|
On Windows, OSS CAD Suite may be distributed as a 7-Zip self-extracting `.exe`
|
|
73
74
|
archive. `devlab install` extracts it automatically into `~/.devlab/toolchains`
|
|
@@ -201,7 +202,9 @@ write completed. Keep `verify = false` unless the selected board/programming
|
|
|
201
202
|
path explicitly supports flash verification.
|
|
202
203
|
|
|
203
204
|
When sources end in `.vhd` or `.vhdl`, `devlab build` runs Yosys with the
|
|
204
|
-
GHDL plugin before synthesis.
|
|
205
|
+
GHDL plugin before synthesis. `devlab` resolves the plugin from the installed
|
|
206
|
+
OSS CAD Suite tree, for example `share/yosys/plugins/ghdl.so` on Linux, and
|
|
207
|
+
falls back to Yosys' plugin search path if a direct path is not found.
|
|
205
208
|
|
|
206
209
|
Use `--dry-run` to print the commands without executing them:
|
|
207
210
|
|
|
@@ -44,6 +44,7 @@ different directory.
|
|
|
44
44
|
OSS CAD Suite tools with the installed suite environment, including the
|
|
45
45
|
official `bin`, `py3bin`, `VIRTUAL_ENV`, `VERILATOR_ROOT`, and `GHDL_PREFIX`
|
|
46
46
|
settings. You do not need to manually source `environment` for those commands.
|
|
47
|
+
`devlab doctor` also checks that `ghdl` and the Yosys GHDL plugin are present.
|
|
47
48
|
|
|
48
49
|
On Windows, OSS CAD Suite may be distributed as a 7-Zip self-extracting `.exe`
|
|
49
50
|
archive. `devlab install` extracts it automatically into `~/.devlab/toolchains`
|
|
@@ -177,7 +178,9 @@ write completed. Keep `verify = false` unless the selected board/programming
|
|
|
177
178
|
path explicitly supports flash verification.
|
|
178
179
|
|
|
179
180
|
When sources end in `.vhd` or `.vhdl`, `devlab build` runs Yosys with the
|
|
180
|
-
GHDL plugin before synthesis.
|
|
181
|
+
GHDL plugin before synthesis. `devlab` resolves the plugin from the installed
|
|
182
|
+
OSS CAD Suite tree, for example `share/yosys/plugins/ghdl.so` on Linux, and
|
|
183
|
+
falls back to Yosys' plugin search path if a direct path is not found.
|
|
181
184
|
|
|
182
185
|
Use `--dry-run` to print the commands without executing them:
|
|
183
186
|
|
|
@@ -7,7 +7,7 @@ from pathlib import Path
|
|
|
7
7
|
from typing import Any
|
|
8
8
|
|
|
9
9
|
from .errors import DevlabError
|
|
10
|
-
from .toolchain import env_with_toolchain, find_executable, install_path
|
|
10
|
+
from .toolchain import env_with_toolchain, find_executable, find_yosys_plugin, install_path
|
|
11
11
|
|
|
12
12
|
try:
|
|
13
13
|
import tomllib
|
|
@@ -287,6 +287,7 @@ def doctor(strict: bool = False) -> int:
|
|
|
287
287
|
checks = {
|
|
288
288
|
"yosys": find_executable("yosys", install_path()),
|
|
289
289
|
"ghdl": find_executable("ghdl", install_path()),
|
|
290
|
+
"yosys-ghdl-plugin": find_yosys_plugin("ghdl", install_path()),
|
|
290
291
|
"nextpnr-himbaechel": find_executable("nextpnr-himbaechel", install_path()),
|
|
291
292
|
"gowin_pack": find_executable("gowin_pack", install_path()),
|
|
292
293
|
"nextpnr-ice40": find_executable("nextpnr-ice40", install_path()),
|
|
@@ -311,10 +312,11 @@ def _yosys_command(config: BuildConfig, synth_script: str) -> list[str]:
|
|
|
311
312
|
hdl = _source_hdl(config.sources)
|
|
312
313
|
if hdl == "vhdl":
|
|
313
314
|
sources = " ".join(shlex.quote(source) for source in config.sources)
|
|
315
|
+
ghdl_plugin = find_yosys_plugin("ghdl", install_path()) or "ghdl"
|
|
314
316
|
return [
|
|
315
317
|
"yosys",
|
|
316
318
|
"-m",
|
|
317
|
-
|
|
319
|
+
ghdl_plugin,
|
|
318
320
|
"-p",
|
|
319
321
|
f"ghdl --std=08 {sources} -e {config.top}; {synth_script}",
|
|
320
322
|
]
|
|
@@ -113,6 +113,12 @@ def bin_dirs(path: Path | None = None) -> list[Path]:
|
|
|
113
113
|
return [path / "oss-cad-suite" / "bin", path / "bin"]
|
|
114
114
|
|
|
115
115
|
|
|
116
|
+
def yosys_plugin_dirs(path: Path | None = None) -> list[Path]:
|
|
117
|
+
path = path or install_path()
|
|
118
|
+
root = _toolchain_root(path)
|
|
119
|
+
return [root / "share" / "yosys" / "plugins", root / "lib" / "yosys"]
|
|
120
|
+
|
|
121
|
+
|
|
116
122
|
def _toolchain_root(path: Path) -> Path:
|
|
117
123
|
nested_root = path / "oss-cad-suite"
|
|
118
124
|
if nested_root.exists():
|
|
@@ -125,6 +131,11 @@ def env_with_toolchain(path: Path | None = None) -> dict[str, str]:
|
|
|
125
131
|
root = _toolchain_root(path)
|
|
126
132
|
env = os.environ.copy()
|
|
127
133
|
tool_dirs = [*bin_dirs(path), root / "py3bin"]
|
|
134
|
+
|
|
135
|
+
# On Windows, add lib directory to PATH for DLL resolution
|
|
136
|
+
if sys.platform.startswith("win"):
|
|
137
|
+
tool_dirs.append(root / "lib")
|
|
138
|
+
|
|
128
139
|
binary_dirs = os.pathsep.join(str(candidate) for candidate in tool_dirs)
|
|
129
140
|
env["PATH"] = binary_dirs + os.pathsep + env.get("PATH", "")
|
|
130
141
|
env["VIRTUAL_ENV"] = str(root)
|
|
@@ -152,6 +163,26 @@ def find_executable(name: str, path: Path | None = None) -> str | None:
|
|
|
152
163
|
return shutil.which(name, path=env_with_toolchain(path).get("PATH"))
|
|
153
164
|
|
|
154
165
|
|
|
166
|
+
def find_yosys_plugin(name: str, path: Path | None = None) -> str | None:
|
|
167
|
+
suffixes = [".so", ".dll", ".dylib", ""]
|
|
168
|
+
for plugin_dir in yosys_plugin_dirs(path):
|
|
169
|
+
for suffix in suffixes:
|
|
170
|
+
candidate = plugin_dir / f"{name}{suffix}"
|
|
171
|
+
if candidate.exists():
|
|
172
|
+
return str(candidate)
|
|
173
|
+
return None
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def missing_toolchain_components(path: Path | None = None) -> list[str]:
|
|
177
|
+
path = path or install_path()
|
|
178
|
+
checks = {
|
|
179
|
+
"yosys": find_executable("yosys", path),
|
|
180
|
+
"ghdl": find_executable("ghdl", path),
|
|
181
|
+
"yosys-ghdl-plugin": find_yosys_plugin("ghdl", path),
|
|
182
|
+
}
|
|
183
|
+
return [name for name, found in checks.items() if not found]
|
|
184
|
+
|
|
185
|
+
|
|
155
186
|
def download_asset(asset: ToolchainAsset, destination: Path, force: bool = False) -> Path:
|
|
156
187
|
destination.parent.mkdir(parents=True, exist_ok=True)
|
|
157
188
|
if destination.exists() and not force:
|
|
@@ -201,36 +232,47 @@ def install_oss_cad_suite(
|
|
|
201
232
|
asset = select_asset()
|
|
202
233
|
destination = install_path(asset, home)
|
|
203
234
|
|
|
204
|
-
if
|
|
235
|
+
if (
|
|
236
|
+
destination.exists()
|
|
237
|
+
and not missing_toolchain_components(destination)
|
|
238
|
+
and not force
|
|
239
|
+
):
|
|
205
240
|
return destination
|
|
206
241
|
|
|
207
242
|
archive = download_asset(asset, archive_path(asset, home), force=force)
|
|
208
243
|
|
|
209
244
|
if asset.name.endswith(".exe"):
|
|
210
245
|
_extract_windows_sfx(archive, destination, force=force)
|
|
211
|
-
|
|
212
|
-
raise DevlabError(
|
|
213
|
-
"The Windows OSS CAD Suite archive was extracted, "
|
|
214
|
-
"but yosys was not found in "
|
|
215
|
-
f"{destination}\\oss-cad-suite\\bin or {destination}\\bin. "
|
|
216
|
-
"Check the extracted files, then run `devlab doctor`."
|
|
217
|
-
)
|
|
246
|
+
_ensure_toolchain_ready(destination, "Windows OSS CAD Suite archive")
|
|
218
247
|
return destination
|
|
219
248
|
|
|
220
249
|
if asset.name.endswith(".zip"):
|
|
221
250
|
_extract_zip(archive, destination, force=force)
|
|
251
|
+
_ensure_toolchain_ready(destination, "OSS CAD Suite zip archive")
|
|
222
252
|
return destination
|
|
223
253
|
|
|
224
254
|
_extract_tarball(archive, destination, force=force)
|
|
225
255
|
for binary_dir in bin_dirs(destination):
|
|
226
256
|
_mark_executables(binary_dir)
|
|
257
|
+
_ensure_toolchain_ready(destination, "OSS CAD Suite tarball")
|
|
227
258
|
return destination
|
|
228
259
|
|
|
229
260
|
|
|
261
|
+
def _ensure_toolchain_ready(destination: Path, archive_description: str) -> None:
|
|
262
|
+
missing = missing_toolchain_components(destination)
|
|
263
|
+
if missing:
|
|
264
|
+
missing_list = ", ".join(missing)
|
|
265
|
+
raise DevlabError(
|
|
266
|
+
f"The {archive_description} was extracted, but these components "
|
|
267
|
+
f"were not found: {missing_list}. Check the extracted files, "
|
|
268
|
+
"then run `devlab doctor`."
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
|
|
230
272
|
def _move_extracted_tree(source: Path, destination: Path, force: bool) -> None:
|
|
231
273
|
destination.parent.mkdir(parents=True, exist_ok=True)
|
|
232
274
|
if destination.exists():
|
|
233
|
-
if not force and
|
|
275
|
+
if not force and not missing_toolchain_components(destination):
|
|
234
276
|
raise DevlabError(f"Install destination already exists: {destination}")
|
|
235
277
|
shutil.rmtree(destination)
|
|
236
278
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: devlab-fpga
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6
|
|
4
4
|
Summary: FPGA development helper for installing OSS CAD Suite and running build/flash flows.
|
|
5
5
|
Author-email: Mrju10 <name@email.com>
|
|
6
6
|
License: MIT
|
|
@@ -68,6 +68,7 @@ different directory.
|
|
|
68
68
|
OSS CAD Suite tools with the installed suite environment, including the
|
|
69
69
|
official `bin`, `py3bin`, `VIRTUAL_ENV`, `VERILATOR_ROOT`, and `GHDL_PREFIX`
|
|
70
70
|
settings. You do not need to manually source `environment` for those commands.
|
|
71
|
+
`devlab doctor` also checks that `ghdl` and the Yosys GHDL plugin are present.
|
|
71
72
|
|
|
72
73
|
On Windows, OSS CAD Suite may be distributed as a 7-Zip self-extracting `.exe`
|
|
73
74
|
archive. `devlab install` extracts it automatically into `~/.devlab/toolchains`
|
|
@@ -201,7 +202,9 @@ write completed. Keep `verify = false` unless the selected board/programming
|
|
|
201
202
|
path explicitly supports flash verification.
|
|
202
203
|
|
|
203
204
|
When sources end in `.vhd` or `.vhdl`, `devlab build` runs Yosys with the
|
|
204
|
-
GHDL plugin before synthesis.
|
|
205
|
+
GHDL plugin before synthesis. `devlab` resolves the plugin from the installed
|
|
206
|
+
OSS CAD Suite tree, for example `share/yosys/plugins/ghdl.so` on Linux, and
|
|
207
|
+
falls back to Yosys' plugin search path if a direct path is not found.
|
|
205
208
|
|
|
206
209
|
Use `--dry-run` to print the commands without executing them:
|
|
207
210
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "devlab-fpga"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.6"
|
|
8
8
|
description = "FPGA development helper for installing OSS CAD Suite and running build/flash flows."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|