add scratchpad config (default size = 4MB) | other misc comments (#383)
This commit is contained in:
27
generators/example/src/main/scala/TopCakes.scala
Normal file
27
generators/example/src/main/scala/TopCakes.scala
Normal file
@@ -0,0 +1,27 @@
|
||||
package example
|
||||
|
||||
import chisel3._
|
||||
|
||||
import freechips.rocketchip.subsystem.BaseSubsystem
|
||||
import freechips.rocketchip.config.{Field}
|
||||
import freechips.rocketchip.diplomacy.{LazyModule, AddressSet}
|
||||
import freechips.rocketchip.tilelink.{TLRAM}
|
||||
|
||||
case class BackingScratchpadParams(
|
||||
base: BigInt,
|
||||
mask: BigInt)
|
||||
|
||||
case object BackingScratchpadKey extends Field[Option[BackingScratchpadParams]](None)
|
||||
|
||||
/**
|
||||
* Trait to add a scratchpad on the mbus
|
||||
*/
|
||||
trait CanHaveBackingScratchpad { this: BaseSubsystem =>
|
||||
private val portName = "Backing-Scratchpad"
|
||||
|
||||
val spadOpt = p(BackingScratchpadKey).map { param =>
|
||||
val spad = LazyModule(new TLRAM(address=AddressSet(param.base, param.mask), beatBytes=mbus.beatBytes))
|
||||
mbus.toVariableWidthSlave(Some(portName)) { spad.node }
|
||||
spad
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user