summaryrefslogtreecommitdiff
path: root/chiselFrontend/src/main/scala/Chisel/SeqUtils.scala
diff options
context:
space:
mode:
authorducky2016-05-05 13:22:04 -0700
committerducky2016-05-20 16:02:49 -0700
commite92f2f69477a6ce86fc148a1a95db5797f2e3051 (patch)
tree2f1511e3395299fd4f1e98c3f75886e06c0cd096 /chiselFrontend/src/main/scala/Chisel/SeqUtils.scala
parent84de04606bc972bd6a83f67913a0e30c4c46ee5e (diff)
Implementation of source locators
Diffstat (limited to 'chiselFrontend/src/main/scala/Chisel/SeqUtils.scala')
-rw-r--r--chiselFrontend/src/main/scala/Chisel/SeqUtils.scala20
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..e3e58cb4 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 <: Bits](in: Seq[(Bool, T)]): T = macro SourceInfoTransform.inArg
+
+ def do_priorityMux[T <: Bits](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 {