diff --git a/vsg/rules/port_map/__init__.py b/vsg/rules/port_map/__init__.py index 2ac23f5b..e255b184 100644 --- a/vsg/rules/port_map/__init__.py +++ b/vsg/rules/port_map/__init__.py @@ -10,5 +10,7 @@ from .rule_007 import rule_007 from .rule_008 import rule_008 from .rule_009 import rule_009 from .rule_010 import rule_010 +from .rule_011 import rule_011 from .rule_100 import rule_100 +from .rule_101 import rule_101 from .rule_200 import rule_200 diff --git a/vsg/rules/port_map/rule_011.py b/vsg/rules/port_map/rule_011.py new file mode 100644 index 00000000..7120d800 --- /dev/null +++ b/vsg/rules/port_map/rule_011.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- + +from vsg.rules import move_token_next_to_another_token +from vsg.token import port_map_aspect as token + + +class rule_011(move_token_next_to_another_token): + """ + This rule checks the **map** keyword is on the same line as the **port** keyword. + + **Violation** + + .. code-block:: vhdl + + port + map ( + WR_EN => WR_EN, + RD_EN => RD_EN, + OVERFLOW => OVERFLOW + ); + + **Fix** + + Use explicit port mapping. + + .. code-block:: vhdl + + port map ( + + WR_EN => WR_EN, + RD_EN => RD_EN, + OVERFLOW => OVERFLOW + ); + """ + + def __init__(self): + super().__init__(token.port_keyword, token.map_keyword) + # The subphase must be changed so that this rule runs after the rule to move the map keyword. + self.solution = "Move the *port* keyword to the same line as the *map* keyword." diff --git a/vsg/rules/port_map/rule_101.py b/vsg/rules/port_map/rule_101.py new file mode 100644 index 00000000..64c98f75 --- /dev/null +++ b/vsg/rules/port_map/rule_101.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- + +from vsg import token +from vsg.rules.whitespace_between_token_pairs import Rule + +lTokens = [] +lTokens.append([token.port_map_aspect.port_keyword, token.port_map_aspect.map_keyword]) + + +class rule_101(Rule): + """ + This rule checks for a single space between the **port** keyword and the **map** keyword. + + |configuring_whitespace_rules_link| + + **Violation** + + .. code-block:: vhdl + + port map ( + + **Fix** + + .. code-block:: vhdl + + port map ( + """ + + def __init__(self): + super().__init__(lTokens) + self.solution = 'Ensure a single space exists between "port" and "map".'