Skip to content
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

vpi memory iterator #655

Closed
veripoolbot opened this issue Jun 5, 2013 · 9 comments
Closed

vpi memory iterator #655

veripoolbot opened this issue Jun 5, 2013 · 9 comments
Labels
resolution: fixed Closed; fixed type: feature-IEEE Request to add new feature, described in IEEE 1800

Comments

@veripoolbot
Copy link
Contributor


Author Name: Rich Porter
Original Redmine Issue: 655 from https://www.veripool.org
Original Date: 2013-06-05
Original Assignee: Rich Porter


I think that the iterator returned by vpi_iterate with a type of vpiMemoryWord is incorrect. The diagram in IEEE 1364, 26.6.9 suggests a memory word iterator is returned not a range iterator as in the current implementation.

26.6.7 suggests that a range object iterator is returned when a reg array is iterated on with vpiRange.

I compiled a test case with a 4 state simulator (cver) that returned a memory word iterator with vpiMemoryWord and not a range, but as it does not support reg arrays I was unable to verify the range iterator.

There is a proposed fix on the branch vpi-memory at https://github.com/rporter/verilator, see

rporter/verilator@master...vpi-memory

It also adds some properties e.g. vpiSize, vpiIndex as well as vpiScope and vpiParent to variable objects.

If you think this is correct I'll add a new testcase.

And I think that VerilatedVpioVarIndex be renamed to VerilatedVpioMemoryWord.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2013-06-06T22:29:17Z


The bug seems reasonable. The test case wasn't in your branch though so I couldn't test it to make sure.

I'm not sure why you need the lhs()/rhs() functions to be in so many classes or virtual. I think this will cause problems later as want to move to supporting more complex data types and a var itself doesn't have a single simple range.

BTW I know it was my fault originally for using lsb/msb, but we should use lo/hi/left/right for function terminology match what IEEE says. If it won't mess you up I can do a simple replace in trunk with no functional change to clean that up.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Rich Porter
Original Date: 2013-06-12T20:10:13Z


I've added a test case to the branch - test_regress/t_vpi_memory, the other test case I mentioned previously was just a throw away piece of code but can supply if you really want.

The only simulator I have access to is icarus, I've been trying to get the vpi test to run on icarus but not done it yet. I'll be happier if it agrees.

I haven't updated t_vpi_var testcase as it now fails because it expects vpiMemoryWord to return a range object (the old behaviour).

Don't know how I ended up with lhs()/rhs() - probably the way VerilatedVpioRange was constructed. What is required is a range() encapsulation of these (I've changed VerilatedVpioRange so it has a range reference instead). The range() method is still in the same places and virtual, though - follows the same pattern as the other accessors.

You will know the scope of the changes better than I for the search & replace. Commit the update & I'll merge it to the this branch.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Rich Porter
Original Date: 2013-06-13T10:12:39Z


I've ported the t_vpi_memory test to iverilog, and it passes for both verilator and iverilog which increases my confidence in the vpi changes.

Sorry about any bastardisation to driver.pl; I've never really used perl, and didn't have time to really understand any nuances in how that script works.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2013-06-13T11:06:29Z


Great, I'll merge your changes then do the other name cleanup.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2013-06-13T12:06:51Z


Pushed to git towards 3.851. Thanks again for patching!

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Rich Porter
Original Date: 2013-06-17T19:51:24Z


I've ported the t_vpi_memory test to iverilog, and it passes for both verilator and iverilog which increases my confidence in the vpi changes.

Sorry about any bastardisation to driver.pl; I've never really used perl, and didn't have time to really understand any nuances in how that script works.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Rich Porter
Original Date: 2013-06-17T19:57:06Z


Oooops. Didn't mean to repost that last comment. Sorry.

But while I'm here I'll point out that the t_vpi_var issue wasn't fixed in the patch that you pulled. I don't know if you ran a full regression but if you did you'll have seen it didn't pass? Don't pull what's currently there because I've got lost trying to get t_vpi_var to work for icarus too.

Do you want me to patch t_vpi_var? Let me know & I'll tell you when you can pull the patch.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2013-06-17T20:29:02Z


I had just made t_vpI_var match the return values, assuming your fixes were ok. If that's not right a fix would be appreciated.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2013-08-13T10:10:56Z


Fixed a while ago.

@veripoolbot veripoolbot added resolution: fixed Closed; fixed type: feature-IEEE Request to add new feature, described in IEEE 1800 labels Dec 22, 2019
tgorochowik pushed a commit to antmicro/verilator that referenced this issue Feb 29, 2024
…uhdm-tests/serv/serv-e59fe53

Bump uhdm-tests/serv/serv from `f04a510` to `e59fe53`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution: fixed Closed; fixed type: feature-IEEE Request to add new feature, described in IEEE 1800
Projects
None yet
Development

No branches or pull requests

1 participant