2015-10-27 05:37:35 +01:00
|
|
|
package groundtest
|
|
|
|
|
|
|
|
import Chisel._
|
|
|
|
import rocket._
|
|
|
|
import uncore._
|
2015-11-19 07:54:05 +01:00
|
|
|
import junctions.{SMIIO, ParameterizedBundle}
|
2015-10-27 05:37:35 +01:00
|
|
|
import scala.util.Random
|
2015-11-19 07:54:05 +01:00
|
|
|
import cde.{Parameters, Field}
|
|
|
|
|
|
|
|
case object BuildGroundTest extends Field[(Int, Parameters) => GroundTest]
|
|
|
|
case object GroundTestMaxXacts extends Field[Int]
|
2015-10-27 05:37:35 +01:00
|
|
|
|
2015-10-28 00:42:31 +01:00
|
|
|
/** A "cache" that responds to probe requests with a release indicating
|
|
|
|
* the block is not present */
|
|
|
|
class DummyCache(implicit val p: Parameters) extends Module
|
|
|
|
with HasGeneratorParams {
|
|
|
|
val io = new ClientTileLinkIO
|
|
|
|
|
|
|
|
val req = Reg(new Probe)
|
|
|
|
val coh = ClientMetadata.onReset
|
|
|
|
val (s_probe :: s_release :: Nil) = Enum(Bits(), 2)
|
|
|
|
val state = Reg(init = s_probe)
|
|
|
|
|
|
|
|
io.acquire.valid := Bool(false)
|
|
|
|
io.probe.ready := (state === s_probe)
|
|
|
|
io.grant.ready := Bool(true)
|
|
|
|
io.release.valid := (state === s_release)
|
|
|
|
io.release.bits := coh.makeRelease(req)
|
|
|
|
|
|
|
|
when (io.probe.fire()) {
|
|
|
|
req := io.probe.bits
|
|
|
|
state := s_release
|
|
|
|
}
|
|
|
|
|
|
|
|
when (io.release.fire()) {
|
|
|
|
state := s_probe
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-19 05:53:19 +01:00
|
|
|
class CSRHandler(implicit val p: Parameters) extends Module {
|
|
|
|
private val csrDataBits = 64
|
|
|
|
private val csrAddrBits = 12
|
|
|
|
|
|
|
|
val io = new Bundle {
|
|
|
|
val finished = Bool(INPUT)
|
|
|
|
val csr = new SMIIO(csrDataBits, csrAddrBits).flip
|
|
|
|
}
|
|
|
|
|
|
|
|
val csr_resp_valid = Reg(Bool()) // Don't reset
|
|
|
|
val csr_resp_data = Reg(UInt(width = csrDataBits))
|
|
|
|
|
|
|
|
io.csr.req.ready := Bool(true)
|
|
|
|
io.csr.resp.valid := csr_resp_valid
|
|
|
|
io.csr.resp.bits := csr_resp_data
|
|
|
|
|
|
|
|
when (io.csr.req.fire()) {
|
|
|
|
val req = io.csr.req.bits
|
|
|
|
csr_resp_valid := Bool(true)
|
|
|
|
csr_resp_data := Mux(req.addr === UInt(CSRs.mtohost), io.finished, req.data)
|
|
|
|
}
|
|
|
|
|
|
|
|
when (io.csr.resp.fire()) {
|
|
|
|
csr_resp_valid := Bool(false)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-19 07:54:05 +01:00
|
|
|
class GroundTestIO(implicit p: Parameters) extends ParameterizedBundle()(p) {
|
|
|
|
val cache = new HellaCacheIO
|
|
|
|
val mem = new ClientUncachedTileLinkIO
|
|
|
|
val finished = Bool(OUTPUT)
|
|
|
|
}
|
2015-11-01 01:43:25 +01:00
|
|
|
|
2015-11-19 07:54:05 +01:00
|
|
|
abstract class GroundTest(implicit p: Parameters) extends Module {
|
|
|
|
val io = new GroundTestIO
|
|
|
|
}
|
2015-11-01 01:43:25 +01:00
|
|
|
|
2015-11-19 07:54:05 +01:00
|
|
|
class GroundTestTile(id: Int, resetSignal: Bool)
|
|
|
|
(implicit val p: Parameters) extends Tile(resetSignal)(p) {
|
2015-10-27 05:37:35 +01:00
|
|
|
|
2015-11-19 07:54:05 +01:00
|
|
|
val dcache = Module(new HellaCache()(dcacheParams))
|
|
|
|
val dcacheIF = Module(new SimpleHellaCacheIF()(dcacheParams))
|
|
|
|
val test = p(BuildGroundTest)(id, dcacheParams)
|
|
|
|
io.uncached.head <> test.io.mem
|
|
|
|
dcacheIF.io.requestor <> test.io.cache
|
|
|
|
dcache.io.cpu <> dcacheIF.io.cache
|
|
|
|
io.cached.head <> dcache.io.mem
|
2015-10-27 05:37:35 +01:00
|
|
|
|
2015-11-19 05:53:19 +01:00
|
|
|
val csr = Module(new CSRHandler)
|
2015-11-19 07:54:05 +01:00
|
|
|
csr.io.finished := test.io.finished
|
2015-11-19 05:53:19 +01:00
|
|
|
csr.io.csr <> io.host.csr
|
2015-10-27 05:37:35 +01:00
|
|
|
}
|