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

Error when preprocessing verilog header with dos line endings #180

Closed
nxpMartin opened this issue May 19, 2023 · 5 comments
Closed

Error when preprocessing verilog header with dos line endings #180

nxpMartin opened this issue May 19, 2023 · 5 comments
Milestone

Comments

@nxpMartin
Copy link

It looks like, there is a problem with the Verilog preprocessor for files that uses dos line endings.

Verilog multiple line macro definition works well in a header file with Unix line endings and causes an error like "SyntaxError:mismatched input 8'b0010_0100 expecting ...."

See params.v for details.

You can also clone (git clone https://github.com/nxpMartin/hdl_analyzer.git -b verilog_preprocessor) and run pytest in the main directory to see it.

@Thomasb81
Copy link
Contributor

Ieee1800.1 2017 does not specify carriage return (CR) as part in section A.9.4:
white_space ::= space | tab | newline | eof

Similarly the standard specify that source code should be ascii text... but some tool vendor support unicode at least in comments ...

@Thomasb81
Copy link
Contributor

The issue is probably in lexer of the pre-processor grammar : https://github.com/Nic30/hdlConvertor/blob/master/grammars/verilogPreprocLexer.g4

@nxpMartin
Copy link
Author

I went into this error when I try to parse the Verilog description of the processor. The description is normally synthesizable by some commercial tools.
So, I believe that it is a good idea to improve/fix it.

@Nic30
Copy link
Owner

Nic30 commented May 27, 2023

@nxpMartin It is possible to hotfix this by normalization of newlines on input, but lets add it to grammar directly as it should not break anything and it should greatly improve user experience.
Also do not be afraid to send pull request with suggested change, it greatly shortens the time required to fix issue.

@Nic30 Nic30 added this to the v2.4 milestone Jan 14, 2024
@Nic30
Copy link
Owner

Nic30 commented Jan 14, 2024

Closing this as it is fixed in mesonbuild branch and will be merged to master soon.

@Nic30 Nic30 closed this as completed Jan 14, 2024
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

3 participants