2012-10-23 21:51:37 +02:00
|
|
|
package referencechip
|
2012-10-09 22:05:56 +02:00
|
|
|
|
|
|
|
import Chisel._
|
|
|
|
import uncore._
|
|
|
|
import rocket._
|
2013-01-25 08:56:45 +01:00
|
|
|
import rocket.Util._
|
2012-10-09 22:05:56 +02:00
|
|
|
|
2014-08-02 03:09:37 +02:00
|
|
|
class DefaultVLSIConfig extends DefaultConfig
|
|
|
|
class DefaultFPGAConfig extends DefaultConfig
|
|
|
|
class DefaultCPPConfig extends DefaultConfig
|
|
|
|
class DefaultConfig extends ChiselConfig {
|
|
|
|
val top:World.TopDefs = {
|
|
|
|
(pname,site,here) => pname match {
|
|
|
|
//DesignSpaceConstants
|
|
|
|
case "NTILES" => 1
|
|
|
|
case "NBANKS" => 1
|
|
|
|
case "HTIF_WIDTH" => 16
|
|
|
|
case "ENABLE_SHARING" => true
|
|
|
|
case "ENABLE_CLEAN_EXCLUSIVE" => true
|
|
|
|
case "USE_DRAMSIDE_LLC" => true
|
|
|
|
case "NL2_REL_XACTS" => 1
|
|
|
|
case "NL2_ACQ_XACTS" => 7
|
|
|
|
case "NMSHRS" => 2
|
2014-08-08 21:27:47 +02:00
|
|
|
//Coherence
|
|
|
|
case Coherence => {
|
|
|
|
val dir = new FullRepresentation(site[Int]("NTILES")+1)
|
|
|
|
if(site[Boolean]("ENABLE_SHARING")) {
|
|
|
|
if(site[Boolean]("ENABLE_CLEAN_EXCLUSIVE")) new MESICoherence(dir)
|
|
|
|
else new MSICoherence(dir)
|
|
|
|
} else {
|
|
|
|
if(site[Boolean]("ENABLE_CLEAN_EXCLUSIVE")) new MEICoherence(dir)
|
|
|
|
else new MICoherence(dir)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//Rocket Constants
|
|
|
|
// Number of ports into D$: 1 from core, 1 from PTW, maybe 1 from RoCC
|
|
|
|
case NDCachePorts => 2 + (if(site(BuildRoCC).isEmpty) 0 else 1)
|
|
|
|
// Number of ports to outer memory system from tile: 1 from I$, 1 from D$, maybe 1 from Rocc
|
|
|
|
case NTilePorts => 2 + (if(site(BuildRoCC).isEmpty) 0 else 1)
|
|
|
|
case BuildRoCC => None
|
|
|
|
case RetireWidth => 1
|
|
|
|
case UseVM => true
|
|
|
|
case FastLoadWord => true
|
|
|
|
case FastLoadByte => false
|
|
|
|
case FastMulDiv => true
|
|
|
|
case DcacheReqTagBits => 7 + log2Up(here(NDCachePorts))
|
|
|
|
case XprLen => 64
|
|
|
|
case NXpr => 32
|
|
|
|
case NXprBits => log2Up(here(NXpr))
|
|
|
|
case BuildFPU => Some(() => new FPU)
|
2014-08-02 03:09:37 +02:00
|
|
|
case FPUParams => Alter({
|
|
|
|
case SFMALatency => 2
|
|
|
|
case DFMALatency => 3
|
|
|
|
})
|
2014-08-08 21:27:47 +02:00
|
|
|
case RocketDCacheParams => Alter({
|
|
|
|
//L1 Specific
|
|
|
|
case StoreDataQueueDepth => 17
|
|
|
|
case ReplayQueueDepth => 16
|
|
|
|
case NMSHRs => site[Int]("NMSHRS")
|
|
|
|
case NTLBEntries => 8
|
|
|
|
case CoreReqTagBits => site(DcacheReqTagBits)
|
|
|
|
case CoreDataBits => site(XprLen)
|
|
|
|
case ECCCode => new IdentityCode
|
2014-08-12 03:37:10 +02:00
|
|
|
case LRSCCycles => 32
|
2014-08-08 21:27:47 +02:00
|
|
|
//From uncore/cache.scala
|
|
|
|
case NSets => 128
|
|
|
|
case NWays => 4
|
2014-08-12 03:37:10 +02:00
|
|
|
case BlockOffBits => log2Up(site(TLDataBits)/8)
|
|
|
|
case RowBits => 2*site(XprLen)
|
|
|
|
case WordBits => site(XprLen) //here(CoreDataBits) TODO
|
|
|
|
case Replacer => () => new RandomReplacement(4)//site(NWays)) TODO
|
2014-08-08 21:27:47 +02:00
|
|
|
})
|
|
|
|
case RocketFrontendParams => Alter({
|
|
|
|
case InstBytes => 4
|
|
|
|
case NTLBEntries => 8
|
|
|
|
case ECCCode => new IdentityCode
|
2014-08-12 03:37:10 +02:00
|
|
|
//From rocket/btb.scala
|
|
|
|
case BTBEntries => 62
|
|
|
|
case NRAS => 2
|
2014-08-08 21:27:47 +02:00
|
|
|
//From uncore/cache.scala
|
|
|
|
case NSets => 128
|
|
|
|
case NWays => 2
|
2014-08-12 03:37:10 +02:00
|
|
|
case BlockOffBits => log2Up(site(TLDataBits)/8)
|
|
|
|
case RowBits => 16*8
|
|
|
|
case WordBits => site(XprLen) //TODO merge with instbytes?
|
|
|
|
case Replacer => () => new RandomReplacement(2)//site(NWays)) TODO
|
2014-08-08 21:27:47 +02:00
|
|
|
})
|
2014-08-02 03:09:37 +02:00
|
|
|
//MemoryConstants
|
2014-08-08 21:27:47 +02:00
|
|
|
case "CACHE_DATA_SIZE_IN_BYTES" => 1 << 6
|
2014-08-02 03:09:37 +02:00
|
|
|
case "OFFSET_BITS" => log2Up(here[Int]("CACHE_DATA_SIZE_IN_BYTES"))
|
2014-08-08 21:27:47 +02:00
|
|
|
case PAddrBits => 32
|
|
|
|
case VAddrBits => 43
|
|
|
|
case PgIdxBits => 13
|
|
|
|
case ASIdBits => 7
|
|
|
|
case PermBits => 6
|
|
|
|
case PPNBits => here(PAddrBits) - here(PgIdxBits)
|
|
|
|
case VPNBits => here(VAddrBits) - here(PgIdxBits)
|
|
|
|
case MIFTagBits => 5
|
|
|
|
case MIFDataBits => 128
|
|
|
|
case MIFAddrBits => here(PAddrBits) - here[Int]("OFFSET_BITS")
|
|
|
|
case MIFDataBeats => 4
|
|
|
|
//Uncore Constants
|
|
|
|
case TileLinkL1Params => Alter({
|
|
|
|
case LNMasters => site[Int]("NBANKS")
|
|
|
|
case LNClients => site[Int]("NTILES")+1
|
2014-08-11 08:08:21 +02:00
|
|
|
case LNEndpoints => site[Int]("NBANKS") + site[Int]("NTILES")+1 // TODO PARAMS why broken?: site(LNMasters) +site(LNClients)
|
2014-08-08 21:27:47 +02:00
|
|
|
case TLCoherence => site(Coherence)
|
2014-08-11 08:08:21 +02:00
|
|
|
case TLAddrBits => site(PAddrBits) - site[Int]("OFFSET_BITS")
|
2014-08-08 21:27:47 +02:00
|
|
|
case TLMasterXactIdBits => log2Up(site[Int]("NL2_REL_XACTS")+site[Int]("NL2_ACQ_XACTS"))
|
|
|
|
case TLClientXactIdBits => 2*log2Up(site[Int]("NMSHRS")*site[Int]("NTILES")+1)
|
|
|
|
case TLDataBits => site[Int]("CACHE_DATA_SIZE_IN_BYTES")*8
|
|
|
|
case TLWriteMaskBits => 6
|
|
|
|
case TLWordAddrBits => 3
|
|
|
|
case TLAtomicOpBits => 4
|
|
|
|
})
|
|
|
|
case L2HellaCacheParams => Alter({
|
|
|
|
case NReleaseTransactors => site[Int]("NL2_REL_XACTS")
|
|
|
|
case NAcquireTransactors => site[Int]("NL2_ACQ_XACTS")
|
|
|
|
case NClients => site[Int]("NTILES") + 1
|
|
|
|
case NSets => 512
|
|
|
|
case NWays => 8
|
2014-08-12 03:37:10 +02:00
|
|
|
case BlockOffBits => 0
|
2014-08-08 21:27:47 +02:00
|
|
|
case RowBits => site(TLDataBits)
|
2014-08-12 03:37:10 +02:00
|
|
|
case WordBits => site(XprLen)
|
|
|
|
case Replacer => () => new RandomReplacement(8)//site(NWays))
|
2014-08-08 21:27:47 +02:00
|
|
|
})
|
|
|
|
case NTiles => here[Int]("NTILES")
|
|
|
|
case NBanks => here[Int]("NBANKS")
|
|
|
|
case BankIdLSB => 5
|
|
|
|
case BuildDRAMSideLLC => () => {
|
|
|
|
val refill = site(TLDataBits)/site(MIFDataBits)
|
|
|
|
if(site[Boolean]("USE_DRAMSIDE_LLC")) {
|
|
|
|
val tag = Mem(Bits(width = 152), 512, seqRead = true)
|
|
|
|
val data = Mem(Bits(width = 64), 4096, seqRead = true)
|
|
|
|
Module(new DRAMSideLLC(sets=512, ways=8, outstanding=16,
|
|
|
|
refill_cycles=refill, tagLeaf=tag, dataLeaf=data))
|
|
|
|
} else { Module(new DRAMSideLLCNull(16, refill)) }
|
|
|
|
}
|
2014-08-12 03:37:10 +02:00
|
|
|
case BuildCoherentMaster => (id: Int, p: Some[Parameters]) => {
|
2014-08-08 21:27:47 +02:00
|
|
|
if(!site[Boolean]("USE_DRAMSIDE_LLC")) {
|
2014-08-12 03:37:10 +02:00
|
|
|
Module(new L2CoherenceAgent(id))(p)
|
2014-08-08 21:27:47 +02:00
|
|
|
} else {
|
2014-08-12 03:37:10 +02:00
|
|
|
Module(new L2HellaCache(id))(p)
|
2014-08-08 21:27:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
//HTIF Constants
|
|
|
|
case HTIFWidth => 16
|
|
|
|
case HTIFNSCR => 64
|
|
|
|
case HTIFOffsetBits => here[Int]("OFFSET_BITS")
|
|
|
|
case HTIFNCores => here[Int]("NTILES")
|
2014-08-02 03:09:37 +02:00
|
|
|
}
|
|
|
|
}
|
2014-04-10 22:13:46 +02:00
|
|
|
}
|
|
|
|
|
2014-08-08 21:27:47 +02:00
|
|
|
case object NTiles extends Field[Int]
|
|
|
|
case object NBanks extends Field[Int]
|
|
|
|
case object BankIdLSB extends Field[Int]
|
|
|
|
case object TileLinkL1Params extends Field[PF]
|
|
|
|
case object L2HellaCacheParams extends Field[PF]
|
|
|
|
case object BuildDRAMSideLLC extends Field[() => DRAMSideLLCLike]
|
2014-08-12 03:37:10 +02:00
|
|
|
case object BuildCoherentMaster extends Field[(Int,Option[Parameters]) => CoherenceAgent]
|
2014-08-08 21:27:47 +02:00
|
|
|
case object Coherence extends Field[CoherencePolicyWithUncached]
|
2013-08-24 22:20:38 +02:00
|
|
|
|
2014-08-08 21:27:47 +02:00
|
|
|
class OuterMemorySystem extends Module
|
2012-10-09 22:05:56 +02:00
|
|
|
{
|
|
|
|
val io = new Bundle {
|
2014-08-08 21:27:47 +02:00
|
|
|
val tiles = Vec.fill(params(NTiles)){new TileLinkIO}.flip
|
2013-01-07 23:19:55 +01:00
|
|
|
val htif = (new TileLinkIO).flip
|
2014-08-08 21:27:47 +02:00
|
|
|
val incoherent = Vec.fill(params(LNClients)){Bool()}.asInput
|
2014-03-30 17:13:05 +02:00
|
|
|
val mem = new MemIO
|
2014-08-08 21:27:47 +02:00
|
|
|
val mem_backup = new MemSerializedIO(params(HTIFWidth))
|
2012-10-09 22:05:56 +02:00
|
|
|
val mem_backup_en = Bool(INPUT)
|
|
|
|
}
|
|
|
|
|
2014-08-08 21:27:47 +02:00
|
|
|
val refill_cycles = params(TLDataBits)/params(MIFDataBits)
|
|
|
|
val llc = params(BuildDRAMSideLLC)()
|
2014-08-12 03:37:10 +02:00
|
|
|
val l2p = Some(params.alter(params(L2HellaCacheParams)))
|
|
|
|
val masterEndpoints = (0 until params(NBanks)).map(params(BuildCoherentMaster)(_,l2p))
|
2012-10-09 22:05:56 +02:00
|
|
|
|
2014-08-12 03:37:10 +02:00
|
|
|
val net = Module(new ReferenceChipCrossbarNetwork)(l2p)
|
2014-01-21 21:37:47 +01:00
|
|
|
net.io.clients zip (io.tiles :+ io.htif) map { case (net, end) => net <> end }
|
2014-04-30 01:50:07 +02:00
|
|
|
net.io.masters zip (masterEndpoints.map(_.io.inner)) map { case (net, end) => net <> end }
|
2013-08-03 00:02:09 +02:00
|
|
|
masterEndpoints.map{ _.io.incoherent zip io.incoherent map { case (m, c) => m := c } }
|
2013-03-20 22:11:54 +01:00
|
|
|
|
2013-08-12 19:46:22 +02:00
|
|
|
val conv = Module(new MemIOUncachedTileLinkIOConverter(2))
|
2014-08-08 21:27:47 +02:00
|
|
|
if(params(NBanks) > 1) {
|
|
|
|
val arb = Module(new UncachedTileLinkIOArbiterThatAppendsArbiterId(params(NBanks)))
|
2014-04-30 01:50:07 +02:00
|
|
|
arb.io.in zip masterEndpoints.map(_.io.outer) map { case (arb, cache) => arb <> cache }
|
2013-03-20 22:11:54 +01:00
|
|
|
conv.io.uncached <> arb.io.out
|
|
|
|
} else {
|
2014-04-30 01:50:07 +02:00
|
|
|
conv.io.uncached <> masterEndpoints.head.io.outer
|
2012-10-09 22:05:56 +02:00
|
|
|
}
|
2013-03-20 22:11:54 +01:00
|
|
|
llc.io.cpu.req_cmd <> Queue(conv.io.mem.req_cmd)
|
2014-03-30 17:13:05 +02:00
|
|
|
llc.io.cpu.req_data <> Queue(conv.io.mem.req_data, refill_cycles)
|
2013-03-20 22:11:54 +01:00
|
|
|
conv.io.mem.resp <> llc.io.cpu.resp
|
2012-10-09 22:05:56 +02:00
|
|
|
|
|
|
|
// mux between main and backup memory ports
|
2014-08-08 21:27:47 +02:00
|
|
|
val mem_serdes = Module(new MemSerdes(params(HTIFWidth)))
|
2013-08-12 19:46:22 +02:00
|
|
|
val mem_cmdq = Module(new Queue(new MemReqCmd, 2))
|
2012-10-09 22:05:56 +02:00
|
|
|
mem_cmdq.io.enq <> llc.io.mem.req_cmd
|
|
|
|
mem_cmdq.io.deq.ready := Mux(io.mem_backup_en, mem_serdes.io.wide.req_cmd.ready, io.mem.req_cmd.ready)
|
|
|
|
io.mem.req_cmd.valid := mem_cmdq.io.deq.valid && !io.mem_backup_en
|
|
|
|
io.mem.req_cmd.bits := mem_cmdq.io.deq.bits
|
|
|
|
mem_serdes.io.wide.req_cmd.valid := mem_cmdq.io.deq.valid && io.mem_backup_en
|
|
|
|
mem_serdes.io.wide.req_cmd.bits := mem_cmdq.io.deq.bits
|
|
|
|
|
2014-03-30 17:13:05 +02:00
|
|
|
val mem_dataq = Module(new Queue(new MemData, refill_cycles))
|
2012-10-09 22:05:56 +02:00
|
|
|
mem_dataq.io.enq <> llc.io.mem.req_data
|
|
|
|
mem_dataq.io.deq.ready := Mux(io.mem_backup_en, mem_serdes.io.wide.req_data.ready, io.mem.req_data.ready)
|
|
|
|
io.mem.req_data.valid := mem_dataq.io.deq.valid && !io.mem_backup_en
|
|
|
|
io.mem.req_data.bits := mem_dataq.io.deq.bits
|
|
|
|
mem_serdes.io.wide.req_data.valid := mem_dataq.io.deq.valid && io.mem_backup_en
|
|
|
|
mem_serdes.io.wide.req_data.bits := mem_dataq.io.deq.bits
|
|
|
|
|
|
|
|
llc.io.mem.resp.valid := Mux(io.mem_backup_en, mem_serdes.io.wide.resp.valid, io.mem.resp.valid)
|
2013-05-02 13:58:43 +02:00
|
|
|
io.mem.resp.ready := Bool(true)
|
2012-10-09 22:05:56 +02:00
|
|
|
llc.io.mem.resp.bits := Mux(io.mem_backup_en, mem_serdes.io.wide.resp.bits, io.mem.resp.bits)
|
|
|
|
|
|
|
|
io.mem_backup <> mem_serdes.io.narrow
|
|
|
|
}
|
|
|
|
|
2013-08-03 00:02:09 +02:00
|
|
|
|
2014-08-08 21:27:47 +02:00
|
|
|
class Uncore extends Module
|
2012-10-09 22:05:56 +02:00
|
|
|
{
|
2014-08-08 21:27:47 +02:00
|
|
|
require(params(BankIdLSB) + log2Up(params(NBanks)) < params(MIFAddrBits))
|
|
|
|
val htif_width = params(HTIFWidth)
|
2012-10-09 22:05:56 +02:00
|
|
|
val io = new Bundle {
|
2013-01-07 23:19:55 +01:00
|
|
|
val host = new HostIO(htif_width)
|
2014-03-30 17:13:05 +02:00
|
|
|
val mem = new MemIO
|
2014-08-08 21:27:47 +02:00
|
|
|
val tiles = Vec.fill(params(NTiles)){new TileLinkIO}.flip
|
|
|
|
val htif = Vec.fill(params(NTiles)){new HTIFIO}.flip
|
|
|
|
val incoherent = Vec.fill(params(NTiles)){Bool()}.asInput
|
2014-03-30 17:13:05 +02:00
|
|
|
val mem_backup = new MemSerializedIO(htif_width)
|
2012-10-09 22:05:56 +02:00
|
|
|
val mem_backup_en = Bool(INPUT)
|
|
|
|
}
|
2014-08-08 21:27:47 +02:00
|
|
|
val htif = Module(new HTIF(CSRs.reset))
|
|
|
|
val outmemsys = Module(new OuterMemorySystem)
|
2013-08-03 00:02:09 +02:00
|
|
|
val incoherentWithHtif = (io.incoherent :+ Bool(true).asInput)
|
|
|
|
outmemsys.io.incoherent := incoherentWithHtif
|
2012-10-19 02:51:41 +02:00
|
|
|
htif.io.cpu <> io.htif
|
2013-08-03 00:02:09 +02:00
|
|
|
outmemsys.io.mem <> io.mem
|
2012-10-09 22:05:56 +02:00
|
|
|
outmemsys.io.mem_backup_en <> io.mem_backup_en
|
|
|
|
|
2013-03-20 22:11:54 +01:00
|
|
|
// Add networking headers and endpoint queues
|
2013-08-12 19:46:22 +02:00
|
|
|
def convertAddrToBank(addr: Bits): UInt = {
|
2014-08-08 21:27:47 +02:00
|
|
|
addr(params(BankIdLSB) + log2Up(params(NBanks)) - 1, params(BankIdLSB))
|
2013-04-23 02:38:13 +02:00
|
|
|
}
|
|
|
|
|
2013-03-20 22:11:54 +01:00
|
|
|
(outmemsys.io.tiles :+ outmemsys.io.htif).zip(io.tiles :+ htif.io.mem).zipWithIndex.map {
|
|
|
|
case ((outer, client), i) =>
|
2014-08-08 21:27:47 +02:00
|
|
|
outer.acquire <> Queue(TileLinkHeaderOverwriter(client.acquire, i, params(NBanks), convertAddrToBank _))
|
|
|
|
outer.release <> Queue(TileLinkHeaderOverwriter(client.release, i, params(NBanks), convertAddrToBank _))
|
2014-04-27 04:16:37 +02:00
|
|
|
outer.finish <> Queue(TileLinkHeaderOverwriter(client.finish, i, true))
|
2013-03-20 22:11:54 +01:00
|
|
|
client.grant <> Queue(outer.grant, 1, pipe = true)
|
|
|
|
client.probe <> Queue(outer.probe)
|
|
|
|
}
|
|
|
|
|
2012-10-09 22:05:56 +02:00
|
|
|
// pad out the HTIF using a divided clock
|
2014-08-08 21:27:47 +02:00
|
|
|
val hio = Module((new SlowIO(512)) { Bits(width = params(HTIFWidth)+1) })
|
2013-01-25 08:56:45 +01:00
|
|
|
hio.io.set_divisor.valid := htif.io.scr.wen && htif.io.scr.waddr === 63
|
|
|
|
hio.io.set_divisor.bits := htif.io.scr.wdata
|
|
|
|
htif.io.scr.rdata(63) := hio.io.divisor
|
|
|
|
|
2012-10-09 22:05:56 +02:00
|
|
|
hio.io.out_fast.valid := htif.io.host.out.valid || outmemsys.io.mem_backup.req.valid
|
|
|
|
hio.io.out_fast.bits := Cat(htif.io.host.out.valid, Mux(htif.io.host.out.valid, htif.io.host.out.bits, outmemsys.io.mem_backup.req.bits))
|
|
|
|
htif.io.host.out.ready := hio.io.out_fast.ready
|
|
|
|
outmemsys.io.mem_backup.req.ready := hio.io.out_fast.ready && !htif.io.host.out.valid
|
|
|
|
io.host.out.valid := hio.io.out_slow.valid && hio.io.out_slow.bits(htif_width)
|
|
|
|
io.host.out.bits := hio.io.out_slow.bits
|
|
|
|
io.mem_backup.req.valid := hio.io.out_slow.valid && !hio.io.out_slow.bits(htif_width)
|
|
|
|
hio.io.out_slow.ready := Mux(hio.io.out_slow.bits(htif_width), io.host.out.ready, io.mem_backup.req.ready)
|
|
|
|
|
|
|
|
val mem_backup_resp_valid = io.mem_backup_en && io.mem_backup.resp.valid
|
|
|
|
hio.io.in_slow.valid := mem_backup_resp_valid || io.host.in.valid
|
|
|
|
hio.io.in_slow.bits := Cat(mem_backup_resp_valid, io.host.in.bits)
|
|
|
|
io.host.in.ready := hio.io.in_slow.ready
|
|
|
|
outmemsys.io.mem_backup.resp.valid := hio.io.in_fast.valid && hio.io.in_fast.bits(htif_width)
|
|
|
|
outmemsys.io.mem_backup.resp.bits := hio.io.in_fast.bits
|
|
|
|
htif.io.host.in.valid := hio.io.in_fast.valid && !hio.io.in_fast.bits(htif_width)
|
|
|
|
htif.io.host.in.bits := hio.io.in_fast.bits
|
|
|
|
hio.io.in_fast.ready := Mux(hio.io.in_fast.bits(htif_width), Bool(true), htif.io.host.in.ready)
|
2012-10-19 02:51:41 +02:00
|
|
|
io.host.clk := hio.io.clk_slow
|
2013-08-16 01:37:58 +02:00
|
|
|
io.host.clk_edge := Reg(next=io.host.clk && !Reg(next=io.host.clk))
|
2013-09-25 10:21:41 +02:00
|
|
|
|
|
|
|
io.host.debug_stats_pcr := htif.io.host.debug_stats_pcr
|
2012-10-09 22:05:56 +02:00
|
|
|
}
|
|
|
|
|
2014-08-08 21:27:47 +02:00
|
|
|
class TopIO extends Bundle {
|
|
|
|
val host = new HostIO(params(HTIFWidth))
|
2014-03-30 17:13:05 +02:00
|
|
|
val mem = new MemIO
|
2013-08-03 00:02:09 +02:00
|
|
|
}
|
|
|
|
|
2014-08-08 21:27:47 +02:00
|
|
|
class VLSITopIO extends TopIO {
|
2012-10-09 22:05:56 +02:00
|
|
|
val mem_backup_en = Bool(INPUT)
|
2012-10-23 12:31:34 +02:00
|
|
|
val in_mem_ready = Bool(OUTPUT)
|
|
|
|
val in_mem_valid = Bool(INPUT)
|
|
|
|
val out_mem_ready = Bool(INPUT)
|
|
|
|
val out_mem_valid = Bool(OUTPUT)
|
2012-10-09 22:05:56 +02:00
|
|
|
}
|
|
|
|
|
2013-08-12 19:46:22 +02:00
|
|
|
class MemDessert extends Module {
|
2014-08-08 21:27:47 +02:00
|
|
|
val io = new MemDesserIO(params(HTIFWidth))
|
|
|
|
val x = Module(new MemDesser(params(HTIFWidth)))
|
2012-10-19 02:51:41 +02:00
|
|
|
io.narrow <> x.io.narrow
|
|
|
|
io.wide <> x.io.wide
|
|
|
|
}
|
|
|
|
|
2013-08-12 19:46:22 +02:00
|
|
|
class Top extends Module {
|
2014-08-08 21:27:47 +02:00
|
|
|
|
|
|
|
//val vic = ICacheConfig(sets = 128, assoc = 1, tl = tl, as = as, btb = BTBConfig(as, 8))
|
|
|
|
//val hc = hwacha.HwachaConfiguration(as, vic, dc, 8, 256, ndtlb = 8, nptlb = 2)
|
|
|
|
|
2014-08-13 00:00:54 +02:00
|
|
|
val nTiles = params[Int]("NTILES")
|
2014-08-08 21:27:47 +02:00
|
|
|
val io = new VLSITopIO
|
|
|
|
|
2014-08-11 08:08:21 +02:00
|
|
|
val tl: PartialFunction[Any,Any] = params(TileLinkL1Params) //TODO PARAMS can't lookup in map() below?
|
2014-08-08 21:27:47 +02:00
|
|
|
val resetSigs = Vec.fill(nTiles){Bool()}
|
2014-08-11 08:08:21 +02:00
|
|
|
val tileList = (0 until nTiles).map(r => Module(new Tile(resetSignal = resetSigs(r)), tl))//TODO PARAMS above alter() is insufficient?
|
2014-08-12 03:37:10 +02:00
|
|
|
val uncore = Module(new Uncore, tl)
|
2014-08-08 21:27:47 +02:00
|
|
|
|
|
|
|
for (i <- 0 until nTiles) {
|
2012-10-09 22:05:56 +02:00
|
|
|
val hl = uncore.io.htif(i)
|
|
|
|
val tl = uncore.io.tiles(i)
|
2013-01-07 23:19:55 +01:00
|
|
|
val il = uncore.io.incoherent(i)
|
2012-10-19 02:51:41 +02:00
|
|
|
|
2012-12-13 01:41:21 +01:00
|
|
|
resetSigs(i) := hl.reset
|
|
|
|
val tile = tileList(i)
|
2014-04-27 04:16:37 +02:00
|
|
|
|
2013-03-20 22:11:54 +01:00
|
|
|
tile.io.tilelink <> tl
|
|
|
|
il := hl.reset
|
2014-04-27 04:16:37 +02:00
|
|
|
tile.io.host.id := UInt(i)
|
2013-08-16 01:37:58 +02:00
|
|
|
tile.io.host.reset := Reg(next=Reg(next=hl.reset))
|
2013-09-13 02:03:38 +02:00
|
|
|
tile.io.host.pcr_req <> Queue(hl.pcr_req, 1)
|
|
|
|
hl.pcr_rep <> Queue(tile.io.host.pcr_rep, 1)
|
|
|
|
hl.ipi_req <> Queue(tile.io.host.ipi_req, 1)
|
|
|
|
tile.io.host.ipi_rep <> Queue(hl.ipi_rep, 1)
|
2013-09-25 10:21:41 +02:00
|
|
|
hl.debug_stats_pcr := tile.io.host.debug_stats_pcr
|
2012-10-09 22:05:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
io.host <> uncore.io.host
|
|
|
|
|
2012-10-23 12:31:34 +02:00
|
|
|
uncore.io.mem_backup.resp.valid := io.in_mem_valid
|
2012-10-09 22:05:56 +02:00
|
|
|
|
2012-10-23 12:31:34 +02:00
|
|
|
io.out_mem_valid := uncore.io.mem_backup.req.valid
|
|
|
|
uncore.io.mem_backup.req.ready := io.out_mem_ready
|
2012-10-09 22:05:56 +02:00
|
|
|
|
|
|
|
io.mem_backup_en <> uncore.io.mem_backup_en
|
|
|
|
io.mem <> uncore.io.mem
|
|
|
|
}
|