diff options
| author | Jim Lawson | 2016-08-25 12:16:33 -0700 |
|---|---|---|
| committer | Jim Lawson | 2016-08-25 12:16:33 -0700 |
| commit | f84e6ef2d68404c741ea7e2aa2f3990ebb0984ee (patch) | |
| tree | 350cab52a238d6ea1ee916e2c754cfdb7e9a7d95 /chiselFrontend/src/main | |
| parent | 716de18b37c301523f8c6fb4954745aaa2a79bdb (diff) | |
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.
Diffstat (limited to 'chiselFrontend/src/main')
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala | 11 |
1 files changed, 9 insertions, 2 deletions
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 } |
