Skip to content

Commit

Permalink
Merge pull request #481 from riscv-boom/rc-july2020
Browse files Browse the repository at this point in the history
[rc] Bump to July 2020 rocketchip
  • Loading branch information
jerryz123 committed Aug 27, 2020
2 parents 235f561 + dc22cac commit 1cb1596
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 31 deletions.
31 changes: 16 additions & 15 deletions src/main/scala/common/tile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -109,29 +109,34 @@ class BoomTile private(
}

ResourceBinding {
Resource(cpuDevice, "reg").bind(ResourceAddress(hartId))
Resource(cpuDevice, "reg").bind(ResourceAddress(staticIdForMetadataUseOnly))
}

override def makeMasterBoundaryBuffers(implicit p: Parameters) = {
if (!boomParams.boundaryBuffers) super.makeMasterBoundaryBuffers
else TLBuffer(BufferParams.none, BufferParams.flow, BufferParams.none, BufferParams.flow, BufferParams(1))
override def makeMasterBoundaryBuffers(crossing: ClockCrossingType)(implicit p: Parameters) = crossing match {
case _: RationalCrossing =>
if (!boomParams.boundaryBuffers) TLBuffer(BufferParams.none)
else TLBuffer(BufferParams.none, BufferParams.flow, BufferParams.none, BufferParams.flow, BufferParams(1))
case _ => TLBuffer(BufferParams.none)
}

override def makeSlaveBoundaryBuffers(implicit p: Parameters) = {
if (!boomParams.boundaryBuffers) super.makeSlaveBoundaryBuffers
else TLBuffer(BufferParams.flow, BufferParams.none, BufferParams.none, BufferParams.none, BufferParams.none)
override def makeSlaveBoundaryBuffers(crossing: ClockCrossingType)(implicit p: Parameters) = crossing match {
case _: RationalCrossing =>
if (!boomParams.boundaryBuffers) TLBuffer(BufferParams.none)
else TLBuffer(BufferParams.flow, BufferParams.none, BufferParams.none, BufferParams.none, BufferParams.none)
case _ => TLBuffer(BufferParams.none)
}

override lazy val module = new BoomTileModuleImp(this)

// DCache
lazy val dcache: BoomNonBlockingDCache = LazyModule(new BoomNonBlockingDCache(hartId))
lazy val dcache: BoomNonBlockingDCache = LazyModule(new BoomNonBlockingDCache(staticIdForMetadataUseOnly))
val dCacheTap = TLIdentityNode()
tlMasterXbar.node := dCacheTap := dcache.node


// Frontend/ICache
val frontend = LazyModule(new BoomFrontend(tileParams.icache.get, hartId))
val frontend = LazyModule(new BoomFrontend(tileParams.icache.get, staticIdForMetadataUseOnly))
frontend.resetVectorSinkNode := resetVectorNexusNode
tlMasterXbar.node := frontend.masterNode

// ROCC
Expand Down Expand Up @@ -164,18 +169,14 @@ class BoomTileModuleImp(outer: BoomTile) extends BaseTileModuleImp(outer){
outer.extTraceSourceNode.bundle <> core.io.trace
outer.traceSourceNode.bundle <> DontCare
outer.bpwatchSourceNode.bundle <> DontCare // core.io.bpwatch
core.io.hartid := constants.hartid
outer.dcache.module.io.hartid := constants.hartid
outer.frontend.module.io.hartid := constants.hartid
outer.frontend.module.io.reset_vector := constants.reset_vector
core.io.hartid := outer.hartIdSinkNode.bundle

// Connect the core pipeline to other intra-tile modules
outer.frontend.module.io.cpu <> core.io.ifu
core.io.lsu <> lsu.io.core

//fpuOpt foreach { fpu => core.io.fpu <> fpu.io } RocketFpu - not needed in boom
core.io.rocc := DontCare
core.io.reset_vector := DontCare

if (outer.roccs.size > 0) {
val (respArb, cmdRouter) = {
Expand Down Expand Up @@ -239,7 +240,7 @@ class BoomTileModuleImp(outer: BoomTile) extends BaseTileModuleImp(outer){
val frontendStr = outer.frontend.module.toString
val coreStr = core.toString
val boomTileStr =
(BoomCoreStringPrefix(s"======BOOM Tile ${p(TileKey).hartId} Params======") + "\n"
(BoomCoreStringPrefix(s"======BOOM Tile ${staticIdForMetadataUseOnly} Params======") + "\n"
+ frontendStr
+ coreStr + "\n")

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/exu/core.scala
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class BoomCore(usingTrace: Boolean)(implicit p: Parameters) extends BoomModule
with HasBoomFrontendParameters // TODO: Don't add this trait
{
val io = new freechips.rocketchip.tile.CoreBundle
with freechips.rocketchip.tile.HasExternallyDrivenTileConstants
{
val hartid = Input(UInt(hartIdLen.W))
val interrupts = Input(new freechips.rocketchip.tile.CoreInterrupts())
val ifu = new boom.ifu.BoomFrontendIO
val ptw = Flipped(new freechips.rocketchip.rocket.DatapathPTWIO())
Expand Down
11 changes: 6 additions & 5 deletions src/main/scala/ifu/frontend.scala
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,13 @@ class BoomFrontendIO(implicit p: Parameters) extends BoomBundle
* @param icacheParams parameters for the icache
* @param hartid id for the hardware thread of the core
*/
class BoomFrontend(val icacheParams: ICacheParams, hartid: Int)(implicit p: Parameters) extends LazyModule
class BoomFrontend(val icacheParams: ICacheParams, staticIdForMetadataUseOnly: Int)(implicit p: Parameters) extends LazyModule
{
lazy val module = new BoomFrontendModule(this)
val icache = LazyModule(new boom.ifu.ICache(icacheParams, hartid))
val icache = LazyModule(new boom.ifu.ICache(icacheParams, staticIdForMetadataUseOnly))
val masterNode = icache.masterNode
val resetVectorSinkNode = BundleBridgeSink[UInt](Some(() =>
UInt(masterNode.edges.out.head.bundle.addressBits.W)))
}

/**
Expand All @@ -306,7 +308,6 @@ class BoomFrontend(val icacheParams: ICacheParams, hartid: Int)(implicit p: Para
* @param outer top level Frontend class
*/
class BoomFrontendBundle(val outer: BoomFrontend) extends CoreBundle()(outer.p)
with HasExternallyDrivenTileConstants
{
val cpu = Flipped(new BoomFrontendIO())
val ptw = new TLBPTWIO()
Expand All @@ -324,6 +325,7 @@ class BoomFrontendModule(outer: BoomFrontend) extends LazyModuleImp(outer)
with HasBoomFrontendParameters
{
val io = IO(new BoomFrontendBundle(outer))
val io_reset_vector = outer.resetVectorSinkNode.bundle
implicit val edge = outer.masterNode.edges.out(0)
require(fetchWidth*coreInstBytes == outer.icacheParams.fetchBytes)

Expand All @@ -332,7 +334,6 @@ class BoomFrontendModule(outer: BoomFrontend) extends LazyModuleImp(outer)
val ras = Module(new BoomRAS)

val icache = outer.icache.module
icache.io.hartid := io.hartid
icache.io.invalidate := io.cpu.flush_icache
val tlb = Module(new TLB(true, log2Ceil(fetchBytes), TLBConfig(nTLBEntries)))
io.ptw <> tlb.io.ptw
Expand Down Expand Up @@ -360,7 +361,7 @@ class BoomFrontendModule(outer: BoomFrontend) extends LazyModuleImp(outer)

when (RegNext(reset.asBool) && !reset.asBool) {
s0_valid := true.B
s0_vpc := io.reset_vector
s0_vpc := io_reset_vector
s0_ghist := (0.U).asTypeOf(new GlobalHistory)
s0_tsrc := BSRC_C
}
Expand Down
6 changes: 2 additions & 4 deletions src/main/scala/ifu/icache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ import boom.util.{BoomCoreStringPrefix}
*/
class ICache(
val icacheParams: ICacheParams,
val hartId: Int)(implicit p: Parameters)
val staticIdForMetadataUseOnly: Int)(implicit p: Parameters)
extends LazyModule
{
lazy val module = new ICacheModule(this)
val masterNode = TLClientNode(Seq(TLClientPortParameters(Seq(TLClientParameters(
sourceId = IdRange(0, 1 + icacheParams.prefetch.toInt), // 0=refill, 1=hint
name = s"Core ${hartId} ICache")))))
name = s"Core ${staticIdForMetadataUseOnly} ICache")))))

val size = icacheParams.nSets * icacheParams.nWays * icacheParams.blockBytes
private val wordBytes = icacheParams.fetchBytes
Expand Down Expand Up @@ -91,8 +91,6 @@ class ICacheResp(val outer: ICache) extends Bundle
class ICacheBundle(val outer: ICache) extends BoomBundle()(outer.p)
with HasBoomFrontendParameters
{
val hartid = Input(UInt(hartIdLen.W))

val req = Flipped(Decoupled(new ICacheReq))
val s1_paddr = Input(UInt(paddrBits.W)) // delayed one cycle w.r.t. req

Expand Down
8 changes: 4 additions & 4 deletions src/main/scala/lsu/dcache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -376,25 +376,26 @@ class BoomBankedDataArray(implicit p: Parameters) extends AbstractBoomDataArray
*
* @param hartid hardware thread for the cache
*/
class BoomNonBlockingDCache(hartid: Int)(implicit p: Parameters) extends LazyModule
class BoomNonBlockingDCache(staticIdForMetadataUseOnly: Int)(implicit p: Parameters) extends LazyModule
{
private val tileParams = p(TileKey)
protected val cfg = tileParams.dcache.get

protected def cacheClientParameters = cfg.scratch.map(x => Seq()).getOrElse(Seq(TLClientParameters(
name = s"Core ${hartid} DCache",
name = s"Core ${staticIdForMetadataUseOnly} DCache",
sourceId = IdRange(0, 1 max (cfg.nMSHRs + 1)),
supportsProbe = TransferSizes(cfg.blockBytes, cfg.blockBytes))))

protected def mmioClientParameters = Seq(TLClientParameters(
name = s"Core ${hartid} DCache MMIO",
name = s"Core ${staticIdForMetadataUseOnly} DCache MMIO",
sourceId = IdRange(cfg.nMSHRs + 1, cfg.nMSHRs + 1 + cfg.nMMIOs),
requestFifo = true))

val node = TLClientNode(Seq(TLClientPortParameters(
cacheClientParameters ++ mmioClientParameters,
minLatency = 1)))


lazy val module = new BoomNonBlockingDCacheModule(this)

def flushOnFenceI = cfg.scratch.isEmpty && !node.edges.out(0).manager.managers.forall(m => !m.supportsAcquireT || !m.executable || m.regionType >= RegionType.TRACKED || m.regionType <= RegionType.IDEMPOTENT)
Expand All @@ -404,7 +405,6 @@ class BoomNonBlockingDCache(hartid: Int)(implicit p: Parameters) extends LazyMod


class BoomDCacheBundle(implicit p: Parameters, edge: TLEdgeOut) extends BoomBundle()(p) {
val hartid = Input(UInt(hartIdLen.W))
val errors = new DCacheErrors
val lsu = Flipped(new LSUDMemIO)
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/lsu/tlb.scala
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class NBDTLB(instruction: Boolean, lgMaxSize: Int, cfg: TLBConfig)(implicit edge
val vpn = widthMap(w => io.req(w).bits.vaddr(vaddrBits-1, pgIdxBits))
val refill_ppn = io.ptw.resp.bits.pte.ppn(ppnBits-1, 0)
val do_refill = usingVM.B && io.ptw.resp.valid
val invalidate_refill = state.isOneOf(s_request /* don't care */, s_wait_invalidate)
val invalidate_refill = state.isOneOf(s_request /* don't care */, s_wait_invalidate) || io.sfence.valid
val mpu_ppn = widthMap(w =>
Mux(do_refill, refill_ppn,
Mux(vm_enabled(w) && special_entry.nonEmpty.B, special_entry.map(_.ppn(vpn(w))).getOrElse(0.U), io.req(w).bits.vaddr >> pgIdxBits)))
Expand Down Expand Up @@ -174,7 +174,7 @@ class NBDTLB(instruction: Boolean, lgMaxSize: Int, cfg: TLBConfig)(implicit edge
val ppn = widthMap(w => Mux1H(hitsVec(w) :+ !vm_enabled(w), all_entries.map(_.ppn(vpn(w))) :+ vpn(w)(ppnBits-1, 0)))

// permission bit arrays
when (do_refill && !invalidate_refill) {
when (do_refill) {
val pte = io.ptw.resp.bits.pte
val newEntry = Wire(new EntryData)
newEntry.ppn := pte.ppn
Expand Down

0 comments on commit 1cb1596

Please sign in to comment.