2016-09-01 01:45:18 +02:00
|
|
|
package uncore
|
|
|
|
|
|
|
|
import Chisel._
|
2016-10-04 00:17:36 +02:00
|
|
|
import diplomacy._
|
2016-09-01 01:45:18 +02:00
|
|
|
|
|
|
|
package object tilelink2
|
|
|
|
{
|
2016-09-30 10:39:35 +02:00
|
|
|
type TLOutwardNode = OutwardNode[TLClientPortParameters, TLManagerPortParameters, TLBundle]
|
|
|
|
type TLAsyncOutwardNode = OutwardNode[TLAsyncClientPortParameters, TLAsyncManagerPortParameters, TLAsyncBundle]
|
|
|
|
type IntOutwardNode = OutwardNode[IntSourcePortParameters, IntSinkPortParameters, Vec[Bool]]
|
2016-09-07 08:46:44 +02:00
|
|
|
def OH1ToUInt(x: UInt) = OHToUInt((x << 1 | UInt(1)) ^ x)
|
|
|
|
def UIntToOH1(x: UInt, width: Int) = ~(SInt(-1, width=width).asUInt << x)(width-1, 0)
|
2016-09-08 19:38:38 +02:00
|
|
|
def trailingZeros(x: Int) = if (x > 0) Some(log2Ceil(x & -x)) else None
|
2016-09-22 20:33:40 +02:00
|
|
|
def highOR(x: UInt) = {
|
|
|
|
val w = x.getWidth
|
|
|
|
def helper(s: Int, x: UInt): UInt =
|
2016-09-23 00:13:35 +02:00
|
|
|
if (s >= w) x else helper(s+s, x | (x << s)(w-1,0))
|
2016-09-22 20:33:40 +02:00
|
|
|
helper(1, x)
|
|
|
|
}
|
2016-09-01 01:45:18 +02:00
|
|
|
}
|