top of page

[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 All

[chisel/scala] Create an array of Modules

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

Comments


Let's do our best with our partner:​ ChatReminder

iphone6.5p2.png

It is an application that achieves goals in a chat format with partners.

google-play-badge.png
Download_on_the_App_Store_Badge_JP_RGB_blk_100317.png

Let's do our best with our partner:​ ChatReminder

納品:iPhone6.5①.png

It is an application that achieves goals in a chat format with partners.

google-play-badge.png
Download_on_the_App_Store_Badge_JP_RGB_blk_100317.png

Theme diary: Decide the theme and record for each genre

It is a diary application that allows you to post and record with themes and sub-themes for each genre.

google-play-badge.png
Download_on_the_App_Store_Badge_JP_RGB_blk_100317.png
bottom of page