1、 数字时钟数字时钟 班级:班级: 学号:学号: 姓名:姓名: 指导老师:指导老师: 提交日期:提交日期:20112011 年年 1 1 月月 8 8 日日 一一 系统简介:系统简介: 使用 VHDL 语言编写程序完成数字时钟的功能设计,利用软件进 行编译和仿真,最后利用实验箱实现系统。 二二 功能简介功能简介: 完成时钟的计时、 调整, 整点报时等基础功能, 完成闹钟的设置、 开启和关闭功能,整点报时的开启和关闭功能,完成日期设定和显示 功能。 三三 总体结构逻辑框图:总体结构逻辑框图: 四四 状态图:状态图: 五五 各各模块模块电路图及程序电路图及程序: 整体电路连接图:整体电路连接图: 1
2、.1. 总控制模块:总控制模块: 时钟脉冲分频元件: library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity dc4_1clkdmux is port( clk:in std_logic; clk1,clk4,clk512:out std_logic); end dc4_1clkdmux; architecture clkdmux of dc4_1clkdmux is signal c1:std_logic_vector(9 downto 0); begin process (clk)
3、 begin if clkevent and clk=1then c1=c1+1; end if; clk1=c1(9);clk4=c1(7); clk512=c1(0); end process; end clkdmux; 模式控制元件: library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity dc4_2mode is port( clk4,bt_m:in std_logic; mode:out std_logic_vector(1 downto 0); cr1,cr2:out st
4、d_logic); end dc4_2mode; architecture mode of dc4_2mode is signal modx:std_logic_vector(1 downto 0); signal c1,c2:std_logic; begin process (clk4,bt_m) begin if clk4event and clk4=1 then if bt_m=1 then modx=modx+1;c2=1; else c2=0; end if; end if; if modx=“00“ then c1=1; else c1=0; end if; mode=modx; cr1=c1;cr2=c2; end process; end mode; 调节项目控制元件: library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity dc4_2mode is port( clk4,bt