Commit afb3db82 authored by Sebastian Nickels's avatar Sebastian Nickels
Browse files

Allow outputs to be used as inputs

parent e42bc2ad
Pipeline #172953 failed with stages
...@@ -342,7 +342,8 @@ public class VariableSymbol extends ArchitectureElementSymbol { ...@@ -342,7 +342,8 @@ public class VariableSymbol extends ArchitectureElementSymbol {
public List<ArchTypeSymbol> computeOutputTypes() { public List<ArchTypeSymbol> computeOutputTypes() {
if (isAtomic()) { if (isAtomic()) {
if (getType() == Type.IO) { if (getType() == Type.IO) {
if (isInput()) { // Allow inputs and outputs to be used as input
if (isInput() || getOutputElement().isPresent()) {
return Collections.singletonList(((IODeclarationSymbol) getDeclaration()).getType()); return Collections.singletonList(((IODeclarationSymbol) getDeclaration()).getType());
} }
else { else {
...@@ -387,9 +388,12 @@ public class VariableSymbol extends ArchitectureElementSymbol { ...@@ -387,9 +388,12 @@ public class VariableSymbol extends ArchitectureElementSymbol {
} }
if (getInputTypes().size() != 1) { if (getInputTypes().size() != 1) {
Log.error("0" + ErrorCodes.INVALID_ELEMENT_INPUT_SHAPE + " Invalid number of input streams. " + // Allow no input when output is used as input
"The number of input streams for the output '" + name + "' is " + getInputTypes().size() + "." if (!(getInputTypes().size() == 0 && getOutputElement().isPresent())) {
, getSourcePosition()); Log.error("0" + ErrorCodes.INVALID_ELEMENT_INPUT_SHAPE + " Invalid number of input streams. " +
"The number of input streams for the output '" + name + "' is " + getInputTypes().size() + "."
, getSourcePosition());
}
} else { } else {
ASTElementType inputType = getInputTypes().get(0).getDomain(); ASTElementType inputType = getInputTypes().get(0).getDomain();
ASTElementType outputType = ioDeclaration.getType().getDomain(); ASTElementType outputType = ioDeclaration.getType().getDomain();
......
Supports Markdown
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