-
Notifications
You must be signed in to change notification settings - Fork 530
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
starting from version 10.0 when signals are set from VPI they updated but their combination is not #223
Comments
I don't see that this is a bug. Setting the values of a and b adds an update event for c to the stratified event queue. Setting the value of clk triggers the @(posedge clk), which adds an evaluation event for that process to the stratified event queue. The simulator is allowed to execute those events in any order. |
@martinwhitaker sorry, I made a mistake and my above minimal reproducible example does not work both on v0.9.7 and v10.0. I have updated my example in https://gitlab.com/vvavrychuk/vpi-issue and now on v10.0 it gives
and on v0.9.7 it gives
Maybe this changes something? Let me explain how my minimal reproducible example is done now. Now my clock is coming from Verilog so that
Helper functions
In clock change event I check that I get high value and change
I think behaviour of v10.0 is not correct because I use |
The IEEE standard doesn't specify the scheduling behaviour for vpi_put_value with a delay. Icarus schedules it as an active update event in the appropriate time slot. If I had implemented it, I would have chosen to make it a nonblocking assign update event, but I can't say the current Icarus behaviour is wrong. So, your "clk = 1" assignment adds active update events for a and b to the event queue and also adds an active evaluation event for the always @(posedge clk) process to the event queue. The simulator may choose to process these events in any order. If it chooses to process the @(posedge clk) event first, the display output will be "a = 0, b = 0, c = 0". If however it processes the a and b update events first, these will cause an active evaluation event for the "a & b" expression to be added to the event queue. The simulator now has the choice of processing either the @(posedge clk) event or the "a & b" evaluation event. If it chooses to process the @(posedge clk) event first, the display output will be "a = 1, b = 1, c = 0". If however it processes the "a & b" evaluation event, this will add an active update event for c to the event queue. The simulator now has the choice of processing either the @(posedge clk) event or the c update event. If it chooses to process the @(posedge clk) event first, the display output will be "a = 1, b = 1, c = 0". If however it processes the c update event first, the display output will be "a = 1, b = 1, c = 1". Extending the above to process the a and b update events either side of the @(posedge clk) event, the range of permissible outputs becomes
|
@martinwhitaker consider usual case of device under test in Verilog and testbench that includes VPI, or SystemC which interfaces Verilog though VPI (as it is done for example here https://github.com/ultraembedded/cores/tree/master/uart/testbench). I shown it on diagram: Both parts are synchronized by clock. If we set some data from VPI synchronously to the clock and then DUT synchronosly to the same clock gets some data updated but an combinatorial function of them not update then we can not implement this testbench in VPI. You say
That seems exactly what is needed. Could you please suggest if there is a way from VPI side to influence that. |
Can you see this https://github.com/GLADICOS/SPACEWIRESYSTEMC |
I think this is a conversation best had on the iverilog-devel mailing list.
…On Tue, Feb 5, 2019 at 10:36 AM Felipe Fernandes da Costa < ***@***.***> wrote:
hello. Can you see this https://github.com/GLADICOS/SPACEWIRESYSTEMC
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#223 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAlMlqgUJDpEaJBO0A0uOxVw-DK06D2ks5vKc88gaJpZM4ZnAiL>
.
--
Steve Williams "The woods are lovely, dark and deep.
[email protected] <[email protected]> But I have promises
to keep,
http://www.icarus.com and lines to code before I sleep,
http://www.picturel.com And lines to code before I sleep."
|
I was able to solve my problem by using system task function to advance VPI simulation
Idea used in @red0bear. It works (as expected) only when I use
But if I use
Full code is in https://gitlab.com/vvavrychuk/vpi-issue/tree/advance-using-system-tf. Still not sure that it will work forever and will not break with some Icarus Verilog version. Because as it is was explained by @martinwhitaker Icarus Verilog is free to choose between added So only correct solution for me seems to use non-zero inertial delay when changing values from VPI code. |
I have found that starting from v10.0 iverilog/vvp can delay updating signals combination when signals are set from VPI. This issue is not present in v0.9.7.
This is happening only in certain case. I prepared minimal reproducible example below. It is also available in https://gitlab.com/vvavrychuk/vpi-issue.
This issue makes some testbenches, for example https://github.com/ultraembedded/cores/tree/master/uart, not working on newer Icarus Verilog (ultraembedded/cores#4).
I use following Verilog code for test
In VPI code on simulation start I set initial values and schedule timer
In timer handler I set other values
As result I get
when running simulation.
Helper functions used in VPI are:
The text was updated successfully, but these errors were encountered: