Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Accept trailing commas in module definition #11

Open
tux3 opened this issue May 21, 2020 · 3 comments
Open

Accept trailing commas in module definition #11

tux3 opened this issue May 21, 2020 · 3 comments
Assignees

Comments

@tux3
Copy link

tux3 commented May 21, 2020

This syntax is accepted by many tools (including Yosys):

module m(
    input a,
    output b,
);

It'd be convenient to support it in sv-parser

@dalance dalance self-assigned this May 21, 2020
@dalance
Copy link
Owner

dalance commented May 28, 2020

Thank you for your suggestion.
I like trailing commas and want that it is supported by SystemVerilog.
But unfortunately it is not in IEEE 1800-2017 and almost all commercial EDA tools don't support it.
So I think it should be detected as parse error.

@tux3
Copy link
Author

tux3 commented May 29, 2020

Yes, unfortunately it is not standard.
I have actually found that trailing commas in the module declaration is accepted by multiple commercial tools, unlike in the port connections where it is almost always rejected.
At least Aldec Active-HDL and Xilinx will accept it for synthesis (although Xilinx still highlights it like an error, all while accepting it...).

I can't really object to it being reported as a syntax error, it would only be convenient to accept existing code-bases. Please feel free to close this if you'd rather not add the option! =)

@DaveMcEwan
Copy link

@tux3 Although it isn't a fix, I have found the comma-leading style helps for new code: https://github.com/DaveMcEwan/dmpvl/blob/master/prs/shr/sv/style_commaleading.sv

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

No branches or pull requests

3 participants