-
-
Notifications
You must be signed in to change notification settings - Fork 117
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
Add 'wait for' clause to output-only VHDL models #512
Conversation
This avoids creating an infinite loop as these models do not have any sensitivity lists (i.e., 'inputs') to create the necessary timing.
See #395 |
Thanks for the fix! Merged. |
I haven't touched digital simulations for a long time, but maybe we should use "wait for 0 ns" there? |
Unfortunately, wait for 0 ns fails to simulate using my test setup. I tried wait for 1 fs, but that makes the simulation extremely slow. I will look into if there is another way to minimize the delay without disrupting the simulation.
Is this statement from the GHDL manual as I couldn't find it? It is worth noting that this delay only affects the logic x and nBit Pattern devices which are initialized at the start of the simulation so it is only the first cycle (1 ns) that will be affected. From then on, everything will work normally. I am not sure why the simulator doesn't optimize away the successive cycles, but maybe it performs the whole simulation at the smallest granularity of the design? of course, it may be a problem with my test bench!! |
It’s interesting to understand the question: why did it work in FreeHDL? p.s. maybe this PR is the only and correct solution.. sorry ;) |
Not at all, it's an interesting point! The "wait for" was added in response the problem identified here: #395 (comment) I had a quick look at the GHDL github and all the tests and examples use 1 ns or more. So this may be a problem with GHDL. I'm guessing that 1 ns is thought suitable because it represents a shorter time than most FPGA hardware can transition and therefore is negligible in terms of effect on the overall simulation. |
as mentioned here https://stackoverflow.com/a/70672467 |
Okay, but as I said in my first comment to this PR, there are no inputs to the blocks so I am not sure what would be in the sensitivity list. My understanding is that these Qucs-S blocks are a convenient way to provide a static input (single bit, or bit pattern) - sort of hardwired logic. I suppose we could synthesize a 'start' pulse that is automatically generated at time zero, but this might add complexity and not achieve much! As I mentioned above, the only place that you will see this delay is in the first 1 ns of simulation and that is quicker than the actual hardware anyway ;) |
This avoids creating an infinite loop as these models do not have any sensitivity lists (i.e., 'inputs') to create the necessary timing.
I am not sure if it is right to hard-code the 'wait for', but I can't see that abstracting it to higher up is that helpful either.