diff --git a/vsg/rules/generic_map/__init__.py b/vsg/rules/generic_map/__init__.py index 50431b37..3f8c8069 100644 --- a/vsg/rules/generic_map/__init__.py +++ b/vsg/rules/generic_map/__init__.py @@ -8,6 +8,8 @@ from .rule_005 import rule_005 from .rule_006 import rule_006 from .rule_007 import rule_007 from .rule_008 import rule_008 +from .rule_009 import rule_009 from .rule_100 import rule_100 +from .rule_101 import rule_101 from .rule_600 import rule_600 from .rule_601 import rule_601 diff --git a/vsg/rules/generic_map/rule_009.py b/vsg/rules/generic_map/rule_009.py new file mode 100644 index 00000000..c1d7b2b2 --- /dev/null +++ b/vsg/rules/generic_map/rule_009.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +from vsg.rules import move_token_next_to_another_token +from vsg.token import generic_map_aspect as token + + +class rule_009(move_token_next_to_another_token): + """ + This rule checks the **map** keyword is on the same line as the **generic** keyword. + + **Violation** + + .. code-block:: vhdl + + generic + map ( + WIDTH => 32, + DEPTH => 512 + ) + + **Fix** + + Use explicit port mapping. + + .. code-block:: vhdl + + generic map ( + + WIDTH => 32, + DEPTH => 512 + ) + """ + + def __init__(self): + super().__init__(token.generic_keyword, token.map_keyword) + self.solution = "Move the *map* keyword to the same line as the *generic* keyword." diff --git a/vsg/rules/generic_map/rule_101.py b/vsg/rules/generic_map/rule_101.py new file mode 100644 index 00000000..716e9019 --- /dev/null +++ b/vsg/rules/generic_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.generic_map_aspect.generic_keyword, token.generic_map_aspect.map_keyword]) + + +class rule_101(Rule): + """ + This rule checks for a single space between the **generic** keyword and the **map** keyword. + + |configuring_whitespace_rules_link| + + **Violation** + + .. code-block:: vhdl + + generic map( + + **Fix** + + .. code-block:: vhdl + + generic map ( + """ + + def __init__(self): + super().__init__(lTokens) + self.solution = 'Ensure a single space exists between "generic" and "map".'