作业帮 > 综合 > 作业

求eda数字钟设计程序

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/17 02:58:03
求eda数字钟设计程序
请根据要求在EDA实验箱上设计实用数字钟系统,要求:
⑴使用EDA实验箱上的6个LED数码管从左到右依次显示有时、分、秒计数;
⑵使用EDA实验箱上的开关实现十二小时制与二十四小时制切换功能;
⑶使用EDA实验箱上的开关实现调时功能,能非常方便地对小时、分钟和秒进行手动调节以校准时间;
⑷使用实验箱上的蜂鸣器实现整点报时功能,每逢整点,产生报时音报时;
⑸使用实验箱上的蜂鸣器与开关,实现闹钟及闹铃时间设定功能(扩展功能);
⑹数字钟系统只能使用单一外部时钟.
其他部分不要了,我就想知道24和12小时制转换的那个部分的程序是怎么做出来的
1.Topclock(元件例化 顶层文件)
Library ieee;
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity topclock is
Port(clk,clr,en,m1,h1:in std_logic;
alarm:out std_logic;
secs,secg,mins,ming,hours,hourg:buffer std_logic_vector(3 downto 0));
End;
2.秒模块程序
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity SECOND is
port(clk,clr:in std_logic;
sec1,sec0:out std_logic_vector(3 downto 0);
co:out std_logic);
end SECOND;
architecture SEC of SECOND is
begin
process(clk,clr)
variable cnt1,cnt0:std_logic_vector(3 downto 0);
begin
if clr='1' then
cnt1:="0000";
cnt0:="0000";
elsif clk'event and clk='1' then
if cnt1="0101" and cnt0="1000" then
coa);
u2:min1 port map(clr=>clr,alarm=>alarm,
mins=>mins,ming=>ming,clkm=>b,enmin=>c);
u3:hour1 port map(clr=>clr,
hours=>hours,hourg=>hourg,clkh=>d);
u4:madapt port map(en=>en,m1=>m1,clk=>clk,secin=>a,minset=>b);
u5:hadapt port map(en=>en,h1=>h1,clk=>clk,minin=>c,hourset=>d);
end;