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

Add support for displaying enums in gtkwave #8

Closed
magnmaeh opened this issue Feb 9, 2024 · 3 comments · Fixed by #15
Closed

Add support for displaying enums in gtkwave #8

magnmaeh opened this issue Feb 9, 2024 · 3 comments · Fixed by #15
Labels
enhancement New feature or request

Comments

@magnmaeh
Copy link
Member

magnmaeh commented Feb 9, 2024

Enums can be used in Verilog code like this and are fairly common:

enum {IDLE, SETUP, ACCESS} state;

When the enums are displayed in gtkwave, they will by default be displayed as their numbers (i.e., 0, 1, 2). It would be better to display these as their names (i.e., IDLE, SETUP, ACCESS) instead.

@magnmaeh magnmaeh added the enhancement New feature or request label Feb 9, 2024
@magnmaeh
Copy link
Member Author

This is possible to do using some Python magic it seems. See https://pyvcd.readthedocs.io/en/latest/vcd.gtkw.html

@magnmaeh
Copy link
Member Author

After looking further into this, the pyvcd API is extremely limiting. Without this API, it will be very challenging and too time-consuming to implement automatic display of enum variables. I'll instead add a guide on how to add enums manually in the README.

@magnmaeh
Copy link
Member Author

After looking EVEN more into this, it seems possible to extend the Verilator class to write additional data to the .vcd file or generate a .gtkw file based on the enum generated by Verilator when /* verilator_public */ is used. :))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant