2014-09-12 19:15:04 +02:00
|
|
|
// See LICENSE for license details.
|
|
|
|
|
2014-09-02 22:51:57 +02:00
|
|
|
package rocketchip
|
2014-08-23 10:26:03 +02:00
|
|
|
|
|
|
|
import Chisel._
|
2015-07-30 02:56:19 +02:00
|
|
|
import junctions._
|
2014-08-23 10:26:03 +02:00
|
|
|
import uncore._
|
|
|
|
import rocket._
|
|
|
|
import rocket.Util._
|
2015-11-10 22:39:08 +01:00
|
|
|
import groundtest._
|
2015-06-26 08:17:35 +02:00
|
|
|
import scala.math.max
|
2015-07-13 23:54:26 +02:00
|
|
|
import DefaultTestSuites._
|
2016-04-22 04:37:08 +02:00
|
|
|
import cde.{Parameters, Config, Dump, Knob, CDEMatchError}
|
2014-08-23 10:26:03 +02:00
|
|
|
|
2016-03-16 22:21:47 +01:00
|
|
|
object ConfigUtils {
|
|
|
|
def max_int(values: Int*): Int = {
|
|
|
|
values.reduce((a, b) => max(a, b))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
import ConfigUtils._
|
|
|
|
|
2016-05-25 20:08:11 +02:00
|
|
|
class BaseConfig extends Config (
|
2014-10-06 22:43:40 +02:00
|
|
|
topDefinitions = { (pname,site,here) =>
|
|
|
|
type PF = PartialFunction[Any,Any]
|
|
|
|
def findBy(sname:Any):Any = here[PF](site[Any](sname))(pname)
|
2016-04-29 01:15:31 +02:00
|
|
|
lazy val internalIOAddrMap: AddrMap = {
|
2016-05-03 03:08:33 +02:00
|
|
|
val entries = collection.mutable.ArrayBuffer[AddrMapEntry]()
|
2016-06-04 02:29:05 +02:00
|
|
|
entries += AddrMapEntry("debug", MemSize(4096, MemAttr(AddrMapProt.RWX)))
|
|
|
|
entries += AddrMapEntry("bootrom", MemSize(4096, MemAttr(AddrMapProt.RX)))
|
|
|
|
entries += AddrMapEntry("rtc", MemSize(4096, MemAttr(AddrMapProt.RW)))
|
2016-06-06 13:51:55 +02:00
|
|
|
entries += AddrMapEntry("plic", MemRange(0x40000000, 0x4000000, MemAttr(AddrMapProt.RW)))
|
|
|
|
entries += AddrMapEntry("prci", MemSize(0x4000000, MemAttr(AddrMapProt.RW)))
|
2016-05-03 03:08:33 +02:00
|
|
|
new AddrMap(entries)
|
2015-11-26 06:10:09 +01:00
|
|
|
}
|
2016-06-04 02:29:05 +02:00
|
|
|
lazy val globalAddrMap = {
|
|
|
|
val memBase = 0x80000000L
|
|
|
|
val memSize = 0x80000000L
|
|
|
|
val extIOBase = 0x60000000L
|
|
|
|
val extIOSize = 0x20000000L
|
2016-04-29 01:15:31 +02:00
|
|
|
val io = AddrMap(
|
2016-06-04 02:29:05 +02:00
|
|
|
AddrMapEntry("int", internalIOAddrMap),
|
|
|
|
AddrMapEntry("ext", MemRange(extIOBase, extIOSize, MemAttr(AddrMapProt.RWX))))
|
2016-05-01 05:59:36 +02:00
|
|
|
val addrMap = AddrMap(
|
2016-06-04 02:29:05 +02:00
|
|
|
AddrMapEntry("io", io),
|
|
|
|
AddrMapEntry("mem", MemRange(memBase, memSize, MemAttr(AddrMapProt.RWX, true))))
|
2016-05-01 05:59:36 +02:00
|
|
|
|
2016-06-04 02:29:05 +02:00
|
|
|
Dump("MEM_BASE", addrMap("mem").start)
|
2016-04-29 01:15:31 +02:00
|
|
|
Dump("MEM_SIZE", memSize)
|
2016-06-04 02:29:05 +02:00
|
|
|
Dump("IO_BASE", addrMap("io:ext").start)
|
2016-05-01 05:59:36 +02:00
|
|
|
Dump("IO_SIZE", extIOSize)
|
2016-06-04 02:29:05 +02:00
|
|
|
addrMap
|
2016-04-29 01:15:31 +02:00
|
|
|
}
|
2016-03-15 02:03:33 +01:00
|
|
|
def makeConfigString() = {
|
2016-06-04 02:29:05 +02:00
|
|
|
val addrMap = globalAddrMap
|
2016-06-06 13:51:55 +02:00
|
|
|
val plicAddr = addrMap("io:int:plic").start
|
|
|
|
val prciAddr = addrMap("io:int:prci").start
|
2016-05-10 09:27:31 +02:00
|
|
|
val plicInfo = site(PLICKey)
|
2016-03-15 02:03:33 +01:00
|
|
|
val xLen = site(XLen)
|
|
|
|
val res = new StringBuilder
|
|
|
|
res append "platform {\n"
|
|
|
|
res append " vendor ucb;\n"
|
|
|
|
res append " arch rocket;\n"
|
|
|
|
res append "};\n"
|
2016-05-10 09:27:31 +02:00
|
|
|
res append "plic {\n"
|
|
|
|
res append s" priority 0x${plicAddr.toString(16)};\n"
|
|
|
|
res append s" pending 0x${(plicAddr + plicInfo.pendingBase).toString(16)};\n"
|
|
|
|
res append s" ndevs ${plicInfo.nDevices};\n"
|
|
|
|
res append "};\n"
|
2016-04-27 23:57:54 +02:00
|
|
|
res append "rtc {\n"
|
2016-04-29 01:15:31 +02:00
|
|
|
res append s" addr 0x${addrMap("io:int:rtc").start.toString(16)};\n"
|
2016-04-27 23:57:54 +02:00
|
|
|
res append "};\n"
|
2016-03-15 02:03:33 +01:00
|
|
|
res append "ram {\n"
|
|
|
|
res append " 0 {\n"
|
2016-04-29 01:15:31 +02:00
|
|
|
res append s" addr 0x${addrMap("mem").start.toString(16)};\n"
|
2016-06-04 02:29:05 +02:00
|
|
|
res append s" size 0x${addrMap("mem").size.toString(16)};\n"
|
2016-03-15 02:03:33 +01:00
|
|
|
res append " };\n"
|
|
|
|
res append "};\n"
|
|
|
|
res append "core {\n"
|
|
|
|
for (i <- 0 until site(NTiles)) {
|
2016-05-25 20:08:11 +02:00
|
|
|
val isa = s"rv${site(XLen)}im${if (site(UseAtomics)) "a" else ""}${if (site(UseFPU)) "fd" else ""}"
|
2016-04-29 01:15:31 +02:00
|
|
|
val timecmpAddr = addrMap("io:int:rtc").start + 8*(i+1)
|
2016-03-15 02:03:33 +01:00
|
|
|
res append s" $i {\n"
|
|
|
|
res append " 0 {\n"
|
2016-04-29 01:15:31 +02:00
|
|
|
res append s" isa $isa;\n"
|
2016-04-27 23:57:54 +02:00
|
|
|
res append s" timecmp 0x${timecmpAddr.toString(16)};\n"
|
2016-06-06 13:51:55 +02:00
|
|
|
res append s" ipi 0x${(prciAddr + 4*i).toString(16)};\n"
|
2016-05-10 09:27:31 +02:00
|
|
|
res append s" plic {\n"
|
|
|
|
res append s" m {\n"
|
|
|
|
res append s" ie 0x${(plicAddr + plicInfo.enableAddr(i, 'M')).toString(16)};\n"
|
|
|
|
res append s" thresh 0x${(plicAddr + plicInfo.threshAddr(i, 'M')).toString(16)};\n"
|
|
|
|
res append s" claim 0x${(plicAddr + plicInfo.claimAddr(i, 'M')).toString(16)};\n"
|
|
|
|
res append s" };\n"
|
2016-05-13 20:22:46 +02:00
|
|
|
if (site(UseVM)) {
|
|
|
|
res append s" s {\n"
|
|
|
|
res append s" ie 0x${(plicAddr + plicInfo.enableAddr(i, 'S')).toString(16)};\n"
|
|
|
|
res append s" thresh 0x${(plicAddr + plicInfo.threshAddr(i, 'S')).toString(16)};\n"
|
|
|
|
res append s" claim 0x${(plicAddr + plicInfo.claimAddr(i, 'S')).toString(16)};\n"
|
|
|
|
res append s" };\n"
|
|
|
|
}
|
2016-05-10 09:27:31 +02:00
|
|
|
res append s" };\n"
|
2016-03-15 02:03:33 +01:00
|
|
|
res append " };\n"
|
|
|
|
res append " };\n"
|
|
|
|
}
|
|
|
|
res append "};\n"
|
|
|
|
res append '\u0000'
|
|
|
|
res.toString.getBytes
|
2015-09-25 18:41:19 +02:00
|
|
|
}
|
2014-10-06 22:43:40 +02:00
|
|
|
pname match {
|
2015-10-06 19:47:38 +02:00
|
|
|
case HtifKey => HtifParameters(
|
|
|
|
width = Dump("HTIF_WIDTH", 16),
|
|
|
|
nSCR = 64,
|
2016-01-15 00:10:40 +01:00
|
|
|
csrDataBits = site(XLen),
|
2015-10-06 19:47:38 +02:00
|
|
|
offsetBits = site(CacheBlockOffsetBits),
|
|
|
|
nCores = site(NTiles))
|
2014-10-06 22:43:40 +02:00
|
|
|
//Memory Parameters
|
|
|
|
case PAddrBits => 32
|
2015-06-26 08:17:35 +02:00
|
|
|
case PgIdxBits => 12
|
|
|
|
case PgLevels => if (site(XLen) == 64) 3 /* Sv39 */ else 2 /* Sv32 */
|
|
|
|
case PgLevelBits => site(PgIdxBits) - log2Up(site(XLen)/8)
|
|
|
|
case VPNBits => site(PgLevels) * site(PgLevelBits)
|
2014-10-06 22:43:40 +02:00
|
|
|
case PPNBits => site(PAddrBits) - site(PgIdxBits)
|
2015-06-26 08:17:35 +02:00
|
|
|
case VAddrBits => site(VPNBits) + site(PgIdxBits)
|
|
|
|
case ASIdBits => 7
|
2016-05-08 06:26:03 +02:00
|
|
|
case MIFTagBits => Dump("MIF_TAG_BITS", 5)
|
2016-02-27 20:41:28 +01:00
|
|
|
case MIFDataBits => Dump("MIF_DATA_BITS", 64)
|
2016-02-26 10:29:38 +01:00
|
|
|
case MIFAddrBits => Dump("MIF_ADDR_BITS",
|
|
|
|
site(PAddrBits) - site(CacheBlockOffsetBits))
|
2015-10-13 21:46:23 +02:00
|
|
|
case MIFDataBeats => site(CacheBlockBytes) * 8 / site(MIFDataBits)
|
2015-10-14 20:33:18 +02:00
|
|
|
case NastiKey => {
|
|
|
|
Dump("MEM_STRB_BITS", site(MIFDataBits) / 8)
|
|
|
|
NastiParameters(
|
|
|
|
dataBits = Dump("MEM_DATA_BITS", site(MIFDataBits)),
|
|
|
|
addrBits = Dump("MEM_ADDR_BITS", site(PAddrBits)),
|
|
|
|
idBits = Dump("MEM_ID_BITS", site(MIFTagBits)))
|
|
|
|
}
|
2016-04-29 03:56:27 +02:00
|
|
|
case HastiKey => HastiParameters(
|
|
|
|
dataBits = site(XLen),
|
|
|
|
addrBits = site(PAddrBits))
|
2014-10-06 22:43:40 +02:00
|
|
|
//Params used by all caches
|
|
|
|
case NSets => findBy(CacheName)
|
|
|
|
case NWays => findBy(CacheName)
|
|
|
|
case RowBits => findBy(CacheName)
|
2015-06-26 08:17:35 +02:00
|
|
|
case NTLBEntries => findBy(CacheName)
|
2015-11-22 01:11:22 +01:00
|
|
|
case CacheIdBits => findBy(CacheName)
|
2016-02-29 23:49:18 +01:00
|
|
|
case SplitMetadata => findBy(CacheName)
|
2015-12-03 02:18:39 +01:00
|
|
|
case ICacheBufferWays => Knob("L1I_BUFFER_WAYS")
|
2014-10-06 22:43:40 +02:00
|
|
|
case "L1I" => {
|
2015-06-26 08:17:35 +02:00
|
|
|
case NSets => Knob("L1I_SETS") //64
|
|
|
|
case NWays => Knob("L1I_WAYS") //4
|
2016-04-02 01:40:30 +02:00
|
|
|
case RowBits => site(TLKey("L1toL2")).dataBitsPerBeat
|
2015-06-26 08:17:35 +02:00
|
|
|
case NTLBEntries => 8
|
2015-11-22 01:11:22 +01:00
|
|
|
case CacheIdBits => 0
|
2016-03-10 23:17:41 +01:00
|
|
|
case SplitMetadata => false
|
2014-10-06 22:43:40 +02:00
|
|
|
}:PF
|
|
|
|
case "L1D" => {
|
2015-06-26 08:17:35 +02:00
|
|
|
case NSets => Knob("L1D_SETS") //64
|
2014-10-06 22:43:40 +02:00
|
|
|
case NWays => Knob("L1D_WAYS") //4
|
2016-04-02 01:40:30 +02:00
|
|
|
case RowBits => site(TLKey("L1toL2")).dataBitsPerBeat
|
2015-06-26 08:17:35 +02:00
|
|
|
case NTLBEntries => 8
|
2015-11-22 01:11:22 +01:00
|
|
|
case CacheIdBits => 0
|
2016-03-10 23:17:41 +01:00
|
|
|
case SplitMetadata => false
|
2014-10-06 22:43:40 +02:00
|
|
|
}:PF
|
|
|
|
case ECCCode => None
|
|
|
|
case Replacer => () => new RandomReplacement(site(NWays))
|
2015-06-26 08:17:35 +02:00
|
|
|
case AmoAluOperandBits => site(XLen)
|
2014-10-06 22:43:40 +02:00
|
|
|
//L1InstCache
|
2015-10-06 19:47:38 +02:00
|
|
|
case BtbKey => BtbParameters()
|
2014-10-06 22:43:40 +02:00
|
|
|
//L1DataCache
|
2015-06-26 08:17:35 +02:00
|
|
|
case WordBits => site(XLen)
|
2014-10-06 22:43:40 +02:00
|
|
|
case StoreDataQueueDepth => 17
|
|
|
|
case ReplayQueueDepth => 16
|
|
|
|
case NMSHRs => Knob("L1D_MSHRS")
|
|
|
|
case LRSCCycles => 32
|
2015-06-26 08:17:35 +02:00
|
|
|
//L2 Memory System Params
|
|
|
|
case NAcquireTransactors => 7
|
|
|
|
case L2StoreDataQueueDepth => 1
|
2015-10-14 08:44:05 +02:00
|
|
|
case L2DirectoryRepresentation => new NullRepresentation(site(NTiles))
|
2015-11-22 01:11:22 +01:00
|
|
|
case BuildL2CoherenceManager => (id: Int, p: Parameters) =>
|
2015-10-06 19:47:38 +02:00
|
|
|
Module(new L2BroadcastHub()(p.alterPartial({
|
2015-10-14 08:44:05 +02:00
|
|
|
case InnerTLId => "L1toL2"
|
|
|
|
case OuterTLId => "L2toMC" })))
|
2014-10-06 22:43:40 +02:00
|
|
|
//Tile Constants
|
2015-07-13 23:54:26 +02:00
|
|
|
case BuildTiles => {
|
2016-03-11 02:40:21 +01:00
|
|
|
val (rvi, rvu) =
|
|
|
|
if (site(XLen) == 64) (rv64i, rv64u)
|
|
|
|
else (rv32i, rv32u)
|
|
|
|
TestGeneration.addSuites(rvi.map(_("p")))
|
2016-05-01 05:59:36 +02:00
|
|
|
TestGeneration.addSuites((if(site(UseVM)) List("v") else List()).flatMap(env => rvu.map(_(env))))
|
2016-03-30 04:56:42 +02:00
|
|
|
TestGeneration.addSuite(bmarks)
|
2015-10-06 19:47:38 +02:00
|
|
|
List.fill(site(NTiles)){ (r: Bool, p: Parameters) =>
|
2015-10-14 08:44:05 +02:00
|
|
|
Module(new RocketTile(resetSignal = r)(p.alterPartial({case TLId => "L1toL2"})))
|
2015-10-06 19:47:38 +02:00
|
|
|
}
|
2015-07-13 23:54:26 +02:00
|
|
|
}
|
2015-11-26 01:02:54 +01:00
|
|
|
case BuildRoCC => Nil
|
2015-12-02 02:55:07 +01:00
|
|
|
case RoccNMemChannels => site(BuildRoCC).map(_.nMemChannels).foldLeft(0)(_ + _)
|
2016-02-25 07:52:02 +01:00
|
|
|
case RoccNPTWPorts => site(BuildRoCC).map(_.nPTWPorts).foldLeft(0)(_ + _)
|
2016-01-15 00:10:40 +01:00
|
|
|
case RoccNCSRs => site(BuildRoCC).map(_.csrs.size).foldLeft(0)(_ + _)
|
2015-11-18 03:21:52 +01:00
|
|
|
case NDmaTransactors => 3
|
2016-01-15 00:10:40 +01:00
|
|
|
case NDmaXacts => site(NDmaTransactors) * site(NTiles)
|
2015-11-18 03:21:52 +01:00
|
|
|
case NDmaClients => site(NTiles)
|
2014-10-06 22:43:40 +02:00
|
|
|
//Rocket Core Constants
|
2015-06-26 08:17:35 +02:00
|
|
|
case FetchWidth => 1
|
2014-10-06 22:43:40 +02:00
|
|
|
case RetireWidth => 1
|
|
|
|
case UseVM => true
|
2016-05-26 00:40:53 +02:00
|
|
|
case UseUser => true
|
2016-06-02 19:53:41 +02:00
|
|
|
case UseDebug => true
|
2015-09-28 22:55:55 +02:00
|
|
|
case UsePerfCounters => true
|
2014-10-06 22:43:40 +02:00
|
|
|
case FastLoadWord => true
|
|
|
|
case FastLoadByte => false
|
|
|
|
case FastMulDiv => true
|
2015-06-26 08:17:35 +02:00
|
|
|
case XLen => 64
|
2015-10-21 00:04:39 +02:00
|
|
|
case UseFPU => {
|
2016-05-01 05:59:36 +02:00
|
|
|
val env = if(site(UseVM)) List("p","v") else List("p")
|
2015-07-14 03:56:18 +02:00
|
|
|
if(site(FDivSqrt)) TestGeneration.addSuites(env.map(rv64uf))
|
|
|
|
else TestGeneration.addSuites(env.map(rv64ufNoDiv))
|
2015-10-21 00:04:39 +02:00
|
|
|
true
|
2015-07-14 03:56:18 +02:00
|
|
|
}
|
2016-05-25 20:08:11 +02:00
|
|
|
case UseAtomics => {
|
|
|
|
val env = if(site(UseVM)) List("p","v") else List("p")
|
|
|
|
TestGeneration.addSuites(env.map(if (site(XLen) == 64) rv64ua else rv32ua))
|
|
|
|
true
|
|
|
|
}
|
2016-05-10 09:27:31 +02:00
|
|
|
case NExtInterrupts => 2
|
2016-05-11 22:12:39 +02:00
|
|
|
case NExtMMIOChannels => 0
|
2016-06-04 02:29:05 +02:00
|
|
|
case PLICKey => PLICConfig(site(NTiles), site(UseVM), site(NExtInterrupts), 0)
|
2016-06-02 19:53:41 +02:00
|
|
|
case DMKey => new DefaultDebugModuleConfig(site(NTiles), site(XLen))
|
2015-06-26 08:17:35 +02:00
|
|
|
case FDivSqrt => true
|
2014-10-06 22:43:40 +02:00
|
|
|
case SFMALatency => 2
|
|
|
|
case DFMALatency => 3
|
|
|
|
case CoreInstBits => 32
|
2015-06-26 08:17:35 +02:00
|
|
|
case CoreDataBits => site(XLen)
|
|
|
|
case NCustomMRWCSRs => 0
|
2016-05-01 05:59:36 +02:00
|
|
|
case ResetVector => BigInt(0x1000)
|
|
|
|
case MtvecInit => BigInt(0x1010)
|
|
|
|
case MtvecWritable => true
|
2014-10-06 22:43:40 +02:00
|
|
|
//Uncore Paramters
|
2015-07-08 02:26:07 +02:00
|
|
|
case RTCPeriod => 100 // gives 10 MHz RTC assuming 1 GHz uncore clock
|
2015-10-14 08:44:05 +02:00
|
|
|
case LNEndpoints => site(TLKey(site(TLId))).nManagers + site(TLKey(site(TLId))).nClients
|
|
|
|
case LNHeaderBits => log2Ceil(site(TLKey(site(TLId))).nManagers) +
|
|
|
|
log2Up(site(TLKey(site(TLId))).nClients)
|
2016-04-27 23:57:54 +02:00
|
|
|
case ExtraL1Clients => 1 // HTIF // TODO not really a parameter
|
2016-05-25 00:59:59 +02:00
|
|
|
case HastiId => "TL"
|
|
|
|
case HastiKey("TL") =>
|
|
|
|
HastiParameters(
|
|
|
|
addrBits = site(PAddrBits),
|
|
|
|
dataBits = site(TLKey(site(TLId))).dataBits / site(TLKey(site(TLId))).dataBeats)
|
2015-10-14 08:44:05 +02:00
|
|
|
case TLKey("L1toL2") =>
|
|
|
|
TileLinkParameters(
|
|
|
|
coherencePolicy = new MESICoherence(site(L2DirectoryRepresentation)),
|
2016-01-15 00:10:40 +01:00
|
|
|
nManagers = site(NBanksPerMemoryChannel)*site(NMemoryChannels) + 1,
|
2015-10-14 08:44:05 +02:00
|
|
|
nCachingClients = site(NTiles),
|
2016-03-28 22:22:00 +02:00
|
|
|
nCachelessClients = site(ExtraL1Clients) +
|
2015-11-18 03:21:52 +01:00
|
|
|
site(NTiles) *
|
|
|
|
(1 + (if(site(BuildRoCC).isEmpty) 0
|
|
|
|
else site(RoccNMemChannels))),
|
2016-03-28 22:22:00 +02:00
|
|
|
maxClientXacts = max_int(
|
|
|
|
// L1 cache
|
|
|
|
site(NMSHRs) + 1,
|
|
|
|
// RoCC
|
2016-04-27 23:57:54 +02:00
|
|
|
if (site(BuildRoCC).isEmpty) 1 else site(RoccMaxTaggedMemXacts)),
|
2016-03-28 22:22:00 +02:00
|
|
|
maxClientsPerPort = if (site(BuildRoCC).isEmpty) 1 else 2,
|
2015-10-14 08:44:05 +02:00
|
|
|
maxManagerXacts = site(NAcquireTransactors) + 2,
|
2016-05-26 03:01:57 +02:00
|
|
|
dataBeats = site(MIFDataBeats),
|
2015-10-17 04:15:47 +02:00
|
|
|
dataBits = site(CacheBlockBytes)*8)
|
2015-10-14 08:44:05 +02:00
|
|
|
case TLKey("L2toMC") =>
|
|
|
|
TileLinkParameters(
|
2016-03-31 00:57:13 +02:00
|
|
|
coherencePolicy = new MEICoherence(
|
|
|
|
new NullRepresentation(site(NBanksPerMemoryChannel))),
|
2015-10-14 08:44:05 +02:00
|
|
|
nManagers = 1,
|
|
|
|
nCachingClients = site(NBanksPerMemoryChannel),
|
|
|
|
nCachelessClients = 0,
|
|
|
|
maxClientXacts = 1,
|
|
|
|
maxClientsPerPort = site(NAcquireTransactors) + 2,
|
|
|
|
maxManagerXacts = 1,
|
2016-05-26 03:01:57 +02:00
|
|
|
dataBeats = site(MIFDataBeats),
|
2015-10-17 04:15:47 +02:00
|
|
|
dataBits = site(CacheBlockBytes)*8)
|
2016-04-01 03:18:30 +02:00
|
|
|
case TLKey("Outermost") => site(TLKey("L2toMC")).copy(
|
|
|
|
maxClientXacts = site(NAcquireTransactors) + 2,
|
2016-04-29 01:15:31 +02:00
|
|
|
maxClientsPerPort = site(NBanksPerMemoryChannel),
|
2016-04-01 03:18:30 +02:00
|
|
|
dataBeats = site(MIFDataBeats))
|
2016-03-31 00:57:13 +02:00
|
|
|
case TLKey("L2toMMIO") => {
|
|
|
|
TileLinkParameters(
|
|
|
|
coherencePolicy = new MICoherence(
|
|
|
|
new NullRepresentation(site(NBanksPerMemoryChannel))),
|
2016-06-04 02:29:05 +02:00
|
|
|
nManagers = globalAddrMap.subMap("io").flatten.size,
|
2016-03-31 00:57:13 +02:00
|
|
|
nCachingClients = 0,
|
|
|
|
nCachelessClients = 1,
|
|
|
|
maxClientXacts = 4,
|
|
|
|
maxClientsPerPort = 1,
|
|
|
|
maxManagerXacts = 1,
|
2016-05-26 03:01:57 +02:00
|
|
|
dataBeats = site(MIFDataBeats),
|
2016-03-31 00:57:13 +02:00
|
|
|
dataBits = site(CacheBlockBytes) * 8)
|
|
|
|
}
|
|
|
|
case TLKey("MMIO_Outermost") => site(TLKey("L2toMMIO")).copy(dataBeats = site(MIFDataBeats))
|
2014-10-06 22:43:40 +02:00
|
|
|
case NTiles => Knob("NTILES")
|
2015-10-31 05:14:33 +01:00
|
|
|
case NMemoryChannels => Dump("N_MEM_CHANNELS", 1)
|
2015-11-05 08:18:34 +01:00
|
|
|
case NBanksPerMemoryChannel => Knob("NBANKS_PER_MEM_CHANNEL")
|
2016-04-29 01:15:31 +02:00
|
|
|
case NOutstandingMemReqsPerChannel => site(NBanksPerMemoryChannel)*(site(NAcquireTransactors)+2)
|
2015-06-26 08:17:35 +02:00
|
|
|
case BankIdLSB => 0
|
2015-10-31 05:14:33 +01:00
|
|
|
case CacheBlockBytes => Dump("CACHE_BLOCK_BYTES", 64)
|
2014-10-06 22:43:40 +02:00
|
|
|
case CacheBlockOffsetBits => log2Up(here(CacheBlockBytes))
|
2016-03-09 22:56:50 +01:00
|
|
|
case UseHtifClockDiv => true
|
2016-03-15 02:03:33 +01:00
|
|
|
case ConfigString => makeConfigString()
|
2016-04-29 01:15:31 +02:00
|
|
|
case GlobalAddrMap => globalAddrMap
|
2016-06-06 20:23:20 +02:00
|
|
|
case field => throw new CDEMatchError(field)
|
2014-10-06 22:43:40 +02:00
|
|
|
}},
|
|
|
|
knobValues = {
|
2014-08-25 04:30:53 +02:00
|
|
|
case "NTILES" => 1
|
2015-11-05 08:18:34 +01:00
|
|
|
case "NBANKS_PER_MEM_CHANNEL" => 1
|
2014-08-25 04:30:53 +02:00
|
|
|
case "L1D_MSHRS" => 2
|
2015-06-26 08:17:35 +02:00
|
|
|
case "L1D_SETS" => 64
|
2014-08-25 04:30:53 +02:00
|
|
|
case "L1D_WAYS" => 4
|
2015-06-26 08:17:35 +02:00
|
|
|
case "L1I_SETS" => 64
|
|
|
|
case "L1I_WAYS" => 4
|
2015-12-03 02:18:39 +01:00
|
|
|
case "L1I_BUFFER_WAYS" => false
|
2016-06-06 20:23:20 +02:00
|
|
|
case field => throw new CDEMatchError(field)
|
2014-08-25 04:30:53 +02:00
|
|
|
}
|
2014-10-06 22:43:40 +02:00
|
|
|
)
|
2016-05-25 20:08:11 +02:00
|
|
|
class DefaultConfig extends Config(new WithBlockingL1 ++ new BaseConfig)
|
2014-08-28 22:07:54 +02:00
|
|
|
|
2016-06-06 20:23:20 +02:00
|
|
|
class With2Cores extends Config(knobValues = { case "NTILES" => 2; case field => throw new CDEMatchError(field) })
|
|
|
|
class With4Cores extends Config(knobValues = { case "NTILES" => 4; case field => throw new CDEMatchError(field) })
|
|
|
|
class With8Cores extends Config(knobValues = { case "NTILES" => 8; case field => throw new CDEMatchError(field) })
|
2015-07-07 03:21:06 +02:00
|
|
|
|
2016-06-06 20:23:20 +02:00
|
|
|
class With2BanksPerMemChannel extends Config(knobValues = { case "NBANKS_PER_MEM_CHANNEL" => 2; case field => throw new CDEMatchError(field) })
|
|
|
|
class With4BanksPerMemChannel extends Config(knobValues = { case "NBANKS_PER_MEM_CHANNEL" => 4; case field => throw new CDEMatchError(field) })
|
|
|
|
class With8BanksPerMemChannel extends Config(knobValues = { case "NBANKS_PER_MEM_CHANNEL" => 8; case field => throw new CDEMatchError(field) })
|
2015-07-07 03:21:06 +02:00
|
|
|
|
2015-10-31 08:00:09 +01:00
|
|
|
class With2MemoryChannels extends Config(
|
|
|
|
(pname,site,here) => pname match {
|
|
|
|
case NMemoryChannels => Dump("N_MEM_CHANNELS", 2)
|
2016-06-06 20:23:20 +02:00
|
|
|
case field => throw new CDEMatchError(field)
|
2015-10-31 08:00:09 +01:00
|
|
|
}
|
|
|
|
)
|
|
|
|
class With4MemoryChannels extends Config(
|
|
|
|
(pname,site,here) => pname match {
|
|
|
|
case NMemoryChannels => Dump("N_MEM_CHANNELS", 4)
|
2016-06-06 20:23:20 +02:00
|
|
|
case field => throw new CDEMatchError(field)
|
2015-10-31 08:00:09 +01:00
|
|
|
}
|
|
|
|
)
|
2016-02-18 00:23:30 +01:00
|
|
|
class With8MemoryChannels extends Config(
|
|
|
|
(pname,site,here) => pname match {
|
|
|
|
case NMemoryChannels => Dump("N_MEM_CHANNELS", 8)
|
2016-06-06 20:23:20 +02:00
|
|
|
case field => throw new CDEMatchError(field)
|
2016-02-18 00:23:30 +01:00
|
|
|
}
|
|
|
|
)
|
2015-10-31 08:00:09 +01:00
|
|
|
|
2015-10-22 03:23:58 +02:00
|
|
|
class WithL2Cache extends Config(
|
2015-06-26 08:17:35 +02:00
|
|
|
(pname,site,here) => pname match {
|
|
|
|
case "L2_CAPACITY_IN_KB" => Knob("L2_CAPACITY_IN_KB")
|
|
|
|
case "L2Bank" => {
|
|
|
|
case NSets => (((here[Int]("L2_CAPACITY_IN_KB")*1024) /
|
|
|
|
site(CacheBlockBytes)) /
|
2015-11-05 07:15:47 +01:00
|
|
|
(site(NBanksPerMemoryChannel)*site(NMemoryChannels))) /
|
2015-06-26 08:17:35 +02:00
|
|
|
site(NWays)
|
|
|
|
case NWays => Knob("L2_WAYS")
|
2015-10-21 03:56:22 +02:00
|
|
|
case RowBits => site(TLKey(site(TLId))).dataBitsPerBeat
|
2015-11-22 01:11:22 +01:00
|
|
|
case CacheIdBits => log2Ceil(site(NMemoryChannels) * site(NBanksPerMemoryChannel))
|
2016-02-29 23:49:18 +01:00
|
|
|
case SplitMetadata => Knob("L2_SPLIT_METADATA")
|
2015-06-26 08:17:35 +02:00
|
|
|
}: PartialFunction[Any,Any]
|
2015-11-12 02:10:58 +01:00
|
|
|
case NAcquireTransactors => 2
|
2015-06-26 08:17:35 +02:00
|
|
|
case NSecondaryMisses => 4
|
2015-10-14 08:44:05 +02:00
|
|
|
case L2DirectoryRepresentation => new FullRepresentation(site(NTiles))
|
2015-11-22 01:11:22 +01:00
|
|
|
case BuildL2CoherenceManager => (id: Int, p: Parameters) =>
|
2015-10-06 19:47:38 +02:00
|
|
|
Module(new L2HellaCacheBank()(p.alterPartial({
|
2015-11-22 01:11:22 +01:00
|
|
|
case CacheId => id
|
|
|
|
case CacheName => "L2Bank"
|
|
|
|
case InnerTLId => "L1toL2"
|
|
|
|
case OuterTLId => "L2toMC"})))
|
2015-12-16 19:24:57 +01:00
|
|
|
case L2Replacer => () => new SeqRandom(site(NWays))
|
2016-06-06 20:23:20 +02:00
|
|
|
case field => throw new CDEMatchError(field)
|
2015-06-26 08:17:35 +02:00
|
|
|
},
|
2016-06-06 20:23:20 +02:00
|
|
|
knobValues = { case "L2_WAYS" => 8; case "L2_CAPACITY_IN_KB" => 2048; case "L2_SPLIT_METADATA" => false; case field => throw new CDEMatchError(field) }
|
2015-06-26 08:17:35 +02:00
|
|
|
)
|
|
|
|
|
2015-12-16 19:24:57 +01:00
|
|
|
class WithPLRU extends Config(
|
|
|
|
(pname, site, here) => pname match {
|
|
|
|
case L2Replacer => () => new SeqPLRU(site(NSets), site(NWays))
|
2016-06-06 20:23:20 +02:00
|
|
|
case field => throw new CDEMatchError(field)
|
2015-12-16 19:24:57 +01:00
|
|
|
})
|
|
|
|
|
2016-06-06 20:23:20 +02:00
|
|
|
class WithL2Capacity2048 extends Config(knobValues = { case "L2_CAPACITY_IN_KB" => 2048; case field => throw new CDEMatchError(field) })
|
|
|
|
class WithL2Capacity1024 extends Config(knobValues = { case "L2_CAPACITY_IN_KB" => 1024; case field => throw new CDEMatchError(field) })
|
|
|
|
class WithL2Capacity512 extends Config(knobValues = { case "L2_CAPACITY_IN_KB" => 512; case field => throw new CDEMatchError(field) })
|
|
|
|
class WithL2Capacity256 extends Config(knobValues = { case "L2_CAPACITY_IN_KB" => 256; case field => throw new CDEMatchError(field) })
|
|
|
|
class WithL2Capacity128 extends Config(knobValues = { case "L2_CAPACITY_IN_KB" => 128; case field => throw new CDEMatchError(field) })
|
|
|
|
class WithL2Capacity64 extends Config(knobValues = { case "L2_CAPACITY_IN_KB" => 64; case field => throw new CDEMatchError(field) })
|
2015-07-07 03:21:06 +02:00
|
|
|
|
2016-06-06 20:23:20 +02:00
|
|
|
class With1L2Ways extends Config(knobValues = { case "L2_WAYS" => 1; case field => throw new CDEMatchError(field) })
|
|
|
|
class With2L2Ways extends Config(knobValues = { case "L2_WAYS" => 2; case field => throw new CDEMatchError(field) })
|
|
|
|
class With4L2Ways extends Config(knobValues = { case "L2_WAYS" => 4; case field => throw new CDEMatchError(field) })
|
2015-11-21 08:26:28 +01:00
|
|
|
|
2016-05-25 20:08:11 +02:00
|
|
|
class DefaultL2Config extends Config(new WithL2Cache ++ new BaseConfig)
|
2015-10-22 03:23:58 +02:00
|
|
|
class DefaultL2FPGAConfig extends Config(new WithL2Capacity64 ++ new WithL2Cache ++ new DefaultFPGAConfig)
|
2015-06-26 08:17:35 +02:00
|
|
|
|
2015-12-16 19:24:57 +01:00
|
|
|
class PLRUL2Config extends Config(new WithPLRU ++ new DefaultL2Config)
|
|
|
|
|
2016-03-11 02:40:21 +01:00
|
|
|
class WithRV32 extends Config(
|
|
|
|
(pname,site,here) => pname match {
|
|
|
|
case XLen => 32
|
2016-04-02 01:41:48 +02:00
|
|
|
case UseVM => false
|
2016-05-26 00:40:53 +02:00
|
|
|
case UseUser => false
|
2016-05-25 20:08:11 +02:00
|
|
|
case UseAtomics => false
|
2016-03-11 02:40:21 +01:00
|
|
|
case UseFPU => false
|
2016-06-06 20:23:20 +02:00
|
|
|
case field => throw new CDEMatchError(field)
|
2016-03-11 02:40:21 +01:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2015-10-22 03:23:58 +02:00
|
|
|
class FPGAConfig extends Config (
|
2014-10-06 22:43:40 +02:00
|
|
|
(pname,site,here) => pname match {
|
2015-07-31 01:30:00 +02:00
|
|
|
case NAcquireTransactors => 4
|
2016-03-09 22:56:50 +01:00
|
|
|
case UseHtifClockDiv => false
|
2016-06-06 20:23:20 +02:00
|
|
|
case field => throw new CDEMatchError(field)
|
2014-09-24 02:05:14 +02:00
|
|
|
}
|
2014-10-06 22:43:40 +02:00
|
|
|
)
|
2014-09-24 02:05:14 +02:00
|
|
|
|
2016-05-25 20:08:11 +02:00
|
|
|
class WithBlockingL1 extends Config (
|
|
|
|
knobValues = {
|
|
|
|
case "L1D_MSHRS" => 0
|
2016-06-06 20:23:20 +02:00
|
|
|
case field => throw new CDEMatchError(field)
|
2016-05-25 20:08:11 +02:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
class DefaultFPGAConfig extends Config(new FPGAConfig ++ new BaseConfig)
|
2014-09-24 02:05:14 +02:00
|
|
|
|
2015-10-22 03:23:58 +02:00
|
|
|
class SmallConfig extends Config (
|
2014-10-06 22:43:40 +02:00
|
|
|
topDefinitions = { (pname,site,here) => pname match {
|
2015-10-21 00:04:39 +02:00
|
|
|
case UseFPU => false
|
2014-08-28 22:07:54 +02:00
|
|
|
case FastMulDiv => false
|
2015-06-26 08:17:35 +02:00
|
|
|
case NTLBEntries => 4
|
2016-04-02 01:41:48 +02:00
|
|
|
case BtbKey => BtbParameters(nEntries = 0)
|
2016-03-25 22:18:24 +01:00
|
|
|
case StoreDataQueueDepth => 2
|
|
|
|
case ReplayQueueDepth => 2
|
|
|
|
case NAcquireTransactors => 2
|
2016-06-06 20:23:20 +02:00
|
|
|
case field => throw new CDEMatchError(field)
|
2014-10-06 22:43:40 +02:00
|
|
|
}},
|
|
|
|
knobValues = {
|
2014-08-28 22:07:54 +02:00
|
|
|
case "L1D_SETS" => 64
|
|
|
|
case "L1D_WAYS" => 1
|
2014-10-06 22:43:40 +02:00
|
|
|
case "L1I_SETS" => 64
|
|
|
|
case "L1I_WAYS" => 1
|
2016-05-25 20:08:11 +02:00
|
|
|
case "L1D_MSHRS" => 0
|
2016-06-06 20:23:20 +02:00
|
|
|
case field => throw new CDEMatchError(field)
|
2014-08-28 22:07:54 +02:00
|
|
|
}
|
2014-10-06 22:43:40 +02:00
|
|
|
)
|
2014-08-23 10:26:03 +02:00
|
|
|
|
2015-10-22 03:23:58 +02:00
|
|
|
class DefaultFPGASmallConfig extends Config(new SmallConfig ++ new DefaultFPGAConfig)
|
2014-10-07 11:05:10 +02:00
|
|
|
|
2016-05-25 20:08:11 +02:00
|
|
|
class DefaultRV32Config extends Config(new SmallConfig ++ new WithRV32 ++ new BaseConfig)
|
2016-03-11 02:40:21 +01:00
|
|
|
|
2016-05-25 20:08:11 +02:00
|
|
|
class ExampleSmallConfig extends Config(new SmallConfig ++ new BaseConfig)
|
2015-08-06 21:51:18 +02:00
|
|
|
|
2016-05-25 20:08:11 +02:00
|
|
|
class DualBankConfig extends Config(new With2BanksPerMemChannel ++ new BaseConfig)
|
2015-11-19 02:07:01 +01:00
|
|
|
class DualBankL2Config extends Config(
|
2016-05-25 20:08:11 +02:00
|
|
|
new With2BanksPerMemChannel ++ new WithL2Cache ++ new BaseConfig)
|
2015-11-03 05:10:10 +01:00
|
|
|
|
2016-05-25 20:08:11 +02:00
|
|
|
class DualChannelConfig extends Config(new With2MemoryChannels ++ new BaseConfig)
|
2015-11-19 02:07:01 +01:00
|
|
|
class DualChannelL2Config extends Config(
|
2016-05-25 20:08:11 +02:00
|
|
|
new With2MemoryChannels ++ new WithL2Cache ++ new BaseConfig)
|
2015-11-19 02:07:01 +01:00
|
|
|
|
|
|
|
class DualChannelDualBankConfig extends Config(
|
2016-05-25 20:08:11 +02:00
|
|
|
new With2MemoryChannels ++ new With2BanksPerMemChannel ++ new BaseConfig)
|
2015-11-19 02:07:01 +01:00
|
|
|
class DualChannelDualBankL2Config extends Config(
|
|
|
|
new With2MemoryChannels ++ new With2BanksPerMemChannel ++
|
2016-05-25 20:08:11 +02:00
|
|
|
new WithL2Cache ++ new BaseConfig)
|
2015-11-19 02:07:01 +01:00
|
|
|
|
2015-11-26 01:02:54 +01:00
|
|
|
class WithRoccExample extends Config(
|
2015-11-19 02:07:01 +01:00
|
|
|
(pname, site, here) => pname match {
|
2015-11-26 01:02:54 +01:00
|
|
|
case BuildRoCC => Seq(
|
2015-12-02 02:55:07 +01:00
|
|
|
RoccParameters(
|
|
|
|
opcodes = OpcodeSet.custom0,
|
|
|
|
generator = (p: Parameters) => Module(new AccumulatorExample()(p))),
|
|
|
|
RoccParameters(
|
|
|
|
opcodes = OpcodeSet.custom1,
|
2016-02-25 07:52:02 +01:00
|
|
|
generator = (p: Parameters) => Module(new TranslatorExample()(p)),
|
|
|
|
nPTWPorts = 1),
|
2015-12-02 02:55:07 +01:00
|
|
|
RoccParameters(
|
|
|
|
opcodes = OpcodeSet.custom2,
|
|
|
|
generator = (p: Parameters) => Module(new CharacterCountExample()(p))))
|
|
|
|
|
2015-11-19 02:07:01 +01:00
|
|
|
case RoccMaxTaggedMemXacts => 1
|
2016-06-06 20:23:20 +02:00
|
|
|
case field => throw new CDEMatchError(field)
|
2015-11-19 02:07:01 +01:00
|
|
|
})
|
|
|
|
|
2016-05-25 20:08:11 +02:00
|
|
|
class RoccExampleConfig extends Config(new WithRoccExample ++ new BaseConfig)
|
2015-11-21 08:26:28 +01:00
|
|
|
|
2015-11-18 03:21:52 +01:00
|
|
|
class WithDmaController extends Config(
|
|
|
|
(pname, site, here) => pname match {
|
|
|
|
case BuildRoCC => Seq(
|
|
|
|
RoccParameters(
|
|
|
|
opcodes = OpcodeSet.custom2,
|
|
|
|
generator = (p: Parameters) => Module(new DmaController()(p)),
|
2016-02-25 07:52:02 +01:00
|
|
|
nPTWPorts = 1,
|
2016-01-15 00:10:40 +01:00
|
|
|
csrs = Seq.range(
|
|
|
|
DmaCtrlRegNumbers.CSR_BASE,
|
|
|
|
DmaCtrlRegNumbers.CSR_END)))
|
2015-11-18 03:21:52 +01:00
|
|
|
case RoccMaxTaggedMemXacts => 1
|
2016-06-06 20:23:20 +02:00
|
|
|
case field => throw new CDEMatchError(field)
|
2015-11-18 03:21:52 +01:00
|
|
|
})
|
|
|
|
|
2016-01-07 06:38:35 +01:00
|
|
|
class WithStreamLoopback extends Config(
|
|
|
|
(pname, site, here) => pname match {
|
|
|
|
case UseStreamLoopback => true
|
|
|
|
case StreamLoopbackSize => 128
|
|
|
|
case StreamLoopbackWidth => 64
|
2016-06-06 20:23:20 +02:00
|
|
|
case field => throw new CDEMatchError(field)
|
2016-01-07 06:38:35 +01:00
|
|
|
})
|
|
|
|
|
2016-01-15 00:10:40 +01:00
|
|
|
class DmaControllerConfig extends Config(new WithDmaController ++ new WithStreamLoopback ++ new DefaultL2Config)
|
|
|
|
class DmaControllerFPGAConfig extends Config(new WithDmaController ++ new WithStreamLoopback ++ new DefaultFPGAConfig)
|
2015-11-18 03:21:52 +01:00
|
|
|
|
2015-11-21 08:26:28 +01:00
|
|
|
class SmallL2Config extends Config(
|
2015-11-22 01:11:22 +01:00
|
|
|
new With2MemoryChannels ++ new With4BanksPerMemChannel ++
|
|
|
|
new WithL2Capacity256 ++ new DefaultL2Config)
|
2016-01-07 06:38:35 +01:00
|
|
|
|
|
|
|
class SingleChannelBenchmarkConfig extends Config(new WithL2Capacity256 ++ new DefaultL2Config)
|
|
|
|
class DualChannelBenchmarkConfig extends Config(new With2MemoryChannels ++ new SingleChannelBenchmarkConfig)
|
|
|
|
class QuadChannelBenchmarkConfig extends Config(new With4MemoryChannels ++ new SingleChannelBenchmarkConfig)
|
2016-02-18 00:23:30 +01:00
|
|
|
class OctoChannelBenchmarkConfig extends Config(new With8MemoryChannels ++ new SingleChannelBenchmarkConfig)
|
|
|
|
|
2016-05-25 20:08:11 +02:00
|
|
|
class EightChannelConfig extends Config(new With8MemoryChannels ++ new BaseConfig)
|
2016-02-26 10:33:25 +01:00
|
|
|
|
2016-06-06 20:23:20 +02:00
|
|
|
class WithSplitL2Metadata extends Config(knobValues = { case "L2_SPLIT_METADATA" => true; case field => throw new CDEMatchError(field) })
|
2016-02-29 23:49:18 +01:00
|
|
|
class SplitL2MetadataTestConfig extends Config(new WithSplitL2Metadata ++ new DefaultL2Config)
|
2016-03-28 22:22:00 +02:00
|
|
|
|
2016-05-25 20:08:11 +02:00
|
|
|
class DualCoreConfig extends Config(new With2Cores ++ new BaseConfig)
|