diff options
| author | Jim Lawson | 2016-06-03 12:38:28 -0700 |
|---|---|---|
| committer | Jim Lawson | 2016-06-03 12:38:28 -0700 |
| commit | 9dd286b8613beba58e053ed00d15877d3a4b02c9 (patch) | |
| tree | 6ae9268d8e7e6532e5b8a0f3ad51d6c345623376 /chiselFrontend/src/main/scala/Chisel/SeqUtils.scala | |
| parent | 70271cd8c3811cb518e81d1d5eb3ed20cb1e2063 (diff) | |
| parent | fd53af8642237998e23456a3fd1648ac84607db0 (diff) | |
Merge branch 'master' into front_end_dependency
Diffstat (limited to 'chiselFrontend/src/main/scala/Chisel/SeqUtils.scala')
| -rw-r--r-- | chiselFrontend/src/main/scala/Chisel/SeqUtils.scala | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/chiselFrontend/src/main/scala/Chisel/SeqUtils.scala b/chiselFrontend/src/main/scala/Chisel/SeqUtils.scala index c63f5735..9a15fd5f 100644 --- a/chiselFrontend/src/main/scala/Chisel/SeqUtils.scala +++ b/chiselFrontend/src/main/scala/Chisel/SeqUtils.scala @@ -2,9 +2,15 @@ package Chisel +import scala.language.experimental.macros + +import internal.sourceinfo.{SourceInfo, SourceInfoTransform} + private[Chisel] object SeqUtils { /** Equivalent to Cat(r(n-1), ..., r(0)) */ - def asUInt[T <: Bits](in: Seq[T]): UInt = { + def asUInt[T <: Bits](in: Seq[T]): UInt = macro SourceInfoTransform.inArg + + def do_asUInt[T <: Bits](in: Seq[T])(implicit sourceInfo: SourceInfo): UInt = { if (in.tail.isEmpty) { in.head.asUInt } else { @@ -15,7 +21,9 @@ private[Chisel] object SeqUtils { } /** Counts the number of true Bools in a Seq */ - def count(in: Seq[Bool]): UInt = { + def count(in: Seq[Bool]): UInt = macro SourceInfoTransform.inArg + + def do_count(in: Seq[Bool])(implicit sourceInfo: SourceInfo): UInt = { if (in.size == 0) { UInt(0) } else if (in.size == 1) { @@ -26,7 +34,9 @@ private[Chisel] object SeqUtils { } /** Returns data value corresponding to first true predicate */ - def priorityMux[T <: Bits](in: Seq[(Bool, T)]): T = { + def priorityMux[T <: Data](in: Seq[(Bool, T)]): T = macro SourceInfoTransform.inArg + + def do_priorityMux[T <: Data](in: Seq[(Bool, T)])(implicit sourceInfo: SourceInfo): T = { if (in.size == 1) { in.head._2 } else { @@ -35,7 +45,9 @@ private[Chisel] object SeqUtils { } /** Returns data value corresponding to lone true predicate */ - def oneHotMux[T <: Data](in: Iterable[(Bool, T)]): T = { + def oneHotMux[T <: Data](in: Iterable[(Bool, T)]): T = macro SourceInfoTransform.inArg + + def do_oneHotMux[T <: Data](in: Iterable[(Bool, T)])(implicit sourceInfo: SourceInfo): T = { if (in.tail.isEmpty) { in.head._2 } else { |
