diff --git a/vsg/rules/constant/rule_011.py b/vsg/rules/constant/rule_011.py index 9f57a484..ea13a951 100644 --- a/vsg/rules/constant/rule_011.py +++ b/vsg/rules/constant/rule_011.py @@ -1,16 +1,36 @@ - -from vsg.rules import token_case +# +#from vsg.rules import token_case +# +#from vsg import token +# +#lTokens = [] +#lTokens.append(token.constant_declaration.subtype_indication) +# +# +#class rule_011(token_case): +# ''' +# Constant rule 011 checks the constant type has proper case. +# ''' +# +# def __init__(self): +# token_case.__init__(self, 'constant', '011', lTokens) from vsg import token -lTokens = [] -lTokens.append(token.constant_declaration.subtype_indication) +from vsg.rules import token_case_subtype_indication + +lStartTokens = [] +lStartTokens.append(token.constant_declaration.colon) + +lEndTokens = [] +lEndTokens.append(token.constant_declaration.assignment_operator) +lEndTokens.append(token.constant_declaration.semicolon) -class rule_011(token_case): +class rule_011(token_case_subtype_indication): ''' - Constant rule 011 checks the constant type has proper case. + Checks the constant type has proper case. ''' def __init__(self): - token_case.__init__(self, 'constant', '011', lTokens) + token_case_subtype_indication.__init__(self, 'constant', '011', lStartTokens, lEndTokens) diff --git a/vsg/tests/constant/rule_011_test_input.fixed_lower.vhd b/vsg/tests/constant/rule_011_test_input.fixed_lower.vhd index e0fe6527..f17d2085 100644 --- a/vsg/tests/constant/rule_011_test_input.fixed_lower.vhd +++ b/vsg/tests/constant/rule_011_test_input.fixed_lower.vhd @@ -7,6 +7,10 @@ architecture RTL of FIFO is constant c_word : integer := 1024; + constant zeros : std_logic_vector(31 downto 0) := (others => '0'); + + constant zeros : std_logic_vector(31 downto 0) := (others => '0'); + begin end architecture RTL; diff --git a/vsg/tests/constant/rule_011_test_input.fixed_upper.vhd b/vsg/tests/constant/rule_011_test_input.fixed_upper.vhd index c2ff01e9..ea4b137d 100644 --- a/vsg/tests/constant/rule_011_test_input.fixed_upper.vhd +++ b/vsg/tests/constant/rule_011_test_input.fixed_upper.vhd @@ -7,6 +7,10 @@ architecture RTL of FIFO is constant c_word : INTEGER := 1024; + constant zeros : STD_LOGIC_VECTOR(31 downto 0) := (others => '0'); + + constant zeros : STD_LOGIC_VECTOR(31 downto 0) := (others => '0'); + begin end architecture RTL; diff --git a/vsg/tests/constant/rule_011_test_input.vhd b/vsg/tests/constant/rule_011_test_input.vhd index 3f6f8ebc..1d7ea009 100644 --- a/vsg/tests/constant/rule_011_test_input.vhd +++ b/vsg/tests/constant/rule_011_test_input.vhd @@ -7,6 +7,10 @@ architecture RTL of FIFO is constant c_word : Integer := 1024; + constant zeros : std_logic_vector(31 downto 0) := (others => '0'); + + constant zeros : STD_LOGIC_VECTOR(31 downto 0) := (others => '0'); + begin end architecture RTL; diff --git a/vsg/tests/constant/test_rule_011.py b/vsg/tests/constant/test_rule_011.py index e2886b18..1857716b 100644 --- a/vsg/tests/constant/test_rule_011.py +++ b/vsg/tests/constant/test_rule_011.py @@ -29,7 +29,7 @@ class test_constant_rule(unittest.TestCase): self.assertEqual(oRule.name, 'constant') self.assertEqual(oRule.identifier, '011') - lExpected = [6, 8] + lExpected = [6, 8, 12] oRule.analyze(self.oFile) self.assertEqual(utils.extract_violation_lines_from_violation_object(oRule.violations), lExpected) @@ -41,7 +41,7 @@ class test_constant_rule(unittest.TestCase): self.assertEqual(oRule.name, 'constant') self.assertEqual(oRule.identifier, '011') - lExpected = [4, 8] + lExpected = [4, 8, 10] oRule.analyze(self.oFile) self.assertEqual(utils.extract_violation_lines_from_violation_object(oRule.violations), lExpected)