Chisel3 - util - Pipe
https://mp.weixin.qq.com/s/WeFesE8k0ORxlaNfLvDzgg
/** A hardware module that delays data coming down the pipeline
* by the number of cycles set by the latency parameter. Functionality
* is similar to ShiftRegister but this exposes a Pipe interface.
*
* Example usage:
* {{{
* val pipe = new Pipe(UInt())
* pipe.io.enq <> produce.io.out
* consumer.io.in <> pipe.io.deq
* }}}
*/
object Pipe
{
@chiselName
def apply[T <: Data](enqValid: Bool, enqBits: T, latency: Int)(implicit compileOptions: CompileOptions): Valid[T] = {
if (latency == 0) {
val out = Wire(Valid(chiselTypeOf(enqBits)))
out.valid := enqValid
out.bits := enqBits
out
} else {
val v = RegNext(enqValid, false.B)
val b = RegEnable(enqBits, enqValid)
apply(v, b, latency-1)(compileOptions)
}
}
def apply[T <: Data](enqValid: Bool, enqBits: T)(implicit compileOptions: CompileOptions): Valid[T] = {
apply(enqValid, enqBits, 1)(compileOptions)
}
def apply[T <: Data](enq: Valid[T], latency: Int = 1)(implicit compileOptions: CompileOptions): Valid[T] = {
apply(enq.valid, enq.bits, latency)(compileOptions)
}
} class Pipe[T <: Data](gen: T, latency: Int = 1)(implicit compileOptions: CompileOptions) extends Module
{
class PipeIO extends Bundle {
val enq = Input(Valid(gen))
val deq = Output(Valid(gen))
} val io = IO(new PipeIO) io.deq <> Pipe(io.enq, latency)
}
Chisel3 - util - Pipe的更多相关文章
- Chisel3 - util - Queue
https://mp.weixin.qq.com/s/vlyOIsQxR6bCqDDMtRQLLg 实现队列模块,先入先出(FIFO). 参考链接: https://github.com/fr ...
- Chisel3 - util - OneHot
https://mp.weixin.qq.com/s/Jsy8P3m9W2EYKwneGVekiw 独热码相关的电路生成器. 参考链接: https://github.com/freechip ...
- Chisel3 - util - MixedVec
https://mp.weixin.qq.com/s/mO648yx4_ZRedXSWX4Gj2g 可以容纳不同类型的变量的向量. 参考链接: https://github.com/freec ...
- Chisel3 - util - Mux
https://mp.weixin.qq.com/s/TK1mHqvDpG9fbLJyNxJp-Q Mux相关电路生成器. 参考链接: https://github.com/freechips ...
- Chisel3 - util - Lookup
https://mp.weixin.qq.com/s/g85Si6n37D9PYfR5hEoRQQ 实现一个查找逻辑. 参考链接: https://github.com/freechips ...
- Chisel3 - util - Valid
https://mp.weixin.qq.com/s/L5eAwv--WzZdr-CfW2-XNA Chisel提供的Valid接口.如果valid为置1,则表明输出的bits有效:反之,则输出无 ...
- Chisel3 - util - Math vs. CircuitMath
https://mp.weixin.qq.com/s/8lC8vQnBdKW9C39H0QFFkA 对数相关的辅助方法,Math通过软件方法实现,CircuitMath通过硬件方法实现. ...
- Chisel3 - util - LFSR16
https://mp.weixin.qq.com/s/DSdb4tmRwDTOki7mbyuu9A 实现16位线性反馈移位寄存器.可用于生成简单的伪随机数. 参 ...
- Chisel3 - util - Bitwise
https://mp.weixin.qq.com/s/MQzX1Ned35ztz0vusPdkdQ 比特相关的操作. 参考链接: https://github.com/freechipspro ...
随机推荐
- H - Fire CodeForces - 864E 01背包
https://codeforces.com/problemset/problem/864/E 这个题目要把这个按照物品毁灭时间进行排序,如果时间短就要排在前面,这个是因为要保证之后的物品的拯救不会影 ...
- 【Linux基础总结】Linux系统管理
Linux系统管理 Linux磁盘管理命令.内存查看命令讲解 系统信息 查看系统 $ uname 查看系统版本号 $ uname -r 查看cpu信息 $ cat /proc/cpuinfo 查看内存 ...
- Linux下ffmpeg交叉编译
1 获取源代码 git clone -b "branch" https://git.ffmpeg.org/ffmpeg.git "branch" 可以是以下的m ...
- python重试次数装饰器
目录 重试次数装饰器 重试次数装饰器 前言, 最近在使用tornado框架写Restful API时遇到很多的问题. 有框架的问题, 有异步的问题. 虽然tornado 被公认为当前python语言最 ...
- DP之石子堆合并问题
相邻 环形 总结 (1)相邻:在一个圆形操场的四周摆放着n堆石子(n<= 100),现要将石子有次序地合并成一堆.规定每次只能选取相邻的两堆合并成新的一堆,并将新的一堆的石子数,记为该次合并的得 ...
- JUC(3)---CountDownLatch、CyclicBarrier和AQS
CountDownLatch可以让一个线程等待其他线程完成了各自的工作之后再执行.比如说一个切菜,一个人切肉,都准备完毕之后才能炒肉. 构造方法: public CountDownLatch(int ...
- git 常用 指令累积
1.查询指定文件的修改所有修改日志git log --pretty=oneline 文件名 1. git log filename 可以看到fileName相关的commit记录2. git log ...
- 数据源管理 | OLAP查询引擎,ClickHouse集群化管理
本文源码:GitHub·点这里 || GitEE·点这里 一.列式库简介 ClickHouse是俄罗斯的Yandex公司于2016年开源的列式存储数据库(DBMS),主要用于OLAP在线分析处理查询, ...
- Java基础之抽象类和接口
今天来说说抽象类和接口的实现以及它们的区别.我们知道抽象类和接口都是对具体事物的抽象,接口在实现上比抽象类更加抽象,抽象类中可以有普通方法和变量,而接口中只有抽象方法和不可变常量.但是从另一个角度看, ...
- Django之内置分页器(paginator)
django分页: from django.shortcutsimportrender from django.core.paginator import Paginator,EmptyPage, P ...