【正文】
use 。end Behavioral。 月份 end if。dat11=dat11。dat11=dat11+39。 end if。139。 Else 除了大月和小月 剩下 2 月 對閏年的判斷2月29 if((yea11=0000OR yea11=0010OR yea11=0100OR yea11=0110 OR yea11=01000)AND(yea10=0000 OR yea10=0100OR yea10=01000))OR ((yea11=0001 OR yea11=0011 OR yea11=0101OR yea11=0111 OR yea11=1001)AND(yea10=0010OR yea10=0110)) THEN if dat10=1001 and dat11=0010then 29天 dat10=0001。 else dat10=dat10+39。dat11=0000。139。 elsif dat10=1001then dat10=0000。 elsif lock=100 and tn=39。dat11=dat11。dat11=dat1139。 end if。139。 Else 除了大月和小月 剩下 2 月 對閏年的判斷2月29 數(shù)碼管只顯示年后兩位 前兩位默認(rèn)為20 故只要后兩位能被4整除即使閏年 if((yea11=0000OR yea11=0010OR yea11=0100OR yea11=0110 OR yea11=01000)AND(yea10=0000 OR yea10=0100OR yea10=01000))OR ((yea11=0001 OR yea11=0011 OR yea11=0101OR yea11=0111 OR yea11=1001)AND(yea10=0010OR yea10=0110)) THEN if dat10=0001 and dat11=0000then閏2月29天 dat10=1001。 個位變9 十位減一 else dat10=dat1039。dat11=0011。139。 1號減一變31號 elsif dat10=0000and dat11/=0000then 個位為0 十位不為0 dat10=1001。 elsif lock=100and tn=39。 else mon10=mon10+39。mon11=0000。 end if。139。then 對月進(jìn)行減的置數(shù) if mon10=0001 and mon11=0000then 1月份再減一變12 mon10=0010。yea11=yea11。yea11=yea11+39。139。139。 elsif yea10=0000and yea11/=0000then yea10=1001。then if lock=010and tn=39。139。mo1=mon11。signal yea11 : std_logic_vector(3 downto 0):=0001。signal dat11 : std_logic_vector(3 downto 0):=0001。 en : in std_logic。entity yuzhis isport( clk1,tn : in std_logic。use 。 end process P3。yea1=yea1。yea1=yea1+39。139。 end if。month_out=39。039。到十二月份后重新回到一月份產(chǎn)生月進(jìn)位給年 elsif mon0=1001then mon0=0000。then 天數(shù)產(chǎn)生進(jìn)位使月份加一 if mon0=0010 and mon1=0001then mon0=0001。對應(yīng)使能 end process P1。判斷閏年的語句 end if。day_out=39。039。 elsif dat0=1001then dat0=0000。 else 不是閏年,二月份28天 if dat0=1000 and dat1=0010then dat0=0001。dat1=dat1。day_out=39。139。 end if。139。dat1=dat1+1。dat1=0000。day_out=39。039。139。139。年月日賦初值P1:process (clk0,en,lock)天的輸出,分大月和小月,以及二月 begin if en=39。mo0=mon0。signal yea1 : std_logic_vector(3 downto 0):=0001。signal dat1 : std_logic_vector(3 downto 0):=0001。 en : in std_logic。entity daymony1 is port( clk0 : in std_logic。use 。 end process。 end if。139。then 對秒進(jìn)行置數(shù)加1 if ts11=0101AND ts10=1001 then ts11=0000。ts11=ts11。ts11=ts1139。039。139。 elsif tm10=1001then tm10=0000。 elsif lock=110 and tn=39。 個位變9 十位減一 else tm10=tm1039。 tm11=0101。 end if。139。then 對時置數(shù)加1 if th11=0010AND th10=0011then th11=0000。th11=th11。 elsif th10=0000and th11/=0000then 個位為0 十位不為0 th10=1001。then 選擇置數(shù)時鐘為clk1 if lock=101and tn=39。139。m1=tm11。signal th11 : std_logic_vector(3 downto 0):=0010。signal ts11 : std_logic_vector(3 downto 0):=0101。 tn : in std_logic。 clk0工作時鐘,clk1預(yù)置脈沖 lock : in std_logic_vector(2 downto 0)。 Unment the following library declaration if using arithmetic functions with Signed or Unsigned valuesuse 。時分秒置數(shù)模塊 Company: Engineer: Create Date: 20:15:01 01/13/2014 Design Name: Module Name: s_m_yuz1 Behavioral Project Name: Target Devices: Tool versions: Description: Dependencies: Revision: Revision File Created Additional Comments: library IEEE。 end if。039。 else th0=th0+39。th1=th1+39。th0=0000。039。 else tm0=tm0+39。tm1=tm1+39。tm0=0000。139。 elsif ts0=1001then ts0=0000。event AND clk0=39。co=cc。m0=tm0。signal th1 : std_logic_vector(3 downto 0):=0010。signal ts1 : std_logic_vector(3 downto 0):=0101。 hour產(chǎn)生進(jìn)位 en : in std_logic。 m0,m1 : out std_logic_vector(3 downto 0)。use 。use 。 end if。event and upd0=39。139。139。begin lock=tem。architecture Behavioral of fenpin issignal tem : std_logic_vector(2 downto 0):=000。 clk : in std_logic。use 。通過這幾天的EDA的數(shù)字鐘課程設(shè)計(jì)真的使我收獲很多,我想我以后還會加強(qiáng)這方面的實(shí)踐經(jīng)歷,多多的積累經(jīng)驗(yàn),但這次實(shí)驗(yàn)也有一些小小的缺憾,就是沒能夠自己動手進(jìn)行程序向器件中的下載,希望實(shí)驗(yàn)室能夠盡快更新一些實(shí)驗(yàn)設(shè)備。再一個就是編寫程序時遇到的問題,最明顯的一個問題就是未給一些變量賦初值,這個問題困擾了很長時間,程序的邏輯和語法都沒有問題,但是在仿真時就是不能出現(xiàn)自己想要的仿真波形,最后賦予了初值才解決了這個問題。器件編程下載及設(shè)計(jì)結(jié)果由于實(shí)驗(yàn)室的設(shè)備有限,因此器件下載的步驟未進(jìn)行。Lock=100,對日進(jìn)行置數(shù)。閏年,2月29天。以加置數(shù)為例,下同。RTL圖如下:內(nèi)部具體結(jié)構(gòu)如下: 仿真與分析f_clk是時鐘clk經(jīng)1000分頻后輸出,lock是對upd0的計(jì)數(shù)。 S_Day : OUT STD_LOGIC_VECTOR(3 DOWNTO 0)。使能 H_Year : OUT STD_LOGIC_VECTOR(3 DOWNTO 0)。預(yù)置脈沖手動 set : IN STD_LOGIC。 輸出的報(bào)時信號end baoshi。end time_show。 aM_Mon : OUT STD_LOGIC_VECTOR(3 DOWNTO 0)。 S_ya0 : IN STD_LOGIC_VECTOR(3 DOWNTO 0)。 S_da0 : IN STD_LOGIC_VECTOR(3 DOWNTO 0)。 S_m0 : IN STD_LOGIC_VECTOR(3 DOWNTO 0)。各部分端口 如下:entity time_show isPORT ( en : IN STD_LOGIC。 h0,h1 : out std_logic_vector(3 downto 0) )。m f0 : in std_logic_vector(3 downto 0)。h d0 : in std_logic_vector(3 downto 0)。s b0 : in std_logic_vector(3 downto 0)。端口如下:entity xuanze1 is port( en : in std_lo