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

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Ladies and gentlemen, Today, I want to talk about the two most important concepts that have shaped human history - war and peace. War has been an unfortunate reality in human history. It has caused immense suffering, destruction, and loss of life. From the ancient wars fought with swords and shields to the modern wars fought with tanks and drones, the devastation caused by war is undeniable. The scars of war can last for generations, and the human cost is immeasurable. However, war is not inevitable. We have the power to create a more peaceful world. Peace is not just the absence of war, but a state of harmony, where people can live together without fear, violence, or conflict. Peace is the foundation of progress, development, and prosperity. Achieving peace requires a collective effort from all of us. It requires us to work together, to respect each other's differences, and to find common ground. We must promote understanding, dialogue, and diplomacy, and reject the use of force as a means of resolving conflicts. We must also address the root causes of conflict. Poverty, inequality, and injustice are all factors that contribute to social unrest and conflict. By addressing these issues, we can create a more equal and just society, where people can live in harmony. In conclusion, war and peace are two sides of the same coin. We must strive for peace and work towards it every day. Let us choose the path of peace, and work together to create a better world for ourselves and future generations. Thank you.
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值