当前位置:网站首页>Verilog grammar basics HDL Bits training 07
Verilog grammar basics HDL Bits training 07
2022-07-30 11:38:00 【nanyou scumbag】
文章目录
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

Design a sixteen-to-one 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

256so many options,case就不能用了,Use variable indexing to accomplish the task,Also pay attention to the bit width of variables and vectors when using them
- 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

Use the bit stitching method to make choices more flexible
- 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
边栏推荐
- MySQL之数据库维护
- 横向对比5种常用的注册中心,无论是用于面试还是技术选型,都非常有帮助
- GBJ2510-ASEMI电机专用25A整流桥GBJ2510
- 久经沙场的程序员居然也被某鱼的假程序员骗了,程序员之间的信任应该是最高的,他一个人毁了这种信任感
- The use and principle of distributed current limiting reduction RRateLimiter
- 模糊离散事件系统的可测性
- Assembly to implement bubble sort
- stm32 RTC闹钟唤醒低功耗模式
- 湖仓一体电商项目(一):项目背景和架构介绍
- Vim plugin GrepIt
猜你喜欢
随机推荐
单片机工程师笔试题目归纳汇总
How to add data to the request header when feign is called remotely
API 网关 APISIX 在Google Cloud T2A 和 T2D 的性能测试
单片机开发之LCD1602显示实验
STM32F1 reads MLX90632 non-contact infrared temperature sensor
HJY-F931A/YJ三相电压继电器
ESP32CAM 1838接收红外遥控器信号
柔性机械系统分布参数建模及其控制的研究与进展
IP池设计思考(面试点)[通俗易懂]
ADC0808/9 signal acquisition developed by single chip microcomputer
Typroa 替代工具marktext
又爆神作!阿里爆款MySQL高级宝典开源,直抵P7
横向对比5种常用的注册中心,无论是用于面试还是技术选型,都非常有帮助
contentDocument contentWindow,canvas 、svg,iframe
The battle-hardened programmer was also deceived by a fake programmer from a certain fish. The trust between programmers should be the highest, and he alone destroyed this sense of trust
零代码开发入门:快速上手DIY函数公式的5个步骤
基于滑模控制的不确定中立型系统有限时间稳定
向上管理读书笔记
汇编实现冒泡排序
Beyond Stream Processing!The 4th real-time computing Flink challenge is launched, and 490,000 prizes are waiting for you!









