libraryieee;;;entitycon60vis------定义六十进制计数器(分,秒)port(clk:instd_logic;en:instd_logic;clr:instd_logic;ld:instd_logic;d:instd_logic_vector(7downto0);co:outstd_logic;qh:bufferstd_logic_vector(3downto0);ql:bufferstd_logic_vector(3downto0));endcon60v;architecturebhvofcon60visbeginco<='1'when(qh="0101"andql="1001"anden='1')else'0';process(clk,clr,ld)beginif(clr='0')thenqh<="0000";ql<="0000";elsif(clk'eventandclk='1')thenif(ld='0')thenqh<=d(7downto4);ql<=d(3downto0);elsif(en='1')thenif(ql<9)thenql<=ql+1;elseql<="0000";if(qh<5)thenqh<=qh+1;elseqh<="0000";endif;endif;endif;endif;endprocess;endbhv;libraryieee;;;entitycon24visport(clk:instd_logic;en:instd_logic;clr:std_logic;ld:instd_logic;d:instd_logic_vector(7downto0);co:outstd_logic;qh:bufferstd_logic_vector(3downto0);ql:bufferstd_logic_vector(3downto0));endcon24v;architecturebhvofcon24visbeginco<='1'when(qh="0000"andql="0011"anden='1')else'0';process(clk,clr,ld)beginif(clr='0')thenqh<="0000";ql<="0000";elsif(clk'eventandclk='1')thenif(ld='0')thenqh<=d(7downto4);ql<=d(3downto0);elsif(en='1')thenif(qh="0010"andql="0011")thenqh<="0000";ql<="0000";elseql<=ql+1;if(ql<9)thenql<=ql+1;elseql<="0000";if(qh<2)thenqh<=qh+1;elseqh<="0000";endif;endif;endif;endif;endif;endprocess;endbhv;libraryieee;;entitydianzib
EDA 电子钟 来自淘豆网www.taodocs.com转载请标明出处.