Skip to content

Issue 1475: Add support for VHDL 2019 views#1477

Merged
jeremiah-c-leary merged 3 commits intojeremiah-c-leary:masterfrom
linknum23:views-2019
Sep 4, 2025
Merged

Issue 1475: Add support for VHDL 2019 views#1477
jeremiah-c-leary merged 3 commits intojeremiah-c-leary:masterfrom
linknum23:views-2019

Conversation

@linknum23
Copy link
Copy Markdown
Contributor

Resolves #1475

  • Adds the relevant changes to VHDL's grammar
  • Updates relevant tests
  • Adds test for view declarations (mode_view_declaration)

There are probably some additional rules that need to be updated, but my current repo didn't report any issues with these changes.

I realize that this is a fairly complicated change and am open to feedback on how to do it better.

@linknum23 linknum23 force-pushed the views-2019 branch 3 times, most recently from 8fcf3ff to c5340ff Compare July 23, 2025 21:39
"""
interface_signal_declaration ::=
[ signal ] identifier_list : [ mode ] subtype_indication [ bus ] [ := *static*_expression ]
signal identifier_list : mode_indication
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I replaced [ signal ] with signal since the case where signal is absent is handled by interface_unknown_declaration. Unsure which is more correct. Depending on your stance a comment about the change would probably be useful here.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your point. Line 15 requires the signal keyword, so including the braces in the comment is misleading.

Thanks for clarifying this in the comment.



def classify(iToken, lObjects):
def detect(iToken, lObjects):
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

detect was needed for handling the options in element_mode_indication

@linknum23 linknum23 changed the title Add support for VHDL 2019 views Issue 1475: Add support for VHDL 2019 views Jul 23, 2025
Copy link
Copy Markdown
Owner

@jeremiah-c-leary jeremiah-c-leary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Evening @linknum23 ,

You are first person dig in to the parser. I hope it wasn't too difficult to figure out.

The PR looks great. You followed the patterns perfectly and it looks exactly what I would have written.

There are just some dead code and cosmetic updates.

Thanks again.

Regards,

--Jeremy

def classify(iToken, lObjects):
"""
simple_mode_indication ::=
[ mode ] subtype_indication [ bus ] [ := static_expression ]
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change static_expression to static_conditional_expression to match the LRM

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC reason that I changed this was matching other similar LRM comments that left out the italicized portion of the keyword. I think the italicized part of the LRM is added just provide extra context.

I'll change this back to match the LRM.

"""
interface_signal_declaration ::=
[ signal ] identifier_list : [ mode ] subtype_indication [ bus ] [ := *static*_expression ]
signal identifier_list : mode_indication
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your point. Line 15 requires the signal keyword, so including the braces in the comment is misleading.

Thanks for clarifying this in the comment.

super().__init__(sString)


class expression(parser.expression):
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this can be removed because the expression production is called. I'm assuming this is a copy/paste from another file before I starting using the expression produciton.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC the goal here was to be able to use a subtyped expression for rules in the future. I'm trying to remember if this specificity is needed in the codes current state.

from vsg import parser


class subtype_indication(parser.subtype_indication):
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this can be removed as this token is not used in the production.


lTokens = []
lTokens.append(token.interface_unknown_declaration.assignment)
lTokens.append(token.simple_mode_indication.assignment)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually fixes a bug since the original did not include interface_signal_declaration.

vsg/parser.py Outdated
super().__init__(sString)


class mode_indication(item):
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed as it does not appear to be used.

@linknum23
Copy link
Copy Markdown
Contributor Author

Thanks for looking at this. The that this follows the LRM made the parser fairly easy to modify. I'm hoping I can find some time to trickle in some more 2019 changes.

@jeremiah-c-leary
Copy link
Copy Markdown
Owner

The that this follows the LRM made the parser fairly easy to modify.

It's all part of my master plan. If it is easy enough for me to figure out, then anybody else can.

I'm hoping I can find some time to trickle in some more 2019 changes.

Looking forward them.

I will get this merged to master.

--Jeremy

@jeremiah-c-leary jeremiah-c-leary merged commit 2a265d6 into jeremiah-c-leary:master Sep 4, 2025
12 checks passed
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

Successfully merging this pull request may close these issues.

Add support for VHDL 2019 interfaces

2 participants