2012-10-23 21:51:37 +02:00
|
|
|
package referencechip
|
2012-10-09 22:05:56 +02:00
|
|
|
|
|
|
|
import Chisel._
|
|
|
|
import Node._
|
|
|
|
import uncore._
|
|
|
|
import rocket._
|
|
|
|
import ReferenceChipBackend._
|
|
|
|
import scala.collection.mutable.ArrayBuffer
|
|
|
|
import scala.collection.mutable.HashMap
|
|
|
|
|
2012-12-12 09:06:14 +01:00
|
|
|
|
|
|
|
object TileToCrossbarShim {
|
2013-01-16 00:57:06 +01:00
|
|
|
def apply[T <: Data](logIO: ClientSourcedIO[LogicalNetworkIO[T]])(implicit lconf: LogicalNetworkConfiguration, pconf: PhysicalNetworkConfiguration) = {
|
|
|
|
val shim = (new TileToCrossbarShim) { logIO.bits.payload.clone }
|
2012-12-12 09:06:14 +01:00
|
|
|
shim.io.in <> logIO
|
|
|
|
shim.io.out
|
|
|
|
}
|
|
|
|
}
|
|
|
|
class TileToCrossbarShim[T <: Data]()(data: => T)(implicit lconf: LogicalNetworkConfiguration, pconf: PhysicalNetworkConfiguration) extends Component {
|
|
|
|
val io = new Bundle {
|
2013-01-16 00:57:06 +01:00
|
|
|
val in = (new ClientSourcedIO){(new LogicalNetworkIO){ data }}.flip
|
|
|
|
val out = (new FIFOIO){(new BasicCrossbarIO){ data }}
|
2012-12-12 09:06:14 +01:00
|
|
|
}
|
2013-01-16 00:57:06 +01:00
|
|
|
io.out.bits.header.src := io.in.bits.header.src + UFix(lconf.nHubs)
|
|
|
|
io.out.bits.header.dst := io.in.bits.header.dst
|
|
|
|
io.out.bits.payload := io.in.bits.payload
|
2012-12-12 09:06:14 +01:00
|
|
|
io.out.valid := io.in.valid
|
|
|
|
io.in.ready := io.out.ready
|
|
|
|
}
|
|
|
|
|
|
|
|
object HubToCrossbarShim {
|
2013-01-16 00:57:06 +01:00
|
|
|
def apply[T <: Data](logIO: MasterSourcedIO[LogicalNetworkIO[T]])(implicit lconf: LogicalNetworkConfiguration, pconf: PhysicalNetworkConfiguration) = {
|
|
|
|
val shim = (new HubToCrossbarShim) { logIO.bits.payload.clone }
|
2012-12-12 09:06:14 +01:00
|
|
|
shim.io.in <> logIO
|
|
|
|
shim.io.out
|
|
|
|
}
|
|
|
|
}
|
|
|
|
class HubToCrossbarShim[T <: Data]()(data: => T)(implicit lconf: LogicalNetworkConfiguration, pconf: PhysicalNetworkConfiguration) extends Component {
|
|
|
|
val io = new Bundle {
|
2013-01-16 00:57:06 +01:00
|
|
|
val in = (new MasterSourcedIO){(new LogicalNetworkIO){ data }}
|
|
|
|
val out = (new FIFOIO){(new BasicCrossbarIO){ data }}
|
2012-12-12 09:06:14 +01:00
|
|
|
}
|
2013-01-16 00:57:06 +01:00
|
|
|
io.out.bits.header.src := io.in.bits.header.src
|
|
|
|
io.out.bits.header.dst := io.in.bits.header.dst + UFix(lconf.nHubs)
|
|
|
|
io.out.bits.payload := io.in.bits.payload
|
2012-12-12 09:06:14 +01:00
|
|
|
io.out.valid := io.in.valid
|
|
|
|
io.in.ready := io.out.ready
|
|
|
|
}
|
|
|
|
|
|
|
|
object CrossbarToTileShim {
|
2013-01-16 00:57:06 +01:00
|
|
|
def apply[T <: Data](physIO: FIFOIO[BasicCrossbarIO[T]])(implicit lconf: LogicalNetworkConfiguration, pconf: PhysicalNetworkConfiguration) = {
|
|
|
|
val shim = (new CrossbarToTileShim) { physIO.bits.payload.clone }
|
2012-12-12 09:06:14 +01:00
|
|
|
shim.io.in <> physIO
|
|
|
|
shim.io.out
|
|
|
|
}
|
|
|
|
}
|
|
|
|
class CrossbarToTileShim[T <: Data]()(data: => T)(implicit lconf: LogicalNetworkConfiguration, pconf: PhysicalNetworkConfiguration) extends Component {
|
|
|
|
val io = new Bundle {
|
2013-01-16 00:57:06 +01:00
|
|
|
val in = (new FIFOIO){(new BasicCrossbarIO){ data }}.flip
|
|
|
|
val out = (new ClientSourcedIO){(new LogicalNetworkIO){ data }}
|
2012-12-12 09:06:14 +01:00
|
|
|
}
|
2013-01-16 00:57:06 +01:00
|
|
|
io.out.bits.header.src := io.in.bits.header.src
|
|
|
|
io.out.bits.header.dst := io.in.bits.header.dst - UFix(lconf.nHubs)
|
|
|
|
io.out.bits.payload := io.in.bits.payload
|
2012-12-12 09:06:14 +01:00
|
|
|
io.out.valid := io.in.valid
|
|
|
|
io.in.ready := io.out.ready
|
|
|
|
}
|
|
|
|
|
|
|
|
object CrossbarToHubShim {
|
2013-01-16 00:57:06 +01:00
|
|
|
def apply[T <: Data](physIO: FIFOIO[BasicCrossbarIO[T]])(implicit lconf: LogicalNetworkConfiguration, pconf: PhysicalNetworkConfiguration) = {
|
|
|
|
val shim = (new CrossbarToHubShim) { physIO.bits.payload.clone }
|
2012-12-12 09:06:14 +01:00
|
|
|
shim.io.in <> physIO
|
|
|
|
shim.io.out
|
|
|
|
}
|
|
|
|
}
|
|
|
|
class CrossbarToHubShim[T <: Data]()(data: => T)(implicit lconf: LogicalNetworkConfiguration, pconf: PhysicalNetworkConfiguration) extends Component {
|
|
|
|
val io = new Bundle {
|
2013-01-16 00:57:06 +01:00
|
|
|
val in = (new FIFOIO){(new BasicCrossbarIO){ data }}.flip
|
|
|
|
val out = (new MasterSourcedIO){(new LogicalNetworkIO){ data }}.flip
|
2012-12-12 09:06:14 +01:00
|
|
|
}
|
2013-01-16 00:57:06 +01:00
|
|
|
io.out.bits.header.src := io.in.bits.header.src - UFix(lconf.nHubs)
|
|
|
|
io.out.bits.header.dst := io.in.bits.header.dst
|
|
|
|
io.out.bits.payload := io.in.bits.payload
|
2012-12-12 09:06:14 +01:00
|
|
|
io.out.valid := io.in.valid
|
|
|
|
io.in.ready := io.out.ready
|
|
|
|
}
|
|
|
|
|
2013-01-16 00:57:06 +01:00
|
|
|
class ReferenceChipCrossbarNetwork(endpoints: Seq[CoherenceAgentRole])(implicit conf: LogicalNetworkConfiguration) extends LogicalNetwork[TileLinkIO](endpoints)(conf) {
|
2013-01-07 23:19:55 +01:00
|
|
|
type TileLinkType = TileLinkIO
|
2012-12-13 20:46:29 +01:00
|
|
|
val io = Vec(endpoints.map(_ match { case t:ClientCoherenceAgent => {(new TileLinkType).flip}; case h:MasterCoherenceAgent => {new TileLinkType}})){ new TileLinkType }
|
2012-12-12 09:06:14 +01:00
|
|
|
|
|
|
|
//If we allow all physical networks to be identical, we can use
|
2012-12-13 01:41:21 +01:00
|
|
|
//reflection to automatically create enough networks for any given
|
|
|
|
//bundle containing LogicalNetworkIOs
|
2012-12-12 09:06:14 +01:00
|
|
|
val tl = new TileLinkType
|
|
|
|
val payloadBitsForEachPhysicalNetwork = tl.getClass.getMethods.filter( x =>
|
2013-01-16 00:57:06 +01:00
|
|
|
classOf[DirectionalFIFOIO[Data]].isAssignableFrom(x.getReturnType)).map(
|
|
|
|
_.invoke(tl).asInstanceOf[DirectionalFIFOIO[LogicalNetworkIO[Data]]].bits.payload)
|
2012-12-12 09:06:14 +01:00
|
|
|
implicit val pconf = new PhysicalNetworkConfiguration(conf.nEndpoints, conf.idBits)//same config for all networks
|
|
|
|
val physicalNetworks: Seq[BasicCrossbar[Data]] = payloadBitsForEachPhysicalNetwork.map(d => (new BasicCrossbar){d.clone})
|
|
|
|
|
|
|
|
//Use reflection to get the subset of each node's TileLink
|
|
|
|
//corresponding to each direction of dataflow and connect each sub-bundle
|
2012-12-13 01:41:21 +01:00
|
|
|
//to the appropriate port of the physical crossbar network, inserting
|
|
|
|
//shims to convert headers and process flits in the process.
|
2012-12-12 09:06:14 +01:00
|
|
|
endpoints.zip(io).zipWithIndex.map{ case ((end, io), id) => {
|
2012-12-13 20:46:29 +01:00
|
|
|
val logNetIOSubBundles = io.getClass.getMethods.filter( x =>
|
2013-01-16 00:57:06 +01:00
|
|
|
classOf[DirectionalFIFOIO[Data]].isAssignableFrom(x.getReturnType)).zipWithIndex
|
|
|
|
val tileProducedSubBundles = logNetIOSubBundles.filter( x =>
|
|
|
|
classOf[ClientSourcedIO[Data]].isAssignableFrom(x._1.getReturnType)).map{ case (m,i) =>
|
|
|
|
(m.invoke(io).asInstanceOf[ClientSourcedIO[LogicalNetworkIO[Data]]],i) }
|
2012-12-13 20:46:29 +01:00
|
|
|
val hubProducedSubBundles = logNetIOSubBundles.filter( x =>
|
2013-01-16 00:57:06 +01:00
|
|
|
classOf[MasterSourcedIO[Data]].isAssignableFrom(x._1.getReturnType)).map{ case (m,i) =>
|
|
|
|
(m.invoke(io).asInstanceOf[MasterSourcedIO[LogicalNetworkIO[Data]]],i) }
|
2012-12-12 09:06:14 +01:00
|
|
|
end match {
|
2012-12-13 20:46:29 +01:00
|
|
|
case x:ClientCoherenceAgent => {
|
2013-01-07 23:19:55 +01:00
|
|
|
tileProducedSubBundles.foreach{ case (sl,i) => {
|
|
|
|
physicalNetworks(i).io.in(id) <> TileToCrossbarShim(sl)
|
|
|
|
physicalNetworks(i).io.out(id).ready := Bool(false)
|
|
|
|
}}
|
|
|
|
hubProducedSubBundles.foreach{ case (sl,i) => {
|
|
|
|
sl <> CrossbarToTileShim(physicalNetworks(i).io.out(id))
|
|
|
|
physicalNetworks(i).io.in(id).valid := Bool(false)
|
|
|
|
}}
|
2012-12-12 09:06:14 +01:00
|
|
|
}
|
2012-12-13 20:46:29 +01:00
|
|
|
case y:MasterCoherenceAgent => {
|
2013-01-07 23:19:55 +01:00
|
|
|
hubProducedSubBundles.foreach{ case (sl,i) => {
|
|
|
|
physicalNetworks(i).io.in(id) <> HubToCrossbarShim(sl)
|
|
|
|
physicalNetworks(i).io.out(id).ready := Bool(false)
|
|
|
|
}}
|
|
|
|
tileProducedSubBundles.foreach{ case (sl,i) => {
|
|
|
|
sl <> CrossbarToHubShim(physicalNetworks(i).io.out(id))
|
|
|
|
physicalNetworks(i).io.in(id).valid := Bool(false)
|
|
|
|
}}
|
2012-12-12 09:06:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
}
|
|
|
|
|
2012-10-09 22:05:56 +02:00
|
|
|
object ReferenceChipBackend {
|
|
|
|
val initMap = new HashMap[Component, Bool]()
|
|
|
|
}
|
|
|
|
|
|
|
|
class ReferenceChipBackend extends VerilogBackend
|
|
|
|
{
|
|
|
|
override def emitPortDef(m: MemAccess, idx: Int) = {
|
|
|
|
val res = new StringBuilder()
|
|
|
|
for (node <- m.mem.inputs) {
|
|
|
|
if(node.name.contains("init"))
|
|
|
|
res.append(" .init(" + node.name + "),\n")
|
|
|
|
}
|
|
|
|
(if (idx == 0) res.toString else "") + super.emitPortDef(m, idx)
|
|
|
|
}
|
|
|
|
|
|
|
|
def addMemPin(c: Component) = {
|
|
|
|
for (node <- Component.nodes) {
|
2012-10-19 02:51:41 +02:00
|
|
|
if (node.isInstanceOf[Mem[ _ ]] && node.component != null && node.asInstanceOf[Mem[_]].seqRead) {
|
2012-10-09 22:05:56 +02:00
|
|
|
val init = Bool(INPUT)
|
|
|
|
init.setName("init")
|
|
|
|
node.inputs += init
|
|
|
|
connectMemPin(c, node.component, init)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def connectMemPin(topC: Component, c: Component, p: Bool): Unit = {
|
|
|
|
p.component = c
|
|
|
|
var isNewPin = false
|
|
|
|
val compInitPin =
|
|
|
|
if (initMap.contains(c)) {
|
|
|
|
initMap(c)
|
|
|
|
} else {
|
|
|
|
isNewPin = true
|
|
|
|
Bool(INPUT)
|
|
|
|
}
|
|
|
|
|
|
|
|
p.inputs += compInitPin
|
|
|
|
|
|
|
|
if (isNewPin) {
|
|
|
|
compInitPin.setName("init")
|
|
|
|
c.io.asInstanceOf[Bundle] += compInitPin
|
|
|
|
initMap += (c -> compInitPin)
|
|
|
|
connectMemPin(topC, c.parent, compInitPin)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def addTopLevelPin(c: Component) = {
|
|
|
|
val init = Bool(INPUT)
|
|
|
|
init.setName("init")
|
|
|
|
init.component = c
|
|
|
|
c.io.asInstanceOf[Bundle] += init
|
|
|
|
initMap += (c -> init)
|
|
|
|
}
|
|
|
|
|
|
|
|
transforms += ((c: Component) => addTopLevelPin(c))
|
|
|
|
transforms += ((c: Component) => addMemPin(c))
|
|
|
|
}
|
|
|
|
|
2012-12-13 20:46:29 +01:00
|
|
|
class OuterMemorySystem(htif_width: Int, tileEndpoints: Seq[ClientCoherenceAgent])(implicit conf: CoherenceHubConfiguration) extends Component
|
2012-10-09 22:05:56 +02:00
|
|
|
{
|
2012-12-13 20:46:29 +01:00
|
|
|
implicit val lnconf = conf.ln
|
2012-10-09 22:05:56 +02:00
|
|
|
val io = new Bundle {
|
2013-01-07 23:19:55 +01:00
|
|
|
val tiles = Vec(conf.ln.nTiles) { new TileLinkIO }.flip
|
|
|
|
val htif = (new TileLinkIO).flip
|
|
|
|
val incoherent = Vec(conf.ln.nTiles) { Bool() }.asInput
|
2012-10-19 02:51:41 +02:00
|
|
|
val mem_backup = new ioMemSerialized(htif_width)
|
2012-10-09 22:05:56 +02:00
|
|
|
val mem_backup_en = Bool(INPUT)
|
|
|
|
val mem = new ioMemPipe
|
|
|
|
}
|
|
|
|
|
|
|
|
import rocket.Constants._
|
2012-12-13 20:46:29 +01:00
|
|
|
|
|
|
|
val lnWithHtifConf = conf.ln.copy(nEndpoints = conf.ln.nEndpoints+1,
|
|
|
|
idBits = log2Up(conf.ln.nEndpoints+1)+1,
|
|
|
|
nTiles = conf.ln.nTiles+1)
|
|
|
|
val chWithHtifConf = conf.copy(ln = lnWithHtifConf)
|
|
|
|
require(tileEndpoints.length == lnWithHtifConf.nTiles)
|
2013-01-07 23:19:55 +01:00
|
|
|
//val hub = new CoherenceHubBroadcast()(chWithHtifConf)
|
2012-10-09 22:05:56 +02:00
|
|
|
val llc_tag_leaf = Mem(1024, seqRead = true) { Bits(width = 72) }
|
|
|
|
val llc_data_leaf = Mem(4096, seqRead = true) { Bits(width = 64) }
|
|
|
|
val llc = new DRAMSideLLC(512, 8, 4, llc_tag_leaf, llc_data_leaf)
|
2012-10-19 02:51:41 +02:00
|
|
|
val mem_serdes = new MemSerdes(htif_width)
|
2012-10-09 22:05:56 +02:00
|
|
|
|
2013-01-23 04:57:31 +01:00
|
|
|
val hub = new CoherenceHubBroadcast()(chWithHtifConf)
|
2013-01-17 08:58:24 +01:00
|
|
|
//val adapter = new CoherenceHubAdapter()(lnWithHtifConf)
|
2013-01-23 04:57:31 +01:00
|
|
|
//val hub = new L2CoherenceAgent()(chWithHtifConf)
|
|
|
|
//val net = new ReferenceChipCrossbarNetwork(List(hub)++tileEndpoints)(lnWithHtifConf)
|
2013-01-17 08:58:24 +01:00
|
|
|
//net.io(0) <> adapter.io.net
|
|
|
|
//hub.io.tiles <> adapter.io.hub
|
2013-01-23 04:57:31 +01:00
|
|
|
//hub.io.network <> net.io(0)
|
2012-12-12 09:06:14 +01:00
|
|
|
|
2013-01-07 23:19:55 +01:00
|
|
|
for (i <- 1 to conf.ln.nTiles) {
|
2013-01-23 04:57:31 +01:00
|
|
|
//net.io(i) <> io.tiles(i-1)
|
|
|
|
hub.io.tiles(i-1) <> io.tiles(i-1)
|
2013-01-17 08:58:24 +01:00
|
|
|
hub.io.incoherent(i-1) := io.incoherent(i-1)
|
2012-10-09 22:05:56 +02:00
|
|
|
}
|
2013-01-23 04:57:31 +01:00
|
|
|
//net.io(conf.ln.nTiles+1) <> io.htif
|
|
|
|
hub.io.tiles(conf.ln.nTiles) <> io.htif
|
2013-01-17 08:58:24 +01:00
|
|
|
hub.io.incoherent(conf.ln.nTiles) := Bool(true)
|
2012-10-09 22:05:56 +02:00
|
|
|
|
2013-01-17 08:58:24 +01:00
|
|
|
llc.io.cpu.req_cmd <> Queue(hub.io.mem.req_cmd)
|
|
|
|
llc.io.cpu.req_data <> Queue(hub.io.mem.req_data, REFILL_CYCLES)
|
|
|
|
hub.io.mem.resp <> llc.io.cpu.resp
|
2012-10-09 22:05:56 +02:00
|
|
|
|
|
|
|
// mux between main and backup memory ports
|
|
|
|
val mem_cmdq = (new Queue(2)) { new MemReqCmd }
|
|
|
|
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
|
|
|
|
|
|
|
|
val mem_dataq = (new Queue(REFILL_CYCLES)) { new MemData }
|
|
|
|
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)
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2012-12-13 20:46:29 +01:00
|
|
|
class Uncore(htif_width: Int, tileEndpoints: Seq[ClientCoherenceAgent])(implicit conf: CoherenceHubConfiguration) extends Component
|
2012-10-09 22:05:56 +02:00
|
|
|
{
|
2012-12-13 20:46:29 +01:00
|
|
|
implicit val lnconf = conf.ln
|
2012-10-09 22:05:56 +02:00
|
|
|
val io = new Bundle {
|
2013-01-07 23:19:55 +01:00
|
|
|
val debug = new DebugIO()
|
|
|
|
val host = new HostIO(htif_width)
|
2012-10-19 02:51:41 +02:00
|
|
|
val mem_backup = new ioMemSerialized(htif_width)
|
2012-10-09 22:05:56 +02:00
|
|
|
val mem_backup_en = Bool(INPUT)
|
|
|
|
val mem = new ioMemPipe
|
2013-01-07 23:19:55 +01:00
|
|
|
val tiles = Vec(conf.ln.nTiles) { new TileLinkIO }.flip
|
|
|
|
val htif = Vec(conf.ln.nTiles) { new HTIFIO(conf.ln.nTiles) }.flip
|
|
|
|
val incoherent = Vec(conf.ln.nTiles) { Bool() }.asInput
|
2012-10-09 22:05:56 +02:00
|
|
|
}
|
|
|
|
|
2012-10-19 02:51:41 +02:00
|
|
|
val htif = new rocketHTIF(htif_width)
|
|
|
|
htif.io.cpu <> io.htif
|
2012-10-09 22:05:56 +02:00
|
|
|
|
2012-12-13 20:46:29 +01:00
|
|
|
val outmemsys = new OuterMemorySystem(htif_width, tileEndpoints++List(htif))
|
2012-10-09 22:05:56 +02:00
|
|
|
outmemsys.io.tiles <> io.tiles
|
|
|
|
outmemsys.io.htif <> htif.io.mem
|
2013-01-07 23:19:55 +01:00
|
|
|
outmemsys.io.incoherent <> io.incoherent
|
2012-10-09 22:05:56 +02:00
|
|
|
io.mem <> outmemsys.io.mem
|
|
|
|
outmemsys.io.mem_backup_en <> io.mem_backup_en
|
|
|
|
|
|
|
|
// pad out the HTIF using a divided clock
|
|
|
|
val hio = (new slowIO(8)) { Bits(width = htif_width+1) }
|
|
|
|
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
|
|
|
|
io.host.clk_edge := Reg(io.host.clk && !Reg(io.host.clk))
|
2012-10-09 22:05:56 +02:00
|
|
|
}
|
|
|
|
|
2013-01-07 23:19:55 +01:00
|
|
|
class TopIO(htif_width: Int) extends Bundle {
|
|
|
|
val debug = new rocket.DebugIO
|
|
|
|
val host = new rocket.HostIO(htif_width);
|
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-12-12 09:06:14 +01:00
|
|
|
val mem = new ioMem
|
2012-10-09 22:05:56 +02:00
|
|
|
}
|
|
|
|
|
2012-12-12 09:06:14 +01:00
|
|
|
object DummyTopLevelConstants extends _root_.uncore.constants.CoherenceConfigConstants {
|
2012-10-19 02:51:41 +02:00
|
|
|
val NTILES = 1
|
|
|
|
val HTIF_WIDTH = 16
|
|
|
|
val ENABLE_SHARING = true
|
|
|
|
val ENABLE_CLEAN_EXCLUSIVE = true
|
|
|
|
}
|
|
|
|
import DummyTopLevelConstants._
|
2012-10-09 22:05:56 +02:00
|
|
|
|
2012-10-19 02:51:41 +02:00
|
|
|
class MemDessert extends Component {
|
|
|
|
val io = new MemDesserIO(HTIF_WIDTH)
|
|
|
|
val x = new MemDesser(HTIF_WIDTH)
|
|
|
|
io.narrow <> x.io.narrow
|
|
|
|
io.wide <> x.io.wide
|
|
|
|
}
|
|
|
|
|
|
|
|
class Top extends Component {
|
2012-10-09 22:05:56 +02:00
|
|
|
val co = if(ENABLE_SHARING) {
|
|
|
|
if(ENABLE_CLEAN_EXCLUSIVE) new MESICoherence
|
|
|
|
else new MSICoherence
|
|
|
|
} else {
|
|
|
|
if(ENABLE_CLEAN_EXCLUSIVE) new MEICoherence
|
|
|
|
else new MICoherence
|
|
|
|
}
|
|
|
|
|
2012-12-13 20:46:29 +01:00
|
|
|
implicit val lnConf = LogicalNetworkConfiguration(NTILES+1, log2Up(NTILES)+1, 1, NTILES)
|
|
|
|
implicit val chConf = CoherenceHubConfiguration(co, lnConf)
|
2012-10-19 02:51:41 +02:00
|
|
|
|
2013-01-07 23:19:55 +01:00
|
|
|
val io = new TopIO(HTIF_WIDTH)
|
2012-10-09 22:05:56 +02:00
|
|
|
|
2012-12-13 01:41:21 +01:00
|
|
|
val resetSigs = Vec(NTILES){ Bool() }
|
|
|
|
val ic = ICacheConfig(128, 2, co, ntlb = 8, nbtb = 16)
|
|
|
|
val dc = DCacheConfig(128, 4, co, ntlb = 8,
|
|
|
|
nmshr = 2, nrpq = 16, nsdq = 17)
|
2013-01-07 23:19:55 +01:00
|
|
|
val rc = RocketConfiguration(lnConf, co, ic, dc,
|
2013-01-23 05:24:17 +01:00
|
|
|
fpu = true, vec = true)
|
2012-12-13 01:41:21 +01:00
|
|
|
val tileList = (0 until NTILES).map(r => new Tile(resetSignal = resetSigs(r))(rc))
|
|
|
|
val uncore = new Uncore(HTIF_WIDTH, tileList)
|
2012-10-09 22:05:56 +02:00
|
|
|
|
|
|
|
var error_mode = Bool(false)
|
2012-12-13 20:46:29 +01: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)
|
2012-10-09 22:05:56 +02:00
|
|
|
|
|
|
|
tile.io.host.reset := Reg(Reg(hl.reset))
|
|
|
|
tile.io.host.pcr_req <> Queue(hl.pcr_req)
|
|
|
|
hl.pcr_rep <> Queue(tile.io.host.pcr_rep)
|
|
|
|
hl.ipi_req <> Queue(tile.io.host.ipi_req)
|
|
|
|
tile.io.host.ipi_rep <> Queue(hl.ipi_rep)
|
|
|
|
error_mode = error_mode || Reg(tile.io.host.debug.error_mode)
|
|
|
|
|
2013-01-22 02:19:07 +01:00
|
|
|
val x_init_q = Queue(tile.io.tilelink.acquire)
|
|
|
|
tl.acquire.valid := x_init_q.valid
|
|
|
|
tl.acquire.bits.payload := x_init_q.bits.payload
|
|
|
|
tl.acquire.bits.header.src := UFix(i)
|
|
|
|
tl.acquire.bits.header.dst := UFix(0)
|
|
|
|
x_init_q.ready := tl.acquire.ready
|
|
|
|
val x_init_data_q = Queue(tile.io.tilelink.acquire_data)
|
|
|
|
tl.acquire_data.valid := x_init_data_q.valid
|
|
|
|
tl.acquire_data.bits.payload := x_init_data_q.bits.payload
|
|
|
|
tl.acquire_data.bits.header.src := UFix(i)
|
|
|
|
tl.acquire_data.bits.header.dst := UFix(0)
|
|
|
|
x_init_data_q.ready := tl.acquire_data.ready
|
|
|
|
val x_finish_q = Queue(tile.io.tilelink.grant_ack)
|
|
|
|
tl.grant_ack.valid := x_finish_q.valid
|
|
|
|
tl.grant_ack.bits.payload := x_finish_q.bits.payload
|
|
|
|
tl.grant_ack.bits.header.src := UFix(i)
|
|
|
|
tl.grant_ack.bits.header.dst := UFix(0)
|
|
|
|
x_finish_q.ready := tl.grant_ack.ready
|
|
|
|
val p_rep_q = Queue(tile.io.tilelink.release, 1)
|
|
|
|
tl.release.valid := p_rep_q.valid
|
|
|
|
tl.release.bits.payload := p_rep_q.bits.payload
|
|
|
|
tl.release.bits.header.src := UFix(i)
|
|
|
|
tl.release.bits.header.dst := UFix(0)
|
|
|
|
p_rep_q.ready := tl.release.ready
|
|
|
|
val p_rep_data_q = Queue(tile.io.tilelink.release_data)
|
|
|
|
tl.release_data.valid := p_rep_data_q.valid
|
|
|
|
tl.release_data.bits.payload := p_rep_data_q.bits.payload
|
|
|
|
tl.release_data.bits.header.src := UFix(i)
|
|
|
|
tl.release_data.bits.header.dst := UFix(0)
|
|
|
|
p_rep_data_q.ready := tl.release_data.ready
|
|
|
|
|
|
|
|
tile.io.tilelink.abort <> Queue(tl.abort)
|
|
|
|
tile.io.tilelink.grant <> Queue(tl.grant, 1, pipe = true)
|
|
|
|
tile.io.tilelink.probe <> Queue(tl.probe)
|
2013-01-07 23:19:55 +01:00
|
|
|
il := hl.reset
|
|
|
|
|
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
|
|
|
|
io.debug.error_mode := error_mode
|
|
|
|
}
|