建立一个2-4译码器的门级模型
一、实验目的
了解2-4译码器的原理及2-4译码器的应用
二、实验过程
1、打开quartus II,打开代码页面(Verilog HDL File)将代码粘贴到页面上。
output [3:0] Z;
input A,B,Enable;
wire Abar,Bbar;
not
not0 (Abar,A),
not1 (Bbar,B);
nand
nand0(Z[3],Enable,A,B),
nand1(Z[0],Enable,Abar,Bbar),
nand2(Z[1],Enable,Abar,B),
nand3(Z[2],Enable,A,Bbar);
endmodule
module tb_22;
reg a,b,e;
wire [3:0] z;
initial
begin
a=0;b=0;e=0;
#10 a=0;b=0;e=1;
#10 a=0;b=1;
#10 a=1;b=0;
#10 a=1;b=1;
#10 a=1’bx;b=1’bx;
#10 $stop;
end
DEC2x4 my_dec2x4 (z,a,b,e);
endmodule
2、点击左上角选择save as ,新建一个文件夹(fulladd),并将代码文件命名为fulladd,保存。
3、对弹出的窗口中的内容进行操作,选择modelsim,选择芯片,保存
4、找到settings选择test bench,选择刚才的fulladd文件夹,完成后点击运行,,没有问题后运行跳转到modelsim,对参数进行调整
三、实验视频
https://v.qq.com/x/page/v3247onf58k.html
四、实验结论
了解了2-4译码器的原理及应用