VHDL計(jì)數(shù)器程序_第1頁
VHDL計(jì)數(shù)器程序_第2頁
VHDL計(jì)數(shù)器程序_第3頁
VHDL計(jì)數(shù)器程序_第4頁
已閱讀5頁,還剩26頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、實(shí)用標(biāo)準(zhǔn)文案十五計(jì)數(shù)器libraryieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;ENTITYfiveteencoutISPORT(clk,reset,enable: INstd_logic;count: OUT std_logic_vector(3downto0);ENDfiveteencout;ARCHITECTUREcounterOF fiveteencoutISSIGNALcount_int:std_logic_vector(0to3);BEGINPROCESS(clk,reset)BEGINWAITU

2、NTILrising_edge(clk);IF reset= '1'THENcount_int<=(OTHERS =>'0');ELSIF enable='1'THENIF(count_int="1110")THENcount_int<="0000"ELSEcount_int<=count_int1;文檔大全實(shí)用標(biāo)準(zhǔn)文案-ELSE-NULL;-IF(count_int="1001")THEN-count_int<="0000"ENDIF;

3、ENDIF;ENDPROCESS;count<=count_int;- IF (reset='0') then -q<="0000"-ELSIF(clk'event and clk='1') THEN -q<=q 1;-IF (q<="1001") then -q<="0000"-END IF;-IF (reset<='1')THEN -q<="00"-ELSIF-wait until (clk'event a

4、nd clk='1');-WAIT UNTIL (clk'EVENT AND clk = '1');-WAITUNTIL(clock'EVENTANDclock='1');-q<=q'1'文檔大全實(shí)用標(biāo)準(zhǔn)文案-endif;-count<=q;-WAIT UNTILclock='1'-if(clock'eventandclock='1')then-WAITUNTILrising_edge(clock);-clock'eventandclock='1&

5、#39;-count<=0;-WAITUNTIL(clock'EVENTANDclock='1');-WAITriseedgeclock= '1'-if(clock'eventandclock='1') then-WAITUNTILrising_edge(clock);-count<=1;-WAITUNTIL(clock'EVENTANDclock='1');-WAITUNTILclock='1'-if(clock'eventandclock='1')th

6、en-WAITUNTILrising_edge(clock);-count<=2;-endif;-endif;-endif;- END PROCESS; END counter;文檔大全實(shí)用標(biāo)準(zhǔn)文案十四計(jì)數(shù)器libraryieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;ENTITYfourteencoutISPORT(clk,reset,enable: INstd_logic;count: OUT std_logic_vector(3downto0);ENDfourteencout;ARCHITECTURE

7、counterOF fourteencoutISSIGNALcount_int:std_logic_vector(0to3);BEGINPROCESS(clk,reset)BEGINWAITUNTILrising_edge(clk);IF reset= '1'THENcount_int<=(OTHERS =>'0');ELSIF enable='1'THENIF(count_int="1101")THENcount_int<="0000"ELSEcount_int<=count_in

8、t1;文檔大全實(shí)用標(biāo)準(zhǔn)文案-ELSE-NULL;-IF(count_int="1001")THEN-count_int<="0000"ENDIF;ENDIF;ENDPROCESS;count<=count_int;- IF (reset='0') then -q<="0000"-ELSIF(clk'event and clk='1') THEN -q<=q 1;-IF (q<="1001") then -q<="0000"

9、;-END IF;-IF (reset<='1')THEN -q<="00"-ELSIF-wait until (clk'event and clk='1');-WAIT UNTIL (clk'EVENT AND clk = '1');-WAITUNTIL(clock'EVENTANDclock='1');-q<=q'1'文檔大全實(shí)用標(biāo)準(zhǔn)文案-endif;-count<=q;-WAIT UNTILclock='1'-if(clock

10、'eventandclock='1')then-WAITUNTILrising_edge(clock);-clock'eventandclock='1'-count<=0;-WAITUNTIL(clock'EVENTANDclock='1');-WAITriseedgeclock= '1'-if(clock'eventandclock='1') then-WAITUNTILrising_edge(clock);-count<=1;-WAITUNTIL(clock'

11、EVENTANDclock='1');-WAITUNTILclock='1'-if(clock'eventandclock='1')then-WAITUNTILrising_edge(clock);-count<=2;-endif;-endif;-endif;- END PROCESS; END counter;文檔大全實(shí)用標(biāo)準(zhǔn)文案十三計(jì)數(shù)器libraryieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;ENTITYthireteencoutISPORT

12、(clk,reset,enable: IN std_logic;count: OUT std_logic_vector(3 downto 0);END thireteencout;ARCHITECTURE counter OF thireteencoutISSIGNALcount_int:std_logic_vector(0to 3);BEGINPROCESS(clk,reset)BEGINWAITUNTILrising_edge(clk);IF reset= '1'THENcount_int<=(OTHERS =>'0');ELSIF enable

13、='1'THENIF(count_int="1100")THENcount_int<="0000"ELSEcount_int<=count_int1;文檔大全實(shí)用標(biāo)準(zhǔn)文案-ELSE-NULL;-IF(count_int="1001")THEN-count_int<="0000"ENDIF;ENDIF;ENDPROCESS;count<=count_int;- IF (reset='0') then -q<="0000"-ELSIF(c

14、lk'event and clk='1') THEN -q<=q 1;-IF (q<="1001") then -q<="0000"-END IF;-IF (reset<='1')THEN -q<="00"-ELSIF-wait until (clk'event and clk='1');-WAIT UNTIL (clk'EVENT AND clk = '1');-WAITUNTIL(clock'EVENTAN

15、Dclock='1');-q<=q'1'文檔大全實(shí)用標(biāo)準(zhǔn)文案-endif;-count<=q;-WAIT UNTILclock='1'-if(clock'eventandclock='1')then-WAITUNTILrising_edge(clock);-clock'eventandclock='1'-count<=0;-WAITUNTIL(clock'EVENTANDclock='1');-WAITriseedgeclock= '1'-i

16、f(clock'eventandclock='1') then-WAITUNTILrising_edge(clock);-count<=1;-WAITUNTIL(clock'EVENTANDclock='1');-WAITUNTILclock='1'-if(clock'eventandclock='1')then-WAITUNTILrising_edge(clock);-count<=2;-endif;-endif;-endif;- END PROCESS; END counter;文檔大全實(shí)用

17、標(biāo)準(zhǔn)文案十二計(jì)數(shù)器libraryieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;ENTITYtwelvecoutISPORT(clk,reset,enable: INstd_logic;count: OUT std_logic_vector(3downto0);ENDtwelvecout;ARCHITECTUREcounterOF twelvecoutISSIGNALcount_int:std_logic_vector(0to3);BEGINPROCESS(clk,reset)BEGINWAITUNTILrisi

18、ng_edge(clk);IF reset= '1'THENcount_int<=(OTHERS =>'0');ELSIF enable='1'THENIF(count_int="1011")THENcount_int<="0000"ELSEcount_int<=count_int1;文檔大全實(shí)用標(biāo)準(zhǔn)文案-ELSE-NULL;-IF(count_int="1001")THEN-count_int<="0000"ENDIF;ENDIF;EN

19、DPROCESS;count<=count_int;- IF (reset='0') then -q<="0000"-ELSIF(clk'event and clk='1') THEN -q<=q 1;-IF (q<="1001") then -q<="0000"-END IF;-IF (reset<='1')THEN -q<="00"-ELSIF-wait until (clk'event and clk=&

20、#39;1');-WAIT UNTIL (clk'EVENT AND clk = '1');-WAITUNTIL(clock'EVENTANDclock='1');-q<=q'1'文檔大全實(shí)用標(biāo)準(zhǔn)文案-endif;-count<=q;-WAIT UNTILclock='1'-if(clock'eventandclock='1')then-WAITUNTILrising_edge(clock);-clock'eventandclock='1'-cou

21、nt<=0;-WAITUNTIL(clock'EVENTANDclock='1');-WAITriseedgeclock= '1'-if(clock'eventandclock='1') then-WAITUNTILrising_edge(clock);-count<=1;-WAITUNTIL(clock'EVENTANDclock='1');-WAITUNTILclock='1'-if(clock'eventandclock='1')then-WAITU

22、NTILrising_edge(clock);-count<=2;-endif;-endif;-endif;- END PROCESS; END counter;文檔大全實(shí)用標(biāo)準(zhǔn)文案十一計(jì)數(shù)器libraryieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;ENTITYelevencoutISPORT(clk,reset,enable: INstd_logic;count: OUT std_logic_vector(3downto0);ENDelevencout;ARCHITECTUREcounterOF el

23、evencoutISSIGNALcount_int:std_logic_vector(0to3);BEGINPROCESS(clk,reset)BEGINWAITUNTILrising_edge(clk);IF reset='1'THENcount_int<=(OTHERS =>'0');ELSIF enable='1'THENIF(count_int="1010")THENcount_int<="0000"ELSEcount_int<=count_int1;文檔大全實(shí)用標(biāo)準(zhǔn)文案-E

24、LSE-NULL;-IF(count_int="1001")THEN-count_int<="0000"ENDIF;ENDIF;ENDPROCESS;count<=count_int;- IF (reset='0') then -q<="0000"-ELSIF(clk'event and clk='1') THEN -q<=q 1;-IF (q<="1001") then -q<="0000"-END IF;-IF (r

25、eset<='1')THEN -q<="00"-ELSIF-wait until (clk'event and clk='1');-WAIT UNTIL (clk'EVENT AND clk = '1');-WAITUNTIL(clock'EVENTANDclock='1');-q<=q'1'文檔大全實(shí)用標(biāo)準(zhǔn)文案-endif;-count<=q;-WAIT UNTILclock='1'-if(clock'eventandcl

26、ock='1')then-WAITUNTILrising_edge(clock);-clock'eventandclock='1'-count<=0;-WAITUNTIL(clock'EVENTANDclock='1');-WAITriseedgeclock= '1'-if(clock'eventandclock='1') then-WAITUNTILrising_edge(clock);-count<=1;-WAITUNTIL(clock'EVENTANDclock=&

27、#39;1');-WAITUNTILclock='1'-if(clock'eventandclock='1')then-WAITUNTILrising_edge(clock);-count<=2;-endif;-endif;-endif;- END PROCESS; END counter;文檔大全實(shí)用標(biāo)準(zhǔn)文案十計(jì)數(shù)器libraryieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;ENTITYcountISPORT(clk,reset,enable: INstd

28、_logic;count:OUT std_logic_vector(3downto 0);END count;ARCHITECTURE counterOF countISSIGNAL count_int:std_logic_vector(0to 3);BEGINPROCESS(clk,reset)BEGINWAIT UNTIL rising_edge(clk);IF reset= '1'THENcount_int<=(OTHERS=> '0');ELSIF enable= '1'THENIF(count_int="1001&

29、quot;)THENcount_int<="0000"文檔大全實(shí)用標(biāo)準(zhǔn)文案ELSEcount_int<= count_int1;-ELSE- NULL;-IF (count_int="1001")THEN-count_int<="0000"ENDIF;ENDIF;ENDPROCESS;count<=count_int;- IF (reset='0') then -q<="0000"-ELSIF(clk'event and clk='1') THE

30、N -q<=q 1;-IF (q<="1001") then -q<="0000"-END IF;-IF (reset<='1')THEN -q<="00"-ELSIF-wait until (clk'event and clk='1');-WAIT UNTIL (clk'EVENT AND clk = '1');文檔大全實(shí)用標(biāo)準(zhǔn)文案-WAITUNTIL(clock'EVENTANDclock='1');- q<

31、=q '1' -end if; -count<=q;- WAIT UNTIL clock = '1'-if(clock'eventandclock='1')then-WAITUNTILrising_edge(clock);-clock'eventandclock='1'-count<=0;-WAITUNTIL(clock'EVENTANDclock='1');-WAITriseedgeclock= '1'-if(clock'eventandclock=&#

32、39;1') then-WAITUNTILrising_edge(clock);-count<=1;-WAITUNTIL(clock'EVENTANDclock='1');-WAITUNTILclock='1'-if(clock'eventandclock='1')then-WAITUNTILrising_edge(clock);-count<=2;-endif;-endif;-endif;文檔大全實(shí)用標(biāo)準(zhǔn)文案- END PROCESS; END counter;九計(jì)數(shù)器libraryieee;use ieee

33、.std_logic_1164.all;use ieee.std_logic_unsigned.all;ENTITYninecoutISPORT(clk,reset,enable: INstd_logic;count: OUT std_logic_vector(3downto0);ENDninecout;ARCHITECTUREcounterOF ninecoutISSIGNALcount_int:std_logic_vector(0to3);BEGINPROCESS(clk,reset)BEGINWAITUNTILrising_edge(clk);IF reset= '1'T

34、HENcount_int<=(OTHERS =>'0');ELSIF enable='1'THENIF(count_int="1000")THENcount_int<="0000"文檔大全實(shí)用標(biāo)準(zhǔn)文案ELSEcount_int<= count_int1;-ELSE- NULL;-IF (count_int="1001")THEN-count_int<="0000"ENDIF;ENDIF;ENDPROCESS;count<=count_int;- I

35、F (reset='0') then -q<="0000"-ELSIF(clk'event and clk='1') THEN -q<=q 1;-IF (q<="1001") then -q<="0000"-END IF;-IF (reset<='1')THEN -q<="00"-ELSIF-wait until (clk'event and clk='1');-WAIT UNTIL (clk'

36、;EVENT AND clk = '1');文檔大全實(shí)用標(biāo)準(zhǔn)文案-WAITUNTIL(clock'EVENTANDclock='1');- q<=q '1' -end if; -count<=q;- WAIT UNTIL clock = '1'-if(clock'eventandclock='1')then-WAITUNTILrising_edge(clock);-clock'eventandclock='1'-count<=0;-WAITUNTIL(clo

37、ck'EVENTANDclock='1');-WAITriseedgeclock= '1'-if(clock'eventandclock='1') then-WAITUNTILrising_edge(clock);-count<=1;-WAITUNTIL(clock'EVENTANDclock='1');-WAITUNTILclock='1'-if(clock'eventandclock='1')then-WAITUNTILrising_edge(clock);

38、-count<=2;-endif;-endif;-endif;文檔大全實(shí)用標(biāo)準(zhǔn)文案- END PROCESS; END counter;八計(jì)數(shù)器libraryieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;ENTITYeightcoutISPORT(clk,reset,enable: INstd_logic;count: OUT std_logic_vector(2downto0);ENDeightcout;ARCHITECTUREcounterOF eightcoutISSIGNALcount_int:s

39、td_logic_vector(0to2);BEGINPROCESS(clk,reset)BEGINWAITUNTILrising_edge(clk);IF reset= '1'THENcount_int<=(OTHERS =>'0');ELSIF enable='1'THENIF(count_int="111")THENcount_int<="000"文檔大全實(shí)用標(biāo)準(zhǔn)文案ELSEcount_int<= count_int1;-ELSE- NULL;-IF (count_int=&q

40、uot;1001")THEN-count_int<="0000"ENDIF;ENDIF;ENDPROCESS;count<=count_int;- IF (reset='0') then -q<="0000"-ELSIF(clk'event and clk='1') THEN -q<=q 1;-IF (q<="1001") then -q<="0000"-END IF;-IF (reset<='1')THEN

41、 -q<="00"-ELSIF-wait until (clk'event and clk='1');-WAIT UNTIL (clk'EVENT AND clk = '1');文檔大全實(shí)用標(biāo)準(zhǔn)文案-WAITUNTIL(clock'EVENTANDclock='1');- q<=q '1' -end if; -count<=q;- WAIT UNTIL clock = '1'-if(clock'eventandclock='1')

42、then-WAITUNTILrising_edge(clock);-clock'eventandclock='1'-count<=0;-WAITUNTIL(clock'EVENTANDclock='1');-WAITriseedgeclock= '1'-if(clock'eventandclock='1') then-WAITUNTILrising_edge(clock);-count<=1;-WAITUNTIL(clock'EVENTANDclock='1');-WAI

43、TUNTILclock='1'-if(clock'eventandclock='1')then-WAITUNTILrising_edge(clock);-count<=2;-endif;-endif;-endif;文檔大全實(shí)用標(biāo)準(zhǔn)文案- END PROCESS; END counter;六計(jì)數(shù)器libraryieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;ENTITYsixcoutISPORT(clk,reset,enable: IN std_logic;count

44、: OUT std_logic_vector(2 downto 0);ENDsixcout;ARCHITECTUREcounterOFsixcoutISSIGNALcount_int:std_logic_vector(0to 2);BEGINPROCESS(clk,reset)BEGINWAIT UNTIL rising_edge(clk);IF reset= '1'THENcount_int<=(OTHERS=>'0');ELSIF enable='1'THEN文檔大全實(shí)用標(biāo)準(zhǔn)文案IF(count_int="101&quo

45、t;)THENcount_int<="000"ELSEcount_int<= count_int1;-ELSE- NULL;-IF(count_int="1001")THEN-count_int<="0000"ENDIF;ENDIF;ENDPROCESS;count <= count_int;- IF(reset='0')then-q<="0000"-ELSIF(clk'eventandclk='1') THEN-q<=q1;-IF(q&l

46、t;="1001")then-q<="0000"-ENDIF;-IF(reset<='1')THEN-q<="00"-ELSIF文檔大全實(shí)用標(biāo)準(zhǔn)文案-waituntil(clk'eventandclk='1');-WAITUNTIL(clk'EVENTANDclk='1');-WAITUNTIL(clock'EVENTANDclock='1');- q<=q '1' -end if; -count<=q

47、;- WAIT UNTIL clock = '1'-if(clock'eventandclock='1')then-WAITUNTILrising_edge(clock);-clock'eventandclock='1'-count<=0;-WAITUNTIL(clock'EVENTANDclock='1');-WAITriseedgeclock= '1'-if(clock'eventandclock='1') then-WAITUNTILrising_edge(clock);-count<=1;-WAITUNTIL(clock'EVENTAND

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論