From 560404992747a8752aa992c5e98e89ecb3f0056a Mon Sep 17 00:00:00 2001 From: "Wesley W. Terpstra" Date: Fri, 9 Sep 2016 11:08:39 -0700 Subject: [PATCH] tilelink2 Buffer: support an unlimited number of channels --- src/main/scala/uncore/tilelink2/Buffer.scala | 34 +++++++++----------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/main/scala/uncore/tilelink2/Buffer.scala b/src/main/scala/uncore/tilelink2/Buffer.scala index 84d6c21b..adfe4c4b 100644 --- a/src/main/scala/uncore/tilelink2/Buffer.scala +++ b/src/main/scala/uncore/tilelink2/Buffer.scala @@ -14,25 +14,23 @@ class TLBuffer(entries: Int = 2, pipe: Boolean = false) extends LazyModule 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) - } 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) + ((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) + out.e <> Queue(out.e, entries, pipe) + } 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) + } } } }