Verilog (二) multiplexer and decoder
1 mutiplexer 数据选择器
1) one-bit wide 2-1 mux
wire dout = sel? din1 : din0; // conditional continuous and wire assignment
2) 4-1 mux
module mux4_1(sel, din0, din1, din2, din3, dout);
input [:] sel;
input din0, din1, din2, din3;
output dout;
reg dout; always @ (sel or din0 or din1 or din2 or din3)
begin
case(sel)
'b00: dout = din0;
'b01: dout = din1;
'b10: dout = din2;
'b11: dout = din3;
default: dout = din0;
endcase
end endmodule
3) two-bit wide 8-1 mux (case statement)
| sel | din7 | din6 | din5 | din4 | din3 | din2 | din1 | din0 | dout |
| 000 | XX | XX | XX | XX | XX | XX | XX | DD | din0 |
| 001 | XX | XX | XX | XX | XX | XX | DD | XX | din1 |
| 010 | XX | XX | XX | XX | XX | DD | XX | XX | din2 |
| 011 | XX | XX | XX | XX | DD | XX | XX | XX | din3 |
| 100 | XX | XX | XX | DD | XX | XX | XX | XX | din4 |
| 101 | XX | XX | DD | XX | XX | XX | XX | XX | din5 |
| 110 | XX | DD | XX | XX | XX | XX | XX | XX | din6 |
| 111 | DD | XX | XX | XX | XX | XX | XX | XX | din7 |
2 decoder 解码器/译码器
n 个输入 => 2n 个输出
1) 3-8 binary decoder
module decoder3_8(A, Y);
input [:] A;
output [:] Y;
reg [:] Y; always @ (A)
case (A)
: Y = 'b00000001;
: Y = 'b00000010;
: Y = 'b00000100;
: Y = 'b00001000;
: Y = 'b00010000;
: Y = 'b00100000;
: Y = 'b01000000;
: Y = 'b10000000;
default: Y = 'b0;
endcase endmodule
decoder3_8
2) 3-6 binary decoder with enable
module decoder3_6(A, EN, Y);
input EN;
input [:] A;
output [:] Y;
reg [:] Y; always @ (EN or A)
case ({EN, A})
'b1000: Y = 6'b000001;
'b1001: Y = 6'b000010;
'b1010: Y = 6'b000100;
'b1011: Y = 6'b001000;
'b1100: Y = 6'b010001;
'b1101: Y = 6'b100000;
default: Y = 'b0;
endcase endmodule
decoder3_6_en
Verilog (二) multiplexer and decoder的更多相关文章
- ARM中的总线
ARM中的总线用于不同部件之间的通信.有两种不同类型的设备连接到总线:ARM处理器,它是总线的主设备,拥有对总线的仲裁权,可以通过同一总线主动发起数据传输请求:外围器件,是总线的从设备,在总线上是被动 ...
- 【Netty】(9)---Netty编解码器
Netty编解码器 在了解Netty编解码之前,先了解Java的编解码: 编码(Encode)称为序列化, 它将对象序列化为字节数组,用于网络传输.数据持久化或者其它用途. 解码(Decode)称为反 ...
- NodeJS学习笔记 (29)二进制解码-string_decoder(ok)
原文:https://github.com/chyingp/nodejs-learning-guide 自己过一遍: 模块简介 string_decoder模块用于将Buffer转成对应的字符串.使用 ...
- System Verilog基础(二)
这一篇笔记主要记录Procedural,Process,Task and function,Interface和Communication中值得注意的点. 1.Procedural 写testbenc ...
- Verilog MIPS32 CPU(二)-- Regfiles
Verilog MIPS32 CPU(一)-- PC寄存器 Verilog MIPS32 CPU(二)-- Regfiles Verilog MIPS32 CPU(三)-- ALU Verilog M ...
- 【第一季】CH05_FPGA设计Verilog基础(二)Enter a post title
[第一季]CH05_FPGA设计Verilog基础(二) 5.1状态机设计 状态机是许多数字系统的核心部件,是一类重要的时序逻辑电路.通常包括三个部分:一是下一个状态的逻辑电路,二是存储状态机当前状态 ...
- 在SublimeText3中搭建Verilog开发环境记录(二)
接上文 SublimeText3中搭建Verilog开发环境记录(一) 在实现了基础功能后,继续添加插件,让功能更为完善: 快速创建代码模块(snippet) Ctrl+鼠标左键实现模块跳转 通过iV ...
- CRC校验原理和verilog实现方法(二)
1 前言 在 前面的博客 CRC校验原理和verilog实现方法(一) 中,介绍了CRC校验的原理和手动计算过程.本文说一下我在学习CRC校验FPGA实现的一点心得体会. 2 线性反馈移位寄存器 ...
- Verilog学习笔记简单功能实现(二)...............全加器
先以一位全加器为例:Xi.Yi代表两个加数,Cin是地位进位信号,Cout是向高位的进位信号.列表有: Xi Yi Cin Sum Cout 0 0 0 0 0 0 0 1 1 0 ...
随机推荐
- 如何安装nodejs
1.进入官网https://nodejs.org/en/download/ 2.安装过程基本直接“NEXT”就可以了.(windows的安装msi文件在过程中会直接添加path的系统变量,变量值是你的 ...
- java多线程(一)——线程安全的单例模式
概念: java中单例模式是一种常见的设计模式,单例模式分三种:懒汉式单例.饿汉式单例.登记式单例三种. 单例模式有一下特点: 1.单例类只能有一个实例. 2.单例类必须自己创建自己的唯一实例. 3. ...
- T-SQL的回车和换行符(SQL)
T-SQL的回车和换行符(SQL) sql server中的回车换行字符是 char(13)+char(10) 回车:char(13) 换行:char(10) 实例1: DECLARE @c NVA ...
- mariadb connector bug
为了解决http://www.cnblogs.com/zhjh256/p/5807086.html的问题测试mariadb connector,常规的增删改查没有问题. 这货本来是为了解决存储过程bu ...
- Vue方法与事件
gitHub地址:https://github.com/lily1010/vue_learn/tree/master/lesson10 一 vue方法实现 <!DOCTYPE html> ...
- 浅析对象访问属性的"."和"[]"方法区别
在JavaScript中通常使用”."运算符来存取对象的属性的值.或者使用[]作为一个关联数组来存取对象的属性.但是这两种方式有什么区别了? 例如,读取object中的property属性值 ...
- Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
改下build.gradle文件,将里面的compileSdkVersion改为23即可 apply plugin: 'com.android.application' android { compi ...
- Sharepoint学习笔记—习题系列--70-573习题解析 -(Q97-Q99)
04 }Which code segment should you add at line 03?A. currentItem["ClassificationMetadata"] ...
- Android根据APP包名启动应用
public void openApp(String packageName, Context context) { PackageManager packageManager = context.g ...
- iOS开发工程师面试知识点汇总
1.KVO实现原理 2.内存管理 3.Runtime 4.GCD 5.Block 6.响应者链 7.@peoperty属性特性 8.单元格cell加载图片处理