def execute_function(self, event): coro = cocotb.coroutine(self._func)(*args, **kwargs) try: _outcome = outcomes.Value((yield coro)) except BaseException as e: _outcome = outcomes.Error(e) event.outcome = _outcome event.set()
def __init__(self, func): self._coro = cocotb.coroutine(func)
def decorator(self, func): return cocotb.coroutine(func)
def execute_function(self, event): event.result = yield cocotb.coroutine(self._func)(*args, **kwargs) event.set()
def coroutine(func): if using_cocotb(): wrapped = cocotb.coroutine(func) return wrapped else: return func