1
0

TLBuffer: Create a wrapper module for TLBufferChain, to allow for more stable naming

This commit is contained in:
Megan Wachs
2017-08-31 13:00:37 -07:00
committed by Wesley W. Terpstra
parent 94f06dc85c
commit 667d966410
4 changed files with 32 additions and 13 deletions

View File

@ -77,3 +77,28 @@ object TLBuffer
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
}
}
}