1
0

tilelink Buffer: use new :=? adapter API

This commit is contained in:
Wesley W. Terpstra 2017-09-06 15:44:54 -07:00
parent 1b705f62f6
commit 80965e8230
2 changed files with 19 additions and 7 deletions

View File

@ -73,7 +73,7 @@ object TLBuffer
d: BufferParams, d: BufferParams,
e: BufferParams)(x: TLOutwardNode)(implicit p: Parameters, sourceInfo: SourceInfo): TLOutwardNode = { e: BufferParams)(x: TLOutwardNode)(implicit p: Parameters, sourceInfo: SourceInfo): TLOutwardNode = {
val buffer = LazyModule(new TLBuffer(a, b, c, d, e)) val buffer = LazyModule(new TLBuffer(a, b, c, d, e))
buffer.node := x buffer.node :=? x
buffer.node buffer.node
} }
} }
@ -82,18 +82,19 @@ class TLBufferChain(depth: Int)(implicit p: Parameters) extends LazyModule {
val nodeIn = TLInputNode() val nodeIn = TLInputNode()
val nodeOut = TLOutputNode() val nodeOut = TLOutputNode()
val node = NodeHandle(nodeIn, nodeOut)
val buf_chain = if (depth > 0) { val buf_chain = if (depth > 0) {
val chain = List.fill(depth)(LazyModule(new TLBuffer(BufferParams.default))) val chain = List.fill(depth)(LazyModule(new TLBuffer(BufferParams.default)))
(chain.init zip chain.tail) foreach { case(prev, next) => next.node :=* prev.node } (chain.init zip chain.tail) foreach { case(prev, next) => next.node :=? prev.node }
chain chain
} else { } else {
List(LazyModule(new TLBuffer(BufferParams.none))) List(LazyModule(new TLBuffer(BufferParams.none)))
} }
buf_chain.head.node :=* nodeIn buf_chain.head.node :=? nodeIn
nodeOut :=* buf_chain.last.node nodeOut :=? buf_chain.last.node
lazy val module = new LazyModuleImp(this) { lazy val module = new LazyModuleImp(this) {
val io = new Bundle { val io = new Bundle {
@ -102,3 +103,12 @@ class TLBufferChain(depth: Int)(implicit p: Parameters) extends LazyModule {
} }
} }
} }
object TLBufferChain
{
def apply(depth: Int)(x: TLOutwardNode)(implicit p: Parameters, sourceInfo: SourceInfo): TLOutwardNode = {
val buffer = LazyModule(new TLBufferChain(depth))
buffer.node :=? x
buffer.node
}
}

View File

@ -68,10 +68,12 @@ abstract class TLBusWrapper(params: TLBusParams, val busName: String)(implicit p
protected def inwardBufNode: TLInwardNode = master_buffer.node protected def inwardBufNode: TLInwardNode = master_buffer.node
protected def bufferChain(depth: Int, name: Option[String] = None): (TLInwardNode, TLOutwardNode) = { protected def bufferChain(depth: Int, name: Option[String] = None): (TLInwardNode, TLOutwardNode) = {
RightStar { implicit p =>
val chain = LazyModule(new TLBufferChain(depth)) val chain = LazyModule(new TLBufferChain(depth))
name.foreach { n => chain.suggestName(s"${busName}_${n}_TLBufferChain")} name.foreach { n => chain.suggestName(s"${busName}_${n}_TLBufferChain")}
(chain.nodeIn, chain.nodeOut) (chain.nodeIn, chain.nodeOut)
} }
}
def bufferFromMasters: TLInwardNode = inwardBufNode def bufferFromMasters: TLInwardNode = inwardBufNode