【文章內(nèi)容簡(jiǎn)介】
elsif(count 1660) then count = count + 1。 enmin =39。039。 after 100 ns。 else count=0000000。 end if。 end if。 end process。END fun。LIBRARY ieee。use 。use 。ENTITY second IS PORT( clk, clk1,reset,setsec : IN STD_LOGIC。 enmin : OUT STD_LOGIC。 daout: out std_logic_vector (6 downto 0))。END entity second 。ARCHITECTURE fun OF second IS SIGNAL count: STD_LOGIC_VECTOR( 6 downto 0)。BEGIN daout = count。 process ( clk,reset,setsec ) begin if (reset=39。039。) then count = 0000000。 elsif (setsec =39。039。) then enmin = clk1。 elsif (clk39。 event and clk=39。139。) then if (count(3 downto 0)=1001) then if (count 1660) then if (count=1011001) then enmin =39。139。 count=0000000。 ELSE count=count+7。 end if。 else count=0000000。 end if。 elsif(count 1660) then count = count + 1。 enmin =39。039。 after 100 ns。 else count=0000000。 end if。 end if。 end process。END fun。該模塊是有三個(gè)LED燈組成,三個(gè)LED輪流亮,起到驗(yàn)證秒表的功能。程序代碼如下:LIBRARY ieee。use 。use 。ENTITY alert IS PORT( clk : IN STD_LOGIC。 dain : IN STD_LOGIC_VECTOR(6 DOWNTO 0)。 lamp : OUT STD_LOGIC_VECTOR(2 DOWNTO 0))。END alert 。ARCHITECTURE fun OF alert IS signal count : std_logic_vector( 1 downto 0)。BEGINlamper:process(clk) begin if (rising_edge(clk))then if (count = 10) then if (count =00) then lamp = 001 。 elsif (count = 01) then lamp = 010 。 elsif(count=1