《EDA技术(机械)实验报告--出租车计费器.docx》由会员分享,可在线阅读,更多相关《EDA技术(机械)实验报告--出租车计费器.docx(8页珍藏版)》请在第壹文秘上搜索。
1、实验报告(计算机类)开课学院及实验室:机械学院工程实验中心实验时间:学生姓名学号成绩学生所在学院年级/专业/班课程名称EDA技术(机械)课程代码实验项目名称出租车计费器项目代码十一指导教师项目学分一、实验目的(I)学习并掌握QUartUSII开发系统的基本操作。(2)掌握用QUartUSII进行文本输入法进行电路设计、编译和仿真方法。(3)掌握CPLD/FPGA的开发流程。(4)掌握EDA实验开发系统的使用。(5)设计一个出租车计费器。二、内容与设计思想设计任务如下:(1)实现计费功能,计费标准为:暗行驶里程计费,起步价为7.OO元,并在车行3km后暗2.20元/加计费,当计费器达到或超过20
2、元时,每千米加收50%的车费,车停止不计费。(2)现场模拟功能:能模拟汽车启动、停止、暂停以及加速等状态。(3)设计动态扫描电路,将车费和路程显示出来,各有两位小数。三、使用环境Pc计算机,quartusII软件环境四、核心代码及调试过程出租车计费器jfe模块Iibraryieee;useieee.std_Iogic_1164.aII;useieee.std_Iogic_unsigned.all;entityjifeiisport(elk,start,stop,pause,js:instd_logic;q:outstd_Iogic_vector(3downto0);chefei,luc:out
3、integerrange0to8000);endjifei;architecturearc_jifeiofjifeibegInprocess(cIkstart,stop,pause,js)variabIea,b:std_logic;variabIeaa:integerrange0to100;variabIechf,Ic:integerrange0to8000;variabIenum:integerrange0to9;beginifcIk,eventandcIk=,1,thenif(stop=0)thenchf:=0;num:=0;b:=1;aa:=0;Ic:=0;eIsif(start=10)
4、thenb:=0;chf:=700;Ic:=0;eIsif(start=11,andjs=11andpause=1)thenif(b=101)thennum:=num+1;endif;if(num=9)thenlc:=lc+5;num:=0;aa:=aa+5;endif;eIsif(start=11,andjs=0,andpause=1)thenlc:=lc+1;aa:-aa+1;endif;if(aa=100)thena=,;aa:=0;eIsea:=0;endif;if(Ic300)thennull;elsif(chf=2000anda=)thenchf:=chf+330;endif;en
5、dif;chefei=chf;Iuc=lc;endprocess;endarc_jifei;X模块,将车费和路程转化成4位十进制Iibraryieee;useieee.std_Iogic_1164.aII;useieee.std_Iogic_unsigned.all;entityxisport(dacIk:instd_logic;ascore,bscore:inintegerrange0to8000;age,ashi,abai.aqian.bge,bshi,bbai,bqian:outstd_Iogic_vector(3downto0);endx;architecturearc_xofxisb
6、eginp1:process(dacIk,ascore)variabIecomb1:integerrange0to8000;variabIecomb1a,comb1b,comb1cfcomb1d:std_Iogic_vector(3downto0);beginifdacIk,eventanddacIk=1thenifcomb1ascorethenifcomb1a=9andcomb1b=9andcomb1c=9thencomb1a:=0000;comb1b:=0000;ComblC:=”0000”;comb1d:-comb1d+1;comb1:=comb1+1;eIsifcomb1a=9andc
7、omb1b=9thencomb1a:=0000;comb1b:=0000;comb1:-comb1+1;comb1c:=comb1c+1;eIsifcomb1a=9thencomb1a:=0000;comb1b:=comb1b+1;comb1:-comb1+1;eIseCOmbIa:=COmbIa+1;comb1:-comb1+1;endif;seashi=comb1b;age=comb1a;abai=comb1c;aqian=comb1d;comb1:=0;COmbla:=OOo0;COmbIb:=OOO0;comb1c:=0000,;comb1d=0000n;endif;endif;end
8、processp1;p2:process(dacIk,bscore)variabIecomb2:integerrange0to8000;variabIecomb2a,comb2b,comb2c,comb2d:std_Iogic_vector(3downto0);beginifdaclk,eventanddacIk=1,thenifcomb2bscorethenifcomb2a=9andcomb2b=9andcomb2c=9thencomb2a:=0000n;comb2bOOOOn;comb2c:=0000;comb2d:=comb2d+1;comb2:=comb2+1;eIsifcomb2a=
9、9andcomb2b-9thencomb2a:=0000;comb2b:=”0000”;comb2:-comb2+1;comb2c:-comb2c+1;eIsifcomb2a=9thencomb2a:=”0000”;comb2b:=comb2b+1;comb2:=comb2+1;eIsecomb2a:=comb2a+1;comb2:=comb2+1;endif;bshi=comb2b;bge-comb2a;bbai-comb2c;bqiand=a1;a13.0 d(3.0 a23.0 a33. .01J - a43.0 b13.0l b2(3 0淅 W(3.01 b43.0; Z; st -d
10、pd=a2;dpd=a3;dpd=a4;dpd=b1;dpd=b2;dpd=b3;dpd=b4;dpnuII;endcase;endprocess;endarc_xxx1;SE模块Iibraryieee;useieee.std_Iogic_1164.aII;useieee.std_Iogic_unsigned.all;entityseisport(elk:instd_logic;a:outstd_Iogic_vector(2downtoO);endse;architecturearc_seofseisbeginprocess(cIk)variabIeb:std_Iogic_vector(2downtoO);beginifcIk,eventandcIk=1,thenifb=1,11,thenb:=000;b:=b+1;endif;endif;aq,011111,when000,=qqqq1100110when-010,=q110110,when0110,=qqq111111,whenothers=q=110111,endcase;2.081PO435W03POJW01bH3.0)文3.0网3.0网3.OJ五、总结