Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Request MuxTLookup #4066

Open
Emin017 opened this issue May 13, 2024 · 0 comments
Open

[Feature Request] Request MuxTLookup #4066

Emin017 opened this issue May 13, 2024 · 0 comments

Comments

@Emin017
Copy link
Contributor

Emin017 commented May 13, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant