2016-09-01 00:53:25 +02:00
|
|
|
// See LICENSE for license details.
|
|
|
|
|
|
|
|
package uncore.tilelink2
|
|
|
|
|
|
|
|
import Chisel._
|
|
|
|
|
|
|
|
class TLBuffer(entries: Int = 2, pipe: Boolean = false) extends LazyModule
|
|
|
|
{
|
|
|
|
val node = TLIdentityNode()
|
|
|
|
|
2016-09-02 20:13:43 +02:00
|
|
|
lazy val module = new LazyModuleImp(this) {
|
2016-09-01 00:53:25 +02:00
|
|
|
val io = new Bundle {
|
|
|
|
val in = node.bundleIn
|
|
|
|
val out = node.bundleOut
|
|
|
|
}
|
|
|
|
|
|
|
|
val in = io.in(0)
|
|
|
|
val out = io.out(0)
|
|
|
|
|
|
|
|
out.a <> Queue(in .a, entries, pipe)
|
|
|
|
in .d <> Queue(out.d, entries, pipe)
|
|
|
|
|
|
|
|
val edge = node.edgesOut(0) // same as edgeIn(0)
|
|
|
|
if (edge.manager.anySupportAcquire && edge.client.anySupportProbe) {
|
|
|
|
in .b <> Queue(out.b, entries, pipe)
|
|
|
|
out.c <> Queue(in .c, entries, pipe)
|
|
|
|
out.e <> Queue(out.e, entries, pipe)
|
|
|
|
}
|
2016-09-02 20:13:43 +02:00
|
|
|
}
|
2016-09-01 00:53:25 +02:00
|
|
|
}
|
2016-09-01 01:45:18 +02:00
|
|
|
|
|
|
|
object TLBuffer
|
|
|
|
{
|
|
|
|
// applied to the TL source node; connect (TLBuffer(x.node) -> y.node)
|
|
|
|
def apply(x: TLBaseNode, entries: Int = 2, pipe: Boolean = false)(implicit lazyModule: LazyModule): TLBaseNode = {
|
2016-09-02 20:13:43 +02:00
|
|
|
val buffer = LazyModule(new TLBuffer(entries, pipe))
|
2016-09-01 01:45:18 +02:00
|
|
|
lazyModule.connect(x -> buffer.node)
|
|
|
|
buffer.node
|
|
|
|
}
|
|
|
|
}
|