1
0
Fork 0

[rocket] use more standard pattern for computing integer min

This commit is contained in:
Andrew Waterman 2016-07-29 15:19:09 -07:00
parent ffac86b041
commit c465120610
2 changed files with 1 additions and 7 deletions

View File

@ -125,7 +125,7 @@ class DmaFrontend(implicit p: Parameters) extends CoreModule()(p)
val last_src_vpn = Reg(UInt(width = vpnBits))
val last_dst_vpn = Reg(UInt(width = vpnBits))
val tx_len = Util.minUInt(src_pglen, dst_pglen, bytes_left)
val tx_len = src_pglen min dst_pglen min bytes_left
val dma_busy = Reg(init = UInt(0, tlMaxClientXacts))
val dma_xact_id = PriorityEncoder(~dma_busy)

View File

@ -44,12 +44,6 @@ object Util {
def toBits(): UInt = Cat(x.map(_.toBits).reverse)
}
def minUInt(values: Seq[UInt]): UInt =
values.reduce((a, b) => Mux(a < b, a, b))
def minUInt(first: UInt, rest: UInt*): UInt =
minUInt(first +: rest.toSeq)
implicit class UIntIsOneOf(val x: UInt) extends AnyVal {
def isOneOf(s: Seq[UInt]): Bool = s.map(x === _).reduce(_||_)