当前位置:网站首页>Verilog语法基础HDL Bits训练 07
Verilog语法基础HDL Bits训练 07
2022-07-30 11:17:00 【南邮学渣】
文章目录
Circuits:Combinational Logic:Multiplexers
一、2-to-1 multiplexer

设计一个二选一多路器
- RTL代码
module top_module(
input a, b, sel,
output out );
always @(*)
case(sel)
1'b0 : out = a;
1'b1 : out = b;
endcase
endmodule
- 仿真波形图

二、2-to-1 bus multiplexer

- RTL代码
module top_module(
input [99:0] a, b,
input sel,
output [99:0] out );
always @(*)
case(sel)
1'b0 : out = a;
1'b1 : out = b;
endcase
endmodule
- 仿真波形图

三、9-to-1 multiplexer

设计一个十六选一多路器
- RTL代码
module top_module(
input [15:0] a, b, c, d, e, f, g, h, i,
input [3:0] sel,
output [15:0] out );
always @(*)
case(sel)
4'b0000 : out = a;
4'b0001 : out = b;
4'b0010 : out = c;
4'b0011 : out = d;
4'b0100 : out = e;
4'b0101 : out = f;
4'b0110 : out = g;
4'b0111 : out = h;
4'b1000 : out = i;
default : out = 16'hffff;
endcase
endmodule
- 仿真波形图

四、256-to-1 multiplexer

256个这么多的选择项,case就不能用了,使用变量索引可以完成任务,同时在使用时注意变量和向量的位宽
- RTL代码
module top_module(
input [255:0] in,
input [7:0] sel,
output out );
assign out = in[sel];
endmodule
五、256-to-1 4-bit multiplexer

使用位拼接法使选择更灵活
- RTL代码
module top_module(
input [1023:0] in,
input [7:0] sel,
output [3:0] out );
assign out = {
in[sel*4+3] , in[sel*4+2] , in[sel*4+1] , in[sel*4]};
endmodule
边栏推荐
- 【JZ64 求1+2+3+...+n】
- Introduction to IoT Technologies: Chapter 6
- Jingdong school recruited written test questions + summary of knowledge points
- 横向对比5种常用的注册中心,无论是用于面试还是技术选型,都非常有帮助
- unity3d C#语言基础(继承)
- 基于多目标两阶段随机规划方法的电热联合系统调度
- 零代码开发入门:快速上手DIY函数公式的5个步骤
- Current relay JL-8GB/11/AC220V
- 基于加权灰色关联投影的Bagging-Blending多模型融合短期电力负荷预测
- 向上管理读书笔记
猜你喜欢

RandLA-Net复现记录

async.js入门

Is it too late to apply for PMP now to take the September exam?Share agile full-true mock questions

又爆神作!阿里爆款MySQL高级宝典开源,直抵P7

【ASP.NET Core】选项类的依赖注入

Typroa alternative tool marktext

EA中的业务对象和业务实体你分得清吗?

我又造了个轮子:GrpcGateway

Beyond Stream Processing !第四届实时计算 Flink 挑战赛启动,49 万奖金等你来拿!

Telerik2022 R2,有效的自动化测试
随机推荐
TensorFlow自定义训练函数
log4j中appender的简介说明
电压继电器SRMUVS-100VAC-2H2D
深入浅出零钱兑换问题——背包问题的套壳
单片机开发之ADC0808/9信号采集
xshell使用技巧(赚分享平台怎么样)
SQL language and paging rownum analysis in Oracle
模糊离散事件系统的可测性
Oracle中SQL语言和分页rownum分析
idea的package没有空心
PanGu-Coder: 函数级的代码生成模型
ODrive应用 #4 配置参数&指令「建议收藏」
ORA-00600 [13013], [5001], [268] 问题分析及恢复
【数据库基础】redis使用总结
Explain the problem of change exchange in simple terms - the shell of the backpack problem
重写并自定义依赖的原生的Bean方法
salesforce使用方法(salesforce authenticator下载)
面试官:Redis中的布隆过滤器与布谷鸟过滤器,你了解多少?
How to add data to the request header when feign is called remotely
oracle export dmp file type as "crash dump file"