VHDL时钟程序(6页).doc





《VHDL时钟程序(6页).doc》由会员分享,可在线阅读,更多相关《VHDL时钟程序(6页).doc(6页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、-VHDL时钟程序-第 6 页library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity Counter_m_f_s isport clk,reset : in std_logic ;bcd_h_m: out std_logic_vector(3 downto 0); -秒钟个位输出bcd_l_m: out std_logic_vector(3 downto 0); -秒钟十位输出bcd_l_f: out std_logic_vector(3 downto 0); -分钟个位输出bcd_h_f:
2、 out std_logic_vector(3 downto 0); -分钟十位输出bcd_l_s: out std_logic_vector(3 downto 0); -时钟个位输出bcd_h_s: out std_logic_vector(3 downto 0); -时钟十位输出up : out std_logicend Counter_m_f_s ;architecture behav of Counter_m_f_s issignal bcd_h_m_r : std_logic_vector(3 downto 0); -秒钟个位内部信号signal bcd_l_m_r : std_lo
3、gic_vector(3 downto 0); -秒钟十位内部信号signal bcd_h_f_r : std_logic_vector(3 downto 0); -分钟个位内部信号signal bcd_l_f_r : std_logic_vector(3 downto 0); -分钟十位内部信号signal bcd_h_s_r : std_logic_vector(3 downto 0); -时钟个位内部信号signal bcd_l_s_r : std_logic_vector(3 downto 0); -时钟个位内部信号signal up_r1 : std_logic;signal up_
4、r2 : std_logic;beginU1: process (clk, reset) -秒钟 begin if reset=0 then bcd_h_m_r =0000; bcd_l_m_r =0000; up_r1 =0;else if clkevent and clk=1 then if bcd_h_m_r =0101 and bcd_l_m_r =1001 then bcd_h_m_r =0000; -59秒,分钟进一 bcd_l_m_r =0000; up_r1 = 1 ; else if bcd_l_m_r(3 downto 0) = 1001 then -秒的个位为9,十位进一
5、,分钟不进为 bcd_l_m_r(3 downto 0)= 0000 ; bcd_h_m_r(3 downto 0) = bcd_h_m_r(3 downto 0) + 1 ; up_r1 = 0; else bcd_l_m_r(3 downto 0) = bcd_l_m_r(3 downto 0) + 1 ; up_r1 = 0; end if; end if; end if; end if; end process;bcd_h_m = bcd_h_m_r;bcd_l_m = bcd_l_m_r;U2: process (up_r1 , reset) -分钟 beginif reset=0
6、then bcd_h_f_r =0000; bcd_l_f_r =0000; up_r2 =0;else if up_r1event and up_r1=1 then if bcd_h_f_r =0101 and bcd_l_f_r =1001 then -59分,时钟进一 bcd_h_f_r =0000; bcd_l_f_r =0000; up_r2 = 1 ; else if bcd_l_f_r(3 downto 0) = 1001 then -分的个位为9,十位进一,时钟不进位 bcd_l_f_r(3 downto 0) = 0000 ; bcd_h_f_r(3 downto 0) =
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- VHDL 时钟 程序

限制150内