版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、EDA課程設(shè)計(jì)題目一:交通燈控制器VHDL的設(shè)計(jì)題目二:智能函數(shù)發(fā)生器題目三:樂曲硬件演奏電路的VHDL設(shè)計(jì)專業(yè):通信工程班級(jí):通信084班1 / 32一、設(shè)計(jì)題目:交通燈控制器VHDL的設(shè)計(jì)二、設(shè)計(jì)目標(biāo)1、 設(shè)計(jì)一個(gè)交通信號(hào)燈控制器,由一條主干道和一條支干道匯合成十字路口,在每個(gè)入口處設(shè)置紅、綠、黃三色信號(hào)燈,紅燈亮禁止通行,綠燈亮允許通行,黃燈亮則給行駛中的車輛有時(shí)間停在禁行線外。2、 紅、綠、黃發(fā)光二極管作信號(hào)燈,。3、 主干道處于常允許通行的狀態(tài),支干道有車來時(shí)才允許通行。主干道亮綠燈時(shí),支干道亮紅燈;支干道亮綠燈時(shí),主干道亮紅燈。4、 主、支干道均有車時(shí),兩者交替允許通行,主干道每次
2、放行45秒,支干道每次放行25秒,設(shè)立45秒、25秒計(jì)時(shí)、顯示電路。5、 在每次由綠燈亮到紅燈亮的轉(zhuǎn)換過程中,要亮5秒黃燈作為過渡,使行駛中的車輛有時(shí)間停到禁行線外,設(shè)立5秒計(jì)時(shí)、顯示電路。三、設(shè)計(jì)原理 主系統(tǒng)由三個(gè)模塊組成,jtd.vhd為頂層文件,其內(nèi)部包含三個(gè)功能模塊模塊:信號(hào)燈主控模塊(moore.vhd)、減法計(jì)數(shù)器模塊(jishu.vhd)、譯碼器模塊(led7s.vhd)。1、 選擇1HZ時(shí)鐘脈沖作為系統(tǒng)時(shí)鐘。2、 45秒、25秒、5秒定時(shí)信號(hào)用倒計(jì)時(shí),計(jì)時(shí)起始信號(hào)由主控電路給出,每當(dāng)計(jì)滿所需時(shí)間,即向主控電路輸出“時(shí)間到”信號(hào),轉(zhuǎn)換信號(hào)燈狀態(tài),由主控電路啟、閉三色信號(hào)燈顯示結(jié)果
3、:十字路口的交通燈控制信號(hào)由主控電路給出,能顯示十字路口東西、南北兩個(gè)方向的紅、黃、綠燈的指示狀態(tài)。用兩組紅、黃、綠三種顏色的燈分別作為東西、南北兩個(gè)方向的紅、黃、綠燈,變化規(guī)律為:東西綠燈亮,南北紅燈亮東西黃燈亮,南北紅燈亮東西紅燈亮、南北綠燈亮東西紅燈亮,南北黃燈亮東西綠燈亮,南北紅燈亮.,這樣依次循環(huán)。東西方向是主干道車道,南北方向是支干道車道,要求兩條交叉道路上的車輛交替運(yùn)行,主干道每次通行時(shí)間都設(shè)為45秒,支干道每次通行時(shí)間都設(shè)為25秒。在綠燈轉(zhuǎn)為紅燈時(shí),要求黃燈先亮5秒鐘,才能變換運(yùn)行車道。要求交通燈控制器有復(fù)位功能,在復(fù)位信號(hào)使能的情況下能夠?qū)崿F(xiàn)交通燈的自動(dòng)復(fù)位,并且要求所有交通
4、燈的狀態(tài)變化,包括復(fù)位信號(hào)引起的均發(fā)生時(shí)鐘脈沖的上升沿處。四、設(shè)計(jì)內(nèi)容1.信號(hào)燈主控模塊moore.vhd設(shè)計(jì)一個(gè)Morre型狀態(tài)機(jī),是一個(gè)4狀態(tài)的狀態(tài)機(jī),輸出ld0控制減法計(jì)數(shù)器,在減法計(jì)數(shù)器減計(jì)數(shù)到6或1時(shí),計(jì)數(shù)器輸出1,將計(jì)數(shù)器的輸出輸入到Moore型狀態(tài)機(jī)c0中來實(shí)現(xiàn)狀態(tài)機(jī)的輸入控制,再通過狀態(tài)機(jī)的輸出來控制計(jì)數(shù)器的計(jì)數(shù)值。即原理相同于S0為東西方向的綠燈控制及南北方向的紅燈控制,計(jì)數(shù)時(shí)間為45秒;S1為東西方向黃燈控制及南北方向的紅燈控制,計(jì)數(shù)時(shí)間為5秒;S2為南北方向的綠燈控制及東西方向的紅燈控制,計(jì)數(shù)時(shí)間為25秒;S3為南北方向的黃燈及東西方向的紅燈控制,計(jì)數(shù)時(shí)間為5秒。狀態(tài)圖如
5、下:clk0:1Hz時(shí)鐘輸入rst0:復(fù)位端c0:狀態(tài)機(jī)輸入控制信號(hào)ld0輸出計(jì)數(shù)控制信號(hào)dinh0,dinl0:輸出高低位計(jì)數(shù)值red_east1等:紅黃綠燈控制信號(hào)2.減法計(jì)數(shù)器的設(shè)計(jì)jishu.vhdclk1:1Hz時(shí)鐘輸入ld1:計(jì)數(shù)控制信號(hào)dinh1,dinl1:輸入高低位計(jì)數(shù)值qh1,ql1:輸出高低位計(jì)數(shù)值c1:輸出狀態(tài)機(jī)控制信號(hào) 減法計(jì)數(shù)器設(shè)計(jì),用dinh1和dinl1來設(shè)置所需要的計(jì)數(shù)數(shù)值,ld1為初始化計(jì)數(shù)數(shù)值,當(dāng)減法計(jì)數(shù)器減到設(shè)置的6或1時(shí),C1輸出為1,其他時(shí)間均為0。Qh1和ql1為計(jì)數(shù)器的計(jì)數(shù)輸出。3.譯碼器的設(shè)計(jì)led7s.vhd譯碼器是一個(gè)簡(jiǎn)單的LED的顯示的譯
6、碼,為47譯碼器。a:譯碼輸入信號(hào)led7s:譯碼輸出信號(hào)五、仿真結(jié)果一、設(shè)計(jì)題目:智能函數(shù)發(fā)生器二、設(shè)計(jì)目標(biāo)設(shè)計(jì)一個(gè)智能函數(shù)發(fā)生器,能夠以穩(wěn)定的頻率發(fā)生遞增斜波、遞減斜波、三角波、梯形波,正弦波和方波。設(shè)置一個(gè)波形選擇輸入信號(hào),通過此改變?cè)撔盘?hào)可以選擇以上各種不同種類的輸出函數(shù)波形,系統(tǒng)具有復(fù)位功能。三、設(shè)計(jì)原理主系統(tǒng)由7個(gè)模塊組成,singt.vhd為頂層設(shè)計(jì)文件,其內(nèi)部有七個(gè)功能模塊:波形選擇模塊(wavsel.vhd)、遞增斜波模塊(zengxie.vhd)、遞減斜波模塊(jianxie.vhd)、三角波模塊(rect.vhd)、梯形模塊(trap.vhd)、方波模塊(reta.vhd
7、)、正弦波模塊(sindata.vhd)。遞減模塊遞增模塊三角波模塊梯形波模塊方波模塊正弦波模塊選 擇 模 塊輸出信號(hào)智能函數(shù)發(fā)生器原理圖四、設(shè)計(jì)內(nèi)容1.遞減模塊的設(shè)計(jì)jianxie.vhd遞減模塊的設(shè)計(jì),遞減模塊是用VHDL程序描述的遞增函數(shù),它的實(shí)體部分部分說明三個(gè)端口,其中兩個(gè)輸入端口時(shí)鐘信號(hào)clk3、復(fù)位信號(hào)rst3和一個(gè)輸出端口jout3。結(jié)構(gòu)體部分定義一個(gè)8位二進(jìn)制變量,然后使用進(jìn)程語句,設(shè)定敏感信號(hào)clk3和 rst3,通過設(shè)計(jì)一個(gè)中間變量從00000101到00000000的遞減賦值給輸出信號(hào)jout3,編譯無誤后,即額可以創(chuàng)建遞減元件符號(hào)。2.遞增模塊的設(shè)計(jì)zengxie.v
8、hd遞增模塊的設(shè)計(jì)與遞減模塊相似,其中兩個(gè)輸入端口時(shí)鐘信號(hào)clk2、復(fù)位信號(hào)rst2和一個(gè)輸出端口zout2。結(jié)構(gòu)體部分定義一個(gè)8位二進(jìn)制變量,然后使用進(jìn)程語句,設(shè)定敏感信號(hào)clk2和 rst2,通過設(shè)計(jì)一個(gè)中間變量從00000000到00000101的遞增賦值給輸出信號(hào)zout2,編譯無誤后,即額可以創(chuàng)建遞增元件符號(hào)。3三角波模塊的設(shè)計(jì)rect.vhd三角波模的設(shè)計(jì)完成功能異步復(fù)位和三角波的形成,程序定義兩個(gè)中間變量,一個(gè)中間變量即為輸出賦值,另一個(gè)完成三角波分段,當(dāng)p為 0時(shí),完成三角波的前段從00000000到00000101遞增;當(dāng)p為1時(shí),完成后段的從00000101到0000000
9、0的遞減,形成一個(gè)完整的三角波。4.梯形波模塊的設(shè)計(jì)trap.vhd 梯形波模塊的設(shè)計(jì)通過運(yùn)用case語句,設(shè)計(jì)三個(gè)狀態(tài),使信號(hào)在“00”狀態(tài)時(shí)從00000000到00000101遞增,在“01”狀態(tài)時(shí)保持00000101,在“10”狀態(tài)時(shí)從00000101到00000000遞減,形成一個(gè)完整的梯形波。5.方波模塊的設(shè)計(jì)reta.vhd 方波模塊即是完成方波輸出地設(shè)計(jì),以及有異步復(fù)位的功能,該程序采用了兩個(gè)進(jìn)程語句,第一個(gè)進(jìn)程是完成在時(shí)鐘上升沿同步時(shí),r<6時(shí)輸出rout1=00000110,否則輸出rout1=00000000。在第二個(gè)進(jìn)程中,完成在時(shí)鐘上升沿的時(shí)候,r從0000000
10、0遞增到00001011,創(chuàng)建的元件符號(hào)同樣是三個(gè)端口,即時(shí)鐘信號(hào)clk1和復(fù)位信號(hào)rst1,以及一個(gè)8位二進(jìn)制的輸出端口rout1。6.正弦波模塊的設(shè)計(jì)sindata.vhd正弦波的設(shè)計(jì)是通過建立正弦波形數(shù)據(jù)、定制LPM ROM來實(shí)現(xiàn)的。7.選擇模塊的設(shè)計(jì)wavsel.vhd 選擇模塊的設(shè)計(jì)通過運(yùn)用case語句,設(shè)計(jì)六個(gè)狀態(tài),通過控制輸入信號(hào)key11、key22、key33,選擇輸出波形?!?00”輸出遞增斜波,“001”輸出遞減斜波,“010輸出”方波,“011”輸出梯形波,“100”輸出三角波,“101”輸出正弦波。五、仿真結(jié)果1.遞增斜波2.遞減斜波3.方波4.梯形波5.三角波6.正
11、弦波一、設(shè)計(jì)題目:樂曲硬件演奏電路的VHDL設(shè)計(jì)二、設(shè)計(jì)目標(biāo)能夠播放“梁祝”樂曲。(2)能夠通過LED顯示音階。(3)具有“播放/停止”功能,并在此基礎(chǔ)上實(shí)現(xiàn)“按鍵演奏”的電子琴功能。三、設(shè)計(jì)原理 主系統(tǒng)由三個(gè)模塊組成,songer.vhd為頂層設(shè)計(jì)文件,其內(nèi)部有三個(gè)功能模塊:tonetaba.vhd、notetabs.vhd和speakera.vhd。 我們知道,組成樂曲的每個(gè)音符的發(fā)音頻率值及其持續(xù)時(shí)間是樂曲能連續(xù)演奏所需的兩個(gè)基本要素,問題是如何來獲取了這兩個(gè)要素所對(duì)應(yīng)的數(shù)值以及通過純硬件的手段來利用這些數(shù)值事先所希望樂曲的演奏效果。原理圖中,模塊U1類似于探親人的手指;U2類似于琴鍵;
12、U3類似于琴弦或音調(diào)發(fā)生器。四、設(shè)計(jì)類容1.數(shù)控分頻器模塊Speakera.vhd這是一個(gè)數(shù)控分頻器,有其clk端輸入已具有較高頻率(這里是12MHz)的信號(hào),通過Speakera分頻后又SPKOUT輸出。Speakera對(duì)clk輸入信號(hào)的分頻比由11位預(yù)置數(shù)Tone10.0決定。 2.按鍵模塊ToneTaba.vhd模塊ToneTaba的功能首先是為Speakera提供決定所發(fā)音符的分頻預(yù)置數(shù),而此數(shù)在Speakera輸入口停留的時(shí)間即為此音符的節(jié)拍值。模塊ToneTaba是樂曲簡(jiǎn)譜碼對(duì)應(yīng)得分頻預(yù)置數(shù)查表電路,其中預(yù)置了“梁祝”樂曲全部音符所對(duì)應(yīng)的分頻預(yù)置數(shù),共13個(gè),這13個(gè)值的輸出有對(duì)應(yīng)
13、于ToneTaba的4位輸入值Index3.0確定。3.輸入控制模塊NoteTabs.vhd 在NoteTabs中設(shè)置了一個(gè)8位二進(jìn)制計(jì)數(shù)器,作為音符數(shù)據(jù)ROM的地址發(fā)生器。這個(gè)計(jì)數(shù)器的計(jì)數(shù)頻率選為4Hz,即每一計(jì)數(shù)值得停留時(shí)間為0.25秒,恰為當(dāng)全音符設(shè)為1秒時(shí),四四拍的4分音符持續(xù)時(shí)間。rst0具有“播放停止”功能。當(dāng)kz=1時(shí),shuru1、shuru2、shuru2、shuru3實(shí)現(xiàn)“按鍵演奏”功能。五、仿真結(jié)果1.自動(dòng)播放2.按鍵演奏六、總結(jié)通過編譯原理課程設(shè)計(jì),掌握了什么是編譯程序,編譯程序工作的基本過程及其各階段的基本任務(wù),熟悉了編譯程序總流程框圖,了解了編譯程序的生成過程、構(gòu)造
14、工具及其相關(guān)的技術(shù)對(duì)課本上的知識(shí)有了更深的理解,課本上的知識(shí)是機(jī)械的,表面的。把原來以為很深?yuàn)W的書本知識(shí)變的更為簡(jiǎn)單,對(duì)實(shí)驗(yàn)原理有更深的理解。通過這次課程設(shè)計(jì)我也發(fā)現(xiàn)了自身存在的不足之處,雖然感覺理論上已經(jīng)掌握,但在運(yùn)用到實(shí)踐的過程中仍有意想不到的困惑,經(jīng)過一番努力才得以解決。這也激發(fā)了我今后努力學(xué)習(xí)的興趣,我想這將對(duì)我以后的學(xué)習(xí)產(chǎn)生積極的影響。而且,這對(duì)于我們的將來也有很大的幫助。以后,不管有多苦,我想我們都能變苦為樂,找尋有趣的事情,發(fā)現(xiàn)其中珍貴的事情。就像中國提倡的艱苦奮斗一樣,我們都可以在實(shí)驗(yàn)結(jié)束之后變的更加成熟,會(huì)面對(duì)需要面對(duì)的事情。七、附錄(一)交通燈控制器VHDL的設(shè)計(jì)1交通燈頂
15、層文件jtd.vhdlibrary ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity jtd is port(clk:in std_logic; rst:in std_logic; red_east,yellow_east,green_east,red_north,yellow_north,green_north:out std_logic; ten_east,one_east,ten_north,one_north:out std_logic_vector(6 downto 0);end;archi
16、tecture one of jtd is component moore port(clk0,rst0,c0 :in std_logic; ld0:out std_logic; red_east1,yellow_east1,green_east1,red_north1,yellow_north1,green_north1:out std_logic; dinl0,dinh0 :out std_logic_vector(3 downto 0); end component; component jishu port(clk1:in std_logic; ld1:in std_logic; di
17、nl1:in std_logic_vector(3 downto 0); dinh1:in std_logic_vector(3 downto 0); ql1:out std_logic_vector(3 downto 0); qh1:out std_logic_vector(3 downto 0); c1:out std_logic); end component; component led7s port(a:in std_logic_vector(3 downto 0); led7s:out std_logic_vector(6 downto 0); end component; sig
18、nal c,ld :std_logic; signal dinl,dinh,led7sh,led7sl:std_logic_vector(3 downto 0); beginu1:moore port map ( clk0=>clk,rst0=>rst,c0=>c,ld0=>ld,dinl0=>dinl,dinh0=>dinh,red_east1=>red_east,yellow_east1=>yellow_east,green_east1=>green_east,red_north1=>red_north,yellow_north1
19、=>yellow_north,green_north1=>green_north); u2:jishu port map (clk1=>clk,ld1=>ld,dinl1=>dinl,dinh1=>dinh,qh1=>led7sh,ql1=>led7sl,c1=>c); u3: led7s port map(a=>led7sh,led7s=>ten_east); u4: led7s port map(a=>led7sl,led7s=>one_east); u5: led7s port map(a=>led7sh
20、,led7s=>ten_north); u6: led7s port map(a=>led7sl,led7s=>one_north);end;2.Morre型狀態(tài)機(jī)的設(shè)計(jì)moore.vhdlibrary ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity moore is port(clk0,rst0,c0 :in std_logic; ld0 :out std_logic; red_east1,green_east1,yellow_east1,red_north1,green_nor
21、th1,yellow_north1:out std_logic; dinl0,dinh0 :out std_logic_vector(3 downto 0);end;architecture one of moore is type st_type is(s0,s1,s2,s3); signal c_st:st_type; signal clk2:std_logic; begin process(clk0,rst0) begin if rst0='0' then c_st<=s0;dinh0<="0100"dinl0<="0101
22、"ld0<='0'red_east1<='0'yellow_east1<='0'green_east1<='1'red_north1<='1'yellow_north1<='0'green_north1<='0'elsif clk0'event and clk0='1' then case c_st iswhen s0=>if c0='1' then c_st<=s1;dinh0&
23、lt;="0000"dinl0<="0101"ld0<='0' else c_st<=s0;ld0<='1' endif; red_east1<='0'yellow_east1<='0'green_east1<='1'red_north1<='1'yellow_north1<='0'green_north1<='0' when s1=>if c0='1
24、39; then c_st<=s2;dinh0<="0010"dinl0<="0101"ld0<='0' else c_st<=s1;ld0<='1' end if; red_east1<='0'yellow_east1<='1'green_east1<='0'red_north1<='1'yellow_north1<='0'green_north1<='0'
25、;when s2=>if c0='1' then c_st<=s3;dinh0<="0000"dinl0<="0101"ld0<='0' else c_st<=s2;ld0<='1'end if; red_east1<='1'yellow_east1<='0'green_east1<='0'red_north1<='0'yellow_north1<='0'g
26、reen_north1<='1'when s3=>if c0='1' then c_st<=s0;dinh0<="0100"dinl0<="0101"ld0<='0' else c_st<=s3;ld0<='1'end if; red_east1<='1'yellow_east1<='0'green_east1<='0'red_north1<='0'yell
27、ow_north1<='1'green_north1<='0'when others=>red_east1<='0'yellow_east1<='0'green_east1<='1'red_north1<='1'yellow_north1<='0'green_north1<='0'ld0<='0' end case; end if; end process;end;3.減法計(jì)數(shù)器的設(shè)計(jì)jish
28、u.vhdlibrary ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity jishu is port(clk1:in std_logic; ld1:in std_logic; dinl1:in std_logic_vector(3 downto 0); dinh1:in std_logic_vector(3 downto 0); ql1:out std_logic_vector(3 downto 0); qh1:out std_logic_vector(3 downto 0); c1:out std
29、_logic);end;architecture one of jishu is signal qa,qat:std_logic_vector(3 downto 0); signal qb,qbt:std_logic_vector(3 downto 0); signal ca,cb :std_logic; begin qh1<=qb; ql1<=qa; process(clk1) begin qat<=dinl1; if clk1'event and clk1='1' then if ld1='0' then qa<=qat;ca
30、<='0' elsif(qa="0000") then qa<="1001"ca<='0' elsif(qa="0001") then ca<='1'qa<="0000" else qa<=qa-1;ca<='0' end if; end if; end process; process(ca,clk1) begin qbt<=dinh1; if clk1'event and clk1='
31、1' then if ld1='0' then qb<=qbt;cb<='0'c1<='0' elsif(qb="0000" and qa="0001") then c1<='0' elsif(qb="0000" and qa="0010") then c1<='1' elsif(qb="0000" and qa="1000") then c1<=
32、9;1' elsif(qb="0000" and qa="0111") then c1<='0' elsif(ca='1') then qb<=qb-1; end if; end if; end process;end;4.譯碼器的設(shè)計(jì)led7s.vhdlibrary ieee; use ieee.std_logic_1164.all;entity led7s isport( a:in std_logic_vector(3 downto 0); led7s:out std_logic_vector(6
33、downto 0); end led7s;architecture one of led7s isbeginprocess(a) begincase A iswhen "0000"=>led7s<="0111111" when "0001"=>led7s<="0000110"when "0010"=>led7s<="1011011" when "0011"=>led7s<="1001111"
34、;when "0100"=>led7s<="1100110" when "0101"=>led7s<="1101101"when "0110"=>led7s<="1111101" when "0111"=>led7s<="0000111"when "1000"=>led7s<="1111111" when "1001"
35、=>led7s<="1101111"when "1010"=>led7s<="1110111" when "1011"=>led7s<="1111100"when "1100"=>led7s<="0111001" when "1101"=>led7s<="1011110"when "1110"=>led7s<="11
36、11001" when "1111"=>led7s<="1110001"when others=>null; end case; end process; end;(二)智能函數(shù)發(fā)生器1.頂層文件singt.vhdlibrary ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity singt isport(clk,rst:in std_logic; key1,key2,key3:in std_logic; douts:out std_l
37、ogic_vector(7 downto 0);end;architecture one of singt iscomponent sindataport(address:in std_logic_vector(5 downto 0); inclock:in std_logic; q:out std_logic_vector(7 downto 0);end component;component retaport(clk1,rst1:in std_logic; rout1:out std_logic_vector(7 downto 0);end component;component trap
38、port(clk5,rst5:in std_logic; tout5:out std_logic_vector(7 downto 0);end component;component jianxie port(clk3,rst3:in std_logic; jout3:out std_logic_vector(7 downto 0);end component;component zengxieport(clk2,rst2:in std_logic; zout2:out std_logic_vector(7 downto 0);end component;component rectport(
39、clk4,rst4:in std_logic; sout4:out std_logic_vector(7 downto 0);end component;component wavselport (key11,key22,key33:in std_logic; zin0,jin0,rin0,tin0,sin0,sinin0:in std_logic_vector(7 downto 0); dout:out std_logic_vector(7 downto 0);end component;signal q1:std_logic_vector(5 downto 0);signal a0,a1,
40、a2,a3,a4,a5:std_logic_vector(7 downto 0);beginprocess(clk)beginif clk'event and clk='1' then q1<=q1+1;end if;end process;u1:sindata port map (address=>q1,q=>a0,inclock=>clk);u2:reta port map(clk1=>clk,rst1=>rst,rout1=>a1);u3:zengxie port map(clk2=>clk,rst2=>rst
41、,zout2=>a2);u4:jianxie port map(clk3=>clk,rst3=>rst,jout3=>a3);u5:rect port map(clk4=>clk,rst4=>rst,sout4=>a4);u6:trap port map(clk5=>clk,rst5=>rst,tout5=>a5);u7:wavsel port map (key11=>key1,key22=>key2,key33=>key3,sinin0=>a0,rin0=>a1,zin0=>a2,jin0=>
42、;a3,sin0=>a4,tin0=>a5,dout=>douts);end;2.遞增斜波程序zengxie.vhdlibrary ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity zengxie isport(clk2,rst2:in std_logic; zout2:out std_logic_vector(7 downto 0);end;architecture one of zengxie isbegin process(clk2)variable r:std_logic_v
43、ector(7 downto 0);beginif rst2='1' then r:=(others=>'0');elsif clk2'event and clk2='1' thenif r<5 then r:=r+1;else r:=(others=>'0');end if;end if;zout2<=r;end process;end;3.遞減斜波程序jianxie.vhdlibrary ieee;use ieee.std_logic_1164.all;use ieee.std_logic_un
44、signed.all;entity jianxie isport(clk3,rst3:in std_logic; jout3:out std_logic_vector(7 downto 0);end;architecture one of jianxie isbegin process(clk3)variable r:std_logic_vector(7 downto 0);beginif rst3='1' then r:="00000101"elsif clk3'event and clk3='1' thenif r>0 th
45、en r:=r-1;else r:="00000101"end if;end if;jout3<=r;end process;end;4.方波程序reta.vhdlibrary ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity reta isport(clk1,rst1:in std_logic; rout1:out std_logic_vector(7 downto 0);end;architecture one of reta issignal r:std_logic_v
46、ector(7 downto 0);begin process(r)beginif r<6 then rout1<="00000110"else rout1<=(others=>'0');end if;end process;process(clk1,rst1,r)beginif rst1='1' then r<=(others=>'0');elsif clk1'event and clk1='1' thenif r<11 then r<=r+1;else
47、 r<=(others=>'0');end if;end if;end process;end;5.梯形波程序trap.vhdlibrary ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity trap isport(clk5,rst5:in std_logic; tout5:out std_logic_vector(7 downto 0);end;architecture one of trap issignal r:std_logic_vector(7 downto 0)
48、;beginprocess(clk5,rst5)variable p:std_logic_vector(1 downto 0);beginif rst5='1' then r<=(others=>'0');tout5<=(others=>'0');p:="00"elsif clk5'event and clk5='1' thencase p iswhen "00" =>if r<6 then r<=r+1;tout5<=r;else p
49、:="01"end if;when "01" =>if r<9 then r<=r+1;tout5<="00000101"else p:="10"r<="00000101"end if;when "10" =>if r>0 then r<=r-1;tout5<=r;else p:="00"r<="00000001"tout5<=r;end if;when others=&
50、gt;NULL;end case;end if;end process;end;6.三角波程序rect.vhdlibrary ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity rect isport(clk4,rst4:in std_logic; sout4:out std_logic_vector(7 downto 0);end;architecture one of rect issignal r:std_logic_vector(7 downto 0);beginprocess(clk4,rst
51、4,r)variable p:std_logic;beginif rst4='1' then r<=(others=>'0');sout4<=(others=>'0');p:='0'elseif clk4'event and clk4='1' then if p='0' then if r<5 then r<=r+1; else p:='1'r<=r-1; end if; else if r>0 then r<=r-1;
52、else p:='0'r<=r+1; end if; end if;end if;end if;sout4<=r;end process;end;7.正弦波程序sindata.vhdlibrary ieee;use ieee.std_logic_1164.all;library lpm;use lpm.lpm_components.all;entity sindata isport(address: in std_logic_vector (5 downto 0);inclock: in std_logic ;q: out std_logic_vector (7 d
53、ownto 0);end sindata;architecture syn of sindata issignal sub_wire0: std_logic_vector (7 downto 0);component lpm_romgeneric (intended_device_family: string;lpm_address_control: string;lpm_file: string;lpm_outdata: string;lpm_type: string;lpm_width: natural;lpm_widthad: natural);port (address: in std
54、_logic_vector (5 downto 0);inclock: in std_logic ;q: out std_logic_vector (7 downto 0);end component;beginq <= sub_wire0(7 downto 0);lpm_rom_component : lpm_romgeneric map (intended_device_family => "acex1k",lpm_address_control => "registered",lpm_file => "sindata.mif",lpm_outdata => "unregistered",lpm_type => "lpm_rom",lpm_width => 8,lpm_widthad => 6)port map (ad
溫馨提示
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2026年不同類型橋梁的設(shè)計(jì)方法
- 2025年高職機(jī)械制造(液壓傳動(dòng)技術(shù))試題及答案
- 2025年高職建筑設(shè)計(jì)(建筑創(chuàng)意設(shè)計(jì))試題及答案
- 2025年大學(xué)二年級(jí)(醫(yī)療器械與裝備工程)裝備應(yīng)用階段測(cè)試題及答案
- 2025年中職煙草栽培與加工(煙草加工工藝)試題及答案
- 2025年大學(xué)第二學(xué)年(釀酒技術(shù))釀酒工藝模擬測(cè)試試題及答案
- 2025年高職第一學(xué)年(制冷與空調(diào)技術(shù))中央空調(diào)安裝調(diào)試階段測(cè)試試題及答案
- 2025年大學(xué)新能源發(fā)電工程(光伏運(yùn)維)試題及答案
- 2025年中職建筑施工技術(shù)(混凝土施工)試題及答案
- 2025年大學(xué)制漿技術(shù)(制漿工藝)試題及答案
- 中國藥物性肝損傷診治指南(2024年版)解讀
- 基層黨建知識(shí)測(cè)試題及答案
- DG-TJ08-2021-2025 干混砌筑砂漿抗壓強(qiáng)度現(xiàn)場(chǎng)檢測(cè)技術(shù)標(biāo)準(zhǔn)
- 鼻竇炎的護(hù)理講課課件
- 腸系膜脂膜炎CT診斷
- 體外膜肺氧合技術(shù)ECMO培訓(xùn)課件
- 老年醫(yī)院重點(diǎn)專科建設(shè)方案
- 銀行解封協(xié)議書模板
- 超星爾雅學(xué)習(xí)通《學(xué)術(shù)規(guī)范與學(xué)術(shù)倫理(華東師范大學(xué))》2025章節(jié)測(cè)試附答案
- GB 17440-2025糧食加工、儲(chǔ)運(yùn)系統(tǒng)粉塵防爆安全規(guī)范
- 《綠色農(nóng)產(chǎn)品認(rèn)證》課件
評(píng)論
0/150
提交評(píng)論