VHDL源代码-计数器_第1页
VHDL源代码-计数器_第2页
VHDL源代码-计数器_第3页
已阅读5页,还剩14页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、实用文档十五计数器library ieee;use ieee.std_logic_ un sig ned.all;ENTITY fivetee ncout ISPORT(clk,reset,e nable : IN stdo gic; cou nt : OUT stdo gic_vector(3 dow nto 0);END fivetee ncout;ARCHITECTURE cou nter OF fivetee ncout ISSIGNAL cou nt_in t:stdo gic_vector(0 to 3);BEGINPROCESS(clk,reset)BEGINWAIT UNTIL

2、 risi ng_edge(clk);IF reset = '1' THENcou nt_int <= (OTHERS => '0');ELSIF en able = '1' THENIF(cou nt_in t="1110") THENcou nt_in t<="0000"ELSEcount_int <= count_int 1;-ELSE-NULL ;-IF (cou nt_in t="1001") THEN-cou nt_in t<="000

3、0"END IF;END IF;END PROCESS;count <= count_int;-IF (reset='0') the n-q<="0000"-ELSIF(clk'eve nt and clk='1') THEN-q<=q 1;-IF (q<="1001") then-q<="0000"-END IF;-IF (reset<='1')THEN-q<="00"-ELSIF-wait un til

4、(clk'eve nt and clk='1');-WAIT UNTIL (clk'EVENT AND clk = '1');-WAIT UNTIL (clock'EVENT AND clock = '1');-q<=q '1'-e nd if;-co un t<=q;-WAIT UNTIL clock = '1'-if (clock'eve nt and clock='1')the n-WAIT UNTIL risi ng_edge(clock);-cl

5、ock'eve nt and clock='1'-co unt <= 0;-WAIT UNTIL (clock'EVENT AND clock = '1');-WAIT riseedge clock = '1'-if (clock'eve nt and clock='1') the n-WAIT UNTIL risi ng_edge(clock);-co unt <= 1;-WAIT UNTIL (clock'EVENT AND clock = '1');-WAIT UN

6、TIL clock = '1'-if (clock'eve nt and clock='1')the n-WAIT UNTIL risi ng_edge(clock);-co unt <= 2;-e nd if;-e nd if;-e nd if;-END PROCESS;END cou nter;十四计数器library ieee;use ieee.std _lo gic_1164.all;use ieee.std_logic_ un sig ned.all;ENTITY fourtee ncout ISPORT(clk,reset,e nabl

7、e : IN stdo gic; cou nt : OUT stdo gic_vector(3 dow nto 0); END fourtee ncout;ARCHITECTURE counter OF fourtee ncout ISSIGNAL cou nt_in t:stdo gic_vector(0 to 3);BEGINPROCESS(clk,reset)BEGINWAIT UNTIL risi ng_edge(clk);IF reset = '1' THENcou nt_int <= (OTHERS => '0');ELSIF en ab

8、le = '1' THENIF(cou nt_in t="1101") THENcou nt_in t<="0000"ELSEcount_int <= count_int 1;-ELSE-NULL ;-IF (cou nt_in t="1001") THEN-cou nt_in t<="0000"END IF;END IF;END PROCESS;count <= count_int;-IF (reset='0') the n-q<="0000

9、"-ELSIF(clk'eve nt and clk='1') THEN-q<=q 1;-IF (q<="1001") then-q<="0000"-END IF;-IF (reset<='1')THEN-q<="00"-ELSIF-wait un til (clk'eve nt and clk='1');-WAIT UNTIL (clk'EVENT AND clk = '1');-WAIT UNTIL (c

10、lock'EVENT AND clock = '1');-q<=q '1'-e nd if;-co un t<=q;-WAIT UNTIL clock = '1'-if (clock'eve nt and clock='1')the n-WAIT UNTIL risi ng_edge(clock);-clock'eve nt and clock='1'-co unt <= 0;-WAIT UNTIL (clock'EVENT AND clock = '1&#

11、39;);-WAIT riseedge clock = '1'-if (clock'eve nt and clock='1') the n-WAIT UNTIL risi ng_edge(clock);-co unt <= 1;-WAIT UNTIL (clock'EVENT AND clock = '1');-WAIT UNTIL clock = '1'-if (clock'eve nt and clock='1')the n-WAIT UNTIL risi ng_edge(cloc

12、k);-co unt <= 2;-e nd if;-e nd if;-e nd if;-END PROCESS;END cou nter;十三计数器library ieee;use ieee.std _lo gic_1164.all;use ieee.std_logic_ un sig ned.all;ENTITY thiretee ncout ISPORT(clk,reset,e nable : IN stdo gic; cou nt : OUT stdo gic_vector(3 dow nto 0); END thiretee ncout;ARCHITECTURE counter

13、OF thiretee ncout ISSIGNAL cou nt_in t:stdo gic_vector(0 to 3);BEGINPROCESS(clk,reset)BEGINWAIT UNTIL risi ng_edge(clk);IF reset = '1' THENcou nt_int <= (OTHERS => '0');ELSIF en able = '1' THENIF(cou nt_in t="1100") THENcou nt_in t<="0000"ELSEcoun

14、t_int <= count_int 1;-ELSE-NULL ;-IF (cou nt_in t="1001") THEN-cou nt_in t<="0000"END IF;END IF;END PROCESS;count <= count_int;-IF (reset='0') the n-q<="0000"-ELSIF(clk'eve nt and clk='1') THEN-q<=q 1;-IF (q<="1001") then-

15、q<="0000"-END IF;-IF (reset<='1')THEN-q<="00"-ELSIF-wait un til (clk'eve nt and clk='1');-WAIT UNTIL (clk'EVENT AND clk = '1');-WAIT UNTIL (clock'EVENT AND clock = '1');-q<=q '1'-e nd if;-co un t<=q;-WAIT UNTIL cl

16、ock = '1'-if (clock'eve nt and clock='1')the n-WAIT UNTIL risi ng_edge(clock);-clock'eve nt and clock='1'-co unt <= 0;-WAIT UNTIL (clock'EVENT AND clock = '1');-WAIT riseedge clock = '1'-if (clock'eve nt and clock='1') the n-WAIT UNT

17、IL risi ng_edge(clock);-co unt <= 1;-WAIT UNTIL (clock'EVENT AND clock = '1');-WAIT UNTIL clock = '1'-if (clock'eve nt and clock='1')the n-WAIT UNTIL risi ng_edge(clock);-co unt <= 2;-e nd if;-e nd if;-e nd if;-END PROCESS;END cou nter;十二计数器library ieee;use ieee

18、.std _lo gic_1164.all;use ieee.std_logic_ un sig ned.all;ENTITY twelvecout ISPORT(clk,reset,e nable : IN stdo gic; cou nt : OUT stdo gic_vector(3 dow nto 0);END twelvecout;ARCHITECTURE counter OF twelvecout ISSIGNAL cou nt_in t:stdo gic_vector(0 to 3);BEGINPROCESS(clk,reset)BEGINWAIT UNTIL risi ng_e

19、dge(clk);IF reset = '1' THENcou nt_int <= (OTHERS => '0');ELSIF en able = '1' THENIF(cou nt_in t="1011") THENcou nt_in t<="0000"ELSEcount_int <= count_int 1;-ELSE-NULL ;-IF (cou nt_in t="1001") THEN-cou nt_in t<="0000"END

20、 IF;END IF;END PROCESS;count <= count_int;-IF (reset='O') then-q<="0000"-ELSIF(clk'eve nt and clk='1') THEN-q<=q 1;-IF (q<="1001") then-q<="0000"-END IF;-IF (reset<='1')THEN-q<="00"-ELSIF-wait un til (clk'ev

21、e nt and clk='1');-WAIT UNTIL (clk'EVENT AND clk = '1');-WAIT UNTIL (clock'EVENT AND clock = '1');-q<=q '1'-e nd if;-co un t<=q;-WAIT UNTIL clock = '1'-if (clock'eve nt and clock='1')the n-WAIT UNTIL risi ng_edge(clock);-clock'eve

22、 nt and clock='1'-co unt <= 0;-WAIT UNTIL (clock'EVENT AND clock = '1');-WAIT riseedge clock = '1'-if (clock'eve nt and clock='1') the n-WAIT UNTIL risi ng_edge(clock);-co unt <= 1;-WAIT UNTIL (clock'EVENT AND clock = '1');-WAIT UNTIL clock =

23、 '1'-if (clock'eve nt and clock='1')the n-WAIT UNTIL risi ng_edge(clock);-co unt <= 2;-e nd if;-e nd if;-e nd if;-END PROCESS;END cou nter;十一计数器library ieee;use ieee.std _lo gic_1164.all;use ieee.std_logic_ un sig ned.all;ENTITY eleve ncout ISPORT(clk,reset,e nable : IN stdo g

24、ic; cou nt : OUT stdo gic_vector(3 dow nto 0);END eleve ncout;ARCHITECTURE counter OF eleve ncout ISSIGNAL cou nt_in t:stdo gic_vector(0 to 3);BEGINPROCESS(clk,reset)BEGINWAIT UNTIL risi ng_edge(clk);IF reset = '1' THENcou nt_int <= (OTHERS => '0');ELSIF en able = '1' T

25、HENIF(cou nt_in t="1010") THENcou nt_in t<="0000"ELSEcount_int <= count_int 1;-ELSE-NULL ;-IF (cou nt_in t="1001") THEN-cou nt_in t<="0000"END IF;END IF;END PROCESS;count <= count_int;-IF (reset='O') the n-q<="0000"-ELSIF(clk&#

26、39;eve nt and clk='1') THEN-q<=q 1;-IF (q<="1001") then-q<="0000"-END IF;-IF (reset<='1')THEN-q<="00"-ELSIF-wait un til (clk'eve nt and clk='1');-WAIT UNTIL (clk'EVENT AND clk = '1');-WAIT UNTIL (clock'EVENT AND

27、 clock = '1');-q<=q '1'-e nd if;-co un t<=q;-WAIT UNTIL clock = '1'-if (clock'eve nt and clock='1')the n-WAIT UNTIL risi ng_edge(clock);-clock'eve nt and clock='1'-co unt <= 0;-WAIT UNTIL (clock'EVENT AND clock = '1');-WAIT riseedg

28、e clock = '1'-if (clock'eve nt and clock='1') the n-WAIT UNTIL risi ng_edge(clock);-co unt <= 1;-WAIT UNTIL (clock'EVENT AND clock = '1');-WAIT UNTIL clock = '1'-if (clock'eve nt and clock='1')the n-WAIT UNTIL risi ng_edge(clock);-co unt <= 2

29、;-e nd if;-e nd if;-e nd if;-END PROCESS;END cou nter;十计数器library ieee;use ieee.std _lo gic_1164.all;use ieee.std_logic_ un sig ned.all;ENTITY count ISPORT(clk,reset,e nable : IN stdo gic; cou nt : OUT stdo gic_vector(3 dow nto 0);END cou nt;ARCHITECTURE cou nter OF count ISSIGNAL cou nt_in t:stdo g

30、ic_vector(0 to 3);BEGINPROCESS(clk,reset)BEGINWAIT UNTIL risi ng_edge(clk);IF reset = '1' THENcou nt_int <= (OTHERS => '0');ELSIF en able = '1' THENIF(cou nt_in t="1001") THENcou nt_in t<="0000"ELSEcount_int <= count_int 1;-ELSE-NULL ;-IF (cou

31、nt_in t="1001") THEN-cou nt_in t<="0000"END IF;END IF;END PROCESS;count <= count_int;-IF (reset='O') the n-q<="0000"-ELSIF(clk'eve nt and clk='1') THEN-q<=q 1;-IF (q<="1001") then-q<="0000"-END IF;-IF (reset<=

32、'1')THEN-q<="00"-ELSIF-wait un til (clk'eve nt and clk='1');-WAIT UNTIL (clk'EVENT AND clk = '1');-WAIT UNTIL (clock'EVENT AND clock = '1');-q<=q '1'-e nd if;-co un t<=q;-WAIT UNTIL clock = '1'-if (clock'eve nt and cl

33、ock='1')the n-WAIT UNTIL risi ng_edge(clock);-clock'eve nt and clock='1'-co unt <= 0;-WAIT UNTIL (clock'EVENT AND clock = '1');-WAIT riseedge clock = '1'-if (clock'eve nt and clock='1') the n-WAIT UNTIL risi ng_edge(clock);-co unt <= 1;-WAIT

34、UNTIL (clock'EVENT AND clock = '1');-WAIT UNTIL clock = '1'-if (clock'eve nt and clock='1')the n-WAIT UNTIL risi ng_edge(clock);-co unt <= 2;-e nd if;-e nd if;-e nd if;-END PROCESS;END cou nter;九计数器library ieee;use ieee.std _lo gic_1164.all;use ieee.std_logic_ un s

35、ig ned.all;ENTITY nin ecout ISPORT(clk,reset,e nable : IN stdo gic; cou nt : OUT stdo gic_vector(3 dow nto 0);END nin ecout;ARCHITECTURE cou nter OF nin ecout ISSIGNAL cou nt_in t:stdo gic_vector(0 to 3);BEGINPROCESS(clk,reset)BEGINWAIT UNTIL risi ng_edge(clk);IF reset = '1' THENcou nt_int &

36、lt;= (OTHERS => '0');ELSIF en able = '1' THENIF(cou nt_in t="1000") THENcou nt_in t<="0000"ELSEcount_int <= count_int 1;-ELSE-NULL ;-IF (cou nt_in t="1001") THEN-cou nt_in t<="0000"END IF;END IF;END PROCESS;count <= count_int;-IF

37、 (reset='0') the n-q<="0000"-ELSIF(clk'eve nt and clk='1') THEN-q<=q 1;-IF (q<="1001") then-q<="0000"-END IF;-IF (reset<='1')THEN-q<="00"-ELSIF-wait un til (clk'eve nt and clk='1');-WAIT UNTIL (clk'

38、EVENT AND clk = '1');-WAIT UNTIL (clock'EVENT AND clock = '1');-q<=q '1'-e nd if;-co un t<=q;-WAIT UNTIL clock = '1'-if (clock'eve nt and clock='1')the n-WAIT UNTIL risi ng_edge(clock);-clock'eve nt and clock='1'-co unt <= 0;-WAIT

39、UNTIL (clock'EVENT AND clock = '1');-WAIT riseedge clock = '1'-if (clock'eve nt and clock='1') the n-WAIT UNTIL risi ng_edge(clock);-co unt <= 1;-WAIT UNTIL (clock'EVENT AND clock = '1');-WAIT UNTIL clock = '1'-if (clock'eve nt and clock=

40、9;1')the n-WAIT UNTIL risi ng_edge(clock);-co unt <= 2;-e nd if;-e nd if;-e nd if;-END PROCESS;END cou nter;八计数器library ieee;use ieee.std_logic_ un sig ned.all;ENTITY eightcout ISPORT(clk,reset,e nable : IN stdo gic; cou nt : OUT stdo gic_vector(2 dow nto 0); END eightcout;ARCHITECTURE counte

41、r OF eightcout ISSIGNAL cou nt_in t:stdo gic_vector(0 to 2);BEGINPROCESS(clk,reset)BEGINWAIT UNTIL risi ng_edge(clk);IF reset = '1' THENcou nt_int <= (OTHERS => '0');ELSIF en able = '1' THENIF(cou nt_i nt="111") THENcount_in t<="000"ELSEcount_int

42、<= count_int 1;-ELSE-NULL ;-IF (cou nt_in t="1001") THEN-cou nt_in t<="0000"END IF;END IF;END PROCESS;count <= count_int;-IF (reset='0') the n-q<="0000"-ELSIF(clk'eve nt and clk='1') THEN-q<=q 1;-IF (q<="1001") then-q<=

43、"0000"-END IF;-IF (reset<='1')THEN-q<="00"-ELSIF-wait un til (clk'eve nt and clk='1');-WAIT UNTIL (clk'EVENT AND clk = '1');-WAIT UNTIL (clock'EVENT AND clock = '1');-q<=q '1'-e nd if;-co un t<=q;-WAIT UNTIL clock =

44、'1'-if (clock'eve nt and clock='1')the n-WAIT UNTIL risi ng_edge(clock);-clock'eve nt and clock='1'-co unt <= 0;-WAIT UNTIL (clock'EVENT AND clock = '1');-WAIT riseedge clock = '1'-if (clock'eve nt and clock='1') the n-WAIT UNTIL ris

45、i ng_edge(clock);-co unt <= 1;-WAIT UNTIL (clock'EVENT AND clock = '1');-WAIT UNTIL clock = '1'-if (clock'eve nt and clock='1')the n-WAIT UNTIL risi ng_edge(clock);-co unt <= 2;-e nd if;-e nd if;-e nd if;-END PROCESS;END cou nter;六计数器library ieee;use ieee.std _l

46、o gic_1164.all;use ieee.std_logic_ un sig ned.all;ENTITY sixcout ISPORT(clk,reset,e nable : IN stdo gic; cou nt : OUT stdo gic_vector(2 dow nto 0);END sixcout;ARCHITECTURE counter OF sixcout ISSIGNAL count_in t:stdo gic_vector(0 to 2);BEGINPROCESS(clk,reset)BEGINWAIT UNTIL risi ng_edge(clk);IF reset

47、 = '1' THENcou nt_int <= (OTHERS => '0');ELSIF en able = '1' THENIF(cou nt_i nt="1O1") THEN count_in t<="000"ELSEcount_int <= count_int 1;-ELSE-NULL ;-IF (cou nt_in t="1001") THEN-cou nt_in t<="0000"END IF;END IF;END PROC

48、ESS;count <= count_int;-IF (reset='0') the n-q<="0000"-ELSIF(clk'eve nt and clk='1') THEN-q<=q 1;-IF (q<="1001") then-q<="0000"-END IF;-IF (reset<='1')THEN-q<="00"-ELSIF-wait un til (clk'eve nt and clk='

49、1');-WAIT UNTIL (clk'EVENT AND clk = '1');-WAIT UNTIL (clock'EVENT AND clock = '1');-q<=q '1'-e nd if;-co un t<=q;-WAIT UNTIL clock = '1'-if (clock'eve nt and clock='1')the n-WAIT UNTIL risi ng_edge(clock);-clock'eve nt and clock='

50、;1'-co unt <= 0;-WAIT UNTIL (clock'EVENT AND clock = '1');-WAIT riseedge clock = '1'-if (clock'eve nt and clock='1') the n-WAIT UNTIL risi ng_edge(clock);-co unt <= 1;-WAIT UNTIL (clock'EVENT AND clock = '1');-WAIT UNTIL clock = '1'-if (clock'eve nt and clock='1')the n-WAIT UNTIL risi ng_edge(clock);-co unt <= 2;-e nd if;-e nd if;-e nd if;-END PROCESS;END cou nt

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论