【正文】
。 when0110=du=10000010。 when0111=du=11111000。 when1000=du=10000000。 when1001=du=10010000。 when others=du=11000000。 end case。 end if。 end process。end architecture。蜂鳴器模塊 library ieee。use 。use 。entity beep is port( clk: in std_logic。 hh1,hh2,mm1,mm2,h1,h2,m1,m2: in std_logic_vector(3 downto 0)。 beep: out std_logic)。end entity。architecture art of beep is signal bep : std_logic。 begin process(bep,clk,hh1,hh2,mm1,mm2,h1,h2,m1,m2) begin if (h1=hh1 and h2=hh2 and mm1=m1 and mm2=m2 ) OR (mm1=0000 and mm2=0000) then if clk=39。139。 and clk39。event then bep=not bep。 end if。 else bep=39。139。 end if。 beep=bep。 end process。end architecture。兩個(gè)時(shí)鐘信號(hào)library ieee。use 。use 。entity fps is port(clk: in std_logic。 clkms: out std_logic。 clks: out std_logic)。end entity。architecture fenp of fps is begin process(clk) variable counts:integer range 0 to 50000001。 begin if clk39。event and clk=39。139。 then if(counts25000000) then clks=39。139。 counts:=counts+1。 elsif(counts50000000) then clks=39。039。 counts:=counts+1。 else counts:=0。 end if。 end if。 end process。 process(clk) variable countms:integer range 0 to 50000。 begin if clk39。event and clk=39。139。 then if(countms25000) then clkms=39。139。 countms:=countms+1。 elsif(countms50000) then clkms=39。039。 countms:=countms+1。 else countms:=0。 end if。 end if。 end process。end architecture fenp。外部觸發(fā)時(shí)鐘use 。entity count is port (cl_r,clk,add: in std_logic。 gsec,ssec: out std_logic_vector(3 downto 0)。 c: out std_logic)。end entity 。architecture art of count is signal co,rclk: std_logic。 begin process(cl_r,clk,rclk,co,add) is variable secg,secs,ad: std_logic_vector(3 downto 0)。 begin rclk=add xnor clk。 if cl_r=39。039。 then secg:=0000。secs:=0000。co=39。039。 elsif (rclk=39。139。and rclk39。event) then if secg=1001 and secs=0101 then secg:=0000。secs:=0000。co=39。139。 elsif secg=1001 then secs:=secs+1。secg:=0000。co=39。039。 elsif secg1001 then secg:=secg+1。 end if。 end if。 c=co。 ssec=secs。 gsec=secg。 end process。end architecture。時(shí)分秒模塊library ieee。use 。use 。entity disshk is port(clk: in std_logic。 d: in std_logic。 q: out std_logic)。end entity。architecture art of disshk is begin process(clk,d) variable count:integer range 0 to 100。 begin if d = 39。039。 then if clk39。event and clk=39。139。 then if(count=100) then q=39。039。 count :=0。 else count:=count+1。 end if。 end if。 else q=39。139。 end if。 end process。end architecture。 library ieee。use 。use 。entity disshk is port(clk: in std_logic。 d: in std_logic。 q: out std_logic)。end entity。architecture art of disshk is begin process(clk,d) variable count:integer range 0 to 100。 begin if d = 39。039。 then if clk39。event and clk=39。139。 then if(count=100) then q=39。039。 count :=0。 else count:=count+1。 end if。 end if。 else q=39。139。 end if。 end process。end architecture。library ieee。use 。use 。entity disshk is port(clk: in std_logic。 d: in std_logic。 q: out std_logic)。end entity。architecture art of disshk is begin process(clk,d) variable count:integer range 0 to 100。 begin if d = 39。039。 then if clk39。event and clk=39。139。 then if(count=100) then q=39。039。 count :=0。 else count:=count+1。 end if。 end if。 else q=39。139。 end if。 end process。end architectur