Updates for issue #248:

Updated the process classifier to update the insideResetProcess line attribute.
This commit is contained in:
Jeremiah C Leary 2019-09-08 06:40:01 -05:00
parent 24cc35f7f1
commit a6d82e7bbe
4 changed files with 36 additions and 4 deletions

View File

@ -77,6 +77,7 @@ class line():
self.isSensitivityListBegin = False
self.isSensitivityListEnd = False
self.insideClockProcess = False
self.insideResetProcess = False
# Concurrent attributes
self.insideConcurrent = False
self.isConcurrentBegin = False

View File

@ -54,3 +54,20 @@ class testVhdlFileAfterMethods(unittest.TestCase):
lActual.append(iIndex)
# Compare
self.assertEqual(lActual, lExpected)
def test_inside_reset_process(self):
lExpected = []
lExpected.extend(range(9, 14))
lExpected.extend(range(26, 31))
lExpected.extend(range(43, 48))
lExpected.extend(range(70, 75))
lExpected.extend(range(87, 92))
lExpected.extend(range(144, 149))
# Generic actual list
lActual = []
for iIndex, oLine in enumerate(oFile.lines):
if oLine.insideResetProcess:
lActual.append(iIndex)
# Compare
self.assertEqual(lActual, lExpected)

View File

@ -1,13 +1,13 @@
import re
def process(dVars, oLine):
def process(dVars, oLine, lLines):
classify_process_keyword(dVars, oLine)
if oLine.insideProcess:
classify_process_sensitivity_list(dVars, oLine)
classify_process_begin_keyword(dVars, oLine)
classify_process_end_keyword(dVars, oLine)
classify_clock_process(dVars, oLine)
classify_clock_process(dVars, oLine, lLines)
def classify_process_keyword(dVars, oLine):
@ -66,10 +66,24 @@ def classify_process_end_keyword(dVars, oLine):
dVars['iCurrentIndentLevel'] = dVars['iCurrentIndentLevel'] - 1
dVars['SensitivityListFound'] = False
def classify_clock_process(dVars, oLine):
def classify_clock_process(dVars, oLine, lLines):
if re.match('^\s*[elsif|if]\s*.*\'event\s+and\s+\w+\s*=\s*\'[0-1]\'', oLine.lineNoComment, flags=re.IGNORECASE):
oLine.insideClockProcess = True
classify_reset_process(oLine, lLines)
if re.match('^\s*[elsif|if]\s*.*rising_edge', oLine.lineNoComment, flags=re.IGNORECASE):
oLine.insideClockProcess = True
classify_reset_process(oLine, lLines)
if re.match('^\s*[elsif|if]\s*.*falling_edge', oLine.lineNoComment, flags=re.IGNORECASE):
oLine.insideClockProcess = True
classify_reset_process(oLine, lLines)
def classify_reset_process(oLine, lLines):
if re.match('^\s*if', oLine.lineNoComment, flags=re.IGNORECASE):
return
iIndex = len(lLines) - 1
while lLines[iIndex].isIfKeyword is False:
lLines[iIndex].insideResetProcess = True
iIndex = iIndex - 1
lLines[iIndex].insideResetProcess = True

View File

@ -72,7 +72,7 @@ class vhdlFile():
classify.constant(dVars, oLine, oLinePrevious)
classify.variable(dVars, oLine)
classify.procedure(dVars, oLine, oLinePrevious)
classify.process(dVars, oLine)
classify.process(dVars, oLine, self.lines)
classify.generate(dVars, oLine, oLinePrevious)
classify.attribute(dVars, oLine)
classify.file_statement(dVars, oLine)