What does Queue() function do in Chisel?

狂风中的少年 提交于 2019-12-11 01:39:22

问题


I was reading source code of rocket chip, in rocc.scala file in rocket/src/main/scala/ there is an example AccumulatorExample for using rocc. At first part of the code there is a function Queue() that I couldn't figure out what it's doing?

   val n = 4
   val regfile = Mem(UInt(width = params(XprLen)), n)
   val busy = Vec.fill(n){Reg(init=Bool(false))}

  val cmd = Queue(io.cmd)
  val funct = cmd.bits.inst.funct
  val addr = cmd.bits.inst.rs2(log2Up(n)-1,0)
  val doWrite = funct === UInt(0)
  val doRead = funct === UInt(1)
  val doLoad = funct === UInt(2)
  val doAccum = funct === UInt(3)
  val memRespTag = io.mem.resp.bits.tag(log2Up(n)-1,0)

Thanks


回答1:


Queue is a Module providing a hardware queue. Circle-talk I know but it's the best I can give. Hope this helps! Your code looks like it is setting the source of the queue as the io.cmd.

Constructor:

Queue(enq:DecoupledIO, entries:Int)
enq DecoupledIO source for the queue
entries size of queue

Interface:

.io.enq Decoupled | IO source (flipped)
.io.deq Decoupled  | IO sink
.io.count UInt  | count of elements in the queue


来源:https://stackoverflow.com/questions/30380823/what-does-queue-function-do-in-chisel

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!