2016-09-01 00:53:25 +02:00
|
|
|
// See LICENSE for license details.
|
|
|
|
|
|
|
|
package uncore.tilelink2
|
|
|
|
|
|
|
|
import Chisel._
|
2016-09-05 02:03:10 +02:00
|
|
|
import chisel3.internal.sourceinfo.SourceInfo
|
2016-09-01 00:53:25 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2016-09-09 20:08:39 +02:00
|
|
|
((io.in zip io.out) zip (node.edgesIn zip node.edgesOut)) foreach { case ((in, out), (edgeIn, edgeOut)) =>
|
|
|
|
out.a <> Queue(in .a, entries, pipe)
|
|
|
|
in .d <> Queue(out.d, entries, pipe)
|
|
|
|
|
|
|
|
if (edgeOut.manager.anySupportAcquire && edgeOut.client.anySupportProbe) {
|
|
|
|
in .b <> Queue(out.b, entries, pipe)
|
|
|
|
out.c <> Queue(in .c, entries, pipe)
|
2016-09-14 01:04:46 +02:00
|
|
|
out.e <> Queue(in .e, entries, pipe)
|
2016-09-09 20:08:39 +02:00
|
|
|
} else {
|
|
|
|
in.b.valid := Bool(false)
|
|
|
|
in.c.ready := Bool(true)
|
|
|
|
in.e.ready := Bool(true)
|
|
|
|
out.b.ready := Bool(true)
|
|
|
|
out.c.valid := Bool(false)
|
|
|
|
out.e.valid := Bool(false)
|
|
|
|
}
|
2016-09-01 00:53:25 +02:00
|
|
|
}
|
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
|
|
|
|
{
|
2016-09-09 08:06:59 +02:00
|
|
|
// applied to the TL source node; y.node := TLBuffer(x.node)
|
|
|
|
def apply(x: TLBaseNode, entries: Int = 2, pipe: Boolean = false)(implicit sourceInfo: SourceInfo): TLBaseNode = {
|
2016-09-02 20:13:43 +02:00
|
|
|
val buffer = LazyModule(new TLBuffer(entries, pipe))
|
2016-09-09 08:06:59 +02:00
|
|
|
buffer.node := x
|
2016-09-01 01:45:18 +02:00
|
|
|
buffer.node
|
|
|
|
}
|
|
|
|
}
|