EDA多路选择器设计实验报告.docx
《EDA多路选择器设计实验报告.docx》由会员分享,可在线阅读,更多相关《EDA多路选择器设计实验报告.docx(11页珍藏版)》请在冰豆网上搜索。
EDA多路选择器设计实验报告
EDA多路选择器设计实验报告
多路选择器设计实验
一、实验目的:
进一步熟悉QuartusII的Verilog文本设计流程,组合电路的设计仿真和硬件测
试。
二、实验内容:
1、根据4.1节流程,利用QuartusII完成4选1多路选择器的文本代码编辑输
入和仿真测试等步骤,给出仿真波形。
2、在实验系统上硬件测试,验证此设计的功能。
三、实验程序:
QuartusII程序:
modulemux41a(a,b,c,d,s0,s1,y);
inputa,b,c,d;
inputs0,s1;
outputy;
regy;
always@(a,b,c,d,s0,s1)
begin:
mux41
case({s0,s1})
2'b00:
y<=a;
2'b01:
y<=b;
2'b10:
y<=c;
2'b11:
y<=d;
default:
y<=a;
endcase
end
endmodule
modelsim程序:
//Copyright(C)1991-2012AlteraCorporation
//YouruseofAlteraCorporation'sdesigntools,logicfunctions//andothersoftwareandtools,anditsAMPPpartnerlogic//functions,andanyoutputfilesfromanyoftheforegoing//(includingdeviceprogrammingorsimulationfiles),andany//associateddocumentationorinformationareexpresslysubject//tothetermsandconditionsoftheAlteraProgramLicense//SubscriptionAgreement,AlteraMegaCoreFunctionLicense//Agreement,orotherapplicablelicenseagreement,including,//withoutlimitation,thatyouruseisforthesolepurposeof//programminglogicdevicesmanufacturedbyAlteraandsoldby
//Alteraoritsauthorizeddistributors.Pleaserefertothe//applicableagreementforfurtherdetails.
//
*****************************************************************************
//ThisfilecontainsaVerilogtestbenchtemplatethatisfreelyeditableto
//suituser'sneeds.Commentsareprovidedineachsectiontohelptheuser
//filloutnecessarydetails.
//
*****************************************************************************
//Generatedon"10/11/201521:
31:
33"
//VerilogTestBenchtemplatefordesign:
mux41a
//
//Simulationtool:
ModelSim-Altera(Verilog)
//
`timescale1us/1ps
modulemux41a_vlg_tst();
//constants//generalpurposeregisters
//regeachvec;
//testvectorinputregisters
rega;
regb;
regc;
regd;
regs0;
regs1;
//wireswirey;
//assignstatements(ifany)mux41ai1(
//portmap-connectionbetweenmasterportsandsignals/registers
.a(a),
.b(b),
.c(c),
.d(d),
.s0(s0),
.s1(s1),
.y(y)
);
initial
begin
a=0;b=0;
c=0;d=0;
s0=0;s1=0;
#20s0=0;s1=1;
#20s0=1;s1=0;
#20s0=1;s1=1;
#20$stop;
end
always#2a=~a;
always#4b=~b;
always#6c=~c;
always#8d=~d;
endmodule
四、实验步骤:
1、打开QuartusII,点击“file”中的“NewProjectWizard”,新建工程到指定文
件夹中
2、点击“New”新建工作簿,写入程序
3、点击“compiledesign”进行编译
方法一:
联合仿真
1、点击“processing”中的“start”
2、点击“file”中的“open”,找到“modelsim”,查找“.vt”文件
3、打开“mux41a”文件
4、修改文件中的程序
5、打开“Assignments”,点击“setting”,修改时间
6、点击“testbenches”后再点击“New”添加“mux41a”文件
7、再进行编译
8、点击“Tools”,打开“RunSimulationTool”,再选择“RTLSimulation”
方法二:
modelsim单独仿真
1、在modelsim中新建“sim”文件
2、打开“modelsim”,创建工程
3、点击“createnewfile”,新建两个工作簿
4、分别添加相应程序进去,进行编译
5、选择library,点击work,之后再右击add?
towave?
selectedsignals,最后选
择simulate点击run?
runall