summaryrefslogtreecommitdiff
path: root/src/main/scala/chisel3/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/chisel3/util')
-rw-r--r--src/main/scala/chisel3/util/Arbiter.scala10
-rw-r--r--src/main/scala/chisel3/util/Bitwise.scala2
-rw-r--r--src/main/scala/chisel3/util/CircuitMath.scala2
-rw-r--r--src/main/scala/chisel3/util/Decoupled.scala2
-rw-r--r--src/main/scala/chisel3/util/OneHot.scala2
5 files changed, 9 insertions, 9 deletions
diff --git a/src/main/scala/chisel3/util/Arbiter.scala b/src/main/scala/chisel3/util/Arbiter.scala
index 44cc88b6..0ece3a0a 100644
--- a/src/main/scala/chisel3/util/Arbiter.scala
+++ b/src/main/scala/chisel3/util/Arbiter.scala
@@ -11,7 +11,7 @@ import chisel3._
class ArbiterIO[T <: Data](gen: T, n: Int) extends Bundle {
val in = Flipped(Vec(n, DecoupledIO(gen)))
val out = DecoupledIO(gen)
- val chosen = Output(UInt(log2Up(n)))
+ val chosen = Output(UInt.width(log2Up(n)))
}
/** Arbiter Control determining which producer has access */
@@ -56,7 +56,7 @@ abstract class LockingArbiterLike[T <: Data](gen: T, n: Int, count: Int, needsLo
class LockingRRArbiter[T <: Data](gen: T, n: Int, count: Int, needsLock: Option[T => Bool] = None)
extends LockingArbiterLike[T](gen, n, count, needsLock) {
lazy val lastGrant = RegEnable(io.chosen, io.out.firing)
- lazy val grantMask = (0 until n).map(UInt(_) > lastGrant)
+ lazy val grantMask = (0 until n).map(UInt.Lit(_) > lastGrant)
lazy val validMask = io.in zip grantMask map { case (in, g) => in.valid && g }
override def grant: Seq[Bool] = {
@@ -64,7 +64,7 @@ class LockingRRArbiter[T <: Data](gen: T, n: Int, count: Int, needsLock: Option[
(0 until n).map(i => ctrl(i) && grantMask(i) || ctrl(i + n))
}
- override lazy val choice = Wire(init=UInt(n-1))
+ override lazy val choice = Wire(init=UInt.Lit(n-1))
for (i <- n-2 to 0 by -1)
when (io.in(i).valid) { choice := UInt.Lit(i) }
for (i <- n-1 to 1 by -1)
@@ -75,7 +75,7 @@ class LockingArbiter[T <: Data](gen: T, n: Int, count: Int, needsLock: Option[T
extends LockingArbiterLike[T](gen, n, count, needsLock) {
def grant: Seq[Bool] = ArbiterCtrl(io.in.map(_.valid))
- override lazy val choice = Wire(init=UInt(n-1))
+ override lazy val choice = Wire(init=UInt.Lit(n-1))
for (i <- n-2 to 0 by -1)
when (io.in(i).valid) { choice := UInt.Lit(i) }
}
@@ -103,7 +103,7 @@ class RRArbiter[T <: Data](gen:T, n: Int) extends LockingRRArbiter[T](gen, n, 1)
class Arbiter[T <: Data](gen: T, n: Int) extends Module {
val io = IO(new ArbiterIO(gen, n))
- io.chosen := UInt(n-1)
+ io.chosen := UInt.Lit(n-1)
io.out.bits := io.in(n-1).bits
for (i <- n-2 to 0 by -1) {
when (io.in(i).valid) {
diff --git a/src/main/scala/chisel3/util/Bitwise.scala b/src/main/scala/chisel3/util/Bitwise.scala
index ab1ff550..b2a9a28c 100644
--- a/src/main/scala/chisel3/util/Bitwise.scala
+++ b/src/main/scala/chisel3/util/Bitwise.scala
@@ -27,7 +27,7 @@ object Fill {
/** Fan out x n times */
def apply(n: Int, x: UInt): UInt = {
n match {
- case 0 => UInt(width=0)
+ case 0 => UInt.width(0)
case 1 => x
case y if n > 1 =>
val p2 = Array.ofDim[UInt](log2Up(n + 1))
diff --git a/src/main/scala/chisel3/util/CircuitMath.scala b/src/main/scala/chisel3/util/CircuitMath.scala
index 5e93b009..8f8bde4a 100644
--- a/src/main/scala/chisel3/util/CircuitMath.scala
+++ b/src/main/scala/chisel3/util/CircuitMath.scala
@@ -20,7 +20,7 @@ object Log2 {
} else if (width == 2) {
x(1)
} else {
- Mux(x(width-1), UInt(width-1), apply(x, width-1))
+ Mux(x(width-1), UInt.width(width-1), apply(x, width-1))
}
}
diff --git a/src/main/scala/chisel3/util/Decoupled.scala b/src/main/scala/chisel3/util/Decoupled.scala
index 5958c744..037f9a22 100644
--- a/src/main/scala/chisel3/util/Decoupled.scala
+++ b/src/main/scala/chisel3/util/Decoupled.scala
@@ -82,7 +82,7 @@ class QueueIO[T <: Data](gen: T, entries: Int) extends Bundle
/** I/O to enqueue data, is [[Chisel.DecoupledIO]]*/
val deq = DeqIO(gen)
/** The current amount of data in the queue */
- val count = Output(UInt(log2Up(entries + 1)))
+ val count = Output(UInt.width(log2Up(entries + 1)))
}
/** A hardware module implementing a Queue
diff --git a/src/main/scala/chisel3/util/OneHot.scala b/src/main/scala/chisel3/util/OneHot.scala
index 8a5caf44..c1f94ba6 100644
--- a/src/main/scala/chisel3/util/OneHot.scala
+++ b/src/main/scala/chisel3/util/OneHot.scala
@@ -31,7 +31,7 @@ object OHToUInt {
* @example {{{ data_out := PriorityEncoder(data_in) }}}
*/
object PriorityEncoder {
- def apply(in: Seq[Bool]): UInt = PriorityMux(in, (0 until in.size).map(UInt(_)))
+ def apply(in: Seq[Bool]): UInt = PriorityMux(in, (0 until in.size).map(UInt.Lit(_)))
def apply(in: Bits): UInt = apply(in.toBools)
}