MikePopoloski / slang

SystemVerilog compiler and language services
MIT License
546 stars 114 forks source link

Question: How to get the raw text of port defined type #960

Closed tsyw closed 1 month ago

tsyw commented 1 month ago

Hello, I want to use the python binding as a library to extract some design related information. However, I found that I cannot get the raw text using PortSymbol.type. Example:

input [ADDR_WIDTH-1:0] addr;

It is great to get the real width after parsing the .v file. But maybe the raw text combined with InstanceBodySymbol.parameters is also a good way for changing the actual width when instantiating the modules.

MikePopoloski commented 1 month ago

You can get the syntax node by looking at the port symbol's internalSymbol.declaredType.typeSyntax or internalExpr.syntax.