BufferParams in diplomacy-Parameter.scala

case class BufferParams(depth: Int, flow: Boolean, pipe: Boolean)

{

require (depth >= 0, "Buffer depth must be >= 0")

def isDefined = depth > 0

def latency = if (isDefined && !flow) 1 else 0

def apply[T <: Data](x: DecoupledIO[T]) =

if (isDefined) Queue(x, depth, flow=flow, pipe=pipe)

else x

def irrevocable[T <: Data](x: ReadyValidIO[T]) =

if (isDefined) Queue.irrevocable(x, depth, flow=flow, pipe=pipe)

else x

def sq[T <: Data](x: DecoupledIO[T]) =

if (!isDefined) x else {

val sq = Module(new ShiftQueue(x.bits, depth, flow=flow, pipe=pipe))

sq.io.enq <> x

sq.io.deq

}

override def toString() = "BufferParams:%d%s%s".format(depth, if (flow) "F" else "", if (pipe) "P" else "")

}

object BufferParams

{

implicit def apply(depth: Int): BufferParams = BufferParams(depth, false, false)

val default = BufferParams(2)

val none = BufferParams(0)

val flow = BufferParams(1, true, false)

val pipe = BufferParams(1, false, true)

}

阅读笔记摘要:

Default buffer深度为2

ShiftQueue Implements the same interface as chisel3.util.Queue, but uses a shift register internally. It is less energy efficient whenever the queue has more than one entry populated, but is faster on the dequeue side.It is efficient for usually-empty flow-through queues.

  • shiftqueue接口与chisel3.util.Queue一致,但是内部实现使用的是移位寄存器。
  • 当队列项数超过一项时,能效会比较低,但是出队更快
  • 当队列总是为空时效率比较高

关于ReadyValidIO,DecoupledIO,IrrevocableIO的继承关系参考https://www.cnblogs.com/wjcdx/p/10124643.html

相关推荐
ChipCamp14 天前
Chisel芯片开发入门系列 -- 18. CPU芯片开发和解释8(流水线架构的代码级理解)
开发语言·青少年编程·fpga开发·scala·dsp开发·risc-v·chisel
ChipCamp18 天前
Chisel芯片开发入门系列 -- 14. CPU芯片开发和解释4(Load/Store指令再探)
arm开发·青少年编程·fpga开发·scala·dsp开发·risc-v·chisel
月光技术杂谈1 个月前
上海RISC-V峰会-香山开源RISC-V CPU随想随记
verilog·risc-v·chisel·vhdl·香山·开源cpu·xiangshan
看未来捏1 年前
【数字集成电路与系统设计】Chisel/Scala简介与Verilog介绍
scala·verilog·chisel
神仙约架1 年前
【chisel】chisel中for (i <- 0 until N-2) {} 的用法,表示什么?
chisel·for
农民真快落1 年前
【IC设计】任意倍数占空比为50%的奇数分频和偶数分频(Verilog源码、仿真波形、讲解)
fpga开发·riscv·chisel·一生一芯·cpu设计
神仙约架1 年前
【chisel】学习chisel进行FPGA开发的步骤
fpga开发·chisel
神仙约架1 年前
【Chisel】chisel中怎么处理类似verilog的可变位宽和parameter
scala·fpga·chisel·asic
半夏之夜1 年前
Chisel3 入门 (1)
chisel·chisel3
农民真快落1 年前
【程序人生】研二下学期快结束了~~~~随便写写
fpga开发·riscv·chisel·一生一芯·cpu设计