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

相关推荐
看未来捏2 个月前
【数字集成电路与系统设计】Chisel/Scala简介与Verilog介绍
scala·verilog·chisel
神仙约架5 个月前
【chisel】chisel中for (i <- 0 until N-2) {} 的用法,表示什么?
chisel·for
农民真快落5 个月前
【IC设计】任意倍数占空比为50%的奇数分频和偶数分频(Verilog源码、仿真波形、讲解)
fpga开发·riscv·chisel·一生一芯·cpu设计
神仙约架6 个月前
【chisel】学习chisel进行FPGA开发的步骤
fpga开发·chisel
神仙约架6 个月前
【Chisel】chisel中怎么处理类似verilog的可变位宽和parameter
scala·fpga·chisel·asic
半夏之夜6 个月前
Chisel3 入门 (1)
chisel·chisel3
农民真快落7 个月前
【程序人生】研二下学期快结束了~~~~随便写写
fpga开发·riscv·chisel·一生一芯·cpu设计
农民真快落8 个月前
【异常处理】sbt构建Chisel库时出现extracting structure failed:build status:error的解决办法
scala·ic设计·chisel·noc·一生一芯
农民真快落9 个月前
【IC设计】Windows下基于IDEA的Chisel环境安装教程(图文并茂)
scala·ic设计·risc-v·chisel·一生一芯
铭....1 年前
一生一芯18——Chisel模板与Chisel工程构建
scala·chisel