Updates for issue #184
Added support for processs without sensitivity lists.
This commit is contained in:
parent
e2970f2023
commit
2ac0e8ee8e
|
|
@ -21,7 +21,7 @@ class rule_002(rule.rule):
|
|||
|
||||
def analyze(self, oFile):
|
||||
for iLineNumber, oLine in enumerate(oFile.lines):
|
||||
if oLine.isProcessKeyword and not re.match('^\s*.*process\s\(', oLine.lineLower):
|
||||
if oLine.isProcessKeyword and re.match('^\s*.*process\s*\(', oLine.lineLower) and not re.match('^\s*.*process\s\(', oLine.lineLower):
|
||||
self.add_violation(iLineNumber)
|
||||
|
||||
def _fix_violations(self, oFile):
|
||||
|
|
|
|||
|
|
@ -111,5 +111,26 @@ proc_name : process (one, two, three) is
|
|||
process_2 => '4'
|
||||
);
|
||||
|
||||
-- processes without sensitivity lists
|
||||
|
||||
MAIN : process
|
||||
|
||||
variable var_a : std_logic_vector(16 downto 0);
|
||||
variable var_b;
|
||||
|
||||
begin
|
||||
|
||||
end process MAIN;
|
||||
|
||||
process
|
||||
|
||||
variable var_a : std_logic_vector(16 downto 0);
|
||||
variable var_b;
|
||||
|
||||
begin
|
||||
|
||||
end process;
|
||||
|
||||
|
||||
end architecture ARCH;
|
||||
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ class testRuleProcessMethods(unittest.TestCase):
|
|||
self.assertTrue(oRule)
|
||||
self.assertEqual(oRule.name, 'process')
|
||||
self.assertEqual(oRule.identifier, '016')
|
||||
dExpected = [6,11,17,24,32,38,51,55]
|
||||
dExpected = [6,11,17,24,32,38,51,55,125]
|
||||
oRule.analyze(oFile)
|
||||
self.assertEqual(oRule.violations, dExpected)
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ class testRuleProcessMethods(unittest.TestCase):
|
|||
self.assertTrue(oRule)
|
||||
self.assertEqual(oRule.name, 'process')
|
||||
self.assertEqual(oRule.identifier, '018')
|
||||
dExpected = [9,15,22,30,36,42,53,60]
|
||||
dExpected = [9,15,22,30,36,42,53,60,132]
|
||||
oRule.analyze(oFile)
|
||||
self.assertEqual(oRule.violations, dExpected)
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ oFileProcess = vhdlFile.vhdlFile(os.path.join(os.path.dirname(__file__),'..','pr
|
|||
class testVhdlFileMethods(unittest.TestCase):
|
||||
|
||||
def test_comment_assignment(self):
|
||||
lExpected = [8,21,50,76,83,90]
|
||||
lExpected = [8,21,50,76,83,90,114]
|
||||
# Generic actual list
|
||||
lActual = []
|
||||
for iIndex, oLine in enumerate(oFileProcess.lines):
|
||||
|
|
@ -21,7 +21,7 @@ class testVhdlFileMethods(unittest.TestCase):
|
|||
self.assertEqual(lActual, lExpected)
|
||||
|
||||
def test_insideProcess_assignment(self):
|
||||
lExpected = [6,7,8,9,11,12,13,14,15,17,18,19,20,21,22,24,25,26,27,28,29,30,32,33,34,35,36,38,39,40,41,42,46,47,48,51,52,53,55,56,57,58,59,60,63,64,65,68,69,70,71,72,75,76,77,78,79,81,82,83,84,85,86,88,89,90,91,92,93,94,97,98,99,100,101,102,103]
|
||||
lExpected = [6,7,8,9,11,12,13,14,15,17,18,19,20,21,22,24,25,26,27,28,29,30,32,33,34,35,36,38,39,40,41,42,46,47,48,51,52,53,55,56,57,58,59,60,63,64,65,68,69,70,71,72,75,76,77,78,79,81,82,83,84,85,86,88,89,90,91,92,93,94,97,98,99,100,101,102,103,116,117,118,119,120,121,122,123,125,126,127,128,129,130,131,132]
|
||||
# Generic actual list
|
||||
lActual = []
|
||||
for iIndex, oLine in enumerate(oFileProcess.lines):
|
||||
|
|
@ -31,7 +31,7 @@ class testVhdlFileMethods(unittest.TestCase):
|
|||
self.assertEqual(lActual, lExpected)
|
||||
|
||||
def test_isProcessBegin_assignment(self):
|
||||
lExpected = [6,13,20,28,34,40,47,52,59,64,70,77,84,92,101]
|
||||
lExpected = [6,13,20,28,34,40,47,52,59,64,70,77,84,92,101,121,130]
|
||||
# Generic actual list
|
||||
lActual = []
|
||||
for iIndex, oLine in enumerate(oFileProcess.lines):
|
||||
|
|
@ -41,7 +41,7 @@ class testVhdlFileMethods(unittest.TestCase):
|
|||
self.assertEqual(lActual, lExpected)
|
||||
|
||||
def test_isProcessKeyword_assignment(self):
|
||||
lExpected = [6,11,17,24,32,38,46,51,55,63,68,75,81,88,97]
|
||||
lExpected = [6,11,17,24,32,38,46,51,55,63,68,75,81,88,97,116,125]
|
||||
# Generic actual list
|
||||
lActual = []
|
||||
for iIndex, oLine in enumerate(oFileProcess.lines):
|
||||
|
|
@ -51,7 +51,7 @@ class testVhdlFileMethods(unittest.TestCase):
|
|||
self.assertEqual(lActual, lExpected)
|
||||
|
||||
def test_isProcessLabel_assignment(self):
|
||||
lExpected = [46,63,68,75,81,88,97]
|
||||
lExpected = [46,63,68,75,81,88,97,116]
|
||||
# Generic actual list
|
||||
lActual = []
|
||||
for iIndex, oLine in enumerate(oFileProcess.lines):
|
||||
|
|
@ -61,7 +61,7 @@ class testVhdlFileMethods(unittest.TestCase):
|
|||
self.assertEqual(lActual, lExpected)
|
||||
|
||||
def test_isEndProcess_assignment(self):
|
||||
lExpected = [9,15,22,30,36,42,48,53,60,65,72,79,86,94,103]
|
||||
lExpected = [9,15,22,30,36,42,48,53,60,65,72,79,86,94,103,123,132]
|
||||
# Generic actual list
|
||||
lActual = []
|
||||
for iIndex, oLine in enumerate(oFileProcess.lines):
|
||||
|
|
|
|||
|
|
@ -10,20 +10,31 @@ def process(dVars, oLine):
|
|||
|
||||
|
||||
def classify_process_keyword(dVars, oLine):
|
||||
if re.match('^\s*process[:|\s|$|(]', oLine.lineLower):
|
||||
if re.match('^\s*process[:|\s|(]', oLine.lineLower):
|
||||
oLine.isProcessKeyword = True
|
||||
oLine.insideProcess = True
|
||||
oLine.indentLevel = dVars['iCurrentIndentLevel']
|
||||
if re.match('^\s*process\s*$', oLine.lineNoComment):
|
||||
oLine.isProcessKeyword = True
|
||||
oLine.insideProcess = True
|
||||
oLine.indentLevel = dVars['iCurrentIndentLevel']
|
||||
dVars['iCurrentIndentLevel'] += 1
|
||||
if re.match('^\s*\S+\s*:\s*process', oLine.lineLower):
|
||||
oLine.isProcessKeyword = True
|
||||
oLine.insideProcess = True
|
||||
oLine.indentLevel = dVars['iCurrentIndentLevel']
|
||||
oLine.isProcessLabel = True
|
||||
if re.match('^\s*\S+\s*:\s*process\s*$', oLine.lineNoComment):
|
||||
dVars['iCurrentIndentLevel'] += 1
|
||||
|
||||
|
||||
def classify_process_sensitivity_list(dVars, oLine):
|
||||
# Check sensitivity list
|
||||
if '(' in oLine.line and not oLine.insideSensitivityList and not dVars['fFoundProcessBegin'] and not dVars['SensitivityListFound']:
|
||||
if '(' in oLine.line and \
|
||||
not oLine.insideSensitivityList and \
|
||||
not dVars['fFoundProcessBegin'] and \
|
||||
not dVars['SensitivityListFound'] and \
|
||||
not oLine.isVariable:
|
||||
oLine.isSensitivityListBegin = True
|
||||
oLine.insideSensitivityList = True
|
||||
dVars['SensitivityListFound'] = True
|
||||
|
|
|
|||
Loading…
Reference in New Issue