【正文】
end if。 elsif (monthin=2) then 當前為小月29天 if(qd=29) then qd=1。 clk2=39。139。 elsif qd29 then qd=qd+1。 clk2=39。039。 end if。 elsif ((monthin=4) or (monthin=6) or (monthin=9) or (monthin=11)) then if(qd=30) then 當前為中月30天 qd=1。 clk2=39。139。 elsif qd30 then qd=qd+1。 clk2=39。039。 end if。 end if。 elsif ((monthin=1) or (monthin=3) or (monthin=5) or (monthin=7) or (monthin=8) or (monthin=10) or (monthin=12)) then 非閏年大月份31天 if(qd=31) then qd=1。 clk2=39。139。 elsif qd31 then qd=qd+1。 clk2=39。039。 end if。 elsif monthin=2 then 非閏年小月28天 if(qd=28) then qd=1。 clk2=39。139。 elsif qd28 then qd=qd+1。 clk2=39。039。 end if。 elsif ((monthin=4) or (monthin=6) or (monthin=9) or (monthin=11)) then非閏年中月30天 if(qd=30) then qd=1。 clk2=39。139。 elsif qd30 then qd=qd+1。 clk2=39。039。 end if。 end if。 end if。 qtd1=qd。 qtd2=qd。 qtd3= conv_std_logic_vector(qd,9)。 qtd4=qd。 end process。end ri。 月份模塊library ieee。use 。USE 。use 。entity month isport ( clkm: in std_logic。 setm: in std_logic。 qtm1: out integer range 1 to 12。 qtm2: out integer range 1 to 12。 qtm3: out std_logic_vector(3 downto 0)。 qtm4: out std_logic_vector(8 downto 0)。 qtm5: out integer range 1 to 12。 clk4: out std_logic) 。 end month。architecture yue of month issignal qm:integer range 1 to 12。begin process(clkm,setm) begin if setm=39。139。 then qm=5。elsif(clkm39。event and clkm=39。139。) then if(qm=12) then qm=1。 clk4=39。139。 elsif qm12 then qm=qm+1。 clk4=39。039。 end if。 end if。end process。qtm1=qm。qtm2=qm。qtm3=conv_std_logic_vector(qm,4)。qtm4=conv_std_logic_vector(qm,9)。qtm5=qm。end yue。 年模塊library ieee。use 。use 。use 。entity year isport ( clky: in std_logic。 sety: in std_logic。 qty1: out integer range 2015 to 2099。 qty2: out integer range 2015 to 2099。 qty3: out integer range 2015 to 2099。 qty4: out integer range 2015 to 2099。 qty5: out integer range 2015 to 2099) 。 end year。architecture nian of year issignal qy:integer range 2015 to 2099。begin process(clky,sety) begin if sety=39。139。 then qy=2015。 elsif(clky39。event and clky=39。139。) then if(qy=2099) then qy=2015。 else qy=qy+1。 end if。 end if。end process。qty1=qy。qty2=qy。qty3=qy。qty4=qy。qty5=qy。end nian。: 陽歷轉陰歷模塊 LIBRARY IEEE。 USE IEEE. 。 USE 。 Entity trans2 is Port ( clk:in std_logic。 year1 : in integer range 2014 to 2099。 month1:in std_logic_vector(8 downto 0)。 day1 :in std_logic_vector(8 downto 0)。 Tday:out std_logic_vector(8 downto 0)。 Tmonth:out std_logic_vector(8 downto 0)。 Tyear : out integer range 2014 to 2099。 Tday_1:out std_logic_vector(8 downto 0)。 Tmonth_1:out std_logic_vector(8 downto 0)。 Tyear_1 : out integer range 2014 to 2099。 chu1:out std_logic)。 End entity。Architecture mk of trans2 isSignal Tyear1:integer range 2014 to 2099。Signal :std_logic_vector(8 downto 0)。Signal 1:std_logic_vector( 8downto 0)。Signal Q:STD_LOGIC_VECTOR(23 DOWNTO 0)。Signal Q_1:STD_LOGIC_VECTOR(23 DOWNTO 0)。格式Q(23)(20) 位表示閏月月份,值為0 為無閏月,Q(19)(16) 對應農歷第14 月的大小Q(15)(8) 對應農歷第512 月大小,第三字節(jié)Q(7) 表示農歷第13 個月大小月份對應的位為1 表示本農歷月大(30 天),為0 表示小(29 天)第三字節(jié)Q(6)(5) 表示春節(jié)的公歷月份,Q(4)(0) 表示春節(jié)的公歷日期 BeginProcess(month1,year1,day1)variable day11:STD_LOGIC_VECTOR(8 DOWNTO 0)。variable x:std_logic_vector(8 downto 0)。variable day12:STD_LOGIC_VECTOR(8 DOWNTO 0)。variable day13:STD_LOGIC_VECTOR(8 DOWNTO 0)。variable i:integer。 variable j:std_logic_vector(8 downto 0)。variable mday1:STD_LOGIC_VECTOR(8 DOWNTO 0)。variable mday2:STD_LOGIC_VECTOR(8 DOWNTO 0)。variable mmday11:STD_LOGIC_VECTOR(8 DOWNTO 0)。variable mmday12:STD_LOGIC_VECTOR(8 DOWNTO 0)。variable mmday13:STD_LOGIC_VECTOR(8 DOWNTO 0)。begin case year11 is when 2014= Q_1=X955ABf。 when 2015 =Q_1=X04BA53 。 when 2016 =Q_1=X0A5B48 。 when 2017=Q_1=X6517BC 。 when 2018 =Q_1=X052B50。 when 2019 =Q_1=X0A9345 。 when 2020=Q_1=X474AB9。 when 2021 =Q_1=X06AA4C。 when 2022 =Q_1=X0Ad541 。 when 2023=Q_1=X24dAB6。 when 2024=Q_1=X04B64A。 when 2025=Q_1=X69573d 。 when 2026=Q_1=X0A4e51。 when 2027 =Q_1=X0d2646 。 when 2028=Q_1=X5e933A 。 when 2029=Q_1=X0d534d 。 when 2030=Q_1=X05AA43 。 when 2031 =Q_1=X36B537 。 when 2032=Q_1=X096d4B。 when 2033=Q_1=XB4AeBf 。 when 2034=Q_1=X04Ad53 。 when 2035=Q_1=X0A4d48 。 when 2036=Q_1=X6d25BC。 when 2037=Q_1=X0d254f 。 when 2038=Q_1=X0d5244 。 when 2039=Q_1=X5dAA38 。 when 2040=Q_1=X0B5A4C 。 when 2041=Q_1=X056d41 。 when 2042=Q_1=X24AdB6 。 when 2043=Q_1=X049B4A 。 when 2044=Q_1=X7A4BBe 。 when 2045=Q_1=X0A4B51 。 when 2046=Q_1=X0AA546 。 when 2047=Q_1=X5B52BA 。 when 2048=Q_1=X06d24e 。 when 2049=Q_1=X0AdA42 。 when 2050=Q_1=X355B37 。 when 2051=Q_1=X09374B 。 when 2052=Q_1=X8497C1 。 when 2053=Q_1=X049753 。 when 2054=Q_1=X064B48 。 when 2055=Q_1=X66A53C 。 when 2056=Q_1=X0eA54f 。 when 2057=Q_1=X06B