[Chisel] About Queue
Introduction
If you want to use a queue to pass data in Chisel, Queue class is provided.
I will explain how to use it.
Basic usage
Definition
val buf = Module(new Queue(gen = new UInt, entries = 10))
For 'gen', specify an instance of the type of data to be passed. For 'entries', specify the upper limit on the number of data that can be queued.
Input/output
Connect the data to be input to io.enq.bits.
buf.io.enq.bits := data
Set 'valid' and 'ready' to true when input data.
buf.io.enq.valid := true.B
buf.io.enq.ready := true.B
Similarly, connect io.deq.bits to the extraction destination and set 'valid' and 'ready'.
eXUnit.io.input := buf.io.deq.bits
buf.io.deq.valid := true.B
buf.io.deq.ready := true.B
In practice, since you want to use a queue, you would like to do something like "take something out of the queue when a certain condition is met.''
For example, when a calculation is completed, the next instruction is taken out of the instruction queue.
In such a case, you can define a "condition signal" and connect it to ready.
var complete = Wire(Bool())
・・・ //complete = true.B when calculation completes
buf.io.deq.valid := complete
This is a bit difficult to understand for a software developer's point of view, that instead of "calling the enq() method when a certain condition is met," control is done using signal values like this.
Reference
Recent Posts
See AllPhenomenon The following chisel code causes the compilation error: val parts = new Module(new MyParts()) class Module is abstract; cannot be instantiated Causes and Solutions This is because I added "
What want to do As the title says, I want to add a chisel hardware array to a Bundle member. Situation is tat I want to implement multiple identical circuits and process them in parallel. It's easy if
What I want to do I have a class (parts) that I created and that inherits from Module. I want to place multiple instances (components) of this class in a circuit. What I tried I tried to create an arr