TLBuffer: Create a wrapper module for TLBufferChain, to allow for more stable naming
This commit is contained in:
parent
94f06dc85c
commit
667d966410
@ -23,7 +23,8 @@ class FrontBus(params: FrontBusParams)(implicit p: Parameters) extends TLBusWrap
|
|||||||
fromSyncPorts(params, buffers, name)
|
fromSyncPorts(params, buffers, name)
|
||||||
|
|
||||||
def fromSyncPorts(params: BufferParams = BufferParams.default, buffers: Int = 1, name: Option[String] = None): TLInwardNode = {
|
def fromSyncPorts(params: BufferParams = BufferParams.default, buffers: Int = 1, name: Option[String] = None): TLInwardNode = {
|
||||||
val (in, out) = bufferChain(buffers, params, name)
|
require(params == BufferParams.default, "Only BufferParams.default supported for FrontBus at this time.")
|
||||||
|
val (in, out) = bufferChain(buffers, name)
|
||||||
inwardNode :=* out
|
inwardNode :=* out
|
||||||
in
|
in
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ class SystemBus(params: SystemBusParams)(implicit p: Parameters) extends TLBusWr
|
|||||||
def toSplitSlaves: TLOutwardNode = outwardSplitNode
|
def toSplitSlaves: TLOutwardNode = outwardSplitNode
|
||||||
|
|
||||||
def toPeripheryBus(nBuffers: Int): TLOutwardNode = {
|
def toPeripheryBus(nBuffers: Int): TLOutwardNode = {
|
||||||
val (in, out) = bufferChain(nBuffers, name = Some("PeripheryBus"))
|
val (in, out) = bufferChain(nBuffers, name = Some("pbus"))
|
||||||
in := pbus_fixer.node
|
in := pbus_fixer.node
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
|
@ -77,3 +77,28 @@ object TLBuffer
|
|||||||
buffer.node
|
buffer.node
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class TLBufferChain(depth: Int)(implicit p: Parameters) extends LazyModule {
|
||||||
|
|
||||||
|
val nodeIn = TLInputNode()
|
||||||
|
val nodeOut = TLOutputNode()
|
||||||
|
|
||||||
|
val buf_chain = if (depth > 0) {
|
||||||
|
val chain = List.fill(depth)(LazyModule(new TLBuffer(BufferParams.default)))
|
||||||
|
|
||||||
|
(chain.init zip chain.tail) foreach { case(prev, next) => next.node :=* prev.node }
|
||||||
|
chain
|
||||||
|
} else {
|
||||||
|
List(LazyModule(new TLBuffer(BufferParams.none)))
|
||||||
|
}
|
||||||
|
|
||||||
|
buf_chain.head.node :=* nodeIn
|
||||||
|
nodeOut :=* buf_chain.last.node
|
||||||
|
|
||||||
|
lazy val module = new LazyModuleImp(this) {
|
||||||
|
val io = new Bundle {
|
||||||
|
val in = nodeIn.bundleIn
|
||||||
|
val out = nodeOut.bundleOut
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -67,17 +67,10 @@ abstract class TLBusWrapper(params: TLBusParams, val busName: String)(implicit p
|
|||||||
protected def inwardNode: TLInwardNode = xbar.node
|
protected def inwardNode: TLInwardNode = xbar.node
|
||||||
protected def inwardBufNode: TLInwardNode = master_buffer.node
|
protected def inwardBufNode: TLInwardNode = master_buffer.node
|
||||||
|
|
||||||
protected def bufferChain(depth: Int, params: BufferParams = BufferParams.default, name: Option[String] = None): (TLInwardNode, TLOutwardNode) = {
|
protected def bufferChain(depth: Int, name: Option[String] = None): (TLInwardNode, TLOutwardNode) = {
|
||||||
if (depth > 0) {
|
val chain = LazyModule(new TLBufferChain(depth))
|
||||||
val chain = List.fill(depth)(LazyModule(new TLBuffer(params)))
|
name.foreach { n => chain.suggestName(s"${busName}_${n}_TLBufferChain")}
|
||||||
name.foreach { n => chain.zipWithIndex foreach { case(b, i) => b.suggestName(s"${busName}_${n}_${i}_TLBuffer") } }
|
(chain.nodeIn, chain.nodeOut)
|
||||||
(chain.init zip chain.tail) foreach { case(prev, next) => next.node :=* prev.node }
|
|
||||||
(chain.head.node, chain.last.node)
|
|
||||||
} else {
|
|
||||||
val dummy = LazyModule(new TLBuffer(BufferParams.none))
|
|
||||||
name.foreach { n => dummy.suggestName(s"${busName}_${n}_empty_TLBuffer")}
|
|
||||||
(dummy.node, dummy.node)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def bufferFromMasters: TLInwardNode = inwardBufNode
|
def bufferFromMasters: TLInwardNode = inwardBufNode
|
||||||
|
Loading…
Reference in New Issue
Block a user