![VHDL源代碼-計數(shù)器[分享借鑒]_第1頁](http://file1.renrendoc.com/fileroot_temp2/2020-10/2/38efda9e-5c6b-47bc-b2df-1207a96e192c/38efda9e-5c6b-47bc-b2df-1207a96e192c1.gif)
![VHDL源代碼-計數(shù)器[分享借鑒]_第2頁](http://file1.renrendoc.com/fileroot_temp2/2020-10/2/38efda9e-5c6b-47bc-b2df-1207a96e192c/38efda9e-5c6b-47bc-b2df-1207a96e192c2.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、十五計數(shù)器library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;ENTITY fiveteencout ISPORT(clk,reset,enable : IN std_logic; count : OUT std_logic_vector(3 downto 0);END fiveteencout;ARCHITECTURE counter OF fiveteencout ISSIGNAL count_int:std_logic_vector(0 to 3);BEGINPROCESS(clk,reset)
2、BEGINWAIT UNTIL rising_edge(clk);IF reset = 1 THENcount_int 0);ELSIF enable = 1 THENIF(count_int=1110) THENcount_int=0000;ELSEcount_int = count_int 1;-ELSE- NULL ;-IF (count_int=1001) THEN-count_int=0000;END IF;END IF;END PROCESS;count = count_int;- IF (reset=0) then-q=0000;-ELSIF(clkevent and clk=1
3、) THEN-q=q 1;-IF (q=1001) then-q=0000;-END IF;-IF (reset=1)THEN-q=00;-ELSIF-wait until (clkevent and clk=1);-WAIT UNTIL (clkEVENT AND clk = 1);-WAIT UNTIL (clockEVENT AND clock = 1);- q=q 1;-end if;-count=q;- WAIT UNTIL clock = 1;-if (clockevent and clock=1)then-WAIT UNTIL rising_edge(clock);-clocke
4、vent and clock=1;-count = 0;-WAIT UNTIL (clockEVENT AND clock = 1);-WAIT riseedge clock = 1;-if (clockevent and clock=1) then-WAIT UNTIL rising_edge(clock);-count = 1;-WAIT UNTIL (clockEVENT AND clock = 1);-WAIT UNTIL clock = 1;-if (clockevent and clock=1)then-WAIT UNTIL rising_edge(clock);-count =
5、2;-end if;-end if;-end if;- END PROCESS;END counter;十四計數(shù)器library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;ENTITY fourteencout ISPORT(clk,reset,enable : IN std_logic; count : OUT std_logic_vector(3 downto 0);END fourteencout;ARCHITECTURE counter OF fourteencout ISSIGNAL count_
6、int:std_logic_vector(0 to 3);BEGINPROCESS(clk,reset)BEGINWAIT UNTIL rising_edge(clk);IF reset = 1 THENcount_int 0);ELSIF enable = 1 THENIF(count_int=1101) THENcount_int=0000;ELSEcount_int = count_int 1;-ELSE- NULL ;-IF (count_int=1001) THEN-count_int=0000;END IF;END IF;END PROCESS;count = count_int;
7、- IF (reset=0) then-q=0000;-ELSIF(clkevent and clk=1) THEN-q=q 1;-IF (q=1001) then-q=0000;-END IF;-IF (reset=1)THEN-q=00;-ELSIF-wait until (clkevent and clk=1);-WAIT UNTIL (clkEVENT AND clk = 1);-WAIT UNTIL (clockEVENT AND clock = 1);- q=q 1;-end if;-count=q;- WAIT UNTIL clock = 1;-if (clockevent an
8、d clock=1)then-WAIT UNTIL rising_edge(clock);-clockevent and clock=1;-count = 0;-WAIT UNTIL (clockEVENT AND clock = 1);-WAIT riseedge clock = 1;-if (clockevent and clock=1) then-WAIT UNTIL rising_edge(clock);-count = 1;-WAIT UNTIL (clockEVENT AND clock = 1);-WAIT UNTIL clock = 1;-if (clockevent and
9、clock=1)then-WAIT UNTIL rising_edge(clock);-count = 2;-end if;-end if;-end if;- END PROCESS;END counter;十三計數(shù)器library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;ENTITY thireteencout ISPORT(clk,reset,enable : IN std_logic; count : OUT std_logic_vector(3 downto 0);END thireteencou
10、t;ARCHITECTURE counter OF thireteencout ISSIGNAL count_int:std_logic_vector(0 to 3);BEGINPROCESS(clk,reset)BEGINWAIT UNTIL rising_edge(clk);IF reset = 1 THENcount_int 0);ELSIF enable = 1 THENIF(count_int=1100) THENcount_int=0000;ELSEcount_int = count_int 1;-ELSE- NULL ;-IF (count_int=1001) THEN-coun
11、t_int=0000;END IF;END IF;END PROCESS;count = count_int;- IF (reset=0) then-q=0000;-ELSIF(clkevent and clk=1) THEN-q=q 1;-IF (q=1001) then-q=0000;-END IF;-IF (reset=1)THEN-q=00;-ELSIF-wait until (clkevent and clk=1);-WAIT UNTIL (clkEVENT AND clk = 1);-WAIT UNTIL (clockEVENT AND clock = 1);- q=q 1;-en
12、d if;-count=q;- WAIT UNTIL clock = 1;-if (clockevent and clock=1)then-WAIT UNTIL rising_edge(clock);-clockevent and clock=1;-count = 0;-WAIT UNTIL (clockEVENT AND clock = 1);-WAIT riseedge clock = 1;-if (clockevent and clock=1) then-WAIT UNTIL rising_edge(clock);-count = 1;-WAIT UNTIL (clockEVENT AN
13、D clock = 1);-WAIT UNTIL clock = 1;-if (clockevent and clock=1)then-WAIT UNTIL rising_edge(clock);-count = 2;-end if;-end if;-end if;- END PROCESS;END counter;十二計數(shù)器library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;ENTITY twelvecout ISPORT(clk,reset,enable : IN std_logic; count
14、 : OUT std_logic_vector(3 downto 0);END twelvecout;ARCHITECTURE counter OF twelvecout ISSIGNAL count_int:std_logic_vector(0 to 3);BEGINPROCESS(clk,reset)BEGINWAIT UNTIL rising_edge(clk);IF reset = 1 THENcount_int 0);ELSIF enable = 1 THENIF(count_int=1011) THENcount_int=0000;ELSEcount_int = count_int
15、 1;-ELSE- NULL ;-IF (count_int=1001) THEN-count_int=0000;END IF;END IF;END PROCESS;count = count_int;- IF (reset=0) then-q=0000;-ELSIF(clkevent and clk=1) THEN-q=q 1;-IF (q=1001) then-q=0000;-END IF;-IF (reset=1)THEN-q=00;-ELSIF-wait until (clkevent and clk=1);-WAIT UNTIL (clkEVENT AND clk = 1);-WAI
16、T UNTIL (clockEVENT AND clock = 1);- q=q 1;-end if;-count=q;- WAIT UNTIL clock = 1;-if (clockevent and clock=1)then-WAIT UNTIL rising_edge(clock);-clockevent and clock=1;-count = 0;-WAIT UNTIL (clockEVENT AND clock = 1);-WAIT riseedge clock = 1;-if (clockevent and clock=1) then-WAIT UNTIL rising_edg
17、e(clock);-count = 1;-WAIT UNTIL (clockEVENT AND clock = 1);-WAIT UNTIL clock = 1;-if (clockevent and clock=1)then-WAIT UNTIL rising_edge(clock);-count = 2;-end if;-end if;-end if;- END PROCESS;END counter;十一計數(shù)器library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;ENTITY elevencout
18、 ISPORT(clk,reset,enable : IN std_logic; count : OUT std_logic_vector(3 downto 0);END elevencout;ARCHITECTURE counter OF elevencout ISSIGNAL count_int:std_logic_vector(0 to 3);BEGINPROCESS(clk,reset)BEGINWAIT UNTIL rising_edge(clk);IF reset = 1 THENcount_int 0);ELSIF enable = 1 THENIF(count_int=1010
19、) THENcount_int=0000;ELSEcount_int = count_int 1;-ELSE- NULL ;-IF (count_int=1001) THEN-count_int=0000;END IF;END IF;END PROCESS;count = count_int;- IF (reset=0) then-q=0000;-ELSIF(clkevent and clk=1) THEN-q=q 1;-IF (q=1001) then-q=0000;-END IF;-IF (reset=1)THEN-q=00;-ELSIF-wait until (clkevent and
20、clk=1);-WAIT UNTIL (clkEVENT AND clk = 1);-WAIT UNTIL (clockEVENT AND clock = 1);- q=q 1;-end if;-count=q;- WAIT UNTIL clock = 1;-if (clockevent and clock=1)then-WAIT UNTIL rising_edge(clock);-clockevent and clock=1;-count = 0;-WAIT UNTIL (clockEVENT AND clock = 1);-WAIT riseedge clock = 1;-if (cloc
21、kevent and clock=1) then-WAIT UNTIL rising_edge(clock);-count = 1;-WAIT UNTIL (clockEVENT AND clock = 1);-WAIT UNTIL clock = 1;-if (clockevent and clock=1)then-WAIT UNTIL rising_edge(clock);-count = 2;-end if;-end if;-end if;- END PROCESS;END counter;十計數(shù)器library ieee;use ieee.std_logic_1164.all;use
22、ieee.std_logic_unsigned.all;ENTITY count ISPORT(clk,reset,enable : IN std_logic; count : OUT std_logic_vector(3 downto 0);END count;ARCHITECTURE counter OF count ISSIGNAL count_int:std_logic_vector(0 to 3);BEGINPROCESS(clk,reset)BEGINWAIT UNTIL rising_edge(clk);IF reset = 1 THENcount_int 0);ELSIF en
23、able = 1 THENIF(count_int=1001) THENcount_int=0000;ELSEcount_int = count_int 1;-ELSE- NULL ;-IF (count_int=1001) THEN-count_int=0000;END IF;END IF;END PROCESS;count = count_int;- IF (reset=0) then-q=0000;-ELSIF(clkevent and clk=1) THEN-q=q 1;-IF (q=1001) then-q=0000;-END IF;-IF (reset=1)THEN-q=00;-E
24、LSIF-wait until (clkevent and clk=1);-WAIT UNTIL (clkEVENT AND clk = 1);-WAIT UNTIL (clockEVENT AND clock = 1);- q=q 1;-end if;-count=q;- WAIT UNTIL clock = 1;-if (clockevent and clock=1)then-WAIT UNTIL rising_edge(clock);-clockevent and clock=1;-count = 0;-WAIT UNTIL (clockEVENT AND clock = 1);-WAI
25、T riseedge clock = 1;-if (clockevent and clock=1) then-WAIT UNTIL rising_edge(clock);-count = 1;-WAIT UNTIL (clockEVENT AND clock = 1);-WAIT UNTIL clock = 1;-if (clockevent and clock=1)then-WAIT UNTIL rising_edge(clock);-count = 2;-end if;-end if;-end if;- END PROCESS;END counter;九計數(shù)器library ieee;us
26、e ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;ENTITY ninecout ISPORT(clk,reset,enable : IN std_logic; count : OUT std_logic_vector(3 downto 0);END ninecout;ARCHITECTURE counter OF ninecout ISSIGNAL count_int:std_logic_vector(0 to 3);BEGINPROCESS(clk,reset)BEGINWAIT UNTIL rising_edge(clk)
27、;IF reset = 1 THENcount_int 0);ELSIF enable = 1 THENIF(count_int=1000) THENcount_int=0000;ELSEcount_int = count_int 1;-ELSE- NULL ;-IF (count_int=1001) THEN-count_int=0000;END IF;END IF;END PROCESS;count = count_int;- IF (reset=0) then-q=0000;-ELSIF(clkevent and clk=1) THEN-q=q 1;-IF (q=1001) then-q
28、=0000;-END IF;-IF (reset=1)THEN-q=00;-ELSIF-wait until (clkevent and clk=1);-WAIT UNTIL (clkEVENT AND clk = 1);-WAIT UNTIL (clockEVENT AND clock = 1);- q=q 1;-end if;-count=q;- WAIT UNTIL clock = 1;-if (clockevent and clock=1)then-WAIT UNTIL rising_edge(clock);-clockevent and clock=1;-count = 0;-WAI
29、T UNTIL (clockEVENT AND clock = 1);-WAIT riseedge clock = 1;-if (clockevent and clock=1) then-WAIT UNTIL rising_edge(clock);-count = 1;-WAIT UNTIL (clockEVENT AND clock = 1);-WAIT UNTIL clock = 1;-if (clockevent and clock=1)then-WAIT UNTIL rising_edge(clock);-count = 2;-end if;-end if;-end if;- END
30、PROCESS;END counter;八計數(shù)器library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;ENTITY eightcout ISPORT(clk,reset,enable : IN std_logic; count : OUT std_logic_vector(2 downto 0);END eightcout;ARCHITECTURE counter OF eightcout ISSIGNAL count_int:std_logic_vector(0 to 2);BEGINPROCESS(
31、clk,reset)BEGINWAIT UNTIL rising_edge(clk);IF reset = 1 THENcount_int 0);ELSIF enable = 1 THENIF(count_int=111) THENcount_int=000;ELSEcount_int = count_int 1;-ELSE- NULL ;-IF (count_int=1001) THEN-count_int=0000;END IF;END IF;END PROCESS;count = count_int;- IF (reset=0) then-q=0000;-ELSIF(clkevent a
32、nd clk=1) THEN-q=q 1;-IF (q=1001) then-q=0000;-END IF;-IF (reset=1)THEN-q=00;-ELSIF-wait until (clkevent and clk=1);-WAIT UNTIL (clkEVENT AND clk = 1);-WAIT UNTIL (clockEVENT AND clock = 1);- q=q 1;-end if;-count=q;- WAIT UNTIL clock = 1;-if (clockevent and clock=1)then-WAIT UNTIL rising_edge(clock)
33、;-clockevent and clock=1;-count = 0;-WAIT UNTIL (clockEVENT AND clock = 1);-WAIT riseedge clock = 1;-if (clockevent and clock=1) then-WAIT UNTIL rising_edge(clock);-count = 1;-WAIT UNTIL (clockEVENT AND clock = 1);-WAIT UNTIL clock = 1;-if (clockevent and clock=1)then-WAIT UNTIL rising_edge(clock);-
34、count = 2;-end if;-end if;-end if;- END PROCESS;END counter;六計數(shù)器library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;ENTITY sixcout ISPORT(clk,reset,enable : IN std_logic; count : OUT std_logic_vector(2 downto 0);END sixcout;ARCHITECTURE counter OF sixcout ISSIGNAL count_int:std_
35、logic_vector(0 to 2);BEGINPROCESS(clk,reset)BEGINWAIT UNTIL rising_edge(clk);IF reset = 1 THENcount_int 0);ELSIF enable = 1 THENIF(count_int=101) THENcount_int=000;ELSEcount_int = count_int 1;-ELSE- NULL ;-IF (count_int=1001) THEN-count_int=0000;END IF;END IF;END PROCESS;count = count_int;- IF (rese
36、t=0) then-q=0000;-ELSIF(clkevent and clk=1) THEN-q=q 1;-IF (q=1001) then-q=0000;-END IF;-IF (reset=1)THEN-q=00;-ELSIF-wait until (clkevent and clk=1);-WAIT UNTIL (clkEVENT AND clk = 1);-WAIT UNTIL (clockEVENT AND clock = 1);- q=q 1;-end if;-count=q;- WAIT UNTIL clock = 1;-if (clockevent and clock=1)
37、then-WAIT UNTIL rising_edge(clock);-clockevent and clock=1;-count = 0;-WAIT UNTIL (clockEVENT AND clock = 1);-WAIT riseedge clock = 1;-if (clockevent and clock=1) then-WAIT UNTIL rising_edge(clock);-count = 1;-WAIT UNTIL (clockEVENT AND clock = 1);-WAIT UNTIL clock = 1;-if (clockevent and clock=1)then-WAIT UNTIL rising_edge(clock);-count = 2;-end if;-end if;-end if;- END PROCESS;END counter
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024-2025學(xué)年一年級下學(xué)期數(shù)學(xué)第七單元《三個兩位數(shù)連加》(教案)
- 2025年會計勞務(wù)合同模板
- 2025年專利轉(zhuǎn)讓合同水產(chǎn)養(yǎng)殖產(chǎn)品適用
- 人教版三年級下冊第一單元-位置和方向(一)-(單元測試)含答案
- 人教版三年級英語上冊期末測試卷
- 2-除數(shù)是一位數(shù)的除法-人教版三年級數(shù)學(xué)下冊單元測試卷(含答案)
- 2025年湖南石油化工職業(yè)技術(shù)學(xué)院單招職業(yè)傾向性測試題庫帶答案
- 2024年碳纖維熱場材料項目投資申請報告代可行性研究報告
- 2024年亞葉酸鈣項目資金需求報告代可行性研究報告
- 2025年廣東省惠州市單招職業(yè)傾向性測試題庫完整
- 燃?xì)夤艿拦こ瘫O(jiān)理實施細(xì)則
- 1 聚聚散散 教案人教版美術(shù)四年級下冊
- 綜合實踐活動勞動與技術(shù)八年級下冊教案
- GB/T 36196-2018蛋鴿飼養(yǎng)管理技術(shù)規(guī)程
- GB/T 21653-2008鎳及鎳合金線和拉制線坯
- GB/T 15970.2-2000金屬和合金的腐蝕應(yīng)力腐蝕試驗第2部分:彎梁試樣的制備和應(yīng)用
- 入職的通知書
- doors培訓(xùn)材料-工具入門
- 中國古典文獻(xiàn)學(xué) 第四章課件
- 諾如病毒-感染性腹瀉預(yù)防控制知識課件
- 旅游經(jīng)濟學(xué)全套課件
評論
0/150
提交評論