Commit 2a501c99 authored by Alexander David Hellwig's avatar Alexander David Hellwig
Browse files

Added testcase for Component with array Port sized by generics

parent b7a88dcb
......@@ -868,5 +868,31 @@ public class SymtabTest extends AbstractSymtabTest {
}
@Test
public void testBasicGenericArrayInstance(){
Scope symTab = createSymTab("src/test/resources");
EMAComponentInstanceSymbol componentInstanceSymbol = symTab.<EMAComponentInstanceSymbol>resolve("test.basicGenericArrayInstance", EMAComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(componentInstanceSymbol);
for(int i = 1; i <= 6; i++){
assertTrue(componentInstanceSymbol.getPortInstance("aVal1["+i+"]").isPresent());
assertTrue(componentInstanceSymbol.getPortInstance("aValOut["+i+"]").isPresent());
}
EMAComponentInstanceSymbol subComp1 = componentInstanceSymbol.getSubComponent("basicGenericArraySize1").orElse(null);
EMAComponentInstanceSymbol subComp2 = componentInstanceSymbol.getSubComponent("basicGenericArraySize2").orElse(null);
assertNotNull(subComp1);
assertNotNull(subComp2);
for(int i = 1; i <= 3; i++) {
assertTrue("basicGenericArraySize1.val1["+i+"] not found", subComp1.getPortInstance("val1["+i+"]").isPresent());
assertTrue("basicGenericArraySize2.val1["+i+"] not found", subComp2.getPortInstance("val1["+i+"]").isPresent());
assertTrue("basicGenericArraySize1.valOut["+i+"] not found",subComp1.getPortInstance("valOut["+i+"]").isPresent());
assertTrue("basicGenericArraySize2.valOut["+i+"] not found",subComp2.getPortInstance("valOut["+i+"]").isPresent());
}
}
}
package test;
component BasicGenericArrayInstance{
ports in Q aVal1[6],
out Q aValOut[6];
instance BasicGenericArraySize<3> basicGenericArraySize1;
instance BasicGenericArraySize<3> basicGenericArraySize2;
connect val1[1:3] -> basicGenericArraySize1.val1[:];
connect val1[4:6] -> basicGenericArraySize2.val1[:];
connect basicGenericArraySize1.valOut[:] -> valOut[1:3];
connect basicGenericArraySize2.valOut[:] -> valOut[4:6];
}
\ No newline at end of file
package test;
component BasicGenericArraySize<N1 n=1>{
ports in Q val1[n],
out Q valOut[n];
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment