Issue#928: Subtype declaration classification issue (#1051)

This commit is contained in:
Jeremiah Leary 2023-11-29 06:31:12 -06:00 committed by GitHub
parent c3f02ec833
commit 2ce68de09c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 70 additions and 4 deletions

View File

@ -147,13 +147,62 @@
28 |
<class 'vsg.parser.blank_line'>
--------------------------------------------------------------------------------
29 | begin
<class 'vsg.token.architecture_body.begin_keyword'>
29 | subtype t_data_axi_stream_m2s is t_axi_stream_m2s(
<class 'vsg.token.subtype_declaration.subtype_keyword'>
<class 'vsg.token.subtype_declaration.identifier'>
<class 'vsg.token.subtype_declaration.is_keyword'>
<class 'vsg.token.type_mark.name'>
<class 'vsg.token.index_constraint.open_parenthesis'>
--------------------------------------------------------------------------------
30 |
30 | st_keep(T_AXI_RANGE)
<class 'vsg.token.type_mark.name'>
<class 'vsg.token.index_constraint.open_parenthesis'>
<class 'vsg.parser.todo'>
<class 'vsg.token.index_constraint.close_parenthesis'>
--------------------------------------------------------------------------------
31 | );
<class 'vsg.token.index_constraint.close_parenthesis'>
<class 'vsg.token.subtype_declaration.semicolon'>
--------------------------------------------------------------------------------
32 |
<class 'vsg.parser.blank_line'>
--------------------------------------------------------------------------------
31 | end architecture RTL;
33 | subtype t_data_axi_stream_m2s is t_axi_stream_m2s(
<class 'vsg.token.subtype_declaration.subtype_keyword'>
<class 'vsg.token.subtype_declaration.identifier'>
<class 'vsg.token.subtype_declaration.is_keyword'>
<class 'vsg.token.type_mark.name'>
<class 'vsg.token.record_constraint.open_parenthesis'>
--------------------------------------------------------------------------------
34 | st_strb2(0 downto 0),
<class 'vsg.token.record_element_constraint.record_element_simple_name'>
<class 'vsg.token.index_constraint.open_parenthesis'>
<class 'vsg.parser.todo'>
<class 'vsg.token.direction.downto'>
<class 'vsg.parser.todo'>
<class 'vsg.token.index_constraint.close_parenthesis'>
<class 'vsg.token.record_constraint.comma'>
--------------------------------------------------------------------------------
35 | st_keep(T_AXI_RANGE)
<class 'vsg.token.record_element_constraint.record_element_simple_name'>
<class 'vsg.token.index_constraint.open_parenthesis'>
<class 'vsg.parser.todo'>
<class 'vsg.token.index_constraint.close_parenthesis'>
--------------------------------------------------------------------------------
36 | );
<class 'vsg.token.record_constraint.close_parenthesis'>
<class 'vsg.token.subtype_declaration.semicolon'>
--------------------------------------------------------------------------------
37 |
<class 'vsg.parser.blank_line'>
--------------------------------------------------------------------------------
38 | begin
<class 'vsg.token.architecture_body.begin_keyword'>
--------------------------------------------------------------------------------
39 |
<class 'vsg.parser.blank_line'>
--------------------------------------------------------------------------------
40 | end architecture RTL;
<class 'vsg.token.architecture_body.end_keyword'>
<class 'vsg.token.architecture_body.end_architecture_keyword'>
<class 'vsg.token.architecture_body.architecture_simple_name'>

View File

@ -26,6 +26,15 @@ architecture RTL of FIFO is
)
);
subtype t_data_axi_stream_m2s is t_axi_stream_m2s(
st_keep(T_AXI_RANGE)
);
subtype t_data_axi_stream_m2s is t_axi_stream_m2s(
st_strb2(0 downto 0),
st_keep(T_AXI_RANGE)
);
begin
end architecture RTL;

View File

@ -14,6 +14,10 @@ def detect(iToken, lObjects):
def check_for_range_attribute_name(iToken, lObjects):
if single_token_enclosed_in_parenthesis(iToken, lObjects):
return True
iParens = 0
for iIndex in range(iToken, len(lObjects)):
iParens = utils.update_paren_counter(iIndex, lObjects, iParens)
@ -26,6 +30,10 @@ def check_for_range_attribute_name(iToken, lObjects):
return False
def single_token_enclosed_in_parenthesis(iToken, lObjects):
return utils.are_next_consecutive_tokens([None, ')'], iToken, lObjects)
def token_is_matching_close_parenthesis(iParens):
if iParens == -1:
return True