江苏大学 数字逻辑电路设计报告.docx
- 文档编号:8005947
- 上传时间:2023-01-27
- 格式:DOCX
- 页数:18
- 大小:318.74KB
江苏大学 数字逻辑电路设计报告.docx
《江苏大学 数字逻辑电路设计报告.docx》由会员分享,可在线阅读,更多相关《江苏大学 数字逻辑电路设计报告.docx(18页珍藏版)》请在冰豆网上搜索。
江苏大学数字逻辑电路设计报告
JIANGSUUNIVERSITY
数字逻辑课程设计报告
-————
学院名称:
计算机学院
专业班级:
通信工程
学生姓名:
学生学号:
2011年7月2日
一、设计目的:
1、学会应用数字系统设计方法进行电路设计。
2、进一步提高MaxplusII软件开发应用能力。
3、提高VHDL进行综合设计的能力
4、培养学生综合实验能力。
二、设计原理与方案:
设计一个多功能数字钟:
1.能进行正常的时、分、秒计时,用动态扫描的方式显示,需用6个数码管。
1)用M6M5进行24进制小时的显示;
2)用M4M3进行60进制分的显示;
3)用M2M1进行60进制秒的显示。
2.利用按键实现“校时”、“校分”和“秒清0”功能。
1)SA:
校时键。
按下SA键时,时计数器迅速递增,按24小时循环,并且计满23时回到00。
2)SB:
校分键。
按下SB键时,分计数器迅速递增,按60小时循环,并且计满59时回到00,但不向时进位。
3)SC:
秒清零。
按下SC时,秒计数器清零。
要求按下按键均不产生数字跳变,因此须对“SA”、“SB”进行消抖处理。
3.能进行整点报时。
1)在59分50、52、54、56、58秒按500Hz频率报时;
2)在59分60秒用1Kz的频率作最后一声正点报时。
4.更高要求:
能进行闹时功能
1)闹时的最小时间间隙为10分钟,闹时长度为1分钟。
闹时频率可以自己设置。
2)按下闹时按键SD后,将一个闹时时间数存入计数器内。
时钟正常运行时,闹时时间和运行的时间进行比较,当比较结果相同时输出一个启动信号,触发闹时电路工作,输出音频信号。
5.设计要求按自顶向下的层次化设计方法设计。
1)顶层图
2)消抖电路用D触发器构成,SA、SB、SC为包含抖动的输入信号,而电路的输出则是一个边沿整齐的输出信号。
3)计时,计分,计秒模块可由10进制计数器连接构成,也可用VHDL语言完成。
10进制计数器需自己设计,不能调用系统库。
4)其他如分频电路、提供报时控制信号、闹时电路等模块用VHDL语言实现。
5)数字显示动态扫描的方式
三、模块描述:
模块功能如下:
1.计时模块:
计时(24进制计数器),计分(60进制计数器)、计秒(60进制计数器)模块可由10进制计数器连接构成,也可用VHDL语言完成。
10进制计数器需自己设计(用VHDL语言,与所做实验74160计数器相同),不能调用系统库。
2.校时模块:
按校时键,时位迅速递增,满23清0;按下校分键,分位迅速递增,满59清0,注意:
此时不向时位产生进位;按秒清0键,秒清0。
注意的问题:
抖动。
电路抖动:
一次按键的弹跳现象,使得电路产生多个计数脉冲,导致一次按键,多次计数的误动作。
抖动原因:
物理原因。
消除方法:
D触发器,同步计数脉冲。
原因:
一个触发器CP内,屏蔽所有的抖动脉冲。
计时与校时的选择:
二选1的多路选择器。
具体策略:
按键输出接2选1MUX选择端,正常的计时时钟与校时时钟分别接2选1MUX的两个数据输入端。
3.报时模块:
从59分50秒开始,每过2秒进行低音报时,当达到整点时,进行一次高音报时。
低音:
频率可定为500Hz;高音:
频率可定为1KHz。
4.分频模块:
通过一个标准的时钟脉冲产生一个基准频率,利用计数器来进行一级或多级分频,生成所需要的各种频率信号。
5.动态显示模块:
1、时间的显示:
24进制(时)与60进制(分、秒)计数器的输出分成6组,每一组(4位BCD码)接BCD-7段码显示译码器(动态显示只需1个),驱动数码管显示。
选用8个数码管中的6个作为时间显示。
2、动态扫描原理与实现:
课本P212,图6-23。
四、设计过程:
1、计时模块:
1)10进制计数器:
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entityls160isport(
data:
instd_logic_vector(3downto0);
clk,ld,p,t,clr:
instd_logic;
count:
bufferstd_logic_vector(3downto0);
tc:
outstd_logic);
endls160;
architecturebehaviorofls160is
begin
tc<='1'when(count="1001"andp='1'andt='1'andld='1'andclr='1')else'0';
cale:
process(clk,clr,p,t,ld)begin
if(rising_edge(clk))then
if(clr='1')then
if(ld='1')then
if(p='1')then
if(t='1')then
if(count="1001")then
count<="0000";
else
count<=count+1;
endif;
else
count<=count;
endif;
else
count<=count;
endif;
else
count<=data;
endif;
else
count<="0000";
endif;
endif;
endprocesscale;
endbehavior;
2)24进制(由10进制计数器连接而成):
3)60进制(由10进制计数器连接而成):
2、校时模块:
1)D触发器:
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entityis
port(clk:
instd_logic;
d:
instd_logic;
q:
outstd_logic);
endd_3090602034;
architecturedofd_3090602034is
begin
process(clk)
begin
if(clk'eventandclk='1')then
q<=d;
endif;
endprocess;
endd;
2)2路选择器:
libraryieee;
useieee.std_logic_1164.all;
entitymux2is
port(in0,in1:
instd_logic;
sel:
instd_logic;
dataout:
outstd_logic);
endmux2;
architecturert1_mux2ofmux2is
begin
withselselect
dataout<=in0when'0',
in1when'1',
'Z'whenothers;
endrt1_mux2;
3、报时模块:
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entityalertis
port(m1,m0,s1,s0:
instd_logic_vector(3downto0);
sig500,sig1k:
outstd_logic);
endalert;
architecturealertofalertis
begin
sig500<='1'when(m1="0101"andm0="1001"ands1="0101"and(s0="0000"ors0="0010"ors0="0100"ors0="0110"ors0="1000"))else'0';
sig1k<='1'when(m1="0000"andm0="0000"ands1="0000"ands0="0000")else'0';
endalert;
4、分频模块:
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_arith.all;
useieee.std_logic_unsigned.all;
entityfrequencydivideris
port(clk:
instd_logic;
hz512:
outstd_logic;
hz256:
outstd_logic;
hz64:
outstd_logic;
hz4:
outstd_logic;
hz1:
outstd_logic
);
endfrequencydivider;
architecturefoffrequencydivideris
signalq:
std_logic_vector(9downto0);
begin
process(clk)
begin
ifclk'eventandclk='1'then
q<=q+1;
endif;
endprocess;
hz512<=q(0);
hz256<=q
(1);
hz64<=q(3);
hz4<=q(7);
hz1<=q(9);
endf;
5、动态显示模块:
1)8路选择器:
libraryieee;
useieee.std_logic_1164.all;
entitymux8is
port(in0,in1,in2,in3,in4,in5,in6,in7:
instd_logic;
sel:
instd_logic_vector(2downto0);
dataout:
outstd_logic);
endmux8;
architecturert1_mux8ofmux8is
begin
withselselect
dataout<=in0when"000",
in1when"001",
in2when"010",
in3when"011",
in4when"100",
in5when"101",
in6when"110",
in7when"111",
'Z'whenothers;
endrt1_mux8;
2)七段译码器:
libraryieee;
useieee.std_logic_1164.all;
entitydecoder_bcd_displayis
port(decoder_in:
instd_logic_vector(3downto0);
decoder_out:
outstd_logic_vector(6downto0));
enddecoder_bcd_display;
architecturebehavior_decoder_bcd_displayofdecoder_bcd_displayis
begin
WITHdecoder_inselect
decoder_out<="1111110"when"0000",
"0110000"when"0001",
"1101101"when"0010",
"1111001"when"0011",
"0110011"when"0100",
"1011011"when"0101",
"0011111"when"0110",
"1110000"when"0111",
"1111111"when"1000",
"1110011"when"1001",
"XXXXXXX"whenothers;
endbehavior_decoder_bcd_display;
3)3-8译码器:
libraryieee;
useieee.std_logic_1164.all;
entityvariable_decoderis
port(a,b,c:
instd_logic;
g1,g2a,g2b:
instd_logic;
y:
outstd_logic_vector(7downto0));
endvariable_decoder;
architecturertl_variable_decoderofvariable_decoderis
begin
process(g1,g2a,g2b,a,b,c)
variablecomb:
std_logic_vector(2downto0);
begin
if(g1='1'andg2a='0'andg2b='0')then
comb:
=c&b&a;
casecombis
when"000"=>y<="11111110";
when"001"=>y<="11111101";
when"010"=>y<="11111011";
when"011"=>y<="11110111";
when"100"=>y<="11101111";
when"101"=>y<="11011111";
when"110"=>y<="10111111";
when"111"=>y<="01111111";
whenothers=>y<="XXXXXXXX";
endcase;
else
y<="11111111";
endif;
endprocess;
endrtl_variable_decoder;
4)六进制计数器:
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitycount6isport(
data:
instd_logic_vector(2downto0);
clk,ld,p,t,clr:
instd_logic;
count:
bufferstd_logic_vector(2downto0);
tc:
outstd_logic);
endcount6;
architecturebehaviorofcount6is
begin
tc<='1'when(count="101"andp='1'andt='1'andld='1'andclr='1')else'0';
cale:
process(clk,clr,p,t,ld)begin
if(rising_edge(clk))then
if(clr='1')then
if(ld='1')then
if(p='1')then
if(t='1')then
if(count="101")then
count<="000";
else
count<=count+1;
endif;
else
count<=count;
endif;
else
count<=count;
endif;
else
count<=data;
endif;
else
count<="000";
endif;
endif;
endprocesscale;
endbehavior;
5)动态显示模块连接图:
动态显示模块生成图:
五、设计总结:
多功能数字钟的顶层图为:
多功能数字钟的功能及所需模块的了解:
1、电子钟可以正常计时,也可以整点报时。
2、D触发器消除抖动、2路选择器选择计时和校时。
3、分频
4、秒进位消除抖动(通过d触发器实现)
5、动态扫描
七、设计体会与经验总结:
设计过程中,遇到如下问题:
1.如何实现校对时间时,计数器快速递增?
按键校对时间时,将一个频率较高的计数脉冲信号作用于计数器,屏蔽正常计时的计数脉冲信号。
2.“抖动”的消除
方法:
D触发器,同步按键脉冲。
原理:
一个CP内,屏蔽所有抖动脉冲。
3.电子钟在下载的时候秒在50的时候会产生进位,在60的时候又产生进位
解决方法:
在秒进位输出接一个D触发器
4.在用VHDL语言写程序时,经常会出错,经常忘括号、分号,导致程序编出来有好多错。
5.在连接图时,有的线没接好,编译出来会有很多错。
体会:
1、通过此次课程设计,对多功能数字钟有了深刻的了解,提高了用VHDL语言编写程序的熟练程度,并且熟练地掌握了仿真的方法。
2、对动态显示和静态显示有了初步的认识和了解,学会了运用动态和静态显示数据,同时也认识到分频器的重要性,以及d触发器的消抖作用,加强了动手能力,更直观形象的对数字钟进行了认识。
3、在设计过程中经常遇到问题,但同时学会了很多书本上没有的应用性知识,觉得非常可贵,对数字逻辑这门课程有了更为深刻的了解。
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 江苏大学 数字逻辑电路设计报告 江苏 大学 数字 逻辑电路 设计 报告