Issue#1320: Added rules generic_map_009 and generic_map_101.

This commit is contained in:
JHertz5 2024-11-13 10:39:56 +00:00
parent db484c8087
commit f2fb3a23ab
3 changed files with 69 additions and 0 deletions

View File

@ -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

View File

@ -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."

View File

@ -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".'