Updates for instantiations:

1)  Fixed issue where instantiations were not detected inside generates
This commit is contained in:
Jeremiah C Leary 2017-11-05 08:40:03 -06:00
parent a1382a3474
commit bcd22a5a72
3 changed files with 31 additions and 1 deletions

View File

@ -0,0 +1,18 @@
architecture ARCH of ENTITY is
begin
GENERATE_1 : for CONDITION in 0 to 7 generate
U_INST1 : INST1
port map (
PORT_1 => w_port_1,
PORT_2 => w_port_2,
PORT_3 => w_port_3
);
end generate;
end architecture ARCH;

View File

@ -5,6 +5,7 @@ from vsg import vhdlFile
oFile = vhdlFile.vhdlFile(os.path.join(os.path.dirname(__file__),'..','instantiation','instantiation_test_input.vhd'))
oFileGeneric = vhdlFile.vhdlFile(os.path.join(os.path.dirname(__file__),'..','instantiation','instantiation_generic_test_input.vhd'))
oFileGenerate = vhdlFile.vhdlFile(os.path.join(os.path.dirname(__file__),'..','instantiation','instantiation_generate_test_input.vhd'))
class testVhdlFileInstantiationAssignments(unittest.TestCase):
@ -102,5 +103,15 @@ class testVhdlFileInstantiationAssignments(unittest.TestCase):
# Compare
self.assertEqual(lActual, lExpected)
def test_isInstantiation_assignment_inside_generate(self):
lExpected = [8]
# Generic actual list
lActual = []
for iIndex, oLine in enumerate(oFileGenerate.lines):
if oLine.isInstantiationDeclaration:
lActual.append(iIndex)
# Compare
self.assertEqual(lActual, lExpected)
if __name__ == '__main__':
unittest.main()

View File

@ -409,7 +409,8 @@ class vhdlFile():
oLine.isSequentialEnd = True
# Check instantiation statements
if fInsideArchitecture and not fInsideProcess and not oLine.isConcurrentBegin and not fInsideComponent and not fInsideGenerate and not fInsideFunction:
# if fInsideArchitecture and not fInsideProcess and not oLine.isConcurrentBegin and not fInsideComponent and not fInsideGenerate and not fInsideFunction:
if fInsideArchitecture and not fInsideProcess and not oLine.isConcurrentBegin and not fInsideComponent and not oLine.isGenerateKeyword and not fInsideFunction:
if re.match('^\s*\w+\s*:\s*\w+', oLine.line):
oLine.isInstantiationDeclaration = True
oLine.indentLevel = iCurrentIndentLevel