Skip to content

Commit 35febb0

Browse files
committed
Updates for 0.0.3 release
Signed-off-by: Matthew Ballance <[email protected]>
1 parent bffd44f commit 35febb0

File tree

6 files changed

+20
-9
lines changed

6 files changed

+20
-9
lines changed

doc/ChangeLog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11

2+
## 0.0.3
3+
- (#29) - Resolve issues with tasks and Python GIL
4+
- (#22) - Resolve return value issue
5+
- () - Add support for AMD Xilinx Xsim simulator
6+
- () - Move tests over to use the DV Flow Manager PyTest extension
7+
28
## 0.0.2
39
- (#25) - Correct issue passing string-type parameters
410

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import sysconfig
77
from setuptools import Extension, setup, find_namespace_packages
88

9-
version="0.0.2"
9+
version="0.0.3"
1010

1111
proj_dir = os.path.dirname(os.path.abspath(__file__))
1212
pythondir = os.path.join(proj_dir, "src")

src/hdl_if/impl/call/call_proxy_dpi.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ async def invoke_hdl_t(
4646
from hdl_if.backend import Backend
4747
be = Backend.inst();
4848
evt = be.mkEvent()
49-
# param = (method_name,)
5049
param = method_name
5150

5251
self.ep.invoke_hdl_t(self.obj_id, evt, param, args)

src/hdl_if/impl/call/gen_sv_class.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,9 +386,10 @@ def gen_tf_impl(self, m : MethodDef):
386386
def gen_task_dispatch(self, api):
387387
self.println("virtual task invokeTask(")
388388
self.inc_ind()
389-
self.println("output pyhdl_if::PyObject retval,")
390-
self.println("input string method,")
391-
self.println("input pyhdl_if::PyObject args);")
389+
self.println("output pyhdl_if::PyObject retval,")
390+
self.println("inout pyhdl_if::PyGILState_STATE state,")
391+
self.println("input string method,")
392+
self.println("input pyhdl_if::PyObject args);")
392393
self.dec_ind()
393394
self.println()
394395
self.inc_ind()
@@ -410,6 +411,7 @@ def gen_task_dispatch(self, api):
410411
self.py2sv_func(p[1]),
411412
i
412413
))
414+
self.println("pyhdl_if::PyGILState_Release(state); // Release the GIL before invoking the task")
413415
self.write("%s" % self._ind)
414416
self.write("%s" % m.name)
415417
if len(m.params) == 0:
@@ -429,6 +431,9 @@ def gen_task_dispatch(self, api):
429431
"," if (i+1 < len(m.params)) else ");"
430432
))
431433
self.dec_ind()
434+
435+
self.println("state = pyhdl_if::PyGILState_Ensure(); // Reacquire the GIL after invoking the task")
436+
432437
if m.rtype is not None:
433438
self.println("retval = %s;" % self.sv2py_func(m.rtype, "__retval"))
434439
self.dec_ind()

src/hdl_if/share/dpi/pyhdl_if_icall_api.svh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ interface class ICallApi;
2525
PyObject args);
2626

2727
pure virtual task invokeTask(
28-
output PyObject retval,
29-
input string method,
30-
input PyObject args);
28+
output PyObject retval,
29+
inout PyGILState_STATE state,
30+
input string method,
31+
input PyObject args);
3132

3233
endclass

src/hdl_if/share/dpi/pyhdl_if_taskcall_closure.svh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class TaskCallClosure implements PyHdlPiRunnable;
2727
evt_obj_set = PyObject_GetAttrString(m_evt_obj, "set");
2828
args = PyTuple_New(1);
2929

30-
m_obj.invokeTask(res, m_method_name, m_args);
30+
m_obj.invokeTask(res, state, m_method_name, m_args);
3131

3232
if (res == null) begin
3333
res = None;

0 commit comments

Comments
 (0)