4选1选通器verilog代码资料

上传人:E**** 文档编号:107070703 上传时间:2019-10-17 格式:DOC 页数:3 大小:250KB
返回 下载 相关 举报
4选1选通器verilog代码资料_第1页
第1页 / 共3页
4选1选通器verilog代码资料_第2页
第2页 / 共3页
4选1选通器verilog代码资料_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

《4选1选通器verilog代码资料》由会员分享,可在线阅读,更多相关《4选1选通器verilog代码资料(3页珍藏版)》请在金锄头文库上搜索。

1、3 实验3 3.1 实验内容题目:设计一个1位的四选一多路选择器要求:1.使用二选一多路选择器模块进行搭建 2. 出现正确的仿真波形,无需板子上验证。3.2 实验步骤1. 系统设计利用3个2选1选通器搭建4选1一位选通器。利用第二题中已编写好的2选1选通器,在新编写的4选1中实例化三个子模块实现。设计原理图如下:2. 重要源代码及注释4选1:module mux4to1(a,b,c,d,s1,s2,out);input wire a,b,c,d;input wire s1,s2;output wire out;wire out1,out2;mux2to1 f1(.a(a),.b(b),.sel

2、(s1),.out(out1);mux2to1 f2(.a(c),.b(d),.sel(s1),.out(out2);mux2to1 f3(.a(out1),.b(out2),.sel(s2),.out(out);endmodule子模块2选1:module mux2to1(a,b,sel,out );input a,b,sel;output out;wire out;assign out=sel?a:b;endmodule3.3 结果分析1 Testbench代码module test();reg a,b,c,d,s1,s2;wire out;mux4to1 U0(.a(a),.b(b),.

3、c(c),.d(d),.s1(s1),.s2(s2),.out(out);initial begin a=0;b=0;c=0;d=0;s1=0;s2=0;endalwaysfork#10 a=1; #20 a=0;#15 b=1; #10 b=0;#5 c=1; #10 c=0;#30 d=1; #20 d=0;#5 s1=0; #10 s1=1;#10 s2=1; #20 s2=0;joinendmodule2 仿真波形图3 说明S1S2对应输出:00d;01b;10c;11a;010ns: s1s2为00,out=d;1020ns: s1s2为11,out=a;2030ns: s1s2为10,out=c;后续波形也同样符合逻辑设计。

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 其它办公文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号