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

Different versions of GCC cause Verilator generated models to succeed or fail #651

Closed
veripoolbot opened this issue May 23, 2013 · 2 comments
Closed

Comments

@veripoolbot
Copy link

@veripoolbot veripoolbot commented May 23, 2013


Author Name: Jeremy Bennett (@jeremybennett)
Original Redmine Issue: 651 from https://www.veripool.org
Original Date: 2013-05-23
Original Assignee: Jeremy Bennett (@jeremybennett)


We've recently run into a design where the choice of GCC version when building Verilator, causes different behavior in generated models. In particular we have one design, where a Verilator compiled with an old GCC 4.1 generated a model which would not work, while the same Verilator compiled with GCC 4.7 generated a model which worked without problem.

Key to this seems to be the C++ STL std::sort() method. This is not guaranteed to be stable, and thus may give different results between different releases of GCC. Replacing this by std::stable_sort() throughout fixed the problem. Verilator compiled with GCC 4.1 and GCC 4.7 both generated working models from the design. As it happens this also increased Verilator's performance.

This suggests there may be some hidden assumption on the stability of sorting within Verilator. In this particular case, it seems the sort in the linkcells step is the one that matters. Unfortunately the examples are all in large confidential designs, and so far we have not been able to reproduce the problem in a smaller test case. So I don't know why the fix works, of if we were just lucky, and the underlying problem remains. I'll have the opportunity to investigate this further next week - any suggestions for how to approach this welcome.

The proposed patch replaces all calls to @sort@ by calls to @stable_sort@. Please pull it from branch stable-sort at git://github.com/jeremybennett/verilator.git.

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented May 24, 2013


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2013-05-24T00:20:58Z


Thanks for the patch, makes sense.

Fixed in git towards 3.848.

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Jun 2, 2013


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2013-06-02T18:54:30Z


In 3.850.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.