2012-09-27 21:59:45 +02:00
|
|
|
package uncore
|
2012-10-16 03:52:48 +02:00
|
|
|
package constants
|
2012-09-27 21:59:45 +02:00
|
|
|
|
|
|
|
import Chisel._
|
2012-10-16 22:58:18 +02:00
|
|
|
import scala.math.max
|
2012-10-16 03:52:48 +02:00
|
|
|
|
2013-07-25 08:22:36 +02:00
|
|
|
object MemoryOpConstants extends MemoryOpConstants
|
2012-10-16 03:52:48 +02:00
|
|
|
trait MemoryOpConstants {
|
2014-01-21 21:20:55 +01:00
|
|
|
val MT_SZ = 3
|
|
|
|
val MT_X = Bits("b???")
|
|
|
|
val MT_B = Bits("b000")
|
|
|
|
val MT_H = Bits("b001")
|
|
|
|
val MT_W = Bits("b010")
|
|
|
|
val MT_D = Bits("b011")
|
|
|
|
val MT_BU = Bits("b100")
|
|
|
|
val MT_HU = Bits("b101")
|
|
|
|
val MT_WU = Bits("b110")
|
2012-10-11 00:42:39 +02:00
|
|
|
|
2013-04-04 07:13:51 +02:00
|
|
|
val M_SZ = 5
|
|
|
|
val M_X = Bits("b?????");
|
|
|
|
val M_XRD = Bits("b00000"); // int load
|
|
|
|
val M_XWR = Bits("b00001"); // int store
|
|
|
|
val M_PFR = Bits("b00010"); // prefetch with intent to read
|
|
|
|
val M_PFW = Bits("b00011"); // prefetch with intent to write
|
2013-09-13 01:09:53 +02:00
|
|
|
val M_XA_SWAP = Bits("b00100");
|
2013-10-29 06:37:41 +01:00
|
|
|
val M_NOP = Bits("b00101");
|
2013-04-04 07:13:51 +02:00
|
|
|
val M_XLR = Bits("b00110");
|
|
|
|
val M_XSC = Bits("b00111");
|
|
|
|
val M_XA_ADD = Bits("b01000");
|
2013-09-13 01:09:53 +02:00
|
|
|
val M_XA_XOR = Bits("b01001");
|
|
|
|
val M_XA_OR = Bits("b01010");
|
|
|
|
val M_XA_AND = Bits("b01011");
|
2013-04-04 07:13:51 +02:00
|
|
|
val M_XA_MIN = Bits("b01100");
|
|
|
|
val M_XA_MAX = Bits("b01101");
|
|
|
|
val M_XA_MINU = Bits("b01110");
|
|
|
|
val M_XA_MAXU = Bits("b01111");
|
|
|
|
val M_INV = Bits("b10000"); // write back and invalidate line
|
|
|
|
val M_CLN = Bits("b10001"); // write back line
|
2012-11-16 11:37:56 +01:00
|
|
|
|
2013-09-13 01:09:53 +02:00
|
|
|
def isAMO(cmd: Bits) = cmd(3) || cmd === M_XA_SWAP
|
2012-11-18 12:13:17 +01:00
|
|
|
def isPrefetch(cmd: Bits) = cmd === M_PFR || cmd === M_PFW
|
2013-04-04 07:13:51 +02:00
|
|
|
def isRead(cmd: Bits) = cmd === M_XRD || cmd === M_XLR || isAMO(cmd)
|
|
|
|
def isWrite(cmd: Bits) = cmd === M_XWR || cmd === M_XSC || isAMO(cmd)
|
|
|
|
def isWriteIntent(cmd: Bits) = isWrite(cmd) || cmd === M_PFW || cmd === M_XLR
|
2012-10-16 03:52:48 +02:00
|
|
|
}
|
2012-09-27 21:59:45 +02:00
|
|
|
|
2013-07-25 08:22:36 +02:00
|
|
|
object AddressConstants extends AddressConstants
|
2012-10-16 22:58:18 +02:00
|
|
|
trait AddressConstants {
|
2012-11-27 05:54:56 +01:00
|
|
|
val PADDR_BITS = 32
|
2012-10-16 22:58:18 +02:00
|
|
|
val VADDR_BITS = 43;
|
|
|
|
val PGIDX_BITS = 13;
|
|
|
|
val PPN_BITS = PADDR_BITS-PGIDX_BITS;
|
|
|
|
val VPN_BITS = VADDR_BITS-PGIDX_BITS;
|
|
|
|
val ASID_BITS = 7;
|
|
|
|
val PERM_BITS = 6;
|
|
|
|
}
|
|
|
|
|
2013-11-21 01:43:55 +01:00
|
|
|
object CacheConstants extends CacheConstants
|
2013-08-02 23:55:06 +02:00
|
|
|
trait CacheConstants {
|
|
|
|
val CACHE_DATA_SIZE_IN_BYTES = 1 << 6
|
|
|
|
val OFFSET_BITS = log2Up(CACHE_DATA_SIZE_IN_BYTES)
|
|
|
|
}
|
|
|
|
|
|
|
|
trait TileLinkSizeConstants {
|
|
|
|
val ACQUIRE_WRITE_MASK_BITS = 6
|
|
|
|
val ACQUIRE_SUBWORD_ADDR_BITS = 3
|
|
|
|
val ACQUIRE_ATOMIC_OP_BITS = 4
|
|
|
|
}
|
|
|
|
|
|
|
|
trait MemoryInterfaceConstants extends
|
|
|
|
CacheConstants with
|
|
|
|
AddressConstants
|