From f84e6ef2d68404c741ea7e2aa2f3990ebb0984ee Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Thu, 25 Aug 2016 12:16:33 -0700 Subject: Use bulkConnect in Vec,fill if any (flattened) element of the Vec has a direction associated with it. This impetus for this came out of discussion during the chisel meeting of 8/24/16 in response to errors running the chisel tutorial examples Adder test. --- chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'chiselFrontend/src/main/scala/chisel3') diff --git a/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala b/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala index 03c84827..5e410ebd 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala @@ -49,9 +49,16 @@ object Vec { // DummyImplicit or additional type parameter will break some code. require(!elts.isEmpty) val width = elts.map(_.width).reduce(_ max _) + // If an element has a direction associated with it, use the bulk connect operator. val vec = Wire(new Vec(elts.head.cloneTypeWidth(width), elts.length)) - for ((v, e) <- vec zip elts) - v := e + def doConnect(sink: T, source: T) = if (elts.head.flatten.exists(_.firrtlDirection != Direction.Unspecified)) { + sink bulkConnect source + } else { + sink connect source + } + for ((v, e) <- vec zip elts) { + doConnect(v, e) + } vec } -- cgit v1.2.3