-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vvp hangs forever on msys2 but does not on linux #1157
Comments
If you put in an RTL proxy for the AND gate does it work as expected on windows? Do you know that the missing path message is benign? Also, __USE_MINGW_ANSI_STDIO is only needed for the msys2 environments that link against MSVCRT. The ucrt64 environment uses, as the name implies, UCRT which does not have the stdio limitations that the mingw environment works around when __USE_MINGW_ANSI_STDIO is used. The downside is UCRT is only installed on windows 10 and later by default. I am working on updates for Icarus where it only uses __USE_MINGW_ANSI_STDIO for the environments that use MSVCRT. |
Another thought, can you use gdb to detect where things are hanging? |
I am incompetent with gdb but this is my experience:
after "../common/and_gate_tb.v:53: $finish called at 114000 (1ps)" I tried to ctrl+c, various times to type bt, but it just creates new threads and blocks me from finding the backtrace lol, every tme I type ctrl+c, a new thread gets spawned. |
That's likely a clue. Do we need to have verilator installed to test this or are the files you provided enough to reproduce? I assume we need verilator for header files, etc. Since GDB is not working I think we'll have to insert debug print statements at various places in the exit code to figure out where things break. I'm busy for a while so will not have time to do this myself until later. |
Yes verilator is necessary is essentially a verilator compiled AND gate simulated through VPI, in Windows I simply use msys2 packaged verilator |
I tried to install verilator to see if I could get an environment that reproduced the issue:
then tried verilator and it fails:
Running it directly from the share directory seems to work:
any ideas? I don't really have time to debug why verilator is failing. There were other issues, but I think they are all related (e.g. --help failed out of share). |
Oh I'm not the only one, how are you running verilator from? Are you using normal windows terminal? I'll make a big report to msys and probably to verilator, I had a similar issue but only when sshing into Windows not when running it from the GUI terminal |
Yeah we get the same error.. I'll just report it to msys2 I used this workaround verilator/verilator@f56f318#commitcomment-145180536 |
I'm working directly on the machine and using the MSYS2 UCRT64 configured shell from the install. I'm able to build This seems like it could be an Here's the message when I try to run
|
Are you running windows 11? |
Nope, still running 10 on this particular machine. |
reported, msys2/MINGW-packages#21706 thank you |
FYI the following are the steps I did to generate the UCRT64 environment that is failing to run verilator: Install msys2 pacman -S mingw-w64-ucrt-x86_64-gcc |
There was an update to the msys2 verilator that now allows me to run the test. During debugging I ran into a couple issues. You do not need the -M or -m options you are passing to The real issue appears to be that windows is hanging while trying to unload the AND DLL. This is outside iverilog so I'm not certain what to do. It likely will require more debug and it does work correctly for the iverilog DLLs so it's likely something related to the way you are building the DLL from Here's a simple patch that I used to show which DLLs are loaded and their address and then which DLL is being closed. It clearly shows the system hanging while trying to unload the AND gate DLL.
|
Also, we recommend using |
Some searching shows that if the DLL is waiting on process input it will hang so maybe you need to create an EndOfSimulation call back to make sure everything in the DLL is shutdown and cleaned up correctly so it can be closed correctly. Linux likely just forces everything to close, though if you run valgrind it will likely show memory that was not freed correctly at exit. If you can find something that indicates this is an iverilog issue please let us know. I marked this |
Ah yes that was me, my "fix" was to use cygwin perl instead of native windows perl, no one was happy with that, but it seemed to solve the problem for the short term.
I tried to use iverilog-vpi while that worked for linux, on windows it refused to accept other files external to it, like headers, or external .dlls 🤷 on windows so I tried to do it myself. Hmm you are saying this could be a verilator bug on windows? It seems however that when I only use verilator, there is no issue unloading the dll? I have to say thank you for looking into this. Thank you so much. |
FYI
I'm not sure I would call this a |
Thank you, I'll take a look at it when I have time. I am not a verilator dev, so not sure about how the verilator flow works exactly, maybe I just need to spend more time fiddling with things. |
Can you file a PR against Though a detailed description of what you did to link the tools is a good place to start so we can understand what is |
Any progress seeing if there is custom code or verilator generated code that is causing the DLL to not be closed correctly? |
Hi, I'll work on it, Thanks for the reminder |
Hello, so I tried to use master branch instead of the release branch and I get the following error while executing vvp:
Any ideas? |
This was code added by our GSOC student last year. It's possible this was just ignored previously. I would need to look at the development code in more detail to know how to work around this. Do you have a code snippet for this or is it in the code you originally provided? |
I looked at the standard quickly and it looks like |
I am doing cosimulation between verilator and icarus on both linux and windows (You need 5.026 of verilator), gcc
Essentially vvp finishes the testbench and blocks forever, for some reason.
This is the minimal reproduction. https://gist.github.com/Kreijstal/ac8dff5de2b771fc6ccde9db433d73d1
On linux you get
On windows however
But vvp hangs forever! infinite loop?
The text was updated successfully, but these errors were encountered: