Chisel3 - Tutorial - ByteSelector
https://mp.weixin.qq.com/s/RQg2ca1rwfVHx_QG-IOV-w
import chisel3._
class ByteSelector extends Module {
val io = IO(new Bundle {
val in = Input(UInt(32.W))
val offset = Input(UInt(2.W))
val out = Output(UInt(8.W))
})
io.out := 0.U(8.W)
when (io.offset === 0.U(2.W)) {
io.out := io.in(7, 0)
}.elsewhen(io.offset === 1.U) {
io.out := io.in(15, 8)
}.elsewhen(io.offset === 2.U) {
io.out := io.in(23, 16)
}.otherwise {
io.out := io.in(31, 24)
}
}
object ByteSelectorMain {
def main(args: Array[String]): Unit = {
chisel3.Driver.execute(Array("--target-dir", "generated/ByteSelector"), () => new ByteSelector)
}
}
Chisel3 - Tutorial - ByteSelector的更多相关文章
- Chisel3 - Tutorial - VendingMachine
https://mp.weixin.qq.com/s/tDpUe9yhwC-2c1VqisFzMw 演示如何使用状态机. 参考链接: https://github.com/ucb-bar/ch ...
- Chisel3 - Tutorial - VendingMachineSwitch
https://mp.weixin.qq.com/s/5lcMkenM2zTy-pYOXfRjyA 演示如何使用switch/is来实现状态机. 参考链接: https://github.co ...
- Chisel3 - Tutorial - Tbl
https://mp.weixin.qq.com/s/e8vJ8claauBtiuedxYYaJw 实现可以动态索引的表. 参考链接: https://github.com/ucb-bar/c ...
- Chisel3 - Tutorial - Stack
https://mp.weixin.qq.com/s/-AVJD1IfvNIJhmZM40DemA 实现后入先出(last in, first out)的栈. 参考链接: https://gi ...
- Chisel3 - Tutorial - Functionality
https://mp.weixin.qq.com/s/3hDzpJiANdwp07hO03psyA 演示使用函数进行代码复用的方法. 参考链接: https://github.com/ucb- ...
- Chisel3 - Tutorial - Parity
https://mp.weixin.qq.com/s/OtiQnE52PwdCpvmzJ6VFnA 奇偶发生器.统计输入中1的个数,如果为偶数则输出0,奇数则输出1. 参考链接: https: ...
- Chisel3 - Tutorial - ShiftRegister
https://mp.weixin.qq.com/s/LKiXUgSnt3DzgFLa9zLCmQ 简单的寄存器在时钟的驱动下,逐个往下传值. 参考链接: https://github.com ...
- Chisel3 - Tutorial - Adder
https://mp.weixin.qq.com/s/SEcVjGRL1YloGlEPSoHr3A 位数为参数的加法器.通过FullAdder级联实现. 参考链接: https://githu ...
- Chisel3 - Tutorial - Adder4
https://mp.weixin.qq.com/s/X5EStKor2DU0-vS_wIO-fg 四位加法器.通过FullAdder级联实现. 参考链接: https://github.co ...
随机推荐
- Spring Cloud学习 之 Spring Cloud Ribbon(负载均衡器源码分析)
文章目录 AbstractLoadBalancer: BaseLoadBalancer: DynamicServerListLoadBalancer: ServerList: ServerListUp ...
- Day_13【IO流】扩展案例2_统计指定项目文件中字符出现的次数
需求分析 统计当前项目下info2.txt文件中, 每个字符出现的个数 文件内容如下: welcome to itheima!!! 最终效果如下: w(1) (2)!(3)t(2)e(3)c(1)a( ...
- STM32 TIM1高级定时器配置快速入门
layout: post tags: [STM32] comments: true 文章目录 layout: post tags: [STM32] comments: true 重点内容 时基单元 计 ...
- 使用IR2104S搭建的H桥-机器人队比赛经典版(原作者答疑)
原理图地址:http://bbs.ednchina.com/BLOG_ARTICLE_3020313.HTM?click_from=8800020962,4950449047,2014-05-01,E ...
- [hdu4627 The Unsolvable Problem]数论
题意:给一个数n,找一个正整数x<n,使得x和n-x的最小公倍数最大. 思路:显然x和n-x越接近越好,gcd必须为1(贪心).从大到小考虑x,如果n为奇数,则答案就是x=n/2,如果n为偶数, ...
- csu1617]强连通分量
题意:定义域属于一个集合S={0,1,...,n-1},求S的子集个数,满足以子集的元素为定义域的函数P(x)的值域等于子集本身. 思路:以元素为点,x到P(x)连一条有向边,不难发现,如果有一个有向 ...
- Apache Poi实现excel解析
一.说明 1.本文通过使用 poi 工具解析 excel 表格数据,实现导入导出 2.excel目前有两种格式 2003版本的 excel.xls 与 2007版本的 excel.xlsx ,注意两种 ...
- python-经典类和新式类区别
经典类和新式类区别 Eg: class A(object): def x(self): print('A')class B(A): def x(self): p ...
- webpack指南(五)TypeScript
将webpack与TS进行集成. 1. 安装TypeScript 编译器和 loader npm install --save-dev typescript ts-loader 2. 在package ...
- 【PHP+MySQL学习笔记】php操作MySQL数据库中语句
1.连接 MYSQL 服务器的函数 mysql_connect();<?php $con = mysql_connect("localhost","root&quo ...