Skip to content

Commit

Permalink
Merge pull request #3470 from chipsalliance/rocket-width
Browse files Browse the repository at this point in the history
Support rocket cache rowBits != sbusWidth
  • Loading branch information
sequencer authored Aug 16, 2023
2 parents 6240ac1 + 3a7d8b6 commit cdab571
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/main/scala/rocket/Frontend.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import chisel3.experimental.SourceInfo
import org.chipsalliance.cde.config._
import freechips.rocketchip.diplomacy._
import freechips.rocketchip.tile._
import freechips.rocketchip.tilelink.{TLWidthWidget}
import freechips.rocketchip.util._
import freechips.rocketchip.util.property

Expand Down Expand Up @@ -383,7 +384,7 @@ class FrontendModule(outer: Frontend) extends LazyModuleImp(outer)
trait HasICacheFrontend extends CanHavePTW { this: BaseTile =>
val module: HasICacheFrontendModule
val frontend = LazyModule(new Frontend(tileParams.icache.get, staticIdForMetadataUseOnly))
tlMasterXbar.node := frontend.masterNode
tlMasterXbar.node := TLWidthWidget(tileParams.icache.get.rowBits/8) := frontend.masterNode
connectTLSlave(frontend.slaveNode, tileParams.core.fetchBytes)
frontend.icache.hartIdSinkNodeOpt.foreach { _ := hartIdNexusNode }
frontend.icache.mmioAddressPrefixSinkNodeOpt.foreach { _ := mmioAddressPrefixNexusNode }
Expand Down
4 changes: 3 additions & 1 deletion src/main/scala/rocket/HellaCache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ class HellaCacheModule(outer: HellaCache) extends LazyModuleImp(outer)
dontTouch(io.cpu.resp) // Users like to monitor these fields even if the core ignores some signals
dontTouch(io.cpu.s1_data)

require(rowBits == edge.bundle.dataBits)

private val fifoManagers = edge.manager.managers.filter(TLFIFOFixer.allVolatile)
fifoManagers.foreach { m =>
require (m.fifoId == fifoManagers.head.fifoId,
Expand Down Expand Up @@ -266,7 +268,7 @@ trait HasHellaCache { this: BaseTile =>
var nDCachePorts = 0
lazy val dcache: HellaCache = LazyModule(p(BuildHellaCache)(this)(p))

tlMasterXbar.node := dcache.node
tlMasterXbar.node := TLWidthWidget(tileParams.dcache.get.rowBits/8) := dcache.node
dcache.hartIdSinkNodeOpt.map { _ := hartIdNexusNode }
dcache.mmioAddressPrefixSinkNodeOpt.map { _ := mmioAddressPrefixNexusNode }
InModuleBody {
Expand Down
10 changes: 10 additions & 0 deletions src/main/scala/subsystem/Configs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,16 @@ class WithL1DCacheWays(ways: Int) extends Config((site, here, up) => {
}
})


class WithRocketCacheRowBits(n: Int) extends Config((site, here, up) => {
case TilesLocated(InSubsystem) => up(TilesLocated(InSubsystem), site) map {
case tp: RocketTileAttachParams => tp.copy(tileParams = tp.tileParams.copy(
dcache = tp.tileParams.dcache.map(_.copy(rowBits = n)),
icache = tp.tileParams.icache.map(_.copy(rowBits = n))))
case t => t
}
})

class WithCacheBlockBytes(linesize: Int) extends Config((site, here, up) => {
case CacheBlockBytes => linesize
})
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/tile/L1Cache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ trait HasL1CacheParameters extends HasTileParameters {
def nTLBSets = cacheParams.nTLBSets
def nTLBWays = cacheParams.nTLBWays

def cacheDataBits = tlBundleParams.dataBits
def cacheDataBits = cacheParams.rowBits
def cacheDataBytes = cacheDataBits / 8
def cacheDataBeats = (cacheBlockBytes * 8) / cacheDataBits
def refillCycles = cacheDataBeats
Expand Down

0 comments on commit cdab571

Please sign in to comment.