《八位加法器设计实验报告.docx》由会员分享,可在线阅读,更多相关《八位加法器设计实验报告.docx(8页珍藏版)》请在第一文库网上搜索。
1、实验四:8位加法器设计实验1 .实验目的:熟悉利用quartus原理图输入方法设计简单组合电路,掌握层次化设计方法。2 .实验原理:一个八位加法器可以由八个全加器构成,加法器间的进位可以串行方式实现,即将低位加法器的进位输出COUt和相邻的高位加法器的最低进位输入信号Cin相接。3 .实验任务:完成半加器,全加器,八位加法器设计,使用例化语句,并将其设计成一个原件符号入库,做好程序设计,编译,程序仿真。1)编译成功的半加器程序:modu1eh_adder(a,b,so,co);inputa,b;outputso,co;assignso=ab;assignco=a&b;endmodu1e2)编译
2、成功的全加器程序:modu1ef_adder(ain,bin,cin,cout,sum);outputcout,sum;inputain,bin,cin;wirenet1,net2,net3;h_adderu1(ain,bin,net1,net2);h_adderu2(.a(net1),.so(sum),.b(cin),.co(net3);oru3(cout,net2,net3);endmodu1e3)编译成功的八位加法器程序:modu1ef_adder8(ain,bin,cin,cout,sum);output7:0sum;outputcout;input7:0ain,bin;inputci
3、n;wirecout0,cout1,cout2,cout3,cout4,cout5,cout6;fadderu(.ain(ain0),.bin(bin0),.cin(cin),.sum(sum0),.cout(cout0);fadderu1(.ain(ain1),.bin(bin1),.cin(cout0),.sum(sum1),.cout(cout1);fadderu2(.ain(ain2),.bin(bin2),.cin(cout1),.sum(sum2),.cout(cout2);fadderu3(.ain(ain3),.bin(bi13),.cin(cout2),.sum(sum3),
4、.cout(cout3);fadderu4(.ain(ain4),.bin(bin4),.cin(cout3),.sum(sum4),.cout(cout4);fadderu5(.ain(ain5),.bin(bin5),.cin(cout4),.sum(sum5),.cout(cout5);fadderu6(.ain(ain6),.bin(bin6),.cin(cout5),.sum(sum6),.cout(cout6);fadderu7(.ain(ain7),.bin(bin7),.cin(cout6),.sum(sum7),.cout(cout);endmodu1e4)八位加法器仿真程序
5、:modu1ef_adder8_v1g_tst();/constants/genera1purposeregisters/regeachvec;/testvectorinputregistersreg7:0ain;reg7:0bin;regcin;/wireswirecout;wire7:0sum;/assignstatements(ifany)fadder8i1(/portmap-connectionbetweenmasterportsandsigna1s/registers.ain(ain),.bin(bin),.cin(cin),.cout(cout),.sum(sum)initia1b
6、eginain=10;bin=11;cin=0;# 100ain=10;bin=10;cin=0;# 100ain=10;bin=10;cin=1;# 100ain=12;bin=18;cin=0;# 100ain=12;bin=18;cin=1;#100$stop;endendmodu1e5)八位加法器仿真图:6)元件原理图及元件入库:半加器原理图:&QuartusII32-bit-D:/yuan1itu/hadder-h_adderFi1eEditViewProjectAssignmentsProcessingToo1sWindowHe1p早口G010昌XCChadderJ圜%彩A。(5X
7、hadder.bdf国区虱Oao-nProjectNavigatorXTasksF1ow:Compi1ationCustomize.fiYTypeMessageifInfo(293000):QUarCUSIIFu11Compi1ationwassuccessfu1.0errors,8warn!inSYStemJPrOCeSSinq119)/ExtraInfoJInfO(111)/Warning(5)JCnt)Ca1WamInq(3)JYTypeMessageifInfo(293000):QUarCUSIIFu11Compi1ationwassuccessfu1.0errors,9warn!IHCritica1Waming(3)JErrOrJSUPPreSSed(6)JSyStefn八PrOCeSSing(121)AEXfraInfbJInfo(112)/1ocation:rt1全加器元件入库:八位全AJ15