Provide suggestName to Queue(and other Chisel Library Moduels)
sequencer opened this issue · comments
Type of issue: Feature Request
Describe the solution you'd like
Queue API doesn't return the Instance of Queue, which makes user impossible to access the Queue instance to suggestName
. This makes queue with an unstable and ugly name.
e.g. https://shz.al/iccR
Queue2_AW_ID4_DATA32_ADDR39 view__aw_deq_q (
...
);
Describe alternatives you've considered
Additional context
What is the use case for implementing this feature?
It seems to name the instance okay if you assign the result of the Queue.apply
call to a val
, eg:
val q = Queue(in, 4)
Gives
inst q_q of Queue4_UInt8
(Scastie: https://scastie.scala-lang.org/kJHzJhOWT7WsHGFIxNkd7g)
But if you immediately connect the output to a view, it prefixes based on the name of the view and you end up with that nasty name...
val in = IO(Flipped(Decoupled(UInt(8.W))))
val out = IO(Decoupled(UInt(8.W)))
val viewOfOut = out.viewAs
viewOfOut :<>= Queue(in, 4)
Gives
inst view__q of Queue4_UInt8
(Scastie: https://scastie.scala-lang.org/xINQireDTK23N2QYIpuYjA)
So there are potentially 2 issues here:
- Improve naming when views are used as prefixes
- Make it possible to influence the
_q
suffix for Queue instances, perhaps we could expose a String argument that defaults to"q"
.