qcnt

qcnt(din: Queue, running=False, lvl=1, init=0, cnt_one_more=False, w_out=16) → Uint[w_out] | Queue[Uint[w_out]]

Counts the number of elements in a Queue. The lvl parameter is used with multi-level Queue -s to designate the level of elements which are counted. If lvl==1, the single elements are counted. If for an example lvl==2, the level 1 transactiona are counted. The init parameter can be used to offset the count, and w_out specifies the size of the counter in number of bits.

If running==False, single Uint number that represents the number of elements is output.

drv(t=Queue[Uint[4]], seq=[[1, 2, 3, 4, 5]]) \
    | qcnt \
    | check(ref=[5])

If running==True, a Queue of Uint -s is output showing the live count of the elements.

drv(t=Queue[Uint[4]], seq=[[1, 2, 3, 4, 5]]) \
    | qcnt(running=True) \
    | check(ref=[[1, 2, 3, 4, 5]])