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

compiler directive not showing in syntax_tree #98

Open
mlr11 opened this issue Jun 26, 2024 · 2 comments
Open

compiler directive not showing in syntax_tree #98

mlr11 opened this issue Jun 26, 2024 · 2 comments

Comments

@mlr11
Copy link

mlr11 commented Jun 26, 2024

The following single line verilog file:

`timescale 1 ns / 1 ps

produce the following syntax tree:

SourceText
   UnsignedNumber
    Token: '1' @ line:1
   TimeUnit
    Keyword
     Token: 'ns' @ line:1
   Symbol
    Token: '/' @ line:1
   UnsignedNumber
    Token: '1' @ line:1
   TimeUnit
    Keyword
     Token: 'ps' @ line:1

All the information that is part of the timescale is present but there's no information that this belongs to a timescale.

I noticed something similar with `undef MACRONAME

The name of the macro shows as a TextMacroIdentifier but there's no information about the undef part.

I haven't looked yet at how other directives are behaving (non macro or include file related).

@yousifBilal
Copy link

There is a preprocessor that expands all macros. I have opened an issue about it here, hoping to get the syntax tree without preprocessing it.

@mlr11
Copy link
Author

mlr11 commented Jul 24, 2024

There is a preprocessor that expands all macros. I have opened an issue about it here, hoping to get the syntax tree without preprocessing it.

What I am looking for is a bit different. I am looking for the information about the directives that are not handled by the preprocessor. Things like `timescale, default_nettype, celldefine, endcelldefine, ...

I ended up finding them in the parseTree but they were attached to WhiteSpace, so I had to add processing for WhiteSpace in my traversal to extract the directives

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

No branches or pull requests

2 participants