-
Notifications
You must be signed in to change notification settings - Fork 68
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
How do I get access to package parameters? #3546
Comments
@maxslug, Surelog does all of that already, you can run your example. surelog -parse my_pkg.sv -d uhdm -nobuiltin
You can create your own application that reads the produced UHDM database or embed the whole Surelog/UHDM into your application. There are plenty of examples on how to do that in the README. |
This is fantastic, thanks for running the example through and providing the output @alaindargelas ! I've browsed around but I haven't found an easy way of traversing the UHDM through a scripting language. I suppose I could just directly use the YAML or use https://github.com/mikefarah/yq. However I thought I would ask if there are any existing efforts to make a friendly front-end to UHDM for Python that I could join? My 2 second version is something like:
|
Looks like you are in luck, there is a PR for UHDM-Python API in flight: The existing APIs are in C (Standard Verilog VPI) or C++ (UHDM): Surelog + UHDM in your "main": Load UHDM and do something about it: |
Great timing indeed! It looks like that will provide access to the SWIG functions to Python libraries. What is the general feel for having an abstraction from the syntax tree in Python? It seems you had the same idea here before : #2635 (comment) . I feel like this will go a long way to bridge the gap for having a good SV compiler accessible for scripted chip design work. |
You need to work it out with @Thomasb81, maybe a separate PR is needed to do #2635 (comment) |
Sounds good, I'll wait for the dust to settle on PR#985 and then try to use the API directly and then propose some layer of abstraction. If there is a semi-standard API out there I would try to get close to that. |
@maxslug looks like chipsalliance/UHDM#895 (merged) is ready for a beta tester! |
#3612 addresses the documentation of the Python API to UHDM. |
Thanks @alaindargelas ! You might want to leave a breadcrumb at https://github.com/chipsalliance/Surelog/blob/master/README.md#python-api about the new Python VPI API for elaborated code in UHDM. |
I would like to make a small tool that would elaborate a SystemVerilog package and then create an elaborated version.
example input
Example output:
Maybe I can get more fancy had use this as a way to document package files and visualize the data structures (struct, union, MDA, etc) too.
Question: Is this information available to us in Surelog? Where would be the best spot to extract this?
Thanks!
The text was updated successfully, but these errors were encountered: