diff options
| author | Richard Lin | 2017-02-15 14:19:36 -0800 |
|---|---|---|
| committer | GitHub | 2017-02-15 14:19:36 -0800 |
| commit | 375e2b6a0a456c55298d82837d28986de6211ebc (patch) | |
| tree | 781f4fc3d22dab0bc73a2fdec48920a20f5e7e42 /chiselFrontend/src/main/scala/chisel3/core/SeqUtils.scala | |
| parent | 41bee3f347e743e328ee520a48109cb542f3b245 (diff) | |
Implement asTypeOf, refactor internal APIs (#450)
Diffstat (limited to 'chiselFrontend/src/main/scala/chisel3/core/SeqUtils.scala')
| -rw-r--r-- | chiselFrontend/src/main/scala/chisel3/core/SeqUtils.scala | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/core/SeqUtils.scala b/chiselFrontend/src/main/scala/chisel3/core/SeqUtils.scala index e435860e..c7b59d96 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/SeqUtils.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/SeqUtils.scala @@ -37,9 +37,9 @@ private[chisel3] object SeqUtils { /** Returns the data value corresponding to the first true predicate. */ - def priorityMux[T <: Data](in: Seq[(Bool, T)]): T = macro SourceInfoTransform.inArg + def priorityMux[T <: Data](in: Seq[(Bool, T)]): T = macro CompileOptionsTransform.inArg - def do_priorityMux[T <: Data](in: Seq[(Bool, T)])(implicit sourceInfo: SourceInfo): T = { + def do_priorityMux[T <: Data](in: Seq[(Bool, T)])(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T = { if (in.size == 1) { in.head._2 } else { @@ -58,8 +58,8 @@ private[chisel3] object SeqUtils { in.head._2 } else { val masked = for ((s, i) <- in) yield Mux(s, i.asUInt, 0.U) - val width = in.map(_._2.width).reduce(_ max _) - in.head._2.cloneTypeWidth(width).fromBits(masked.reduceLeft(_|_)) + val output = cloneSupertype(in.toSeq map {_._2}, "oneHotMux") + output.fromBits(masked.reduceLeft(_|_)) } } } |
