From 00796dfce1ec3eba739467571cdfc52df2aa62de Mon Sep 17 00:00:00 2001 From: Jack Koenig Date: Tue, 4 Apr 2017 13:35:03 -0700 Subject: Use input element to decide if Vec of values has direction (#570) Using the sample_element of the created wire is incorrect because Wires have no direction so the Wire constructed for a Vec of Module IO was constructed incorrectly. Fixes #569 and resolves #522.--- chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'chiselFrontend/src/main/scala/chisel3/core') diff --git a/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala b/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala index a561e7d5..be874042 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala @@ -73,7 +73,9 @@ object Vec { def doConnect(sink: T, source: T) = { // TODO: this looks bad, and should feel bad. Replace with a better abstraction. - val hasDirectioned = vec.sample_element match { + // NOTE: Must use elts.head instead of vec.sample_element because vec.sample_element has + // WireBinding which does not have a direction + val hasDirectioned = elts.head match { case t: Aggregate => t.flatten.exists(_.dir != Direction.Unspecified) case t: Element => t.dir != Direction.Unspecified } -- cgit v1.2.3