vunit-python-bridge 0.3.0__py3-none-any.whl → 0.4.0__py3-none-any.whl
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.
- vunit_python_bridge/__init__.py +9 -24
- vunit_python_bridge/bin/vunit_python_bridge-cp310-win_amd64.dll +0 -0
- vunit_python_bridge/bin/vunit_python_bridge-cp311-win_amd64.dll +0 -0
- vunit_python_bridge/bin/vunit_python_bridge-cp312-win_amd64.dll +0 -0
- vunit_python_bridge/bin/vunit_python_bridge-cp313-win_amd64.dll +0 -0
- vunit_python_bridge/bin/vunit_python_bridge-cp314-win_amd64.dll +0 -0
- vunit_python_bridge/bin/vunit_python_bridge-cp315-win_amd64.dll +0 -0
- vunit_python_bridge/bridge.py +99 -16
- vunit_python_bridge/native_library.py +10 -2
- vunit_python_bridge/simulator_hooks.py +44 -15
- {vunit_python_bridge-0.3.0.dist-info → vunit_python_bridge-0.4.0.dist-info}/METADATA +5 -1
- {vunit_python_bridge-0.3.0.dist-info → vunit_python_bridge-0.4.0.dist-info}/RECORD +15 -15
- {vunit_python_bridge-0.3.0.dist-info → vunit_python_bridge-0.4.0.dist-info}/WHEEL +0 -0
- {vunit_python_bridge-0.3.0.dist-info → vunit_python_bridge-0.4.0.dist-info}/licenses/LICENSE +0 -0
- {vunit_python_bridge-0.3.0.dist-info → vunit_python_bridge-0.4.0.dist-info}/top_level.txt +0 -0
vunit_python_bridge/__init__.py
CHANGED
|
@@ -14,7 +14,8 @@ language interface implementing them for the selected simulator:
|
|
|
14
14
|
|
|
15
15
|
the VUnit Python bridge, a small C library (native/*.c) embedding CPython in the simulator
|
|
16
16
|
process, called through VHPIDIRECT (NVC, GHDL), the FLI (Questa/ModelSim) or VHPI
|
|
17
|
-
(Riviera-PRO).
|
|
17
|
+
(Riviera-PRO). A simulator provided by a VUnit package names its interface itself, see
|
|
18
|
+
bridge.bridge_simulators.
|
|
18
19
|
|
|
19
20
|
Modules:
|
|
20
21
|
|
|
@@ -40,20 +41,6 @@ from .file_base import set_relative_file_base as set_relative_file_base
|
|
|
40
41
|
|
|
41
42
|
VHDL_PATH = Path(__file__).parent.resolve() / "hdl" / "src"
|
|
42
43
|
|
|
43
|
-
# The foreign language interface implementing the package for a simulator. VUnit says which
|
|
44
|
-
# simulator was selected, the package says how it is served: NVC and GHDL both go through
|
|
45
|
-
# VHPIDIRECT but bind the library differently, Questa/ModelSim goes through the FLI and
|
|
46
|
-
# Riviera-PRO through VHPI.
|
|
47
|
-
FOREIGN_LANGUAGE_INTERFACES = {
|
|
48
|
-
"nvc": "VHPIDIRECT_NVC",
|
|
49
|
-
"ghdl": "VHPIDIRECT_GHDL",
|
|
50
|
-
"modelsim": "FLI",
|
|
51
|
-
"rivierapro": "VHPI",
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
# The simulators of the table, named as a user knows them
|
|
55
|
-
SUPPORTED_SIMULATORS = "NVC, GHDL, Questa/ModelSim or Riviera-PRO"
|
|
56
|
-
|
|
57
44
|
|
|
58
45
|
def setup(context):
|
|
59
46
|
"""
|
|
@@ -63,21 +50,18 @@ def setup(context):
|
|
|
63
50
|
foreign language interface of the selected simulator.
|
|
64
51
|
"""
|
|
65
52
|
# pylint: disable=import-outside-toplevel
|
|
66
|
-
from .bridge import setup as setup_bridge
|
|
53
|
+
from .bridge import bridge_simulators, select_simulator, setup as setup_bridge
|
|
67
54
|
from . import simulator_hooks
|
|
68
55
|
|
|
69
56
|
simulator_name = context.simulator_name
|
|
57
|
+
simulators = bridge_simulators(simulator_name)
|
|
70
58
|
if simulator_name is None:
|
|
71
59
|
raise RuntimeError(
|
|
72
|
-
f"The vunit-python-bridge package requires {
|
|
60
|
+
f"The vunit-python-bridge package requires {', '.join(simulators)} but no simulator was found"
|
|
73
61
|
)
|
|
74
62
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
raise RuntimeError(
|
|
78
|
-
f"The vunit-python-bridge package requires {SUPPORTED_SIMULATORS}, "
|
|
79
|
-
f"it has no foreign language interface for {simulator_name}"
|
|
80
|
-
)
|
|
63
|
+
# Before anything is built, so a simulator the bridge cannot serve fails first
|
|
64
|
+
interface = select_simulator(simulators, simulator_name).interface
|
|
81
65
|
|
|
82
66
|
add_file_base_package(context)
|
|
83
67
|
|
|
@@ -87,8 +71,9 @@ def setup(context):
|
|
|
87
71
|
simulator_name,
|
|
88
72
|
context.simulator_prefix,
|
|
89
73
|
context.simulator_backend,
|
|
74
|
+
interface,
|
|
90
75
|
)
|
|
91
76
|
|
|
92
77
|
context.add_source_files(context.library.name, list(bridge.vhdl_files))
|
|
93
78
|
|
|
94
|
-
simulator_hooks.register(context, bridge)
|
|
79
|
+
simulator_hooks.register(context, bridge, simulators)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
vunit_python_bridge/bridge.py
CHANGED
|
@@ -13,7 +13,9 @@ import os
|
|
|
13
13
|
import re
|
|
14
14
|
import sys
|
|
15
15
|
from pathlib import Path
|
|
16
|
-
from typing import List, NamedTuple, Optional
|
|
16
|
+
from typing import Callable, Dict, List, NamedTuple, Optional
|
|
17
|
+
|
|
18
|
+
from vunit.sim_if.factory import SIMULATOR_FACTORY
|
|
17
19
|
|
|
18
20
|
from .native_library import (
|
|
19
21
|
LIBRARY_DIR_VARIABLE,
|
|
@@ -31,10 +33,20 @@ VHDL_SOURCE_PATH = PACKAGE_PATH / "hdl" / "src"
|
|
|
31
33
|
BRIDGE_PACKAGE_TEMPLATE = VHDL_SOURCE_PATH / "python_bridge_pkg.vhd.in"
|
|
32
34
|
CONFIG_FILE_NAME = "vunit_python_bridge.cfg"
|
|
33
35
|
|
|
34
|
-
# The
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
# The foreign language interface of each built-in VUnit simulator. VHPIDIRECT names the library
|
|
37
|
+
# by file name and the simulator hooks make the simulator load it, which GHDL does in its own way.
|
|
38
|
+
BUILTIN_SIMULATORS = {
|
|
39
|
+
"nvc": "VHPIDIRECT",
|
|
40
|
+
"ghdl": "VHPIDIRECT_GHDL",
|
|
41
|
+
"modelsim": "FLI",
|
|
42
|
+
"rivierapro": "VHPI",
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
# What the interface class of a simulator from a VUnit package defines instead, see
|
|
46
|
+
# docs/simulator_packages.rst
|
|
47
|
+
INTERFACE_ATTRIBUTE = "foreign_language_interface"
|
|
48
|
+
HOOKS_ATTRIBUTE = "native_library_hooks"
|
|
49
|
+
PACKAGE_INTERFACES = ("VHPIDIRECT", "FLI", "VHPI")
|
|
38
50
|
|
|
39
51
|
# GHDL backends that link the design ahead of time. For these the library
|
|
40
52
|
# token in the VHPIDIRECT attribute is passed to the linker instead of being
|
|
@@ -47,6 +59,16 @@ FOREIGN_PATTERN = re.compile(r"\{foreign:(\w+)\}")
|
|
|
47
59
|
SUBPROGRAM_PATTERN = re.compile(r"^ (impure function|procedure) (\w+)(\([^)]*\))?( return \w+)?;", re.MULTILINE)
|
|
48
60
|
|
|
49
61
|
|
|
62
|
+
class BridgeSimulator(NamedTuple):
|
|
63
|
+
"""
|
|
64
|
+
How the bridge serves a simulator: its foreign language interface and, for a simulator from a
|
|
65
|
+
VUnit package, the native_library_hooks that make it load the library (None for a built-in one).
|
|
66
|
+
"""
|
|
67
|
+
|
|
68
|
+
interface: str
|
|
69
|
+
native_library_hooks: Optional[Callable]
|
|
70
|
+
|
|
71
|
+
|
|
50
72
|
class PythonBridge(NamedTuple):
|
|
51
73
|
"""
|
|
52
74
|
A prepared bridge: the native library and the generated VHDL.
|
|
@@ -63,6 +85,7 @@ def setup(
|
|
|
63
85
|
simulator_name: Optional[str] = None,
|
|
64
86
|
simulator_prefix: Optional[str] = None,
|
|
65
87
|
simulator_backend: Optional[str] = None,
|
|
88
|
+
interface: Optional[str] = None,
|
|
66
89
|
) -> PythonBridge:
|
|
67
90
|
"""
|
|
68
91
|
Prepare the Python bridge for a project. Called by the package setup function.
|
|
@@ -73,19 +96,18 @@ def setup(
|
|
|
73
96
|
:param simulator_prefix: The path its executables were found in.
|
|
74
97
|
:param simulator_backend: How the installation found there was built, which for GHDL
|
|
75
98
|
is the code generator deciding how the library is bound.
|
|
99
|
+
:param interface: The foreign language interface, see bridge_simulators. None takes it from
|
|
100
|
+
there by simulator name.
|
|
76
101
|
:returns: The bridge. Its vhdl_files are to be added to the package library.
|
|
77
102
|
"""
|
|
78
|
-
if
|
|
79
|
-
|
|
80
|
-
f"The vunit-python-bridge package requires NVC, GHDL, Questa/ModelSim or Riviera-PRO, "
|
|
81
|
-
f"it is not supported for {simulator_name}"
|
|
82
|
-
)
|
|
103
|
+
if interface is None and simulator_name is not None:
|
|
104
|
+
interface = select_simulator(bridge_simulators(simulator_name), simulator_name).interface
|
|
83
105
|
|
|
84
106
|
check_python_build()
|
|
85
107
|
check_windows_64bit_simulator(simulator_name, simulator_prefix)
|
|
86
108
|
|
|
87
|
-
is_fli =
|
|
88
|
-
is_vhpi =
|
|
109
|
+
is_fli = interface == "FLI"
|
|
110
|
+
is_vhpi = interface == "VHPI"
|
|
89
111
|
if (is_fli or is_vhpi) and simulator_prefix is None:
|
|
90
112
|
raise PythonBridgeError(
|
|
91
113
|
f"The {'FLI' if is_fli else 'VHPI'} variant of the bridge is built against the {simulator_name} "
|
|
@@ -105,13 +127,13 @@ def setup(
|
|
|
105
127
|
# and the library, by absolute path since Questa accepts it, for the FLI; the library by
|
|
106
128
|
# absolute path without its suffix, which Riviera-PRO adds, and the entry point registered
|
|
107
129
|
# by native/vhpi.c for VHPI; the VHPIDIRECT library token and the entry point itself for
|
|
108
|
-
#
|
|
130
|
+
# VHPIDIRECT.
|
|
109
131
|
if is_fli:
|
|
110
132
|
foreign = f"fli_{{entry_point}} {library_file!s}"
|
|
111
133
|
elif is_vhpi:
|
|
112
134
|
foreign = f"VHPI {_vhpi_library_token(library_file)} {{entry_point}}"
|
|
113
135
|
else:
|
|
114
|
-
foreign = f"VHPIDIRECT {_vhpidirect_token(
|
|
136
|
+
foreign = f"VHPIDIRECT {_vhpidirect_token(interface, simulator_backend, library_file)} {{entry_point}}"
|
|
115
137
|
bridge_package = root / "vhdl" / "python_bridge_pkg.vhd"
|
|
116
138
|
_write_if_changed(bridge_package, _render_bridge_package(foreign))
|
|
117
139
|
|
|
@@ -125,6 +147,67 @@ def setup(
|
|
|
125
147
|
)
|
|
126
148
|
|
|
127
149
|
|
|
150
|
+
def bridge_simulators(selected: Optional[str] = None) -> Dict[str, BridgeSimulator]:
|
|
151
|
+
"""
|
|
152
|
+
The simulators the bridge serves, by name: the built-in ones and every simulator VUnit knows,
|
|
153
|
+
from a simulator package, whose interface class defines foreign_language_interface and
|
|
154
|
+
native_library_hooks. The simulator packages are added to VUnit before the bridge. Only the
|
|
155
|
+
attributes of the selected simulator are checked, a class defining just one of them is
|
|
156
|
+
otherwise not a simulator the bridge serves.
|
|
157
|
+
"""
|
|
158
|
+
simulators = {name: BridgeSimulator(interface, None) for name, interface in BUILTIN_SIMULATORS.items()}
|
|
159
|
+
for simulator_class in SIMULATOR_FACTORY.supported_simulators():
|
|
160
|
+
interface = getattr(simulator_class, INTERFACE_ATTRIBUTE, None)
|
|
161
|
+
hooks = getattr(simulator_class, HOOKS_ATTRIBUTE, None)
|
|
162
|
+
if interface is None and hooks is None:
|
|
163
|
+
continue
|
|
164
|
+
if simulator_class.name == selected:
|
|
165
|
+
_check_attributes(simulator_class.name, interface, hooks)
|
|
166
|
+
elif interface is None or hooks is None:
|
|
167
|
+
continue
|
|
168
|
+
simulators[simulator_class.name] = BridgeSimulator(interface, hooks)
|
|
169
|
+
return simulators
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def select_simulator(simulators: Dict[str, BridgeSimulator], name: str) -> BridgeSimulator:
|
|
173
|
+
"""
|
|
174
|
+
The simulator of the given name from bridge_simulators.
|
|
175
|
+
"""
|
|
176
|
+
if name not in simulators:
|
|
177
|
+
raise PythonBridgeError(
|
|
178
|
+
f"The vunit-python-bridge package requires {', '.join(simulators)}, or a simulator whose interface "
|
|
179
|
+
f"class says how it loads a native library, which {name} does not. Its simulator interface class must "
|
|
180
|
+
f"define {INTERFACE_ATTRIBUTE} ({', '.join(map(repr, PACKAGE_INTERFACES))}) and "
|
|
181
|
+
f"{HOOKS_ATTRIBUTE}(library_file), see 'Simulator packages' in the vunit-python-bridge documentation."
|
|
182
|
+
)
|
|
183
|
+
return simulators[name]
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def _check_attributes(name: str, interface, hooks) -> None:
|
|
187
|
+
"""
|
|
188
|
+
Check the attributes a simulator interface class defines to be served by the bridge.
|
|
189
|
+
"""
|
|
190
|
+
for defined, missing, value in (
|
|
191
|
+
(INTERFACE_ATTRIBUTE, HOOKS_ATTRIBUTE, hooks),
|
|
192
|
+
(HOOKS_ATTRIBUTE, INTERFACE_ATTRIBUTE, interface),
|
|
193
|
+
):
|
|
194
|
+
if value is None:
|
|
195
|
+
raise PythonBridgeError(
|
|
196
|
+
f"The {name} simulator interface defines {defined} but not {missing}, "
|
|
197
|
+
"the vunit-python-bridge package needs both. Define it in the simulator interface class."
|
|
198
|
+
)
|
|
199
|
+
if interface not in PACKAGE_INTERFACES:
|
|
200
|
+
raise PythonBridgeError(
|
|
201
|
+
f"{INTERFACE_ATTRIBUTE} of the {name} simulator interface is {interface!r}, "
|
|
202
|
+
f"the vunit-python-bridge package knows {', '.join(map(repr, PACKAGE_INTERFACES))}"
|
|
203
|
+
)
|
|
204
|
+
if not callable(hooks):
|
|
205
|
+
raise PythonBridgeError(
|
|
206
|
+
f"{HOOKS_ATTRIBUTE} of the {name} simulator interface is not callable, it must be a static or "
|
|
207
|
+
"class method taking the library file"
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
|
|
128
211
|
def _prepare_library(simulator_prefix: Optional[Path], front_end: Optional[str]) -> Path:
|
|
129
212
|
"""
|
|
130
213
|
Prepare the library in the library directory, failing with a pointer to the variable
|
|
@@ -141,12 +224,12 @@ def _prepare_library(simulator_prefix: Optional[Path], front_end: Optional[str])
|
|
|
141
224
|
) from exc
|
|
142
225
|
|
|
143
226
|
|
|
144
|
-
def _vhpidirect_token(
|
|
227
|
+
def _vhpidirect_token(interface: Optional[str], simulator_backend: Optional[str], library_file: Path) -> str:
|
|
145
228
|
"""
|
|
146
229
|
The library token of the VHPIDIRECT attributes: the file name the simulator dlopen()s,
|
|
147
230
|
or the linker flag of the GHDL backends that link the design ahead of time.
|
|
148
231
|
"""
|
|
149
|
-
if
|
|
232
|
+
if interface == "VHPIDIRECT_GHDL" and simulator_backend in GHDL_LINKING_BACKENDS:
|
|
150
233
|
return "-lvunit_python_bridge"
|
|
151
234
|
return library_file.name
|
|
152
235
|
|
|
@@ -162,6 +162,8 @@ def _check_windows_python() -> None:
|
|
|
162
162
|
# Machine field values of the PE (Windows executable) header
|
|
163
163
|
_PE_MACHINE_X64 = 0x8664
|
|
164
164
|
_PE_MACHINE_NAMES = {_PE_MACHINE_X64: "64-bit x86 (x64)", 0x014C: "32-bit x86", 0xAA64: "ARM64"}
|
|
165
|
+
# The environment variables VUnit reads for the executable of NVC and GHDL
|
|
166
|
+
EXECUTABLE_VARIABLES = {"nvc": "NVC", "ghdl": "GHDL"}
|
|
165
167
|
|
|
166
168
|
|
|
167
169
|
def pe_machine(path: Path) -> Optional[int]:
|
|
@@ -192,8 +194,14 @@ def check_windows_64bit_simulator(simulator_name: str, simulator_prefix: Optiona
|
|
|
192
194
|
if simulator_prefix is None:
|
|
193
195
|
return
|
|
194
196
|
# NVC and GHDL name their executable, which VUnit lets the NVC and GHDL environment variables
|
|
195
|
-
# override, the Questa/ModelSim and Aldec interfaces use vsim
|
|
196
|
-
|
|
197
|
+
# override, the Questa/ModelSim and Aldec interfaces use vsim. The executable of a simulator
|
|
198
|
+
# from a VUnit package is not known here.
|
|
199
|
+
if simulator_name in EXECUTABLE_VARIABLES:
|
|
200
|
+
name = os.environ.get(EXECUTABLE_VARIABLES[simulator_name], simulator_name)
|
|
201
|
+
elif simulator_name in ("modelsim", "rivierapro"):
|
|
202
|
+
name = "vsim"
|
|
203
|
+
else:
|
|
204
|
+
return
|
|
197
205
|
executable = Path(simulator_prefix) / (name if name.lower().endswith(".exe") else f"{name}.exe")
|
|
198
206
|
machine = pe_machine(executable)
|
|
199
207
|
if machine is not None and machine != _PE_MACHINE_X64:
|
|
@@ -21,7 +21,8 @@ import sys
|
|
|
21
21
|
from pathlib import Path
|
|
22
22
|
from typing import Dict, List, Optional
|
|
23
23
|
|
|
24
|
-
from .bridge import GHDL_LINKING_BACKENDS, PythonBridge
|
|
24
|
+
from .bridge import GHDL_LINKING_BACKENDS, HOOKS_ATTRIBUTE, BridgeSimulator, PythonBridge
|
|
25
|
+
from .native_library import PythonBridgeError
|
|
25
26
|
|
|
26
27
|
# The vsim flag keeping the runtime libraries Questa bundles out of the dynamic library
|
|
27
28
|
# search path, and the help category listing every vsim flag.
|
|
@@ -31,32 +32,60 @@ VSIM_HELP_ARGUMENTS = ("-help", "all")
|
|
|
31
32
|
# Read by native/config.c, keep in sync
|
|
32
33
|
CONFIG_FILE_VARIABLE = "VUNIT_PYTHON_BRIDGE_CONFIG"
|
|
33
34
|
|
|
35
|
+
# The keyword arguments of register_simulator_hooks of the VUnit package context
|
|
36
|
+
HOOK_KINDS = ("elab_flags", "run_flags", "process_flags", "run_env")
|
|
34
37
|
|
|
35
|
-
|
|
38
|
+
|
|
39
|
+
def register(context, bridge: PythonBridge, simulators: Dict[str, BridgeSimulator]) -> None:
|
|
36
40
|
"""
|
|
37
|
-
Register the hooks of every simulator
|
|
41
|
+
Register the hooks of every built-in simulator with the package context. The hooks the selected
|
|
42
|
+
simulator interface gives by native_library_hooks replace the built-in ones.
|
|
38
43
|
"""
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"ghdl",
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
)
|
|
44
|
+
hooks = {
|
|
45
|
+
"nvc": dict(run_flags=_nvc_run_flags(bridge), run_env=_config_run_env(bridge)),
|
|
46
|
+
"ghdl": dict(elab_flags=_ghdl_elab_flags(bridge), run_env=_ghdl_run_env(bridge)),
|
|
47
|
+
"modelsim": dict(process_flags=_modelsim_process_flags(), run_env=_config_run_env(bridge)),
|
|
48
|
+
}
|
|
49
|
+
selected = simulators.get(context.simulator_name)
|
|
50
|
+
if selected is not None and selected.native_library_hooks is not None:
|
|
51
|
+
hooks[context.simulator_name] = _package_hooks(context.simulator_name, selected.native_library_hooks, bridge)
|
|
52
|
+
for simulator_name, kinds in hooks.items():
|
|
53
|
+
context.register_simulator_hooks(simulator_name, **kinds)
|
|
48
54
|
if context.simulator_name == "rivierapro":
|
|
49
55
|
# Its interface has no run environment hook, but starts vsim with the environment of this
|
|
50
56
|
# process, after the setup
|
|
51
57
|
os.environ[CONFIG_FILE_VARIABLE] = str(bridge.config_file)
|
|
52
58
|
|
|
53
59
|
|
|
54
|
-
def
|
|
60
|
+
def _package_hooks(simulator_name: str, native_library_hooks, bridge: PythonBridge) -> Dict:
|
|
61
|
+
"""
|
|
62
|
+
The hooks of a simulator interface loading the library, with the configuration added to its
|
|
63
|
+
run environment.
|
|
64
|
+
"""
|
|
65
|
+
hooks = native_library_hooks(bridge.library_file)
|
|
66
|
+
if not isinstance(hooks, dict):
|
|
67
|
+
raise PythonBridgeError(
|
|
68
|
+
f"{HOOKS_ATTRIBUTE} of the {simulator_name} simulator interface returned {type(hooks).__name__}, "
|
|
69
|
+
f"it must return a dict with any of the keys {', '.join(HOOK_KINDS)}"
|
|
70
|
+
)
|
|
71
|
+
unknown = sorted(str(kind) for kind in hooks if kind not in HOOK_KINDS)
|
|
72
|
+
if unknown:
|
|
73
|
+
raise PythonBridgeError(
|
|
74
|
+
f"{HOOKS_ATTRIBUTE} of the {simulator_name} simulator interface returned the unknown keys "
|
|
75
|
+
f"{', '.join(unknown)}, the keys are {', '.join(HOOK_KINDS)}"
|
|
76
|
+
)
|
|
77
|
+
return dict(hooks, run_env=_config_run_env(bridge, hooks.get("run_env")))
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def _config_run_env(bridge: PythonBridge, simulator_run_env=None):
|
|
55
81
|
"""
|
|
56
|
-
Tell the bridge library where the configuration of the project is
|
|
82
|
+
Tell the bridge library where the configuration of the project is, on top of the environment
|
|
83
|
+
a simulator_run_env hook gives.
|
|
57
84
|
"""
|
|
58
85
|
|
|
59
|
-
def hook(simulator_interface, env: Dict[str, str]) -> Dict[str, str]:
|
|
86
|
+
def hook(simulator_interface, env: Dict[str, str]) -> Dict[str, str]:
|
|
87
|
+
if simulator_run_env is not None:
|
|
88
|
+
env = simulator_run_env(simulator_interface, env)
|
|
60
89
|
env = dict(env)
|
|
61
90
|
env[CONFIG_FILE_VARIABLE] = str(bridge.config_file)
|
|
62
91
|
return env
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vunit-python-bridge
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: A VUnit package making Python callable from VHDL.
|
|
5
5
|
Author-email: Lars Asplund <lars.anders.asplund@gmail.com>
|
|
6
6
|
License-Expression: MPL-2.0
|
|
@@ -96,6 +96,10 @@ check(call_integer_vector("gain", arg(integer_vector'(1, 2))) = integer_vector'(
|
|
|
96
96
|
| Questa/ModelSim | FLI | Tested manually on Linux; the Windows build is untested |
|
|
97
97
|
| Riviera-PRO | VHPI | Tested manually on Linux and Windows |
|
|
98
98
|
|
|
99
|
+
A simulator provided by a VUnit package says how it loads the bridge
|
|
100
|
+
itself, by two attributes of its simulator interface class: see
|
|
101
|
+
[Simulator packages](https://vunit-python-bridge.readthedocs.io/en/latest/simulator_packages.html).
|
|
102
|
+
|
|
99
103
|
## Requirements
|
|
100
104
|
|
|
101
105
|
- VUnit 5.0.0.dev15 or later (`vunit_hdl` on PyPI), which pip installs with the package.
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
vunit_python_bridge/__init__.py,sha256=
|
|
2
|
-
vunit_python_bridge/bridge.py,sha256=
|
|
1
|
+
vunit_python_bridge/__init__.py,sha256=3YLbTXiMC0KSBhayw_q2rXNi3O1GMaviINSAnHi7EeU,3036
|
|
2
|
+
vunit_python_bridge/bridge.py,sha256=wnWAmtxW77-uyzAAacHkqCU-YGGuM1DZW1yKweCT3rE,12779
|
|
3
3
|
vunit_python_bridge/file_base.py,sha256=yWWN-z7GWPnWMLuqIyUMSRWfax_6W0i92pA0nrh2qTY,4730
|
|
4
|
-
vunit_python_bridge/native_library.py,sha256=
|
|
4
|
+
vunit_python_bridge/native_library.py,sha256=DUH4MYaPSHO-FtvX7_1UsVIpgLSWArPOU8Urv1rGa20,25340
|
|
5
5
|
vunit_python_bridge/runtime.py,sha256=iEK0JhKajaOSdOUvvhqD2tF0rFm4bPIKqpr5CYgSmRs,32962
|
|
6
|
-
vunit_python_bridge/simulator_hooks.py,sha256=
|
|
6
|
+
vunit_python_bridge/simulator_hooks.py,sha256=syBITFpv5pE7ZKbHIM4vTwo8wGhF9AfhNa-Obs0xNdI,7599
|
|
7
7
|
vunit_python_bridge/vunit_pkg.toml,sha256=8AO9wJFWqIGbWU8FLWAHL8vtfeYuD3D0FllilXVXmVE,660
|
|
8
|
-
vunit_python_bridge/bin/vunit_python_bridge-cp310-win_amd64.dll,sha256=
|
|
9
|
-
vunit_python_bridge/bin/vunit_python_bridge-cp311-win_amd64.dll,sha256=
|
|
10
|
-
vunit_python_bridge/bin/vunit_python_bridge-cp312-win_amd64.dll,sha256
|
|
11
|
-
vunit_python_bridge/bin/vunit_python_bridge-cp313-win_amd64.dll,sha256=
|
|
12
|
-
vunit_python_bridge/bin/vunit_python_bridge-cp314-win_amd64.dll,sha256=
|
|
13
|
-
vunit_python_bridge/bin/vunit_python_bridge-cp315-win_amd64.dll,sha256=
|
|
8
|
+
vunit_python_bridge/bin/vunit_python_bridge-cp310-win_amd64.dll,sha256=ZPlJVI3URk2el4ssMiP18JoDQSlX-qOlG-XXIWWahUI,26624
|
|
9
|
+
vunit_python_bridge/bin/vunit_python_bridge-cp311-win_amd64.dll,sha256=j9o0XEqBy8GsYAzojEW8wgr6OURBoELTi5koauWXNEg,26624
|
|
10
|
+
vunit_python_bridge/bin/vunit_python_bridge-cp312-win_amd64.dll,sha256=-qrU8d8diewTjYGB5wLPlSlMQw2HcOeXLiKJBfoRqF0,26624
|
|
11
|
+
vunit_python_bridge/bin/vunit_python_bridge-cp313-win_amd64.dll,sha256=jfLkgU4rjk3qZLxLTFCqCGd2m7calq16Z6mcaAEeaS0,26624
|
|
12
|
+
vunit_python_bridge/bin/vunit_python_bridge-cp314-win_amd64.dll,sha256=yK1rPbDBxyhltVDUHIbxVdPW3MX2uESZRDnmcsQus34,26624
|
|
13
|
+
vunit_python_bridge/bin/vunit_python_bridge-cp315-win_amd64.dll,sha256=NiXLTCHla_aCAKEkWxlFKrpKwX4zt6Mne-p_MMTB5OE,26624
|
|
14
14
|
vunit_python_bridge/hdl/src/python_bridge_pkg.vhd.in,sha256=0Nqy9w2S5PuJVEYhgoiyUi9I3n_kz12iXmCYHA8eEBM,4811
|
|
15
15
|
vunit_python_bridge/hdl/src/python_context.vhd,sha256=IE9dVRfPiA9tDVPW82hYltu5z3ZUczJIC4S3Hk_z9z4,522
|
|
16
16
|
vunit_python_bridge/hdl/src/python_ffi_pkg_bridge.vhd,sha256=WdbcNm6NqKGpXrGDwEHg_7d6n5DBqVw7atCUFy2J83U,19859
|
|
@@ -27,8 +27,8 @@ vunit_python_bridge/native/fli.c,sha256=Half7fS8BA9X3n1jjpRAsUOoNDWEqhUT4WVfn_d-
|
|
|
27
27
|
vunit_python_bridge/native/interpreter.c,sha256=Ey6S6NZdCGs32G43jnOnAoS04RhSwJZoGGFGlaG0CBw,8222
|
|
28
28
|
vunit_python_bridge/native/operations.c,sha256=8hDC4iHcYOcy9Ijh564OKEx80eoJ7GDnlbPJX4hII1g,7271
|
|
29
29
|
vunit_python_bridge/native/vhpi.c,sha256=jnoHXIavPWC8wmAZwUvM-w7sDiptXxlHWlntVgmie2s,9208
|
|
30
|
-
vunit_python_bridge-0.
|
|
31
|
-
vunit_python_bridge-0.
|
|
32
|
-
vunit_python_bridge-0.
|
|
33
|
-
vunit_python_bridge-0.
|
|
34
|
-
vunit_python_bridge-0.
|
|
30
|
+
vunit_python_bridge-0.4.0.dist-info/licenses/LICENSE,sha256=Pz2eACSxkhsGfW9_iN60pgy-enjnbGTj8df8O3ebnQQ,16726
|
|
31
|
+
vunit_python_bridge-0.4.0.dist-info/METADATA,sha256=QxqywUZ1ZDM16QwBTzUbL5Iixe3s4PEiyzPhIwDtNoE,5741
|
|
32
|
+
vunit_python_bridge-0.4.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
33
|
+
vunit_python_bridge-0.4.0.dist-info/top_level.txt,sha256=abj4noIVQMKaPr2m8kPPxH6RSYadeXKc0Ho2uilmlEg,20
|
|
34
|
+
vunit_python_bridge-0.4.0.dist-info/RECORD,,
|
|
File without changes
|
{vunit_python_bridge-0.3.0.dist-info → vunit_python_bridge-0.4.0.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|