Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions diplomatic/src/rocket/BusErrorUnit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ trait BusErrors extends Bundle {
def toErrorList: List[Option[(Valid[UInt], String, String)]]
}

class L1BusErrors(implicit p: Parameters) extends CoreBundle()(p) with BusErrors {
val icache = new ICacheErrors
class L1BusErrors(paddrBits :Int, cacheParams : ICacheParams)(implicit p: Parameters) extends CoreBundle()(p) with BusErrors {
val icache = new ICacheErrors(paddrBits, cacheParams)
val dcache = new DCacheErrors

def toErrorList = List(None,
Expand Down
11 changes: 7 additions & 4 deletions diplomatic/src/rocket/Frontend.scala
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,21 @@ class FrontendIO(implicit p: Parameters) extends CoreBundle()(p) {
val progress = Output(Bool())
}

class Frontend(val icacheParams: ICacheParams, staticIdForMetadataUseOnly: Int)(implicit p: Parameters) extends LazyModule {
class Frontend(val icacheParams: ICacheParams, staticIdForMetadataUseOnly: Int, usingVM: Boolean, paddrBits :Int, vaddrBits:Int, ppnBits:Int, vpnBits:Int)(implicit p: Parameters) extends LazyModule {
lazy val module = new FrontendModule(this)
val icache = LazyModule(new ICache(icacheParams, staticIdForMetadataUseOnly))
val icache = LazyModule(new ICache(icacheParams, staticIdForMetadataUseOnly, usingVM, paddrBits, vaddrBits, ppnBits, vpnBits))
val masterNode = icache.masterNode
val slaveNode = icache.slaveNode
val resetVectorSinkNode = BundleBridgeSink[UInt](Some(() => UInt(masterNode.edges.out.head.bundle.addressBits.W)))

val iCacheParams = icacheParams
val paddrbits = paddrBits
}

class FrontendBundle(val outer: Frontend) extends CoreBundle()(outer.p) {
val cpu = Flipped(new FrontendIO())
val ptw = new TLBPTWIO()
val errors = new ICacheErrors
val errors = new ICacheErrors(outer.paddrbits, outer.iCacheParams)
}

class FrontendModule(outer: Frontend) extends LazyModuleImp(outer)
Expand Down Expand Up @@ -382,7 +385,7 @@ class FrontendModule(outer: Frontend) extends LazyModuleImp(outer)
/** Mix-ins for constructing tiles that have an ICache-based pipeline frontend */
trait HasICacheFrontend extends CanHavePTW { this: BaseTile =>
val module: HasICacheFrontendModule
val frontend = LazyModule(new Frontend(tileParams.icache.get, staticIdForMetadataUseOnly))
val frontend = LazyModule(new Frontend(tileParams.icache.get, staticIdForMetadataUseOnly, usingVM, paddrBits, vaddrBits, ppnBits, vpnBits))
tlMasterXbar.node := frontend.masterNode
connectTLSlave(frontend.slaveNode, tileParams.core.fetchBytes)
frontend.icache.hartIdSinkNodeOpt.foreach { _ := hartIdNexusNode }
Expand Down
26 changes: 16 additions & 10 deletions diplomatic/src/rocket/ICache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,11 @@ trait HasL1ICacheParameters extends HasL1CacheParameters with HasCoreParameters
val cacheParams = tileParams.icache.get
}

class ICacheReq(implicit p: Parameters) extends CoreBundle()(p) with HasL1ICacheParameters {
class ICacheReq(vaddrBits: Int) extends Bundle {
val addr = UInt(vaddrBits.W)
}

class ICacheErrors(implicit p: Parameters) extends CoreBundle()(p)
with HasL1ICacheParameters
class ICacheErrors(paddrBits :Int, cacheParams : ICacheParams) extends Bundle
with CanHaveErrors {
val correctable = (cacheParams.tagCode.canDetect || cacheParams.dataCode.canDetect).option(Valid(UInt(paddrBits.W)))
val uncorrectable = (cacheParams.itimAddr.nonEmpty && cacheParams.dataCode.canDetect).option(Valid(UInt(paddrBits.W)))
Expand Down Expand Up @@ -119,7 +118,8 @@ class ICacheErrors(implicit p: Parameters) extends CoreBundle()(p)
* @param icacheParams parameter to this I$.
* @param staticIdForMetadataUseOnly metadata used for hart id.
*/
class ICache(val icacheParams: ICacheParams, val staticIdForMetadataUseOnly: Int)(implicit p: Parameters) extends LazyModule {
class ICache(val icacheParams: ICacheParams, val staticIdForMetadataUseOnly: Int, usingVM: Boolean, paddrBits :Int, vaddrBits:Int, ppnBits:Int, vpnBits:Int) (implicit p: Parameters)
extends LazyModule{
lazy val module = new ICacheModule(this)

/** Diplomatic hartid bundle used for ITIM. */
Expand All @@ -133,7 +133,13 @@ class ICache(val icacheParams: ICacheParams, val staticIdForMetadataUseOnly: Int
* AMBA privileged, secure will be set as true while others set as false.
* see [[freechips.rocketchip.amba.AMBAProt]] for more informations.
*/
val useVM = p(TileKey).core.useVM
val useVM = usingVM: Boolean

val pBits = paddrBits
val vBits = vaddrBits
val ppn = ppnBits
val vpn = vpnBits
val iCacheParams = icacheParams

/** [[TLClientNode]] of I$.
*
Expand Down Expand Up @@ -208,11 +214,11 @@ class ICachePerfEvents extends Bundle {
}

/** IO from CPU to ICache. */
class ICacheBundle(val outer: ICache) extends CoreBundle()(outer.p) {
class ICacheBundle(val outer: ICache) extends Bundle {
/** first cycle requested from CPU. */
val req = Flipped(Decoupled(new ICacheReq))
val s1_paddr = Input(UInt(paddrBits.W)) // delayed one cycle w.r.t. req
val s2_vaddr = Input(UInt(vaddrBits.W)) // delayed two cycles w.r.t. req
val req = Flipped(Decoupled(new ICacheReq(outer.vBits)))
val s1_paddr = Input(UInt(outer.pBits.W)) // delayed one cycle w.r.t. req
val s2_vaddr = Input(UInt(outer.vBits.W)) // delayed two cycles w.r.t. req
val s1_kill = Input(Bool()) // delayed one cycle w.r.t. req
val s2_kill = Input(Bool()) // delayed two cycles; prevents I$ miss emission
val s2_cacheable = Input(Bool()) // should L2 cache line on a miss?
Expand All @@ -228,7 +234,7 @@ class ICacheBundle(val outer: ICache) extends CoreBundle()(outer.p) {
/** I$ has error, notify to bus.
* TODO: send to BPU.
*/
val errors = new ICacheErrors
val errors = new ICacheErrors(outer.pBits, outer.iCacheParams)

/** for performance counting. */
val perf = Output(new ICachePerfEvents())
Expand Down
2 changes: 1 addition & 1 deletion diplomatic/src/rocket/RocketTile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class RocketTile private(
dtim_adapter.foreach(lm => connectTLSlave(lm.node, lm.node.portParams.head.beatBytes))

val bus_error_unit = rocketParams.beuAddr map { a =>
val beu = LazyModule(new BusErrorUnit(new L1BusErrors, BusErrorUnitParams(a)))
val beu = LazyModule(new BusErrorUnit(new L1BusErrors(paddrBits,rocketParams.icache.get), BusErrorUnitParams(a)))
intOutwardNode := beu.intNode
connectTLSlave(beu.node, xBytes)
beu
Expand Down