summaryrefslogtreecommitdiff
path: root/src/main/scala/chisel3/util/Arbiter.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/chisel3/util/Arbiter.scala')
-rw-r--r--src/main/scala/chisel3/util/Arbiter.scala24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/main/scala/chisel3/util/Arbiter.scala b/src/main/scala/chisel3/util/Arbiter.scala
index 0ece3a0a..5875b3f2 100644
--- a/src/main/scala/chisel3/util/Arbiter.scala
+++ b/src/main/scala/chisel3/util/Arbiter.scala
@@ -36,17 +36,17 @@ abstract class LockingArbiterLike[T <: Data](gen: T, n: Int, count: Int, needsLo
if (count > 1) {
val lockCount = Counter(count)
val lockIdx = Reg(UInt())
- val locked = lockCount.value =/= UInt.Lit(0)
+ val locked = lockCount.value =/= UInt(0)
val wantsLock = needsLock.map(_(io.out.bits)).getOrElse(Bool(true))
- when (io.out.firing && wantsLock) {
+ when (io.out.fire() && wantsLock) {
lockIdx := io.chosen
lockCount.inc()
}
when (locked) { io.chosen := lockIdx }
for ((in, (g, i)) <- io.in zip grant.zipWithIndex)
- in.ready := Mux(locked, lockIdx === UInt.Lit(i), g) && io.out.ready
+ in.ready := Mux(locked, lockIdx === UInt(i), g) && io.out.ready
} else {
for ((in, g) <- io.in zip grant)
in.ready := g && io.out.ready
@@ -55,8 +55,8 @@ 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.Lit(_) > lastGrant)
+ lazy val lastGrant = RegEnable(io.chosen, io.out.fire())
+ lazy val grantMask = (0 until n).map(UInt(_) > lastGrant)
lazy val validMask = io.in zip grantMask map { case (in, g) => in.valid && g }
override def grant: Seq[Bool] = {
@@ -64,20 +64,20 @@ 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.Lit(n-1))
+ override lazy val choice = Wire(init=UInt(n-1))
for (i <- n-2 to 0 by -1)
- when (io.in(i).valid) { choice := UInt.Lit(i) }
+ when (io.in(i).valid) { choice := UInt(i) }
for (i <- n-1 to 1 by -1)
- when (validMask(i)) { choice := UInt.Lit(i) }
+ when (validMask(i)) { choice := UInt(i) }
}
class LockingArbiter[T <: Data](gen: T, n: Int, count: Int, needsLock: Option[T => Bool] = None)
extends LockingArbiterLike[T](gen, n, count, needsLock) {
def grant: Seq[Bool] = ArbiterCtrl(io.in.map(_.valid))
- override lazy val choice = Wire(init=UInt.Lit(n-1))
+ override lazy val choice = Wire(init=UInt(n-1))
for (i <- n-2 to 0 by -1)
- when (io.in(i).valid) { choice := UInt.Lit(i) }
+ when (io.in(i).valid) { choice := UInt(i) }
}
/** Hardware module that is used to sequence n producers into 1 consumer.
@@ -103,11 +103,11 @@ 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.Lit(n-1)
+ io.chosen := UInt(n-1)
io.out.bits := io.in(n-1).bits
for (i <- n-2 to 0 by -1) {
when (io.in(i).valid) {
- io.chosen := UInt.Lit(i)
+ io.chosen := UInt(i)
io.out.bits := io.in(i).bits
}
}