diff options
| author | Jim Lawson | 2017-03-13 11:39:21 -1000 |
|---|---|---|
| committer | Richard Lin | 2017-03-13 14:39:21 -0700 |
| commit | a6798adbf7567cf105f8190ebd293a4cfb3aeb11 (patch) | |
| tree | 0a66072a06f9ba5bf4ccd56c6d0b6db28b53152d /chiselFrontend/src/main/scala/chisel3 | |
| parent | a290d77ef3e88b200ab61cd41fcd1a1138321b66 (diff) | |
Revert "Change Vec creation to check if gen is lit (and hence needs t… (#530)
* Revert "Change Vec creation to check if gen is lit (and hence needs to be declared)"
This reverts commit dc86e7e1734d6abacb739b488df1de231e6b41b2.
This may address #522 - using chiselCloneType (instead of cloneType) to preserve directionality.
* Add missing implicits to Vec.apply() signature.
* Use correct macro (CompileOptionsTransform) for indexWhere.
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3')
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala b/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala index 92cf658d..2bba14ed 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/Aggregate.scala @@ -42,19 +42,10 @@ object Vec { * * @note elements are NOT assigned by default and have no value */ - def apply[T <: Data](n: Int, gen: T): Vec[T] = macro VecTransform.apply_ngen; - - def do_apply[T <: Data](n: Int, gen: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Vec[T] = { - if ( gen.isLit ) { - Vec(Seq.fill(n)(gen)) - } else { - new Vec(gen.chiselCloneType, n) - } - } + def apply[T <: Data](n: Int, gen: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Vec[T] = new Vec(gen.chiselCloneType, n) @deprecated("Vec argument order should be size, t; this will be removed by the official release", "chisel3") - def apply[T <: Data](gen: T, n: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Vec[T] = - do_apply(n, gen) + def apply[T <: Data](gen: T, n: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Vec[T] = new Vec(gen.chiselCloneType, n) /** Creates a new [[Vec]] composed of elements of the input Seq of [[Data]] * nodes. @@ -332,14 +323,14 @@ trait VecLike[T <: Data] extends collection.IndexedSeq[T] with HasId { /** Outputs the index of the first element for which p outputs true. */ - def indexWhere(p: T => Bool): UInt = macro SourceInfoTransform.pArg + def indexWhere(p: T => Bool): UInt = macro CompileOptionsTransform.pArg def do_indexWhere(p: T => Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = SeqUtils.priorityMux(indexWhereHelper(p)) /** Outputs the index of the last element for which p outputs true. */ - def lastIndexWhere(p: T => Bool): UInt = macro SourceInfoTransform.pArg + def lastIndexWhere(p: T => Bool): UInt = macro CompileOptionsTransform.pArg def do_lastIndexWhere(p: T => Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = SeqUtils.priorityMux(indexWhereHelper(p).reverse) |
