1一.程序代码及其仿真:1.cnt60子模块代码:libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;ENTITYV_cnt60ISPORT(clk:INstd_logic;Q0,Q1,Q2,Q3,Q4,Q5,Q6,QC:OUTstd_logic);ENDV_cnt60;ARCHITECTUREfuncOFV_cnt60ISSIGNALcount1:std_logic_vector(3downto0);SIGNALcount2:std_logic_vector(3downto0);SIGNALcarryin:std_logic;BEGINQ0=count1(0);Q1=count1(1);Q2=count1(2);Q3=count1(3);Q4=count2(0);Q5=count2(1);Q6=count2(2);QC=carryin;process(clk)BEGINif(clk'eventANDclk='1')thencarryin='0';if(count1=1001)thencount1=0000;count2=count2+1;elsecount1=count1+1;ENDif;if(count2=0101ANDcount1=1001)thencount2=0000;count1=0000;carryin='1';ENDif;ENDif;ENDprocess;2ENDfunc;cnt60仿真波形:2.cnt24子模块代码:libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;ENTITYV_cnt24ISPORT(clk:INstd_logic;Q0,Q1,Q2,Q3,Q4,Q5:OUTstd_logic);ENDV_cnt24;ARCHITECTUREfunc_cnt24OFV_cnt24ISSIGNALcount1:std_logic_vector(3downto0);SIGNALcount2:std_logic_vector(3downto0);SIGNALcarryin:std_logic;BEGINQ0=count1(0);Q1=count1(1);Q2=count1(2);Q3=count1(3);3Q4=count2(0);Q5=count2(1);process(clk)BEGINif(clk'eventandclk='1')thenif(count1=1001)thencount1=0000;count2=count2+1;elsecount1=count1+1;ENDif;if(count2=0010ANDcount1=0011)thencount2=0000;count1=0000;ENDif;ENDif;ENDprocess;ENDfunc_cnt24;cnt24仿真波形:43.cnt1000字模块代码:libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entityV_cnt1000isport(clk:instd_logic;cnt1000:outstd_logic;clk_c:outstd_logic);endV_cnt1000;architecturebhvofV_cnt1000issignaltmp:std_logic_vector(9downto0);signalamp:std_logic_vector(8downto0);beginprocess(clk)beginif(clk'eventandclk='1')thenif(tmp=1023)thentmp=0000000000;elsetmp=tmp+1;endif;if(tmp511)thencnt1000='0';elsecnt1000='1';endif;endif;endprocess;process(clk)beginif(clk'eventandclk='1')thenif(amp=511)thenamp=000000000;elseamp=amp+1;endif;if(amp255)thenclk_c='0';elseclk_c='1';endif;endif;endprocess;endbhv;5cnt1000仿真波形:4.clk_c子模块代码:libraryIEEE;useIEEE.std_logic_1164.all;useIEEE.std_logic_unsigned.all;ENTITYV_clk_cISPORT(clk,CLK_C,M1,S1,SS,MM,HH,CTRL:INSTD_LOGIC;CLKS,CLKM,CLKH:OUTSTD_LOGIC);ENDV_clk_c;ARCHITECTUREfuncOFV_clk_cISBEGINprocessbeginCLKS=(CTRLANDCLK)OR((NOTCTRL)ANDHHANDMMAND(NOTSS)ANDCLK_C);CLKM=(CTRLANDS1)OR((NOTCTRL)ANDHHAND(NOTMM)ANDSSANDCLK_C);CLKH=(CTRLANDM1)OR((NOTCTRL)AND(NOTHH)ANDMMANDSSANDCLK_C);ENDprocess;ENDfunc;65.display子模块代码:libraryIEEE;useIEEE.std_logic_1164.all;useIEEE.std_logic_unsigned.all;ENTITYdisplayISPORT(clk:INstd_logic;LED1Q_0,LED1Q_1,LED1Q_2,LED1Q_3:INstd_logic;LED2Q_0,LED2Q_1,LED2Q_2,LED2Q_3:INstd_logic;LED3Q_0,LED3Q_1,LED3Q_2,LED3Q_3:INstd_logic;LED4Q_0,LED4Q_1,LED4Q_2,LED4Q_3:INstd_logic;LED5Q_0,LED5Q_1,LED5Q_2,LED5Q_3:INstd_logic;LED6Q_0,LED6Q_1,LED6Q_2,LED6Q_3:INstd_logic;LED1,LED2,LED3,LED4,LED5,LED6:OUTstd_logic;SE_A,SE_B,SE_C,SE_D,SE_E,SE_F,SE_G:OUTstd_logic);ENDdisplay;ARCHITECTUREfuncOFdisplayISSIGNALctrl:std_logic_vector(2downto0);SIGNALcode:std_logic_vector(3downto0);BEGINprocess(ctrl)BEGINCASEctrlISWHEN000=LED1='1';LED2='0';LED3='0';LED4='0';LED5='0';LED6='0';code(0)=LED1Q_0;code(1)=LED1Q_1;code(2)=LED1Q_2;code(3)=LED1Q_3;WHEN001=LED1='0';LED2='1';LED3='0';LED4='0';LED5='0';LED6='0';7code(0)=LED2Q_0;code(1)=LED2Q_1;code(2)=LED2Q_2;code(3)=LED2Q_3;WHEN010=LED1='0';LED2='0';LED3='1';LED4='0';LED5='0';LED6='0';code(0)=LED3Q_0;code(1)=LED3Q_1;code(2)=LED3Q_2;code(3)=LED3Q_3;WHEN011=LED1='0';LED2='0';LED3='0';LED4='1';LED5='0';LED6='0';code(0)=LED4Q_0;code(1)=LED4Q_1;code(2)=LED4Q_2;code(3)=LED4Q_3;WHEN100=LED1='0';LED2='0';LED3='0';LED4='0';LED5='1';LED6='0';code(0)=LED5Q_0;code(1)=LED5Q_1;code(2)=LED5Q_2;code(3)=LED5Q_3;WHEN101=LED1='0';LED2='0';LED3='0';LED4='0';LED5='0';LED6='1';8code(0)=LED6Q_0;code(1)=LED6Q_1;code(2)=LED6Q_2;code(3)=LED6Q_3;WHENOTHERS=NULL;ENDCASE;ENDprocess;process(code)BEGINCASEcodeISWHEN0000=SE_A='1';SE_B='1';SE_C='1';SE_D='1';SE_E='1';SE_F='1';SE_G='0';WHEN0001=SE_A='0';SE_B='1';SE_C='1';SE_D='0';SE_E='0';SE_F='0';SE_G='0';WHEN0010=SE_A='1';SE_B='1';SE_C='0';SE_D='1';SE_E='1';SE_F='0';SE_G='1';WHEN0011=SE_A='1';SE_B='1';SE_C='1';SE_D='1';SE_E='0';SE_F='0';SE_G='1';WHEN0100=SE_A='0';SE_B='1';SE_C='1';SE_D='0';SE_E='0';SE_F='1';SE_G='1';WHEN0101=SE_A='1';SE_B='0';SE_C='1';SE_D='1';SE_E='0';SE_F='1';SE_G='1';WHEN0110=SE_A='1';SE_B='0';SE_C='1';SE_D='1';SE_E='1';SE_F='1';SE_G='1';WHEN0111=SE_A='1';SE_B='1';SE_C='1';SE_D='0';SE_E='0';SE_F='0';SE_G='0';WHEN1000=SE_A='1';SE_B='1';SE_C='1';SE_D='1';SE_E='1';SE_F='1';SE_G='1';WHEN1001=SE_A='1';SE_B='1';SE_C='1';SE_D='1';SE_E='0';SE_F='1';SE_G='1';WHEN1010=SE_A='1';SE_B='1';SE_C='1';SE_D='0';SE_E='1';SE_F='1';SE_G='1';9WHEN1011=SE_A='0';SE_B='0';SE_C='1';SE_D='1';SE_E='1';SE_F='1';SE_G='1';WHEN1100=SE_A='1';SE_B='0';SE_C='0';SE_D='1';SE_E='1';SE_F='1';SE_G='0';WHEN1101=SE_A='0';SE_B='1';SE_C='1';SE_D='1';SE_E='1';SE_F='0';SE_G='1';WHEN1110=SE_A='1';SE_