diff options
| author | Øyvind Harboe | 2021-12-11 04:39:27 +0100 |
|---|---|---|
| committer | GitHub | 2021-12-11 03:39:27 +0000 |
| commit | 55cb58877aca898f1ccae5edf29aeede9d1b71ba (patch) | |
| tree | 1a866565c79bcbbc8d79564f46929c24f67f8137 /core/src/main/scala/chisel3 | |
| parent | 630d05bdca90ec1c80eaaa7834e755f51095463d (diff) | |
reduceTree() now operates on Seq (#2292)
preserves input/output information of the type being reduced.
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Diffstat (limited to 'core/src/main/scala/chisel3')
| -rw-r--r-- | core/src/main/scala/chisel3/Aggregate.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/src/main/scala/chisel3/Aggregate.scala b/core/src/main/scala/chisel3/Aggregate.scala index dbde7068..600e2d11 100644 --- a/core/src/main/scala/chisel3/Aggregate.scala +++ b/core/src/main/scala/chisel3/Aggregate.scala @@ -338,11 +338,11 @@ sealed class Vec[T <: Data] private[chisel3] (gen: => T, val length: Int) def do_reduceTree(redOp: (T, T) => T, layerOp: (T) => T = (x: T) => x) (implicit sourceInfo: SourceInfo, compileOptions: CompileOptions) : T = { require(!isEmpty, "Cannot apply reduction on a vec of size 0") - var curLayer = this + var curLayer : Seq[T] = this while (curLayer.length > 1) { - curLayer = VecInit(curLayer.grouped(2).map( x => + curLayer = curLayer.grouped(2).map( x => if (x.length == 1) layerOp(x(0)) else redOp(x(0), x(1)) - ).toSeq) + ).toSeq } curLayer(0) } |
