diff --git a/org.lflang/src/org/lflang/ast/AfterDelayTransformation.java b/org.lflang/src/org/lflang/ast/AfterDelayTransformation.java index 69367af018..0451a192c8 100644 --- a/org.lflang/src/org/lflang/ast/AfterDelayTransformation.java +++ b/org.lflang/src/org/lflang/ast/AfterDelayTransformation.java @@ -37,7 +37,6 @@ import org.lflang.lf.TypeParm; import org.lflang.lf.VarRef; import org.lflang.lf.WidthSpec; -import org.lflang.lf.WidthTerm; public class AfterDelayTransformation implements ITransformation { @@ -101,8 +100,7 @@ private void insertGeneratedDelays(List reactors) { Type type = ((Port) connection.getRightPorts().get(0).getVariable()).getType(); Reactor delayClass = getDelayClass(type); String generic = targetTypes.supportsGenerics() ? targetTypes.getTargetType(InferredType.fromAST(type)) : ""; - Instantiation delayInstance = getDelayInstance(delayClass, connection, generic, - !generator.generateAfterDelaysWithVariableWidth()); + Instantiation delayInstance = getDelayInstance(delayClass, connection, generic); // Stage the new connections for insertion into the tree. List connections = ASTUtils.convertToEmptyListIfNull(newConnections.get(parent)); @@ -198,13 +196,9 @@ private static List rerouteViaDelay(Connection connection, * @param connection The connection to create a delay instantiation foe * @param generic A string that denotes the appropriate type parameter, * which should be null or empty if the target does not support generics. - * @param defineWidthFromConnection If this is true and if the connection - * is a wide connection, then instantiate a bank of delays where the width - * is given by ports involved in the connection. Otherwise, the width will - * be unspecified indicating a variable length. */ private static Instantiation getDelayInstance(Reactor delayClass, - Connection connection, String generic, Boolean defineWidthFromConnection) { + Connection connection, String generic) { Expression delay = connection.getDelay(); Instantiation delayInstance = factory.createInstantiation(); delayInstance.setReactorClass(delayClass); @@ -215,19 +209,7 @@ private static Instantiation getDelayInstance(Reactor delayClass, } if (ASTUtils.hasMultipleConnections(connection)) { WidthSpec widthSpec = factory.createWidthSpec(); - if (defineWidthFromConnection) { - // Add all left ports of the connection to the WidthSpec of the generated delay instance. - // This allows the code generator to later infer the width from the involved ports. - // We only consider the left ports here, as they could be part of a broadcast. In this case, we want - // to delay the ports first, and then broadcast the output of the delays. - for (VarRef port : connection.getLeftPorts()) { - WidthTerm term = factory.createWidthTerm(); - term.setPort(EcoreUtil.copy(port)); - widthSpec.getTerms().add(term); - } - } else { - widthSpec.setOfVariableLength(true); - } + widthSpec.setOfVariableLength(true); delayInstance.setWidthSpec(widthSpec); } Assignment assignment = factory.createAssignment(); diff --git a/org.lflang/src/org/lflang/generator/IDelayBodyGenerator.java b/org.lflang/src/org/lflang/generator/IDelayBodyGenerator.java index 50a55d8501..fecdc8e0a4 100644 --- a/org.lflang/src/org/lflang/generator/IDelayBodyGenerator.java +++ b/org.lflang/src/org/lflang/generator/IDelayBodyGenerator.java @@ -34,23 +34,4 @@ public interface IDelayBodyGenerator { */ String generateDelayGeneric(); - /** - * Indicates whether delay banks generated from after delays should have a variable length - * width. - *

- * If this is true, any delay reactors that are inserted for after delays on multiport - * connections - * will have an unspecified variable length width. The code generator is then responsible for - * inferring the - * correct width of the delay bank, which is only possible if the precise connection width is - * known at compile time. - *

- * If this is false, the width specification of the generated bank will list all the ports - * listed on the right - * side of the connection. This gives the code generator the information needed to infer the - * correct width at - * runtime. - */ - boolean generateAfterDelaysWithVariableWidth(); - } diff --git a/org.lflang/src/org/lflang/generator/c/CDelayBodyGenerator.java b/org.lflang/src/org/lflang/generator/c/CDelayBodyGenerator.java index 2fb600a4de..5d540122b8 100644 --- a/org.lflang/src/org/lflang/generator/c/CDelayBodyGenerator.java +++ b/org.lflang/src/org/lflang/generator/c/CDelayBodyGenerator.java @@ -55,8 +55,4 @@ public String generateDelayGeneric() { throw new UnsupportedOperationException("TODO: auto-generated method stub"); } - @Override - public boolean generateAfterDelaysWithVariableWidth() { - return false; - } } diff --git a/org.lflang/src/org/lflang/generator/cpp/CppDelayBodyGenerator.kt b/org.lflang/src/org/lflang/generator/cpp/CppDelayBodyGenerator.kt index 377bc73400..827d6d2902 100644 --- a/org.lflang/src/org/lflang/generator/cpp/CppDelayBodyGenerator.kt +++ b/org.lflang/src/org/lflang/generator/cpp/CppDelayBodyGenerator.kt @@ -41,6 +41,4 @@ class CppDelayBodyGenerator : IDelayBodyGenerator { override fun generateDelayGeneric() = "T" - override fun generateAfterDelaysWithVariableWidth() = false - } \ No newline at end of file diff --git a/org.lflang/src/org/lflang/generator/ts/TSDelayBodyGenerator.kt b/org.lflang/src/org/lflang/generator/ts/TSDelayBodyGenerator.kt index 33add8daee..948be78ca5 100644 --- a/org.lflang/src/org/lflang/generator/ts/TSDelayBodyGenerator.kt +++ b/org.lflang/src/org/lflang/generator/ts/TSDelayBodyGenerator.kt @@ -32,6 +32,4 @@ class TSDelayBodyGenerator : IDelayBodyGenerator { override fun generateDelayGeneric(): String { return "T extends Present" } - - override fun generateAfterDelaysWithVariableWidth() = false } \ No newline at end of file