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

Find UNUSED and UNDRIVEN components in structs #850

Open
veripoolbot opened this issue Nov 26, 2014 · 3 comments
Open

Find UNUSED and UNDRIVEN components in structs #850

veripoolbot opened this issue Nov 26, 2014 · 3 comments

Comments

@veripoolbot
Copy link

@veripoolbot veripoolbot commented Nov 26, 2014


Author Name: Jeremy Bennett (@jeremybennett)
Original Redmine Issue: 850 from https://www.veripool.org


At present Verilator cannot detect unused bits or fields within a struct, due to their representation by nested @AstSel@ nodes in the AST. I have written a patch to add support for this. It includes a new regression test case.

At present this just reports the bits affected in the flattened struct. In the long term it would be good to be able to report the field names of these parts of the struct. However by the time we get to V3Undriven, this information is gone from the AST. The solution will be either to run this pass earlier, or to carry struct field information forward.

Please review and pull the code from branch unused-structs at https://github.com/jeremybennett/verilator

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Nov 26, 2014


Original Redmine Comment
Author Name: Jeremy Bennett (@jeremybennett)
Original Date: 2014-11-26T15:08:12Z


Some further testing indicates that this doesn't get nested packed multidimensional arrays right. It often seems to report the entire array as undriven, when it is not the case. I'll investigate further, but if you can see what I have got wrong that will be useful.

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Nov 26, 2014


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2014-11-26T22:03:36Z


Per variable I think you should make an ordered map which contains a <lsb,width> pair, as you need to handle finding bits in any order. You should not use a vector or map per bit as it will be too memory intensive.

When something is used lookup the newlsb and match if within the range of the entry that is found (foundlsb <= newlsb <= foundlsb+width-1 ) or immediately proceeds it (foundlsb <= newlsb <= foundlsb+width-1). If not found, look at any entry before the hit and possibly extend its width (if foundlsb+width==foundlsb then foundwidth++), or look at the next sequential entry and (if lsb=found+1 decrement foundlsb and increment the foundwidth).

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Oct 18, 2019


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-10-18T00:06:41Z


Not currently being worked on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.