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 ...
随机推荐
- spring的单元测试
如果spring 4.3.18这个版本的spring要使用junit,需要使用junit的junit-4.12之上的版本.使用这个版本junit的时 候需要引入hamcrest-all的jar包.之前 ...
- React Native超简单完整示例-tabs、页面导航、热更新、用户行为分析
初学React Native,如果没有人指引,会发现好多东西无从下手,但当有人指引后,会发现其实很简单.这也是本人写这篇博客的主要原因,希望能帮到初学者. 本文不会介绍如何搭建开发环境,如果你还没有搭 ...
- 汽车安全攻击篇:智能网联系统的短板,如何防护汽车的安全C
我们在<速度与激情>里,经常可以看到主角们利用网络侵入汽车网络系统,然后任意的操纵这些车辆,看电影的时候会被画面所震撼到,这两年"自动驾驶"随着特斯拉的车已经越来越普及 ...
- Neo4j填坑记录-Neo4jClient建立节点、建立关系相关
最近一个项目需要用到知识图谱,选用了neo4j图数据库,在这过程中遇到几个坑,记录一下 1.无法登录,疯狂提示“WebSocket connection failure. Due to securit ...
- 利用Asp.net和Sql Server实现留言板功能
本教程设及到:使用SQL Server查询分析器创建数据库:SQL查询语句常用的一些属性值:触发器创建和使用:存储过程的创建,ASP使用存储过程. 正文: 一.创建数据库: 创建一个feedback数 ...
- 配置centos7 java环境
一.环境 centos7 jdk-8u231-linux-x64.tar.gz 二.安装jdk 使用ftp或者 WinScp软件把下载在win10电脑上的jdk安装包上传到linux 解压到/opt/ ...
- tp5.1 nginx环境下url去掉index.php
原来的地址http://xxxxxxx/index.php/admin/login/index.html 修改完的路径http://xxxxxxx/admin/login/index.html 修改. ...
- layui常见弹窗使用方法
1:confim类型使用方法 layui.use('layer', function(){ layer.confirm('是否立即上传卷宗信息?', { btn: ['是','否'], t ...
- python 之模块引入
模块引入: 1.同级引入 如 ac_first.py 引入ac_second.py:只需直接 import ac_second 即可 这种情况 不论是 python ac\ac_first.py 还是 ...
- HTTP及Web核心基础
1. HTTP服务重要基础 1.1 用户访问网站基本流程 (1)客户端从浏览器输入"www.baidu.com"网站地址,回车后,系统首先会查找系统本地的DNS缓存及hosts文件 ...