From 058572136b8385473094854d053416c722ab5d1a Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Mon, 12 Jan 2026 12:52:37 +0800 Subject: [PATCH] feat(LookupTree): support BitPat as the key of LookupTree * The implicit arg d typed DummyImplicit is used to support function overload and avoid type erase in Seq. --- src/main/scala/utility/LookupTree.scala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/scala/utility/LookupTree.scala b/src/main/scala/utility/LookupTree.scala index fd1a348..bf10ffa 100644 --- a/src/main/scala/utility/LookupTree.scala +++ b/src/main/scala/utility/LookupTree.scala @@ -22,6 +22,9 @@ import chisel3.util._ object LookupTree { def apply[T <: Data](key: UInt, mapping: Iterable[(UInt, T)]): T = Mux1H(mapping.map(p => (p._1 === key, p._2))) + + def apply[T <: Data](key: UInt, mapping: Iterable[(BitPat, T)])(implicit d: DummyImplicit): T = + Mux1H(mapping.map(p => (p._1 === key, p._2))) } object LookupTreeDefault {