chisel
chisel copied to clipboard
[Feature Request] Request MuxTLookup
Type of issue: Feature Request
Is your feature request related to a problem? Please describe. I would like to extend the functionality of MuxLookup a bit like this:
val (test0,test1, test2) = MuxTLookup(in.foo, (1.U, 2.U, true.B),Seq(
1.U -> (2.U, 3.U, false.B),
2.U -> (3.U, 4.U, true.B),
3.U -> (4.U, 5.U, false.B),
))
Currently Chisel's MuxLookup API does not support this usage, Chisel compiler will report an error when we use it as in the above example:
[#6] [error] [S <: chisel3.EnumType, T <: chisel3.Data](key: S, default: T)(mapping: Seq[(S, T)]): T <and>
[#6] [error] [T <: chisel3.Data](key: chisel3.UInt, default: T)(mapping: Seq[(chisel3.UInt, T)]): T
[#6] [error] cannot be applied to (chisel3.UInt, (chisel3.UInt, chisel3.UInt, chisel3.Bool))
[#6] [error] val (test0, test1, test2) = MuxLookup(in.foo, (1.U,2.U, true.B))(Seq(
[#6] [error] ^
[#6] [error] one error found
Describe the solution you'd like I noticed that the rocket-chip has a MuxTLookup API with similar functionality: https://github.com/chipsalliance/rocket-chip/blob/dbcb06afe1c76d1129cb6d264949322a34c37185/src/main/scala/util/Misc.scala#L45 I think this API can be handy in circuit design, Can we add the MuxTLookup API to Chisel?