Fixing minor issues after running on examples.

This commit is contained in:
Jeremiah Leary 2017-09-02 21:16:31 -05:00
parent 083f57103a
commit d8bead6040
3 changed files with 19 additions and 3 deletions

View File

@ -980,12 +980,17 @@ class rule_040(entity_rule):
def analyze(self, lines):
lFailureLines = []
fEntityFound = False
fGenericMapFound = False
for iLineNumber, sLine in enumerate(lines):
if fEntityFound:
if re.match('^\s*port', sLine.lower()):
if not re.match('^\s*\)', lines[iLineNumber - 1]):
lFailureLines.append(iLineNumber + 1)
if fGenericMapFound:
if not re.match('^\s*\)', lines[iLineNumber - 1]):
lFailureLines.append(iLineNumber + 1)
fEntityFound = False
fGenericMapFound = False
if re.match('^\s*generic\s\s*\(', sLine.lower()):
fGenericMapFound = True
if re.match('\s*entity', sLine.lower()):
fEntityFound = True
self.violations = lFailureLines

View File

@ -122,3 +122,14 @@ entity ENTITY1 is
);
end entity ENTITY1
-- Check if no generic is present
entity ENTITY1 is
port (
I_PORT1 : in std_logic;
O_PORT2 : out std_logic;
IO_PORT3 : inout std_logic
);
end entity ENTITY1

View File

@ -330,7 +330,7 @@ class testRuleEntityMethods(unittest.TestCase):
oRule = rule_entity.rule_023()
oRule.port_direction = 'Suffix'
dExpected = [9,10,11,12,13,14,26,27,28,29,30,31,40,41,42,43,44,45,57,58,59,60,61,62,71,72,73,74,75,76,87,88,89,120]
dExpected = [9,10,11,12,13,14,26,27,28,29,30,31,40,41,42,43,44,45,57,58,59,60,61,62,71,72,73,74,75,76,87,88,89,120, 129,130,131]
oRule.analyze(lLines)
self.assertEqual(oRule.violations, dExpected)