Closed chevillotn closed 9 months ago
At first glance that should be reasonably straightforward.
The current task is in cocotb.scheduler._current_task
and the coroutine is in task._coro
. You don't seem to need much more than that, though I suspect the devil in in the details …
Also, you should send a PR to cocotb to support sniffio
.
Thanks for the reply. I will do some tests on my side with sniffio
and local cocotb
.
I have patched cocotb
to inform sniffio
what the task is and patched also greenback
to support cocotb
similar to how asyncio
is implemented.
The good thing is that i can use the greenback
feature now with cocotb
! (with patches...)
So indeed it was quite straight forward, very neat implementation you did here!
I will raise an issue to cocotb
to implement the sniffio
and current_task
such that something can be done on greenback
side if you agree?
I have opened an issue with cocotb: https://github.com/cocotb/cocotb/issues/3650
Hi, Actualluy cocotb already provides a mechanism to do exactly the same as what greenback does. So i have been using this instead and that works fine. Therefore there is no need to add cocotb support to greenback. Thanls for your support!
Hi,
I am trying to port synchronous python code to asynchronous with the minimum amount of effort. This code contains about thousand functions with thousand calls which make it annoying to properly port as this requires adding
async
/await
keywords everywhere.greenback
framework looks like to be exactly what i need. I've tested it usingasyncio
and that fulfills my needs. However i want to use this not withtrio
orasyncio
but withcocotb
which is also an asynchronous IO framework but running in a special HDL simulator, in this casemoselsim
/questasim
. This is for embedded electronics development on FPGAs.When using
greenback
as described in the documentation i get the early complaint that it is not supported.I am wondering how much effort it is to enable support of a new asynchronous IO framework for
greenback
and what that means exactly. I would assumecocotb
is very closely related toasyncio
but that's only an assumption.cocotb
documentation/sources can be found here: https://www.cocotb.org/ https://github.com/cocotb/cocotbIf you can provide some help would be very useful. Thanks Nicolas