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 Cloud 学习 之 Spring Cloud Eureka(源码分析)
Spring Cloud 学习 之 Spring Cloud Eureka(源码分析) Spring Boot版本:2.1.4.RELEASE Spring Cloud版本:Greenwich.SR1 ...
- Android广播时间——实现强制下线功能
目录 思路:强制下线功能需要先关闭掉所有的活动,然后回到登录界面. 步骤 1.关闭所有活动 2.创建BaseActivity类作为所有活动的父类,因为需要用ActivityCollector管理所有活 ...
- python --函数学习之全局变量和局部变量
定义在函数内部的变量拥有一个局部作用域,定义在函数外的拥有全局作用域. 局部变量只能在其被声明的函数内部访问,而全局变量可以在整个程序内访问. 在调用函数的时候,所有在函数内声明的变量名称都被加到作用 ...
- python --整理数据结构(列表)
该整理来源于:https://www.runoob.com/python3/python3-data-structure.html 列表 python中列表是可变的,这是它区别于字符串和元组的最重要的 ...
- c++离散化处理大范围和重复数据
关于离散化 有些新手可能会问:离散化是什么?离散化就是将无限空间中有限的个体映射到有限的空间里去. 上面的定义肯定会有人看不懂(其实我刚开始学的时候也看不懂) 用我自己的话来说,就是在不改变数据的相对 ...
- Error: ER_BAD_FIELD_ERROR: Unknown column 'xxx' in 'where clause'
node中调用mysql模块读写时候,如果直接插入字符串: connection.query('SELECT * from users WHERE name=' + data.name , call ...
- MySQL zip解压 安装过程和配置
MYSQL官网下载地址:https://dev.mysql.com/downloads/mysql/ 1.下载mysql-5.7.19-winx64.zip,解压到指定的文件夹, 例如:E:\so ...
- Unity Singleton 单例类(Unity3D开发)
一.添加单例模板类 using UnityEngine; public class Singleton<T> : MonoBehaviour where T : MonoBehaviour ...
- POJ1321棋盘问题(DFS)
Description 在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别.要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子 ...
- jQuery中效果animate方法解决width是百分比出现的问题
jQuery中效果animate方法解决width是百分比出现的问题 http://www.mafutian.net/131.html 问题描述: 效果如图,初始化,每个层宽20%,采用animate ...