版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、 12. Describe sequential systems in VHDL 12.1 Defining clocks, flip-flops and registers 12.2 Register Transfer Level (RTL) Coding12.3 Sequential logic 1 12.1 Defining clocks, flip-flops & registers 1. Defining a clock signal PROCESSBEGIN clock = 0;WAIT FOR 10 NS; clock = 1WAIT FOR 10 NS;END PROCESS;
2、There are many ways to define a clock. For example:Simulation waveform 2 12.1 Defining clocks, flip-flops & registers 2. The D-type flip-flopLIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL;ENTITY dff IS PORT ( d, clock: IN STD_LOGIC; Q: OUT STD_LOGIC);END ENTITY dff;ARCHITECTURE correct OF dff ISBEGIN PROC
3、ESS (clock) BEGIN IF ( rising_edge(clock) ) THEN q = d; END IF; END PROCESS;END ARCHITECTURE correct;3 12.1 Defining clocks, flip-flops & registers 3. The D-type flip-flop with reset If the Reset is synchronous, then it is ignored until the rising edge of the clock. When the rising edge comes, if Re
4、set=1 then q goes to 0. If Reset=0, then the flip-flop exhibits normal behavior, i.e. q=d. (1)If the Reset is synchronous4 12.1 Defining clocks, flip-flops & registers LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL; - D-type flip-flopENTITY dff IS PORT ( d : IN STD_LOGIC; - Data input clock: IN STD_LOGIC;
5、 - Clock input reset: IN STD_LOGIC; - Reset input Q : OUT STD_LOGIC); - OutputEND ENTITY dff;ENTITY definition 5 12.1 Defining clocks, flip-flops & registers ARCHITECTURE synch_reset OF dff ISBEGIN PROCESS (clock) BEGIN IF ( rising_edge(clock) ) THEN IF ( reset=1 ) THEN q = 0; ELSE q = d; END IF; EN
6、D IF; END PROCESS;END ARCHITECTURE synch_reset;Architecture declaration6 12.1 Defining clocks, flip-flops & registers If the Reset is asynchronous, then it takes immediate effect, no matter what the clock is doing. This means that the flip-flop is always sensitive to its Reset input. (2)If the Reset
7、 is asynchronous7 12.1 Defining clocks, flip-flops & registers ARCHITECTURE asynch_reset OF dff ISBEGIN PROCESS (clock, reset) BEGIN IF ( reset=1 ) THEN q = 0; ELSIF ( rising_edge(clock) ) THEN q = d; END IF; END PROCESS;END ARCHITECTURE asynch_reset;Architecture declaration should be:8 12.2 Registe
8、r Transfer Level Coding1. VHDL description of a registered adderARCHITECTURE behavioral OF adder ISBEGIN sum = a + b;END ARCHITECTURE behavioral;Behavioral description9 12.2 Register Transfer Level CodingAn obvious way to describe the adder with registered output is to instantiate 4 flip-flops at th
9、e output:ARCHITECTURE registered OF adder ISBEGIN sum sum(0), clock=clock, q=reg_sum(0) ); g2: ENTITY work.dff(correct) PORT MAP ( d=sum(1), clock=clock, q=reg_sum(1) ); g3: ENTITY work.dff(correct) PORT MAP ( d=sum(2), clock=clock, q=reg_sum(2) ); g4: ENTITY work.dff(correct) PORT MAP ( d=sum(3), c
10、lock=clock, q=reg_sum(3) );END ARCHITECTURE registered;10 12.2 Register Transfer Level Coding2. Register Transfer Level VHDLIf we want a reset signal, that can asynchronously reset the adder output to zero, the code should be:ARCHITECTURE rtl2 OF adder IS BEGIN PROCESS (clock, reset) BEGIN IF ( rese
11、t=1 ) THEN reg_sum 0); ELSIF ( rising_edge(clock) ) THEN reg_sum = a + b; end if; END PROCESS; END ARCHITECTURE rtl2;11 12.2 Register Transfer Level CodingThis style of coding is called register transfer level coding. We are using assignments to signals, but wrapping them up in processes triggered b
12、y the clock (and reset signal) in order to make it clear on what clock cycle the outputs should assume their values. 12 12.2 Register Transfer Level Coding3. VHDL variables A VHDL variable can only exist inside a process, and will assume its new value immediately whenever an assignment occurs. Like
13、c and f in the following circuit. 13 12.2 Register Transfer Level CodingARCHITECTURE fig12-10 OF adder ISBEGIN PROCESS (clock) VARIABLE e, f: SIGNED ( 31 DOWNTO 0 ); BEGIN IF ( rising_edge(clock) ) THEN c := a + b; f := d + e; sum = c + f; END IF; END PROCESS;END ARCHITECTURE fig12-10;Code listing using variables 14 12.3 Sequential logic 000001010011100101110111A Binar
溫馨提示
- 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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 自動售貨機(jī) 場地租賃合同
- 招生計劃書模板
- 員工個人原因解除勞動合同協(xié)議書
- 永不結(jié)婚協(xié)議書
- 移交保護(hù)協(xié)議書范本
- Myristyl-stearate-生命科學(xué)試劑-MCE
- MRS7292-生命科學(xué)試劑-MCE
- minus-Fucose-Standard-生命科學(xué)試劑-MCE
- 部編2024版歷史七年級上冊第一單元《第3課 中華文明的起源》有關(guān)故事、軼事和傳說(學(xué)案)
- XX學(xué)校防范電信與網(wǎng)絡(luò)詐騙方案
- 皮內(nèi)注射法(青霉素皮試)操作規(guī)程及評分標(biāo)準(zhǔn)
- 2024時事政治必考試題庫帶答案(綜合題)
- 急性肺栓塞的應(yīng)急預(yù)案及流程
- 汽車計劃員崗位職責(zé)
- 2024年4月自考00322中國行政史答案及評分參考
- 2024年13起典型火災(zāi)案例及消防安全知識專題培訓(xùn)
- 2024年第九屆湖北省高三 (4月) 調(diào)研模擬考試 英語試卷(含答案及解析)
- 中華民族共同體概論課件專家版4第四講 天下秩序與華夏共同體的演進(jìn)(夏商周時期)
- 五年級道德與法治下冊第一單元單元整體教學(xué)設(shè)計
- 小班體育活動《跳圈圈》含反思
- 基于情境的小學(xué)語文學(xué)習(xí)任務(wù)群設(shè)計與實施
評論
0/150
提交評論