zhangyanjun1984的个人空间 https://blog.eetop.cn/1055545 [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

scala

已有 129 次阅读| 2024-3-26 09:24 |系统分类:芯片设计

package utils


import chisel3._

import chisel3.util._


object ParallelOperation {

  def apply[T](xs: Seq[T], func: (T, T) => T): T = {

    require(xs.nonEmpty)

    xs match {

      case Seq(a) => a

      case Seq(a, b) => func(a, b)

      case _ =>

        apply(Seq(apply(xs take xs.size/2, func), apply(xs drop xs.size/2, func)), func)

    }

  }

}


object ParallelOR {

  def apply[T <: Data](xs: Seq[T]): T = {

    ParallelOperation(xs, (a: T, b: T) => (a.asUInt | b.asUInt).asTypeOf(xs.head))

  }

}



object LowerMask {

  def apply(a: UInt, len: Int): UInt = {

    ParallelOR((0 until len).map(i => (a >> i).asUInt))

  }

  def apply(a: UInt): UInt = {

    apply(a, a.getWidth)

  }

}


 val s2_allocatableSlots = VecInit(s2_resps.map(r => !r.valid && !r.bits.u)).asUInt &  //5 bits

    ~(LowerMask(UIntToOH(s2_provider), ITTageNTables) & Fill(ITTageNTables, s2_provided.asUInt))


全部作者的其他最新日志

评论 (0 个评论)

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 1

    粉丝
  • 1

    好友
  • 1

    获赞
  • 0

    评论
  • 3

    访问数
关闭

站长推荐 上一条 /1 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-27 16:33 , Processed in 0.024928 second(s), 14 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部