资源描述
《电子设计自动化EDA》
课程设计汇报书
学号: 08057102
班级: 自动化081
姓名: 陈婷
指导老师: 刘伟
目 录
一、设计思想 2
二、设计步骤 3
三、调试过程 8
四、结果分析 10
五、心得体会 11
六、参考文件 11
一、设计思想
(一)、设计要求
1、含有以二十四小时制时、分、秒记时、显示功效。
2、含有整点报时功效,整点报时同时LED花样显示。
3、含有消零,调整小时,分钟功效。
4、设计精度要求为1s。
(二)、系统功效描述
1.、系统输入:
调时、调分,清零信号,分别用按键开关SETHOUR、SETMIN、RESET控制;
计数时钟信号CLK采取2HZ时钟源,扫描时钟信号CLKDSP采取32HZ时钟源或更高;
2、系统输出:
8位八段共阴极数码管显示输出;LED花样显示输出;
3、系统功效具体描述:
计时:正常工作状态下,每日按二十四小时计时制,蜂鸣器无声,逢整点报时。
显示:要求采取扫描显示方法驱动8位8段数码管显示。
整点报时:蜂鸣器在“51”、“53”、“55”、“57”、“59”秒发音,结束时为整点;
校时:在计时状态下,按下按键SETMIN设定分钟,按下按键SETHOUR设定小时。
(三)设计思绪
1、分别写出六进制、十进制、二十四进制、清零、设置时分、LED译码部分,在主体部分用元件例化语句计时,清零设置时分、LED译码,再加上扫描模块
2、将六进制、十进制、二十四进制、清零、设置时分、LED译码、扫描模块分模块写在一个主中
(四)系统电路结构框图
二、设计步骤
(一)多种进制计时立即钟控制模块程序
1、6进制
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity counter6 is
port( clk,reset,set: in std_logic;
ain:in std_logic_vector(3 downto 0);
aout: out std_logic_vector(3 downto 0);
co: out std_logic);
end counter6;
architecture art2 of counter6 is
signal count:std_logic_vector(3 downto 0);
begin
process(clk)
begin
if (clk'event and clk='1')then
if(reset='0')then count<="0000";
elsif(set='1')then count<=ain;
elsif (count="0101")then
count<="0000";
co<='1';
else count<=count+1;co<='0';
end if;
end if;
end process;
aout<=count;
end art2;
2、10进制
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity counter10 is
port(clk,reset,set: in std_logic;
ain:std_logic_vector(3 downto 0);
aout:out std_logic_vector(3 downto 0);
co:out std_logic);
end counter10;
architecture art1 of counter10 is
signal count:std_logic_vector(3 downto 0);
begin
process(clk)
begin
if(clk'event and clk='1') then
if(reset='0')then count<="0000";
elsif(set='1')then count<=ain;
elsif(count="1001") then
count<="0000";
co<='1';
else count<=count+1;co<='0';
end if;
end if;
end process;
aout<=count;
end art1;
3、24进制
ibrary ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity counter24 is
port( clk,reset,set: in std_logic;
ainh:in std_logic_vector(3 downto 0);
ainl:in std_logic_vector(3 downto 0);
aout: out std_logic_vector(7 downto 0));
end counter24;
architecture art3 of counter24 is
signal count:std_logic_vector(7 downto 0);
begin
process(clk)
begin
if(clk'event and clk='1') then
if(reset='0')then count<="00000000";
elsif(set='1')then count(7 downto 4)<=ainh;count(3 downto 0)<=ainl;
elsif(count(7 downto 4)<"0011" ) then
if(count(7 downto 4)="0010" and count(3 downto 0)="0011") then
count<="00000000";
elsif(count(3 downto 0)="1001") then
count(3 downto 0)<="0000";
count(7 downto 4)<=count(7 downto 4)+1;
else count(3 downto 0)<=count(3 downto 0)+1;
end if;
end if;
end if;
--end if;
end process;
aout<=count;
end art3;
(二)系统整体程序
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity clock is
port(clk,b1,clks: in std_logic;
reset: in std_logic;
setmin,sethour: in std_logic;
minutell,minutehh,hourll,hourhh,b2:in std_logic_vector(3 downto 0);
secondl,secondh:out std_logic_vector(3 downto 0);
--second0,second2:out std_logic_vector(6 downto 0);
minutel,minuteh:out std_logic_vector(3 downto 0);
--minute0,minute2:out std_logic_vector(6 downto 0);
hourl,hourh:out std_logic_vector(3 downto 0);
--hour0,hour2,dout:out std_logic_vector(6 downto 0);
dout:out std_logic_vector(6 downto 0);
s:out std_logic_vector(2 downto 0);
singing,light: out std_logic);
end clock;
architecture art of clock is
component counter10 is
port(clk,reset,set: in std_logic;
ain:in std_logic_vector(3 downto 0);
aout:out std_logic_vector(3 downto 0);
co:out std_logic);
end component;
component counter6 is
port(clk,reset,set: in std_logic;
ain:in std_logic_vector(3 downto 0);
aout:out std_logic_vector(3 downto 0);
co:out std_logic);
end component;
component counter24 is
port(clk,reset,set: in std_logic;
ainh,ainl:std_logic_vector(3 downto 0);
aout:out std_logic_vector(7 downto 0));
end component;
component led7 is
port(ain: in std_logic_vector(3 downto 0);
aout:out std_logic_vector(6 downto 0));
end component;
signal cs0,cs1,cm0,cm1:std_logic;
signal s0,s1,m0,m1,h0,h1,cout:std_logic_vector(3 downto 0);
signal h:std_logic_vector(7 downto 0);
signal count:std_logic_vector(2 downto 0);
begin
h0<=h(3 downto 0);h1<=h(7 downto 4);
u1:counter10 port map(clk=>clk,reset=>reset,set=>b1,ain=>b2,aout=>s0,co=>cs0);
u2:counter6 port map(clk=>cs0,reset=>reset,set=>b1,ain=>b2,aout=>s1,co=>cs1);
u3:counter10
port map(clk=>cs1,reset=>reset,set=>setmin,ain=>minutell,aout=>m0,co=>cm0);
u4:counter6
port map(clk=>cm0,reset=>reset,set=>setmin,ain=>minutehh,aout=>m1,co=>cm1);
u5:counter24
port map(clk=>cm1,reset=>reset,set=>sethour,ainl=>hourll,ainh=>hourhh,aout=>h);
u6:led7 port map(ain=>cout,aout=>dout);
secondl<=s0;secondh<=s1;minutel<=m0;minuteh<=m1;hourl<=h0;hourh<=h1;
process(m1,m0,s1,s0)
begin
if(m1="0101" and m0="1001" and s1="0101" and s0="1001") then
singing<='1';light<='1';
else singing<='0';light<='0';
end if;
end process;
process(clks)
begin
if(clks'event and clks='1') then
if (count="101") then
count<="000";
else count<=count+1;
end if;
s<=count;
CASE count IS
when"000"=> cout<=s0;
when"001"=> cout<=s1;
when"010"=> cout<=m0;s<="010";
when"011"=> cout<=m1 ;
when"100"=> cout<=h0;
when"101"=> cout<=h1;
when others=> cout<="0000";
end case;
end if;
end process;
end art;
三、调试过程
(一)仿真波形
1、6进制程序仿真波形
2、10进制程仿真波形
3、24进制程序仿真波形
4、系统程序仿真波形
(二)分析
问题1:
u6:led7 port map(ain=>secondl,aout=>second0);
u7:led7 port map(ain=>secondh,aout=>second1);
u8:led7 port map(ain=>minutel,aout=>minute0);
u9:led7 port map(ain=>minuteh,aout=>minute1);
u10:led7 port map(ain=>hourl,aout=>hour0);
u11:led7 port map(ain=>hourh,aout=>hour1);
问题分析:元件例化是并行语句,按此段代码LDE并行显示,每一个数码管全部需要八个端口,这么就需要八排插口,而试验箱只有一排端口。
处理措施:采取扫描显示方法,修改程序为: u6:led7 port map(ain=>cout,aout=>dout);
问题2:
u1:counter10 port map(clk=>clk,reset=>reset, aout=>s0,co=>cs0);
问题分析:此元件例化中有set,ain两个端口没有用到
处理措施:设置两个输入端口使set和ain为无效信号,设置b1,b2,使set=>b1,ain=>b2,b1,b2类型必需分别和set和ain相同,在连线时可用拨码开关将b1,b2置成对应状态。
问题3:对变量多重赋值
处理措施:设置中间信号
问题4:
元件例化模块采取名称映射时两个变量类型不相同
处理措施:名称映射两变量类型应相同
四、结果分析
1、10进制计数器
分析:当reset=‘0‘时,aout<=’0000’;
当set=‘1‘时,aout<=ain(0011);
当reset=‘1‘且set=‘0‘时,开始计数从“0000”到“1001”,当aout=“1001”时aout被置零,且进位Co<=’1’,计数器开始重新计数;
2、6进制计数器
分析:当reset=‘0‘时,aout<=’0000’;
当set=‘1‘时,aout<=ain(0101);
当reset=‘1‘且set=‘0‘时,开始计数从“0000”到“0101”,当aout=“0101”时aout被置零,并开始重新计数;
3、24进制计数器
分析:当reset=‘0‘时,aout<=’0000’;
当set=‘1‘时,aout<=ain(0101);
当reset=‘1‘且set=‘0‘时,开始计数从“0000”到“0101”,当aout=“0101”时aout被置零,并开始重新计数;
五、心得体会
在这课程设计过程中不仅能够巩固以前所学过知识,而且学到了很多在书本上所没有学到过知识。经过这次设计,深入加深了对EDA了解,在编写顶层文件程序时,碰到了不少问题,尤其是各元件之间连接,和信号定义,总是有错误,在细心检验下,最终找出了错误和警告,排除困难后,程序编译就经过了,在波形仿真时,也碰到了一点困难,想要结果不能在波形上得到正确显示:在初始设定输入时钟信号后一直看不到需要时段波形改变,
,数次调试以后,才发觉是因为输入时钟信号对于器件延迟时间来说太短了。经过一再调试,最终找到了比较适宜输入数值:endtime值需要设置长一点:这么就能够观察到完整仿真结果。
经过这次课程设计使我知道了理论和实际相结合是很关键,只有理论知识是远远不够,只有把所学理论知识和实践相结合起来,从理论中得出结论,才能真正为社会服务,从而提升自己实际动手能力和独立思索能力。在设计过程中碰到问题,能够说得是困难重重,这毕竟第一次做,难免会碰到过多种多样问题,同时在设计过程中发觉了自己不足之处,对以前所学过知识了解得不够深刻,掌握得不够牢靠。
总来说,在设计中碰到了很多问题,最终在老师辛勤指导下,最终游逆而解,有点小小成就感,最终认为平时所学知识有了实用价值,达成了理论和实际相结合目标,不仅学到了不少知识,而且锻炼了自己能力,最终,对给过我帮助全部同学和各位指导老师再次表示忠心感谢!
六、参考文件
《EDA技术及应用》
展开阅读全文