chisel

How to use the empty signal of the Queue?


I'm using the Queue of the Chisel Lang in a design. Accessing the empty and full signals of the Queue could be beneficial, but since they're not part of the IO, I cannot use them. Is there any way to use those signals other than duplicating the Queue implementation and customizing it? Thanks.


Solution

  • As we can see in Chisel code :

      io.deq.valid := !empty
      io.enq.ready := !full
    

    we can use enqueue and dequeue interface to know if Queue is full or empty.

    If the dequeue signal io.deq.valid is false.B, then the Queue is empty (you can't «dequeue» data). And if the enqueue signal io.enq.ready is false.B, then the Queue is full (you can't push new data).