目录
1 引言 ............................................................................................................................................1
1.1 设计背景 .........................................................................................................................1 1.2 EDA的发展前景 ..........................................................................................................1 2 系统的总体框图 ......................................................................................................................2 3 系统各模块的实现 ..................................................................................................................2
3.1 jifei的实现 ....................................................................................................................2 3.2 x的实现 ........................................................................................................................3 3.3 xxx1的实现 ..................................................................................................................3 3.4 decode3_8 ......................................................................................................................4 3.5 di模块 ...........................................................................................................................4 3.6 se模块 ...........................................................................................................................5 4 系统仿真 ..................................................................................................................................5
4.1 系统的仿真结果 ...........................................................................................................5 4.2 jifei的仿真结果 ............................................................................................................6 4.3 x的仿真结果 ................................................................................................................6 4.4 se的仿真结果 ...............................................................................................................7 5 设计心得 ....................................................................................................................................8 6附源程序 .....................................................................................................................................9
1 引言
1.1 设计背景
二十世纪后半期,随着集成电路和计算机技术的飞速发展,数字系统也得到了很大的发展。其实现方法经历了由部分元件到整体元件的过程。同时,为了提高系统的可靠性与通用性,微处理器和专业集成电路(ASTC)逐渐取代了通用全硬件LSI电路,而ASIC以其体积小,重量轻,功耗低,速度快,成本低,保密性好而脱颖而出。目前,大量的可编程逻辑器件(PLD),尤其是现场可编程逻辑器件(FPLD)被大量应用在ASIC的制作中。
QUARTUSII7.2软件设计环境的灵活性和高效性为出租车计费器的设计带来了无可比拟的好处。其丰富的界面,让设计人员可以轻松的掌握和使用。
1.2 EDA的发展前景
EDA技术(即Electronic Design Automation技术)就是依赖强大的计算机,在EDA工具软件平台上,对以硬件描述语言HDL(Hardware Ddscription Langurage)为系统逻辑描述手段完成的设计文件,自动地完成逻辑编译、化简、分割、综合、布局布线以及逻辑优化和仿真测试,直至实现既定的电子线路系统功能。它在硬件实现方面融合了大规模集成电路制造技术、IC版图设计、ASIC测试和封装、FPGA(Gield Peogrammable Gate Array)/CPLD(Complex Programmable Logic Device)编程下载和自动测试等技术;在计算机辅助工程方面融合了计算机辅助设计(CAD),计算机辅助制造(CAM),计算机辅助测试(CAT),计算机辅助工程(CAE)技术以及多种计算机语言的设计概念;而在现代电子学方面则容纳了更多的内容,如电子线路设计理论、数字信号处理技术、数字系统建模和优化技术及长线技术理论等。
1
2 系统的总体框图
图1 系统总体框图
3 系统各模块的实现
3.1 jifei的实现
模块jifei见下图。输入端口js,start,pause,stop分别为出租车计费器的加速、起动、暂停、停止按键。实现计费功能,计费标准为:按行驶里程计费,起步价为7.0元,并在车行3km后按2.20元/km计费,车费超过20元时,每公里加收50%的车费,车停止不计费。
2
图2 模块jifei
3.2 x的实现
模块x见下图。该模块把车费和路程转化为4位十进制数,daclk的频率要比clk快得多。
图3 模块x
3.3 xxx1的实现
模块xxx1见下图。通过这个模块将十进制的车费转换成四位二进制的值
3
图4 模块xxx1 3.4 decode3_8
译码管片的选通信号,对se模块的输出作为输入。
图5 模块decode3_8 3.5 di模块
将四位二进制的车费值转换成数码管上显示的十进制数。
图6 di模块
4
3.6 se模块
图7 se模块
4 系统仿真
4.1 系统的仿真结果
输入:daclk,clk,js,pause,start,stop; 输出:dp,q,s.
图8 系统仿真结果
5
4.2 jifei的仿真结果
输入:clk,js,start,pause,stop;
输出:chefei,luc.
图9 jifei仿真结果
4.3 x的仿真结果
输入:ascore,bscore,daclk;
输出:age,ashi,abai,aqian,bge,bshi,bbai,bqian;
图10 x仿真结果
6
4.4 se的仿真结果
输入:clk 输出:s
图11 se的仿真结果
7
5 设计心得
这次课程设计是出租车计费器,开始拿到课题时候相当兴奋!觉得大学四年的理论课程与生活中的实际密切结合了!
首先,我查阅了相关书籍。然而,我还是遇到了很多棘手的问题,比如说,程序不理解,软件运用不熟练,再比如说,应用模块不熟悉,等等。真正领略到艰苦奋斗的真正含义,我才意识到学好基础的重要性。我想说,设计确实有些辛苦,但苦中也有乐。
但是,本次设计也存在一些不足,暴露了自己对EDA的掌握还有所欠缺。通过这次课程设计使我懂得了理论与实际相结合是很重要的,只有理论知识是远远不够的,只有把所学的理论知识与实践相结合起来,从理论中得出结论,才能真正为社会服务,从而提高自己的实际动手能力和独立思考的能力。在设计的过程中遇到问题,可以说得是困难重重,这毕竟第一次做的,难免会遇到过各种各样的问题,同时在设计的过程中发现了自己的不足之处,对以前所学过的知识理解得不够深刻,掌握得不够牢固。
通过为期两周的课程设计,本人在多方面都有所提高。同时各科相关的课程都有了全面的复习,独立思考的能力也有了提高。在这次设计过程中,体现出自己单独设计模具的能力以及综合运用知识的能力,体会了学以致用、突出自己劳动成果的喜悦心情,从中发现自己平时学习的不足和薄弱环节,从而加以弥补。
同时感谢对我帮助过的同学们,谢谢你们对我的帮助和支持,让我感受到同学的友谊。在此感谢我们的老师.,老师严谨细致、一丝不苟的作风一直是我工作、学习中的榜样;老师循循善诱的教导和不拘一格的思路给予我无尽的启迪;这次设计的每个细节和每个数据,都离不开老师您的细心指导。而您开朗的个性和宽容的态度,帮助我能够很顺利的完成了这次课程设计。
8
6附源程序
******************se模块程序************************************ library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity se is port(clk:in std_logic;
a:out std_logic_vector(2 downto 0)); end se; architecture rt1 of se is begin
proce(clk)
variable b:std_logic_vector(2 downto 0);
begin
if(clk\'event and clk=\'1\')then
if(b=\"111\")then
b:=\"000\";
else
b:=b+1;
end if;
end if;
a
end proce; end rt1;
9
************************jifei模块程序************************ library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity jifei is
port(clk,start,stop,pause,js:in std_logic;
chefei,luc:out integer range 0 to 8000); end jifei; architecture rt1 of jifei is begin
proce(clk,start,stop,pause,js)
variable a,b:std_logic;
variable aa:integer range 0 to 100;
variable chf,lc:integer range 0 to 8000;
variable num:integer range 0 to 9;
begin
if(clk\'event and clk=\'1\')then
if(stop=\'0\')then
chf:=0;
num:=0;
b:=\'1\';
aa:=0;
lc:=0;
elsif(start=\'0\')then
b:=\'0\';
chf:=700;
%起始车费为7.00元
lc:=0;
elsif(start=\'1\'and js=\'1\'and pause=\'1\')then
10
if(b=\'0\')then
num:=num+1;
end if;
if(num=9)then
lc:=lc+5;
num:=0;
aa:=aa+5;
end if;
elsif(start=\'1\'and js=\'0\'and pause=\'1\')then
lc:=lc+1;
aa:=aa+5;
end if;
if(aa>=100)then
a:=\'1\';
aa:=0;
else
a:=\'0\';
end if;
if(lc
null;
%路程小于3km时
elsif(chf
chf:=chf+220;
%车费少于20元是按2.20元/Km计费
elsif(chf>=2000 and a=\'1\')then
chf:=chf+330;
%车费超过20元是按3.30元/Km计费
end if;
end if; chefei
luc
end rt1;
11
***************************x模块程序****************************** library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity x is
port(daclk:in std_logic;
ascore,bscore:in integer range 0 to 8000;
age,ashi,abai,aqian,bge,bshi,bbai,bqian:out std_logic_vector(3 downto 0)); end x; architecture rt1 of x is begin
proce(daclk,ascore)
variable comb1:integer range 0 to 8000;
variable comb1a,comb1b,comb1c,comb1d:std_logic_vector(3 downto 0);
begin
if(daclk\'event and daclk=\'1\')then
if(comb1
if(comb1a=9 and comb1b=9 and comb1c=9)then
comb1a:=\"0000\";
comb1b:=\"0000\";
comb1c:=\"0000\";
comb1d:=comb1d+1;
comb1:=comb1+1;
elsif(comb1a=9 and comb1b=9)then
comb1a:=\"0000\";
comb1b:=\"0000\";
comb1:=comb1+1;
comb1c:=comb1c+1;
12
elsif(comb1a=9)then
comb1a:=\"0000\";
comb1b:=comb1b+1;
comb1:=comb1+1;
else
comb1a:=comb1a+1;
comb1:=comb1+1;
end if;
else
ashi
age
abai
aqian
comb1:=0;
comb1a:=\"0000\";
comb1b:=\"0000\";
comb1c:=\"0000\";
comb1d:=\"0000\";
end if;
end if;
end proce;
proce(daclk,bscore)
variable comb2:integer range 0 to 8000;
variable comb2a,comb2b,comb2c,comb2d:std_logic_vector(3 downto 0);
begin
if(daclk\'event and daclk=\'1\')then
if(comb2
if(comb2a=9 and comb2b=9 and comb2c=9)then
13
comb2a:=\"0000\";
comb2b:=\"0000\";
comb2c:=\"0000\";
comb2d:=comb2d+1;
comb2:=comb2+1;
elsif(comb2a=9 and comb2b=9)then
comb2a:=\"0000\";
comb2b:=\"0000\";
comb2:=comb2+1;
comb2c:=comb2c+1;
elsif(comb2a=9)then
comb2a:=\"0000\";
comb2b:=comb2b+1;
comb2:=comb2+1;
else
comb2a:=comb2a+1;
comb2:=comb2+1;
end if;
else
bshi
bge
bbai
bqian
comb2:=0;
comb2a:=\"0000\";
comb2b:=\"0000\";
comb2c:=\"0000\";
comb2d:=\"0000\";
14
end if;
end if;
end proce; end rt1; ********************xxx1模块程序******************************* library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity xxx1 is port(c:in std_logic_vector(2 downto 0);
dp:out std_logic;
a1,a2,a3,a4,b1,b2,b3,b4:in std_logic_vector(3 downto 0);
d:out std_logic_vector(3 downto 0)); end xxx1; architecture rt1 of xxx1 is begin
proce(c,a1,a2,a3,a4,b1,b2,b3,b4)
variable comb:std_logic_vector(2 downto 0);
begin
comb:=c;
case comb is
when\"000\"=>d
dp
when\"001\"=>d
dp
when\"010\"=>d
dp
when\"011\"=>d
15
dp
when\"100\"=>d
dp
when\"101\"=>d
dp
when\"110\"=>d
dp
when\"111\"=>d
dp
when others=>null;
end case;
end proce; end rt1; ******************di模块程序******************************* library ieee; use ieee.std_logic_1164.all; entity di is
port(d:in std_logic_vector(3 downto 0);
q:out std_logic_vector(6 downto 0)); end di; architecture rt1 of di is begin
proce(d)
begin
case d is
when\"0000\"=>q
when\"0001\"=>q
when\"0010\"=>q
16
when\"0011\"=>q
when\"0100\"=>q
when\"0101\"=>q
when\"0110\"=>q
when\"0111\"=>q
when\"1000\"=>q
when others=>q
end case;
end proce; end rt1;