Skip to content

Commit 95a3370

Browse files
committed
fixup! [util] Add a withShadowLayer Queue
1 parent 3ad2125 commit 95a3370

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/main/scala/chisel3/util/Queue.scala

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,25 @@ class Queue[T <: Data](
142142
* generator's `typeName`
143143
*/
144144
override def desiredName = s"Queue${entries}_${gen.typeName}"
145+
146+
/** Create a "shadow" `Queue` in a specific layer that will be queued and
147+
* dequeued in lockstep with an original `Queue`. Connections are made using
148+
* `BoringUtils.tapAndRead` which allows this method to be called anywhere in
149+
* the hierarchy.
150+
*
151+
* An intended use case of this is as a building block of a "shadow" design
152+
* verification datapath which augments an existing design datapath with
153+
* additional information. E.g., a shadow datapath that tracks transations
154+
* in an interconnect.
155+
*
156+
* @param data a hardware data that should be enqueued together with the
157+
* original `Queue`'s data
158+
* @param layer the `Layer` in which this queue should be created
159+
* @return a layer-colored `Valid` interface of probe type
160+
*/
161+
def shadow[A <: Data](data: A, layer: Layer): Valid[A] = {
162+
(new Queue.ShadowFactory(enq = io.enq, deq = io.deq, entries, pipe, flow, useSyncReadMem, io.flush))(data, layer)
163+
}
145164
}
146165

147166
/** Factory for a generic hardware queue. */

0 commit comments

Comments
 (0)