【正文】
脈沖從 0 計數(shù)至 59,向前進 1, enmin 由低電平變至高電平。 分模塊 LIBRARY ieee。 use 。 use 。 ENTITY minute IS PORT( clk, reset,sethour : IN STD_LOGIC。 enhour : OUT STD_LOGIC。 da1out: out std_logic_vector (6 downto 0))。 END entity minute。 ARCHITECTURE fun OF minute IS SIGNAL count: STD_LOGIC_VECTOR( 6 downto 0)。 BEGIN da1out = count。 process ( clk , reset , sethour) begin enmin=k。 if (reset=39。039。) then count = 0000000。 elsif (sethour=39。039。) then enhour = clk。 elsif (clk 39。event and clk=39。139。) then if (count(3 downto 0)=1001) then if (count 1660) then if (count=1011001) then enhour=39。139。 count=0000000。 ELSE count=count+7。 end if。 else count=0000000。 end if。 elsif (count 1660) then count = count+1。 enhour=39。039。 after 100 ns。 else count=0000000。 end if。 end if。 end process。 END fun。 分析: 脈沖從 0 計數(shù)至 59,向前進 1, enhour 由低電平變至高電平。 時模塊 LIBRARY ieee。 use 。 use 。 ENTITY hour IS PORT( clk, reset,setweek : IN STD_LOGIC。 enweek : OUT STD_LOGIC。 da2out: out std_logic_vector (6 downto 0))。 END entity hour 。 ARCHITECTURE fun OF hour IS SIGNAL count: STD_LOGIC_VECTOR( 6 downto 0)。 BEGIN da2out = count。 process ( clk , reset , setweek) begin enmin=k。 if (reset=39。039。) then count = 0000000。 elsif (setweek=39。039。) then enweek