From 6a12a215ba5dda1b5806c7519c86dd9cd165efef Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Sat, 1 Apr 2023 15:23:16 -0700 Subject: [PATCH] Improve performance of PrioritizingRouter by skipping simple cases --- src/main/scala/router/vcalloc/Prioritizing.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/scala/router/vcalloc/Prioritizing.scala b/src/main/scala/router/vcalloc/Prioritizing.scala index 7f157bc..d49da68 100644 --- a/src/main/scala/router/vcalloc/Prioritizing.scala +++ b/src/main/scala/router/vcalloc/Prioritizing.scala @@ -65,7 +65,11 @@ trait Prioritizing { this: VCAllocator => val ref = (((e.inVId << addr_bundle.id.getWidth) | e.inId) << addr_bundle.flow.getWidth) | e.flow.asLiteral(flow) (BitPat(ref.U), BitPat((1 << e.prio).U(nPrios.W))) } - Mux(in(i)(j), DecodeLogic(addr, BitPat.dontCare(nPrios), lookup), 0.U(nPrios.W)) + if (lookup.map(_._2).distinct.size == 1) { + Mux(in(i)(j), BitPat.bitPatToUInt(lookup.head._2), 0.U(nPrios.W)) + } else { + Mux(in(i)(j), DecodeLogic(addr, BitPat.dontCare(nPrios), lookup), 0.U(nPrios.W)) + } }} val mask = RegInit(0.U(w.W))