EDA课程设计秒表设计Word格式.docx
- 文档编号:4710582
- 上传时间:2023-05-03
- 格式:DOCX
- 页数:17
- 大小:843.09KB
EDA课程设计秒表设计Word格式.docx
《EDA课程设计秒表设计Word格式.docx》由会员分享,可在线阅读,更多相关《EDA课程设计秒表设计Word格式.docx(17页珍藏版)》请在冰点文库上搜索。
entityctrlis
port(clr,clk,sp:
instd_logic;
en:
outstd_logic);
endctrl;
architecturebehaveofctrlis
typestatesis(s0,s1,s2,s3);
signalcurrent_state,next_state:
states;
begin
com:
process(sp,current_state)
casecurrent_stateis
whens0=>
en<
='
0'
;
ifsp='
1'
thennext_state<
=s1;
elsenext_state<
=s0;
endif;
whens1=>
=s2;
whens2=>
=s3;
whens3=>
endcase;
endprocess;
synch:
process(clk)
ifclr='
then
current_state<
elsifclk'
eventandclk='
then
=next_state;
endif;
endprocess;
endbehave;
2、时基分频模块程序
entitycb10is
port(clk:
instd_logic;
co:
bufferstd_logic);
endcb10;
architectureartofcb10is
signalcounter:
integerrange0to49999;
begin
process(clk)
if(clk='
andclk'
event)then
ifcounter=49999then
counter<
=0;
co<
=notco;
else
=counter+1;
endart;
3、计时模块的程序
1)、十进制计数器
entitycdu10is
port(clk,clr,en:
cn:
outstd_logic;
count10:
outstd_logic_vector(3downto0));
endcdu10;
architectureartofcdu10is
signaltemp:
std_logic_vector(3downto0);
process(clk,clr)
temp<
="
0000"
cn<
elsif(clk'
)then
ifen='
iftemp>
1001"
temp<
cn<
else
temp<
=temp+1;
cn<
endif;
count10<
=temp;
2)、六进制计数器
entitycdu6is
count6:
endcdu6;
architectureartofcdu6is
begin
ifclr='
elsif(clk'
ifen='
iftemp="
0110"
endif;
count6<
3)计时器程序
entitycountis
clr:
S_10ms:
outstd_logic_vector(3downto0);
S_100ms:
S_1s:
S_10s:
M_1min:
M_10min:
outstd_logic_vector(3downto0));
endcount;
architectureartofcountis
componentcdu10
endcomponentcdu10;
componentcdu6
endcomponentcdu6;
signalA,B,C,D,E,F:
std_logic;
U1:
cdu10portmap(clk,clr,en,A,S_10ms);
U2:
cdu10portmap(A,clr,en,B,S_100ms);
U3:
cdu10portmap(B,clr,en,C,S_1s);
U4:
cdu6portmap(C,clr,en,D,S_10s);
U5:
cdu10portmap(D,clr,en,E,M_1min);
U6:
cdu10portmap(E,clr,en,F,M_10min);
4、显示模块程序
1)七段译码驱动器程序
useieee.std_logic_unsigned;
entitybcd7is
port(bcd:
instd_logic_vector(3downto0);
led:
outstd_logic_vector(6downto0));
endbcd7;
architectureartofbcd7is
begin
led<
="
0111111"
whenbcd="
else
"
0000110"
0001"
1011011"
0010"
1001111"
0011"
1100110"
0100"
1101101"
0101"
1111101"
"
0000111"
0111"
1111111"
1000"
1101111"
0000000"
2)数据选择器程序
useieee.std_logic_UNSIGNED.all;
entitymulxis
outbcd:
seg:
outstd_logic_vector(2downto0));
endmulx;
architectureartofmulxis
signalcount:
std_logic_vector(2downto0);
if(clr='
)then
count<
111"
elsif(clk='
andclk'
ifcount="
101"
count<
000"
elsecount<
=count+1;
ifclk'
then
casecountis
when"
=>
outbcd<
=S_10ms;
seg<
001"
=S_100ms;
010"
=S_1s;
011"
=S_10s;
100"
=M_1min;
=M_10min;
whenothers=>
null;
5、顶层设计源程序
entitystopwatchis
port(sp:
instd_logic;
clk:
led:
outstd_logic_vector(6downto0);
endstopwatch;
architectureartofstopwatchis
componentctrl
port(clr:
sp:
outstd_logic);
endcomponent;
componentcb10
componentcount
port(clk:
componentbcd7
componentmulx
port(clr:
signalc,e:
signalms10_s,ms100_s:
signals1_s,s10_s:
signalmin1_s,min10_s:
signalbcd_s,s:
u0:
ctrlportmap(clr,clk,sp,e);
u1:
cb10portmap(clk,c);
u2:
countportmap(c,clr,e,ms10_s,ms100_s,s1_s,s10_s,min1_s,min10_s);
u3:
mulxportmap(clr,clk,e,ms10_s,ms100_s,s1_s,s10_s,min1_s,min10_s,bcd_s,seg);
u4:
bcd7portmap(bcd_s,led);
四、设计解决的关键问题
本次设计的关键性问题是分频和顶层文件的设计,在分频代码段中可以看出我们本次采用的主频率是5MHZ。
1/100秒的频率为100HZ所以只需要用5MHZ乘以1/50000即可得到100HZ的分频信号,即1/100秒。
数码管显示部分的关键就是弄清楚每个数字对应的二进制代码,刚开始我们用画原理图的方法进行顶层文件设计,完成了实验,而后又尝试用VHDL语言进行程序设计,虽然程序复杂而且老出编译错误,期间反复看书,和上网查找资料,经过几天的修改终于将此顶层程序的设计工作完成。
五:
设计分工说明
1,主程序设计,编写实验报告——易新会
2,程序修改,用VHDL语言顶层文件设计——陈虹余
3,上机硬件调试,用原理图的方法设计顶层文件——王伟
4,收集相关资料、拍照——迪拉热
仿真结果与分析
测试数据选择
测试数据选择为00:
00:
00——03:
56:
38
波形分析
三:
问题说明
数码管的显示由sel片选信号来控制。
硬件调试功能正常。
总结
开始VHDL语言不是很熟练,做设计时总是会犯一些错误且花费的时间比较多,例如在做顶层文件设计的时候总是会出现一些编译错误,其中有些错误是因为一个字母没写对而导致,相比较来说在此次设计中用原理图做顶层设计似乎更容易,当然这主要是我们做的这个小设计不是一个大型的系统,当系统复杂时用VHDL语言更省事,在编程时,我们使用了自顶向下的设计思想,这样程序检查起来也比较方便,也便于小组分工,做EDA设计考验我们的耐心、毅力和细心,而对错误的检查要求我们要有足够的耐心,通过这次实战,我们对VHDL语言了解的更深了,也积累了一定的解决问题的经验,对以后从事集成电路设计工作会有一定的帮助。
在设计工作中,分工很重要,即使你一个人能够把整个程序写出来,但与分工良好的组相比较,分工不好的组效率更低
在应用VHDL的过程中我们领会到了其并行运行与其他软件顺序执行的差别及其在电路设计上的优越性。
用VHDL硬件描述语言的形式来进行数字系统的设计方便灵活,利用EDA软件进行编译优化仿真极大地减少了电路设计时间和可能发生的错误,降低了开发成本,这门技术应用很广泛,纵然这份报告的上交意味着我们可以结课了,但对这方面的学习不会止步......
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- EDA 课程设计 秒表 设计
![提示](https://static.bingdoc.com/images/bang_tan.gif)