From e939181aebb5a0131562609a5782e1f1df88699d Mon Sep 17 00:00:00 2001 From: Jack Koenig Date: Mon, 16 Sep 2019 15:54:31 -0700 Subject: Da steve101 tree reduce (#485) * Add a tree reduce function to Vec * Change function names of reduce operation function in Vec * Change reference to single layer operation in Vec.reduce * Commint name change for pair macro * Remove pair, call not necessary and can just be used from grouped(2) and map * Changed to reduceTree, added default identity function for single reduce. * Change style of Vec.reduceTree and tests to chisel3 and canonical Scala style * Cleanup Vec initialization, implicitCompileOptions --- .../scala/chisel3/internal/sourceinfo/SourceInfoTransform.scala | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'coreMacros/src') diff --git a/coreMacros/src/main/scala/chisel3/internal/sourceinfo/SourceInfoTransform.scala b/coreMacros/src/main/scala/chisel3/internal/sourceinfo/SourceInfoTransform.scala index e69c569a..d38396f4 100644 --- a/coreMacros/src/main/scala/chisel3/internal/sourceinfo/SourceInfoTransform.scala +++ b/coreMacros/src/main/scala/chisel3/internal/sourceinfo/SourceInfoTransform.scala @@ -84,6 +84,12 @@ class VecTransform(val c: Context) extends SourceInfoTransformMacro { def contains(x: c.Tree)(ev: c.Tree): c.Tree = { q"$thisObj.do_contains($x)($implicitSourceInfo, $ev, $implicitCompileOptions)" } + def reduceTree(redOp: c.Tree, layerOp: c.Tree): c.Tree = { + q"$thisObj.do_reduceTree($redOp,$layerOp)($implicitSourceInfo, $implicitCompileOptions)" + } + def reduceTreeDefault(redOp: c.Tree ): c.Tree = { + q"$thisObj.do_reduceTree($redOp)($implicitSourceInfo, $implicitCompileOptions)" + } } /** "Automatic" source information transform / insertion macros, which generate the function name -- cgit v1.2.3