Skip to content

Commit 978fa64

Browse files
ivanvigolofk
authored andcommitted
Added new envvars needed for cocotb
1 parent fa90950 commit 978fa64

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

edalize/flows/edaflow.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ def __init__(self, edam, work_root, verbose=False):
293293

294294
self.work_root = work_root
295295

296+
self.verbose = verbose
296297
self.stdout = None
297298
self.stderr = None
298299

edalize/flows/sim.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,22 @@ def run(self, args=None):
7878

7979
# Get run command from simulator
8080
(cmd, args, cwd) = run_tool.run()
81+
82+
# Get required cocotb env data
83+
prev_verbose = self.verbose
84+
self.verbose = False
85+
_, libpy, _ = self._run_tool("cocotb-config", ["--libpython"], quiet=True)
86+
_, pybin, _ = self._run_tool("cocotb-config", ["--python-bin"], quiet=True)
87+
self.verbose = prev_verbose
88+
8189
cocotb_module = self.flow_options.get("cocotb_module")
8290
env = (
83-
{"MODULE": cocotb_module, "COCOTB_TEST_MODULES": cocotb_module}
91+
{
92+
"COCOTB_TEST_MODULES": cocotb_module,
93+
"MODULE": cocotb_module, # Keep for compatibility with cocotb < v2.0
94+
"LIBPYTHON_LOC": libpy.decode("utf-8").strip(),
95+
"PYGPI_PYTHON_BIN": pybin.decode("utf-8").strip(),
96+
}
8497
if cocotb_module
8598
else {}
8699
)

0 commit comments

Comments
 (0)