Issue#1458: Rules port_011 and port_025 were operating on component declarations.

This commit is contained in:
Jeremiah Leary 2025-07-10 22:04:22 -05:00
parent 285768d3eb
commit 54fb8761bb
4 changed files with 58 additions and 6 deletions

View File

@ -17,3 +17,23 @@ entity FIFO is
DATA : out std_logic_vector(31 downto 0)
);
end entity FIFO;
architecture rtl of fifo is
component foo is
port (
WR_EN : in std_logic;
DATA : out std_logic;
RD_EN : inout std_logic
);
end component foo;
begin
U_FOO : foo
port map (
WR_EN => '0',
DATA => '1'
);
end architecture rtl;

View File

@ -17,3 +17,23 @@ entity FIFO is
DATA : out std_logic_vector(31 downto 0)
);
end entity FIFO;
architecture rtl of fifo is
component foo is
port (
WR_EN : in std_logic;
DATA : out std_logic;
RD_EN : inout std_logic
);
end component foo;
begin
U_FOO : foo
port map (
WR_EN => '0',
DATA => '1'
);
end architecture rtl;

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from vsg import token
from vsg.rules import token_prefix_between_tokens
from vsg.rules import token_prefix_between_tokens_unless_between_tokens as Rule
lTokens = []
lTokens.append(token.interface_constant_declaration.identifier)
@ -9,8 +9,14 @@ lTokens.append(token.interface_signal_declaration.identifier)
lTokens.append(token.interface_variable_declaration.identifier)
lTokens.append(token.interface_unknown_declaration.identifier)
oStart = token.port_clause.open_parenthesis
oEnd = token.port_clause.close_parenthesis
class rule_011(token_prefix_between_tokens):
lUnless = []
lUnless.append([token.component_declaration.component_keyword, token.component_declaration.semicolon])
class rule_011(Rule):
"""
This rule checks for valid prefixes on port identifiers.
The default port prefixes are: *i_*, *o_*, *io_*.
@ -42,5 +48,5 @@ class rule_011(token_prefix_between_tokens):
"""
def __init__(self):
super().__init__(lTokens, token.port_clause.open_parenthesis, token.port_clause.close_parenthesis)
super().__init__(lTokens, oStart, oEnd, lUnless)
self.prefixes = ["i_", "o_", "io_"]

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from vsg import token
from vsg.rules import token_suffix_between_tokens
from vsg.rules import token_suffix_between_tokens_unless_between_tokens as Rule
lTokens = []
lTokens.append(token.interface_constant_declaration.identifier)
@ -9,8 +9,14 @@ lTokens.append(token.interface_signal_declaration.identifier)
lTokens.append(token.interface_variable_declaration.identifier)
lTokens.append(token.interface_unknown_declaration.identifier)
oStart = token.port_clause.open_parenthesis
oEnd = token.port_clause.close_parenthesis
class rule_025(token_suffix_between_tokens):
lUnless = []
lUnless.append([token.component_declaration.component_keyword, token.component_declaration.semicolon])
class rule_025(Rule):
"""
This rule checks for valid suffixes on port identifiers.
The default port suffixes are *_i*, *_o*, *_io*.
@ -41,5 +47,5 @@ class rule_025(token_suffix_between_tokens):
"""
def __init__(self):
super().__init__(lTokens, token.port_clause.open_parenthesis, token.port_clause.close_parenthesis)
super().__init__(lTokens, oStart, oEnd, lUnless)
self.suffixes = ["_i", "_o", "_io"]