In the implementation of the Queue in chisel3,
Object Queue returns TransitName:
object Queue
{
/** Create a queue and supply a DecoupledIO containing the product. */
@chiselName
def apply[T <: Data](
enq: ReadyValidIO[T],
entries: Int = 2,
pipe: Boolean = false,
flow: Boolean = false): DecoupledIO[T] = {
if (entries == 0) {
val deq = Wire(new DecoupledIO(enq.bits))
deq.valid := enq.valid
deq.bits := enq.bits
enq.ready := deq.ready
deq
} else {
require(entries > 0)
val q = Module(new Queue(chiselTypeOf(enq.bits), entries, pipe, flow))
q.io.enq.valid := enq.valid // not using <> so that override is allowed
q.io.enq.bits := enq.bits
enq.ready := q.io.enq.ready
TransitName(q.io.deq, q)
}
}
I couldn't grasp what's inside TransitName, because I couldn't understand its meaning of source code.
At the line located at TransitName(q.io.deq, q)
, I think that just returning q.io.deq(instead of TransitName), it works correctly. But why do we need TransitName??