From 3cb0a3cfbae154e8c7a79b526880837f6a74a889 Mon Sep 17 00:00:00 2001 From: eal Date: Fri, 11 Mar 2022 14:00:34 -0800 Subject: [PATCH 1/5] Test that will fail due to bug in ganged connections. --- test/C/src/multiport/BankGangedConnections.lf | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/C/src/multiport/BankGangedConnections.lf diff --git a/test/C/src/multiport/BankGangedConnections.lf b/test/C/src/multiport/BankGangedConnections.lf new file mode 100644 index 0000000000..c01931f93e --- /dev/null +++ b/test/C/src/multiport/BankGangedConnections.lf @@ -0,0 +1,22 @@ +target C; +import Count from "../lib/Count.lf" +import TestCount from "../lib/TestCount.lf" +reactor Through { + input in:int; + output out:int; + reaction(in) -> out {= + SET(out, in->value); + =} +} +reactor Bank { + input in:int; + output out:int; + t = new Through(); + in, t.out -> t.in, out; +} +main reactor { + b = new[2] Bank(); + s = new Count(); + t = new TestCount(); + s.out, b.out -> b.in, t.in; +} \ No newline at end of file From dc9bbe18b46ed0a541ee3c6d0aedaa860cdf43ca Mon Sep 17 00:00:00 2001 From: eal Date: Fri, 11 Mar 2022 14:03:20 -0800 Subject: [PATCH 2/5] Set timeout --- test/C/src/multiport/BankGangedConnections.lf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/C/src/multiport/BankGangedConnections.lf b/test/C/src/multiport/BankGangedConnections.lf index c01931f93e..b0dff2fcca 100644 --- a/test/C/src/multiport/BankGangedConnections.lf +++ b/test/C/src/multiport/BankGangedConnections.lf @@ -1,4 +1,6 @@ -target C; +target C { + timeout: 1 sec +} import Count from "../lib/Count.lf" import TestCount from "../lib/TestCount.lf" reactor Through { From 486918548fe8897de2919bb63f7b4759f62b2b8e Mon Sep 17 00:00:00 2001 From: eal Date: Fri, 11 Mar 2022 19:13:03 -0800 Subject: [PATCH 3/5] Reduced timeout --- test/C/src/multiport/BankGangedConnections.lf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/C/src/multiport/BankGangedConnections.lf b/test/C/src/multiport/BankGangedConnections.lf index b0dff2fcca..db9d6f8758 100644 --- a/test/C/src/multiport/BankGangedConnections.lf +++ b/test/C/src/multiport/BankGangedConnections.lf @@ -1,5 +1,5 @@ target C { - timeout: 1 sec + timeout: 0 sec } import Count from "../lib/Count.lf" import TestCount from "../lib/TestCount.lf" From 96647d345533cc8856bee530bf306248124ecf38 Mon Sep 17 00:00:00 2001 From: eal Date: Fri, 11 Mar 2022 19:13:20 -0800 Subject: [PATCH 4/5] Check for ganged connections on the inside --- org.lflang/src/org/lflang/generator/ReactorInstance.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/org.lflang/src/org/lflang/generator/ReactorInstance.java b/org.lflang/src/org/lflang/generator/ReactorInstance.java index bc994b7639..1f88acd6e9 100644 --- a/org.lflang/src/org/lflang/generator/ReactorInstance.java +++ b/org.lflang/src/org/lflang/generator/ReactorInstance.java @@ -1060,8 +1060,14 @@ private List> listPortInstances( if (count < references.size() - 1) { int portWidth = portInstance.width; int portParentWidth = portInstance.parent.width; + // If the port is being connected on the inside and there is + // more than one port in the list, then we can only connect one + // bank member at a time. + if (reactor == this && references.size() > 1) { + portParentWidth = 1; + } int widthBound = portWidth * portParentWidth; - + // If either of these widths cannot be determined, assume infinite. if (portWidth < 0) widthBound = Integer.MAX_VALUE; if (portParentWidth < 0) widthBound = Integer.MAX_VALUE; From 9c18496663414fea1b3d355435c50fe26840be6f Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Fri, 11 Mar 2022 23:07:31 -0800 Subject: [PATCH 5/5] Update test/C/src/multiport/BankGangedConnections.lf --- test/C/src/multiport/BankGangedConnections.lf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/C/src/multiport/BankGangedConnections.lf b/test/C/src/multiport/BankGangedConnections.lf index db9d6f8758..135af7868b 100644 --- a/test/C/src/multiport/BankGangedConnections.lf +++ b/test/C/src/multiport/BankGangedConnections.lf @@ -21,4 +21,4 @@ main reactor { s = new Count(); t = new TestCount(); s.out, b.out -> b.in, t.in; -} \ No newline at end of file +}