版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
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等.壓縮文件請(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024年臨時(shí)搬運(yùn)合同
- 2024年度某新能源汽車制造技術(shù)許可合同
- 2024年度文化娛樂活動(dòng)策劃合同
- 2024年廣播劇配音委托合同
- 2024年建筑工程地面建設(shè)合同
- 企業(yè)普通員工年終個(gè)人工作總結(jié)
- 2024年度風(fēng)力發(fā)電設(shè)備安裝合同
- 節(jié)能宣傳課件教學(xué)課件
- 2024醫(yī)療機(jī)構(gòu)人力資源共享與培訓(xùn)合同
- 2024年度碎石料供需合同
- 護(hù)士與醫(yī)生的合作與溝通
- GB 42295-2022電動(dòng)自行車電氣安全要求
- 產(chǎn)品系統(tǒng)設(shè)計(jì)開發(fā) 課件 第4、5章 產(chǎn)品系統(tǒng)設(shè)計(jì)類型、產(chǎn)品系統(tǒng)設(shè)計(jì)開發(fā)綜合案例
- 1編譯原理及實(shí)現(xiàn)課后題及答案
- 焊接材料的質(zhì)量控制和追溯規(guī)范
- 讓閱讀成為習(xí)慣家長(zhǎng)會(huì)課件
- 家庭健康照護(hù)服務(wù)方案
- 施工方案 誰編
- 滬教牛津版八上英語Unit-6-單元完整課件
- 新能源及多能互補(bǔ)互補(bǔ)技術(shù)
- 混凝土攪拌站安裝及拆除方案
評(píng)論
0/150
提交評(píng)論