1
0

add some more comments to describe the new device system

This commit is contained in:
Howard Mao 2016-08-18 15:06:55 -07:00
parent 1b6fa70b5c
commit 91a97d6773
3 changed files with 30 additions and 2 deletions

View File

@ -8,6 +8,13 @@ import uncore.Util._
import junctions.HasAddrMapParameters import junctions.HasAddrMapParameters
import cde.Parameters import cde.Parameters
/**
* An example bus mastering devices that writes some preset data to memory.
* When it receives an MMIO put request, it starts writing out the data.
* When it receives an MMIO get request, it responds with the progress of
* the write. A grant data of 1 means it is still writing, grant data 0
* means it has finished.
*/
class ExampleBusMaster(implicit val p: Parameters) extends Module class ExampleBusMaster(implicit val p: Parameters) extends Module
with HasAddrMapParameters with HasAddrMapParameters
with HasTileLinkParameters { with HasTileLinkParameters {

View File

@ -9,14 +9,35 @@ case object ExtraTopPorts extends Field[Parameters => Bundle]
case object ExtraDevices extends Field[Seq[Device]] case object ExtraDevices extends Field[Seq[Device]]
abstract class Device { abstract class Device {
/** Does this device have an MMIO port? */
def hasMMIOPort: Boolean def hasMMIOPort: Boolean
/** Does this device have a client port? */
def hasClientPort: Boolean def hasClientPort: Boolean
/**
* This function elaborates the hardware for the device and connects
* it to the mmio port, client port, and extra top-level ports.
*
* @param mmioPort The port from the MMIO network that goes to this device.
* If hasMMIOPort is false, this will be None
*
* @param clientPort The client port provided for this device to make
* requests to the memory system. If hasClientPort is false, this will be None
*/
def builder( def builder(
mmioPort: Option[ClientUncachedTileLinkIO], mmioPort: Option[ClientUncachedTileLinkIO],
clientPort: Option[ClientUncachedTileLinkIO], clientPort: Option[ClientUncachedTileLinkIO],
extra: Bundle, p: Parameters): Unit extra: Bundle, p: Parameters): Unit
/**
* The entry that will be placed into the address map for this device.
* If hasMMIOPort is false, you do not need to override this
*/
def addrMapEntry: AddrMapEntry = def addrMapEntry: AddrMapEntry =
throw new UnsupportedOperationException("no addrMapEntry defined") throw new UnsupportedOperationException("no addrMapEntry defined")
/**
* Create the config string entry for this device that goes into the
* Boot ROM. You generally won't need to override this
*/
def makeConfigString(region: MemRegion): String = { def makeConfigString(region: MemRegion): String = {
s"${addrMapEntry.name} {\n" + s"${addrMapEntry.name} {\n" +
s" addr 0x${region.start.toString(16)};\n" + s" addr 0x${region.start.toString(16)};\n" +

View File

@ -242,8 +242,8 @@ class Periphery(implicit val p: Parameters) extends Module
} else None } else None
val buildParams = p.alterPartial({ val buildParams = p.alterPartial({
case InnerTLId => "L2toMMIO" case InnerTLId => "L2toMMIO" // Device MMIO port
case OuterTLId => "L1toL2" case OuterTLId => "L1toL2" // Device client port
}) })
device.builder(mmioPort, clientPort, io.extra, buildParams) device.builder(mmioPort, clientPort, io.extra, buildParams)