diplomacy: BufferParams can now directly create a Queue
This commit is contained in:
parent
36562ce48e
commit
4a15d47061
@ -248,6 +248,10 @@ case class BufferParams(depth: Int, flow: Boolean, pipe: Boolean)
|
|||||||
require (depth >= 0, "Buffer depth must be >= 0")
|
require (depth >= 0, "Buffer depth must be >= 0")
|
||||||
def isDefined = depth > 0
|
def isDefined = depth > 0
|
||||||
def latency = if (isDefined && !flow) 1 else 0
|
def latency = if (isDefined && !flow) 1 else 0
|
||||||
|
|
||||||
|
def apply[T <: Data](x: DecoupledIO[T]) =
|
||||||
|
if (isDefined) Queue(x, depth, flow=flow, pipe=pipe)
|
||||||
|
else x
|
||||||
}
|
}
|
||||||
|
|
||||||
object BufferParams
|
object BufferParams
|
||||||
|
@ -29,22 +29,14 @@ class TLBuffer(
|
|||||||
val out = node.bundleOut
|
val out = node.bundleOut
|
||||||
}
|
}
|
||||||
|
|
||||||
def buffer[T <: Data](config: BufferParams, data: DecoupledIO[T]): DecoupledIO[T] = {
|
|
||||||
if (config.isDefined) {
|
|
||||||
Queue(data, config.depth, pipe=config.pipe, flow=config.flow)
|
|
||||||
} else {
|
|
||||||
data
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
((io.in zip io.out) zip (node.edgesIn zip node.edgesOut)) foreach { case ((in, out), (edgeIn, edgeOut)) =>
|
((io.in zip io.out) zip (node.edgesIn zip node.edgesOut)) foreach { case ((in, out), (edgeIn, edgeOut)) =>
|
||||||
out.a <> buffer(a, in .a)
|
out.a <> a(in .a)
|
||||||
in .d <> buffer(d, out.d)
|
in .d <> d(out.d)
|
||||||
|
|
||||||
if (edgeOut.manager.anySupportAcquireB && edgeOut.client.anySupportProbe) {
|
if (edgeOut.manager.anySupportAcquireB && edgeOut.client.anySupportProbe) {
|
||||||
in .b <> buffer(b, out.b)
|
in .b <> b(out.b)
|
||||||
out.c <> buffer(c, in .c)
|
out.c <> c(in .c)
|
||||||
out.e <> buffer(e, in .e)
|
out.e <> e(in .e)
|
||||||
} else {
|
} else {
|
||||||
in.b.valid := Bool(false)
|
in.b.valid := Bool(false)
|
||||||
in.c.ready := Bool(true)
|
in.c.ready := Bool(true)
|
||||||
|
Loading…
Reference in New Issue
Block a user