Reflect upstream rocket-chip changes

* hartId -> tileId
* TileCrossingParamsLike -> HierarchicalElementCrossingParamsLike
* don't use bus_error_unit
This commit is contained in:
Hansung Kim
2024-01-16 23:20:32 -08:00
parent cd1022c608
commit 37d2af5478
3 changed files with 78 additions and 80 deletions

View File

@@ -43,7 +43,7 @@ class WithRadianceCores(
nTLBSuperpages = 1, nTLBSuperpages = 1,
blockBytes = site(CacheBlockBytes)))) blockBytes = site(CacheBlockBytes))))
List.tabulate(n)(i => VortexTileAttachParams( List.tabulate(n)(i => VortexTileAttachParams(
vortex.copy(hartId = i + idOffset), vortex.copy(tileId = i + idOffset),
RocketCrossingParams() RocketCrossingParams()
)) ++ prev )) ++ prev
} }
@@ -151,7 +151,7 @@ class WithNCustomSmallRocketCores(
nTLBSuperpages = 1, nTLBSuperpages = 1,
blockBytes = site(CacheBlockBytes)))) blockBytes = site(CacheBlockBytes))))
List.tabulate(n)(i => RocketTileAttachParams( List.tabulate(n)(i => RocketTileAttachParams(
med.copy(hartId = i + idOffset), med.copy(tileId = i + idOffset),
crossing crossing
)) ++ prev )) ++ prev
} }

View File

@@ -36,9 +36,9 @@ class VortexBundleD(
class VortexBundle(tile: VortexTile)(implicit p: Parameters) extends CoreBundle { class VortexBundle(tile: VortexTile)(implicit p: Parameters) extends CoreBundle {
val clock = Input(Clock()) val clock = Input(Clock())
val reset = Input(Reset()) val reset = Input(Reset())
// val hartid = Input(UInt(hartIdLen.W)) // val hartid = Input(UInt(tileIdLen.W))
val reset_vector = Input(UInt(resetVectorLen.W)) val reset_vector = Input(UInt(resetVectorLen.W))
val interrupts = Input(new CoreInterrupts()) val interrupts = Input(new freechips.rocketchip.rocket.CoreInterrupts(false/*hasBeu*/))
// conditionally instantiate ports depending on whether we want to use VX_cache or not // conditionally instantiate ports depending on whether we want to use VX_cache or not
val imem = if (!tile.vortexParams.useVxCache) Some(Vec(1, new Bundle { val imem = if (!tile.vortexParams.useVxCache) Some(Vec(1, new Bundle {
@@ -107,11 +107,11 @@ class VortexBundle(tile: VortexTile)(implicit p: Parameters) extends CoreBundle
class Vortex(tile: VortexTile)(implicit p: Parameters) class Vortex(tile: VortexTile)(implicit p: Parameters)
extends BlackBox( extends BlackBox(
// Each Vortex core gets tied-off hartId of 0, 1, 2, 3, ... // Each Vortex core gets tied-off tileId of 0, 1, 2, 3, ...
// The actual MHARTID read by the program is different by warp, not core; // The actual MHARTID read by the program is different by warp, not core;
// see VX_csr_data that implements the read logic for CSR_MHARTID/GWID. // see VX_csr_data that implements the read logic for CSR_MHARTID/GWID.
Map( Map(
"CORE_ID" -> tile.tileParams.hartId, "CORE_ID" -> tile.tileParams.tileId,
// TODO: can we get this as a parameter? // TODO: can we get this as a parameter?
"BOOTROM_HANG100" -> 0x10100, "BOOTROM_HANG100" -> 0x10100,
"NUM_THREADS" -> tile.numLsuLanes "NUM_THREADS" -> tile.numLsuLanes

View File

@@ -11,7 +11,7 @@ import freechips.rocketchip.diplomacy._
import freechips.rocketchip.interrupts._ import freechips.rocketchip.interrupts._
import freechips.rocketchip.tilelink._ import freechips.rocketchip.tilelink._
import freechips.rocketchip.rocket._ import freechips.rocketchip.rocket._
import freechips.rocketchip.subsystem.TileCrossingParamsLike import freechips.rocketchip.subsystem.HierarchicalElementCrossingParamsLike
import freechips.rocketchip.util._ import freechips.rocketchip.util._
import freechips.rocketchip.prci.ClockSinkParameters import freechips.rocketchip.prci.ClockSinkParameters
import freechips.rocketchip.regmapper.RegField import freechips.rocketchip.regmapper.RegField
@@ -26,71 +26,69 @@ case class VortexTileParams(
btb: Option[BTBParams] = None, // Some(BTBParams()), btb: Option[BTBParams] = None, // Some(BTBParams()),
dataScratchpadBytes: Int = 0, dataScratchpadBytes: Int = 0,
name: Option[String] = Some("vortex_tile"), name: Option[String] = Some("vortex_tile"),
hartId: Int = 0, tileId: Int = 0,
beuAddr: Option[BigInt] = None, beuAddr: Option[BigInt] = None,
blockerCtrlAddr: Option[BigInt] = None, blockerCtrlAddr: Option[BigInt] = None,
clockSinkParams: ClockSinkParameters = ClockSinkParameters(), clockSinkParams: ClockSinkParameters = ClockSinkParameters(),
boundaryBuffers: Option[RocketTileBoundaryBufferParams] = None boundaryBuffers: Option[RocketTileBoundaryBufferParams] = None
) extends InstantiableTileParams[VortexTile] { ) extends InstantiableTileParams[VortexTile] {
// TODO: want to use ICache/DCacheParams as well
// require(icache.isDefined) // require(icache.isDefined)
// require(dcache.isDefined) // require(dcache.isDefined)
def instantiate(crossing: TileCrossingParamsLike, lookup: LookupByHartIdImpl)( def instantiate(crossing: HierarchicalElementCrossingParamsLike, lookup: LookupByHartIdImpl)(
implicit p: Parameters implicit p: Parameters
): VortexTile = { ): VortexTile = {
new VortexTile(this, crossing, lookup) new VortexTile(this, crossing, lookup)
} }
val baseName = name.getOrElse("radiance_tile")
val uniqueName = s"${baseName}_$tileId"
} }
// TODO: move to VortexCore // TODO: move to VortexCore
// VortexTileParams extends TileParams which require a `core: CoreParams` // VortexTileParams extends TileParams which require a `core: CoreParams`
// field, so VortexCoreParams needs to extend from that, requiring all // field, so VortexCoreParams needs to extend from CoreParams as well,
// these fields to be initialized. Most of this is unnecessary though. TODO // requiring all these fields to be initialized. Most of this is unnecessary
// though. TODO see how BOOM does that
case class VortexCoreParams( case class VortexCoreParams(
bootFreqHz: BigInt = 0, bootFreqHz: BigInt = 0,
useVM: Boolean = true, useVM: Boolean = true,
useUser: Boolean = false, useUser: Boolean = false,
useSupervisor: Boolean = false, useSupervisor: Boolean = false,
useHypervisor: Boolean = false, useHypervisor: Boolean = false,
useDebug: Boolean = true, useDebug: Boolean = true,
useAtomics: Boolean = false, useAtomics: Boolean = true,
useAtomicsOnlyForIO: Boolean = false, useAtomicsOnlyForIO: Boolean = false,
useCompressed: Boolean = false, useCompressed: Boolean = true,
useRVE: Boolean = false, useRVE: Boolean = false,
useSCIE: Boolean = false, useConditionalZero: Boolean = false,
useBitManip: Boolean = false, nLocalInterrupts: Int = 0,
useBitManipCrypto: Boolean = false, useNMI: Boolean = false,
useCryptoNIST: Boolean = false, nBreakpoints: Int = 1,
useCryptoSM: Boolean = false, useBPWatch: Boolean = false,
useConditionalZero: Boolean = false, mcontextWidth: Int = 0,
nLocalInterrupts: Int = 0, scontextWidth: Int = 0,
useNMI: Boolean = false, nPMPs: Int = 8,
nBreakpoints: Int = 1, nPerfCounters: Int = 0,
useBPWatch: Boolean = false, haveBasicCounters: Boolean = true,
mcontextWidth: Int = 0, haveCFlush: Boolean = false,
scontextWidth: Int = 0, misaWritable: Boolean = true,
nPMPs: Int = 8, nL2TLBEntries: Int = 0,
nPerfCounters: Int = 0, nL2TLBWays: Int = 1,
haveBasicCounters: Boolean = true, nPTECacheEntries: Int = 8,
haveCFlush: Boolean = false, mtvecInit: Option[BigInt] = Some(BigInt(0)),
misaWritable: Boolean = true, mtvecWritable: Boolean = true,
nL2TLBEntries: Int = 0, fastLoadWord: Boolean = true,
nL2TLBWays: Int = 1, fastLoadByte: Boolean = false,
nPTECacheEntries: Int = 8, branchPredictionModeCSR: Boolean = false,
mtvecInit: Option[BigInt] = Some(BigInt(0)), clockGate: Boolean = false,
mtvecWritable: Boolean = true, mvendorid: Int = 0, // 0 means non-commercial implementation
fastLoadWord: Boolean = true, mimpid: Int = 0x20181004, // release date in BCD
fastLoadByte: Boolean = false, mulDiv: Option[MulDivParams] = Some(MulDivParams()),
branchPredictionModeCSR: Boolean = false, fpu: Option[FPUParams] = Some(FPUParams()),
clockGate: Boolean = false, debugROB: Boolean = false, // if enabled, uses a C++ debug ROB to generate trace-with-wdata
mvendorid: Int = 0, // 0 means non-commercial implementation haveCease: Boolean = true, // non-standard CEASE instruction
mimpid: Int = 0x20181004, // release date in BCD haveSimTimeout: Boolean = true // add plusarg for simulation timeout
mulDiv: Option[MulDivParams] = Some(MulDivParams()),
fpu: Option[FPUParams] = Some(FPUParams()),
debugROB: Boolean =
false, // if enabled, uses a C++ debug ROB to generate trace-with-wdata
haveCease: Boolean = true, // non-standard CEASE instruction
haveSimTimeout: Boolean = true // add plusarg for simulation timeout
) extends CoreParams { ) extends CoreParams {
val haveFSDirty = false val haveFSDirty = false
val pmpGranularity: Int = if (useHypervisor) 4096 else 4 val pmpGranularity: Int = if (useHypervisor) 4096 else 4
@@ -113,21 +111,21 @@ class VortexTile private (
// Private constructor ensures altered LazyModule.p is used implicitly // Private constructor ensures altered LazyModule.p is used implicitly
def this( def this(
params: VortexTileParams, params: VortexTileParams,
crossing: TileCrossingParamsLike, crossing: HierarchicalElementCrossingParamsLike,
lookup: LookupByHartIdImpl lookup: LookupByHartIdImpl
)(implicit p: Parameters) = )(implicit p: Parameters) =
this(params, crossing.crossingType, lookup, p) this(params, crossing.crossingType, lookup, p)
val intOutwardNode = IntIdentityNode() val intOutwardNode = None
val slaveNode = TLIdentityNode() val slaveNode = TLIdentityNode()
val masterNode = visibilityNode val masterNode = visibilityNode
// Memory-mapped region for HTIF communication // Memory-mapped region for HTIF communication
// We use fixed addresses instead of tohost/fromhost // We use fixed addresses instead of tohost/fromhost
val regDevice = val regDevice =
new SimpleDevice("vortex-reg", Seq(s"vortex-reg${tileParams.hartId}")) new SimpleDevice("vortex-reg", Seq(s"vortex-reg${tileParams.tileId}"))
val regNode = TLRegisterNode( val regNode = TLRegisterNode(
address = Seq(AddressSet(0x7c000000 + 0x1000 * tileParams.hartId, 0xfff)), address = Seq(AddressSet(0x7c000000 + 0x1000 * tileParams.tileId, 0xfff)),
device = regDevice, device = regDevice,
beatBytes = 4, beatBytes = 4,
concurrency = 1 concurrency = 1
@@ -208,7 +206,7 @@ class VortexTile private (
clients = Seq( clients = Seq(
TLMasterParameters.v1( TLMasterParameters.v1(
sourceId = IdRange(0, 1 << imemSourceWidth), sourceId = IdRange(0, 1 << imemSourceWidth),
name = s"Vortex Core ${vortexParams.hartId} I-Mem $i", name = s"Vortex Core ${vortexParams.tileId} I-Mem $i",
requestFifo = true, requestFifo = true,
supportsProbe = supportsProbe =
TransferSizes(1, lazyCoreParamsView.coreDataBytes), TransferSizes(1, lazyCoreParamsView.coreDataBytes),
@@ -227,7 +225,7 @@ class VortexTile private (
clients = Seq( clients = Seq(
TLMasterParameters.v1( TLMasterParameters.v1(
sourceId = IdRange(0, 1 << dmemSourceWidth), sourceId = IdRange(0, 1 << dmemSourceWidth),
name = s"Vortex Core ${vortexParams.hartId} D-Mem Lane $i", name = s"Vortex Core ${vortexParams.tileId} D-Mem Lane $i",
requestFifo = true, requestFifo = true,
supportsProbe = supportsProbe =
TransferSizes(1, lazyCoreParamsView.coreDataBytes), TransferSizes(1, lazyCoreParamsView.coreDataBytes),
@@ -250,7 +248,7 @@ class VortexTile private (
clients = Seq( clients = Seq(
TLMasterParameters.v1( TLMasterParameters.v1(
sourceId = IdRange(0, 1 << smemSourceWidth), sourceId = IdRange(0, 1 << smemSourceWidth),
name = s"Vortex Core ${vortexParams.hartId} SharedMem Lane $i", name = s"Vortex Core ${vortexParams.tileId} SharedMem Lane $i",
requestFifo = true, requestFifo = true,
supportsProbe = supportsProbe =
TransferSizes(1, lazyCoreParamsView.coreDataBytes), TransferSizes(1, lazyCoreParamsView.coreDataBytes),
@@ -283,7 +281,7 @@ class VortexTile private (
TLMasterParameters.v1( TLMasterParameters.v1(
// FIXME: need to also respect imemSourceWidth // FIXME: need to also respect imemSourceWidth
sourceId = IdRange(0, 1 << dmemSourceWidth), sourceId = IdRange(0, 1 << dmemSourceWidth),
name = s"Vortex Core ${vortexParams.hartId} Mem Interface", name = s"Vortex Core ${vortexParams.tileId} Mem Interface",
requestFifo = true, requestFifo = true,
supportsProbe = TransferSizes(16, 16), // FIXME: hardcoded supportsProbe = TransferSizes(16, 16), // FIXME: hardcoded
supportsGet = TransferSizes(16, 16), supportsGet = TransferSizes(16, 16),
@@ -362,13 +360,13 @@ class VortexTile private (
/* below are copied from rocket */ /* below are copied from rocket */
val bus_error_unit = vortexParams.beuAddr map { a => // val bus_error_unit = vortexParams.beuAddr map { a =>
val beu = // val beu =
LazyModule(new BusErrorUnit(new L1BusErrors, BusErrorUnitParams(a))) // LazyModule(new BusErrorUnit(new L1BusErrors, BusErrorUnitParams(a)))
intOutwardNode := beu.intNode // intOutwardNode := beu.intNode
connectTLSlave(beu.node, xBytes) // connectTLSlave(beu.node, xBytes)
beu // beu
} // }
val tile_master_blocker = val tile_master_blocker =
tileParams.blockerCtrlAddr tileParams.blockerCtrlAddr
@@ -392,13 +390,13 @@ class VortexTile private (
val itimProperty = val itimProperty =
Nil // frontend.icache.itimProperty.toSeq.flatMap(p => Map("sifive,itim" -> p)) Nil // frontend.icache.itimProperty.toSeq.flatMap(p => Map("sifive,itim" -> p))
val beuProperty = bus_error_unit // val beuProperty = bus_error_unit
.map(d => Map("sifive,buserror" -> d.device.asProperty)) // .map(d => Map("sifive,buserror" -> d.device.asProperty))
.getOrElse(Nil) // .getOrElse(Nil)
val cpuDevice: SimpleDevice = new SimpleDevice( val cpuDevice: SimpleDevice = new SimpleDevice(
"cpu", "cpu",
Seq(s"sifive,vortex${tileParams.hartId}", "riscv") Seq(s"sifive,vortex${tileParams.tileId}", "riscv")
) { ) {
override def parent = Some(ResourceAnchors.cpus) override def parent = Some(ResourceAnchors.cpus)
override def describe(resources: ResourceBindings): Description = { override def describe(resources: ResourceBindings): Description = {
@@ -406,13 +404,13 @@ class VortexTile private (
Description( Description(
name, name,
mapping ++ cpuProperties ++ nextLevelCacheProperty mapping ++ cpuProperties ++ nextLevelCacheProperty
++ tileProperties ++ dtimProperty ++ itimProperty ++ beuProperty ++ tileProperties ++ dtimProperty ++ itimProperty /*++ beuProperty*/
) )
} }
} }
ResourceBinding { ResourceBinding {
Resource(cpuDevice, "reg").bind(ResourceAddress(staticIdForMetadataUseOnly)) Resource(cpuDevice, "reg").bind(ResourceAddress(tileId))
} }
override lazy val module = new VortexTileModuleImp(this) override lazy val module = new VortexTileModuleImp(this)
@@ -472,11 +470,11 @@ class VortexTileModuleImp(outer: VortexTile) extends BaseTileModuleImp(outer) {
outer.decodeCoreInterrupts(core.io.interrupts) // Decode the interrupt vector outer.decodeCoreInterrupts(core.io.interrupts) // Decode the interrupt vector
outer.bus_error_unit.foreach { beu => // outer.bus_error_unit.foreach { beu =>
core.io.interrupts.buserror.get := beu.module.io.interrupt // core.io.interrupts.buserror.get := beu.module.io.interrupt
} // }
core.io.interrupts.nmi.foreach { nmi => nmi := outer.nmiSinkNode.bundle } core.io.interrupts.nmi.foreach { nmi => nmi := outer.nmiSinkNode.get.bundle }
// Pass through various external constants and reports that were bundle-bridged into the tile // Pass through various external constants and reports that were bundle-bridged into the tile
// outer.traceSourceNode.bundle <> core.io.trace // outer.traceSourceNode.bundle <> core.io.trace