Commit 984e0361 authored by Sebastian Nickels's avatar Sebastian Nickels

Splitted the resolve functionality of ArchitectureElementSymbol into ResolvableSymbol

parent 6b545750
Pipeline #179999 failed with stages
in 2 minutes and 10 seconds
......@@ -45,8 +45,6 @@ public class ArchitectureElementData {
this.name = name;
this.element = element;
this.templateController = templateController;
this.partOfUnroll = partOfUnroll;
this.unrollIndex = unrollIndex;
}
public String getName() {
......
......@@ -66,10 +66,8 @@ public abstract class ArchitectureSupportChecker {
}
private boolean hasConstant(ArchitectureElementSymbol element) {
ArchitectureElementSymbol resolvedElement = element.getResolvedThis().get();
if (resolvedElement instanceof CompositeElementSymbol) {
List<ArchitectureElementSymbol> constructedElements = ((CompositeElementSymbol) resolvedElement).getElements();
if (element instanceof CompositeElementSymbol) {
List<ArchitectureElementSymbol> constructedElements = ((CompositeElementSymbol) element).getElements();
for (ArchitectureElementSymbol constructedElement : constructedElements) {
if (hasConstant(constructedElement)) {
......@@ -77,7 +75,7 @@ public abstract class ArchitectureSupportChecker {
}
}
}
else if (resolvedElement instanceof ConstantSymbol) {
else if (element instanceof ConstantSymbol) {
return true;
}
......
......@@ -68,22 +68,22 @@ public class LayerNameCreator {
return nameSerialComposite((SerialCompositeElementSymbol) architectureElement, stage, streamIndices);
} else if (architectureElement instanceof ParallelCompositeElementSymbol) {
return nameParallelComposite((ParallelCompositeElementSymbol) architectureElement, stage, streamIndices);
} else{
if (architectureElement.isAtomic()){
} else {
if (architectureElement.isAtomic()) {
if (architectureElement.getMaxSerialLength().get() > 0){
return add(architectureElement, stage, streamIndices);
} else {
return stage;
}
} else {
if(!architectureElement.isResolved()){
if (!architectureElement.isResolved()) {
try {
architectureElement.resolve();
} catch (ArchResolveException e) {
e.printStackTrace();
}
}
ArchitectureElementSymbol resolvedElement = architectureElement.getResolvedThis().get();
ArchitectureElementSymbol resolvedElement = (ArchitectureElementSymbol) architectureElement.getResolvedThis().get();
return name(resolvedElement, stage, streamIndices);
}
}
......
......@@ -17,11 +17,10 @@ public abstract class LayerSupportChecker {
protected List<String> supportedLayerList = new ArrayList<>();
private boolean isSupportedLayer(ArchitectureElementSymbol element){
ArchitectureElementSymbol resolvedElement = element.getResolvedThis().get();
List<ArchitectureElementSymbol> constructLayerElemList;
if (resolvedElement instanceof CompositeElementSymbol) {
constructLayerElemList = ((CompositeElementSymbol) resolvedElement).getElements();
if (element instanceof CompositeElementSymbol) {
constructLayerElemList = ((CompositeElementSymbol) element).getElements();
for (ArchitectureElementSymbol constructedLayerElement : constructLayerElemList) {
if (!isSupportedLayer(constructedLayerElement)) {
return false;
......@@ -31,23 +30,23 @@ public abstract class LayerSupportChecker {
}
// Support all inputs and outputs
if (resolvedElement instanceof VariableSymbol) {
if (((VariableSymbol) resolvedElement).getType() == VariableSymbol.Type.LAYER) {
return isSupportedLayer(((VariableSymbol) resolvedElement).getLayerVariableDeclaration().getLayer());
if (element instanceof VariableSymbol) {
if (((VariableSymbol) element).getType() == VariableSymbol.Type.LAYER) {
return isSupportedLayer(((VariableSymbol) element).getLayerVariableDeclaration().getLayer());
}
else if (resolvedElement.isInput() || resolvedElement.isOutput()) {
else if (element.isInput() || element.isOutput()) {
return true;
}
}
// Support for constants is checked in ArchitectureSupportChecker
if (resolvedElement instanceof ConstantSymbol) {
if (element instanceof ConstantSymbol) {
return true;
}
// Support all layer declarations
if (resolvedElement instanceof LayerSymbol) {
if (!((LayerSymbol) resolvedElement).getDeclaration().isPredefined()) {
if (element instanceof LayerSymbol) {
if (!((LayerSymbol) element).getDeclaration().isPredefined()) {
return true;
}
}
......
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