Replies: 2 comments 4 replies
-
Hi Toni, thanks for reaching out. Happy you see ways to make the project work for you! In order to run as a single thread, PyHDL-IF would need to be architected in a very different way with respect to how it uses the simulator's DPI interface. And, the rearchitecture would restrict to always only running a single thread. Many testbench environments will need to deal with more than one device interface, and these environments require multiple threads. Consequently, coroutines really are required any time behavior on the Python side must consume simulation time -- for example, start a bus cycle and wait for it complete. Now, it certainly is possible to use Python in a non-blocking way from SystemVerilog. A common use case would be implementing a scoreboard in Python. Any time new data comes in on the SystemVerilog side, SV calls Python and passes the data. Since the scoreboard simply reacts to the data, these calls need not be async/coroutine calls. Hope this helps! Best Regards, Matthew |
Beta Was this translation helpful? Give feedback.
-
Thanks for the the example, @anrusal . It seems to me that you might be looking for a way to leverage existing code in a way that works with PyHDL-IF without requiring changes (eg add await) to that code. If that's the case, let's try to find an adapter that we can use to connect the existing code to PyHDL-IF. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi @mballance ,
First thing congratulations for this project, I find it amazing and I think it could be very usefull for so many different use cases.
One of the usecases that I am actually analysing is use this as a way to run directly python scripts without needing to use async/await in the script.
Please correct me if I am wrong but the only reason you would need coroutines in a script would be in a scenarion where Python needs to generate stimulus to the DUT in paralel like driving a clock and then waiting the script to generate a transaction perhaps on a bus. On this scenario it makes sense to me to pause the execution of the threads and let the scheduler to generate stimulus in parallel.
However most of the "normal" scripts that interact with real hardware don't need multi-threading or any other multi-task mechanism since you just interact with the real hardware using a single thread. I wonder if pyhdl-if could be use on something like a UVM driven environment in which Python just works as a single thread stimulus generation for transactions while all the other taks are carried out by the SV/UVM envionment wihtout requiring to use the annoying async/await coroutine calls.
Regards, Toni
Beta Was this translation helpful? Give feedback.
All reactions