LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;USEIEEE.STD_LOGIC_UNSIGNED.ALL;--------------------------------------------------------------------------------------------ENTITYCNT9ISPORT(CLK,en:INSTD_LOGIC;PLD,ENB:INSTD_LOGIC;-------PLD±íʾ¸´Î»ÐźÅWARN:OUTSTD_LOGIC;S0:OUTSTD_LOGIC_VECTOR(6DOWNTO0));------------ÒëÂëÊä³ö£¬S0Ϊ¸öλENDCNT9;--------------------------------------------------------------------------------------------ARCHITECTUREAOFCNT9ISSIGNALSS:STD_LOGIC_VECTOR(3DOWNTO0);-------------SS±íʾ¸öλBEGINPRO1:PROCESS(CLK,en,ENB)VARIABLETMPA:STD_LOGIC_VECTOR(3DOWNTO0);VARIABLETMPWARN:STD_LOGIC;BEGINIFen='1'THENTMPA:=1001;TMPWARN:='0';ELSIFCLK'EVENTANDCLK='1'THENTMPA:=TMPA-1;iftmpa='0'thenTMPWARN:='1';ENDIF;ENDIF;SS=TMPA;WARN=TMPWARN;PROCESS(SS)BEGINCASESSIS--------------------------¸öλÏÔʾ²¿·ÖWHEN0000=S0=0111111;--ÏÔʾ0WHEN0001=S0=0000110;--ÏÔʾ1WHEN0010=S0=1011011;--ÏÔʾ2WHEN0011=S0=1001111;--ÏÔʾ3WHEN0100=S0=1100110;--ÏÔʾ4WHEN0101=S0=1101101;--ÏÔʾ5WHEN0110=S0=1111101;--ÏÔʾ6WHEN0111=S0=0000111;--ÏÔʾ7WHEN1000=S0=1111111;--ÏÔʾ8WHEN1001=S0=1101111;--ÏÔʾ9WHENOTHERS=S0=0000000;ENDCASE;ENDPROCESS;ENDA;