第4章 數字邏輯單元設計_第1頁
第4章 數字邏輯單元設計_第2頁
第4章 數字邏輯單元設計_第3頁
第4章 數字邏輯單元設計_第4頁
第4章 數字邏輯單元設計_第5頁
已閱讀5頁,還剩119頁未讀 繼續免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、process(clk,clr,pre,c) begin if(clr=1) then q_tmp=0; elsif(pre=1) then q_tmp=1; elsif rising_edge(clk) then if(ce=1) then q_tmp=d; else q_tmp=q_tmp; end if; end if; end process;end rtl;輸入輸入輸出輸出RSCEJKCQ1XXXX001XXX1000XXX無變化無變化00100X無變化無變化00101000111翻轉翻轉001101 if(r=1) then q_tmp=0; elsif(s=1) then q_t

2、mp=1; elsif rising_edge(clk) then if(ce=0) then q_tmp=q_tmp; else if(j=0 and k=1) then q_tmp=0; elsif(j=1 and k=0) then q_tmp=1; elsif(j=1 and k=1) then q_tmp=not q_tmp; end if; end if; end process;end rtl;輸入輸出RSCQ00無變化01110011無變化process(clk) begin if rising_edge(clk)then if (s = 1 and r = 0) then q

3、_tmp=1; elsif (s=0 and r=1) then q_tmp=0; elsif (s=0 and r=0) then q_tmp=q_tmp; else null; end if; end if; end process; end rtl;architecture Behavioral of mod5cnt isbegin process(clk,clr) begin if(clr=1) then q=000; elsif(rising_edge(clk) then if(q=100) then q=000; else q=q + 1; end if; end if; end

4、process;end Behavioral;architecture Behavioral of clkdiv issignal q : std_logic_vector(24 downto 0);begin process(clr,clk) begin if(clr=1) then q0); elsif(rising_edge(clk) then q = q + 1; end if; end process; clk190 = q(17); -190Hz clk48 = q(19); -47.7Hzend Behavioral;architecture Behavioral of ring

5、_shiftreg4 isbegin process(clr,clk) begin if(clr=1) then q=0001; elsif(rising_edge(clk) then q(3) = q(0); q(2 downto 0) = q(3 downto 1); end if; end process;end Behavioral;architecture Behavioral of debounce4 issignal delay1,delay2,delay3 : std_logic_vector(3 downto 0);begin process(cclk,clr,inp) be

6、gin if(clr=1) then delay1=0000; delay2=0000; delay3=0000; elsif(rising_edge(cclk) then delay1=inp; delay2=delay1; delay3=delay2; end if; end process; outp=delay1 and delay2 and delay3; end Behavioral;architecture Behavioral of clock_pluse issignal delay1,delay2,delay3 : std_logic;begin process(clr,c

7、clk) begin if(clr=1) then delay1=0; delay2=0; delay3=0; elsif(rising_edge(cclk) then delay1=inp; delay2=delay1; delay3=delay2; end if; end process; outp=delay1 and delay2 and (not delay3);end Behavioral;%100周期占空占空比architecture Behavioral of pwm4 issignal count : STD_LOGIC_VECTOR (3 downto 0);signal

8、set,reset : std_logic;Beginset = not (count(0) or count(1) or count(2) or count(3); process(clk,clr) begin if(clr=1) then count=0000;elsif(rising_edge(clk) then if(count=period1-1) then count=0000; else count=count + 1; end if; end if; end process;process(clk)begin if(rising_edge(clk) then if(set=1)

9、 then pwm=1; end if; if(reset=1) then pwm=0; end if; end if;end process;end Behavioral;圖4.16 ROM的結構圖圖4.17 單端口RAM的結構十進制數十進制數二進制碼二進制碼Gray碼碼Johnson碼碼One-hot嗎嗎000000000000110010010010102010011011100301101011110004100110510111161101017111100architecture Behavioral of seqdeta istype state is(s0,s1,s2,s3,s

10、4); -狀態聲明signal present_state,next_state : state; beginprocess(clr,clk)begin if(clr=1) then -狀態寄存器 present_state=s0; elsif rising_edge(clk) then present_state=next_state; end if;end process;architecture Behavioral of seqdetb istype state is(s0,s1,s2,s3); -定義狀態signal present_state,next_state : state; beginprocess(clr,clk) -狀態寄存器begin if(clr=1) then present_state=s0; elsif rising_edge(clk) t

溫馨提示

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

評論

0/150

提交評論