【文章內(nèi)容簡介】
cd1M:in std_logic_vector(3 downto 0)。 clkout:out std_logic)。 end yourname_baoshi。 architecture bav of yourname_baoshi is signal clkout_1:std_logic。 begin process(bcd10S,bcd1S,bcd10M,bcd1M,clk_2KHz,clk_1KHz,clk1Hz) begin if (bcd10M=0101 and bcd1M=1001) and (bcd10S=0101) and (bcd1S4) and (bcd1S=9) then if clk1Hz=39。139。 then clkout_1=clk_1KHz。 else clkout_1=39。Z39。 end if。 elsif (bcd10M=0000 and bcd1M=0000) and (bcd10S=0000) and (bcd1S=0000) then if clk1Hz=39。139。 then clkout_1=clk_2KHz。 else clkout_1=39。Z39。 end if。 else clkout_1=39。Z39。 end if。 clkout=clkout_1。 end process。 end bav。 12/24 小時切換控制 模塊 c lkc o n tr1 2 _ 2 4b c d 1 0 [3 ..0 ]b c d 1 [3 ..0 ]jy 4 7 3 9 _ c n t1 2 _ 2 4in s t6 library ieee。 use 。 use 。 entity yourname_t12_24 is port(clk,contr12_24:in std_logic。 bcd10,bcd1:out std_logic_vector(3 downto 0))。 end yourname_t12_24。 architecture behav of yourname_t12_24 is type ly is(s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,s21,s22,s23)。 signal p,n:ly。 signal b10,b1:std_logic_vector(3 downto 0)。 begin process(clk) begin if clk39。event and clk=39。139。 then p=n。 end if。 end process。 process(p,contr12_24) begin case p is when s0= if contr12_24=39。039。 then b10=0000。 b1=0000。 else b10=0001。 b1=0010。 end if。 n=s1。 when s1= b10=0000。 b1=0001。 n=s2。 when s2= b10=0000。 b1=0010。 n=s3。 when s3= b10=0000。 b1=0011。 n=s4。 when s4 =b10=0000。 b1=0100。 n=s5。 when s5 =b10=0000。 b1=0101。 n=s6。 when s6 =b10=0000。 b1=0110。 n=s7。 when s7 =b10=0000。 b1=0111。 n=s8。 when s8 =b10=0000。 b1=1000。 n=s9。 when s9 =b10=0000。 b1=0101。 n=s10。 when s10 =b10=0001。 b1=0000。 n=s11。 when s11 =b10=0001。 b1=0001。 n=s12。 when s12 =b10=0001。 b1=0010。 n=s13。 when s13 =if contr12_24=39。039。 then b10=0001。 b1=0011。 else b10=0000。 b1=0001。 end if。 n=s14。 when s14 =if contr12_24=39。039。 then b10=0001。 b1=0100。 else b10=0000。 b1=0010。 end if。 n=s15。 when s15 =if contr12_24=39。039。 then b10=0001。 b1=0101。 else b10=0000。 b1=0011。 end if。 n=s16。 when s16 =if contr12_24=39。039。 then b10=0001。 b1=0110。 else b10=0000。 b1=0100。 end if。 n=s17。 when s17 =if contr12_24=39。039。 then b10=0001。 b1=0111。 else b10=0000。 b1=0101。 end if。 n=s18。 when s18 =if contr12_24=39。039。 then b10=0001。 b1=1000。 else b10=0000。 b1=0110。 end if。 n=s19。 when s19 =if contr12_24=39。039。 then b10=0001。 b1=1001。 else b10=0000。 b1=0111。 end if。 n=s20。 when s20 =if contr12_24=39。039。 then b10=0010。 b1=0000。 else b10=0000。 b1=1000。 end if。 n=s21。 when s21 =if contr12_24=39。039。 then b10=0010。 b1=0001。 else b10=0000。 b1=1001。 end if。 n=s22。 when s22 =if contr12_24=39。039。 then b10=0010。 b1=0010。 else b10=0001。 b1=0000。 end if。 n=s23。 when s23 =if contr12_24=39。039。 then b10=0010。 b1=0011。 else b10=0001。 b1=0001。 end if。 n=s0。 when others=null。 end case。 end process。 bcd10=b10。 bcd1=b1。 end behav。 數(shù)碼管動態(tài)掃描顯示 din0 [3. .0]din1 [3. .0]din2 [3. .0]din3 [3. .0]din4 [3. .0]din5