![VHDL與數(shù)字系統(tǒng)EDA設(shè)計_第1頁](http://file2.renrendoc.com/fileroot_temp3/2021-7/5/52ce82a5-7d8f-49b1-a221-b46b69e2cec7/52ce82a5-7d8f-49b1-a221-b46b69e2cec71.gif)
![VHDL與數(shù)字系統(tǒng)EDA設(shè)計_第2頁](http://file2.renrendoc.com/fileroot_temp3/2021-7/5/52ce82a5-7d8f-49b1-a221-b46b69e2cec7/52ce82a5-7d8f-49b1-a221-b46b69e2cec72.gif)
![VHDL與數(shù)字系統(tǒng)EDA設(shè)計_第3頁](http://file2.renrendoc.com/fileroot_temp3/2021-7/5/52ce82a5-7d8f-49b1-a221-b46b69e2cec7/52ce82a5-7d8f-49b1-a221-b46b69e2cec73.gif)
![VHDL與數(shù)字系統(tǒng)EDA設(shè)計_第4頁](http://file2.renrendoc.com/fileroot_temp3/2021-7/5/52ce82a5-7d8f-49b1-a221-b46b69e2cec7/52ce82a5-7d8f-49b1-a221-b46b69e2cec74.gif)
![VHDL與數(shù)字系統(tǒng)EDA設(shè)計_第5頁](http://file2.renrendoc.com/fileroot_temp3/2021-7/5/52ce82a5-7d8f-49b1-a221-b46b69e2cec7/52ce82a5-7d8f-49b1-a221-b46b69e2cec75.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、vhdl與數(shù)字系統(tǒng)eda設(shè)計姓名: 李 勃 學(xué)號: 0800030014 班級: 代培生班 2009年6月20日目錄實驗一1實驗二5實驗三8實驗四10實驗五14作業(yè)18vhdl與數(shù)字系統(tǒng)eda設(shè)計李勃 0800030014實驗一1. 用if語句設(shè)計一個四十六譯碼器;2. 用case語句設(shè)計一個四十六譯碼器;3. 用generate語句構(gòu)造一個串行的十六進制計數(shù)器。實驗?zāi)康模簩W(xué)會使用相關(guān)eda軟件進行vhdl代碼的輸入、仿真,會用vhdl實現(xiàn)一些簡單的組合邏輯和時序邏輯。1. 用if語句設(shè)計一個四十六譯碼器實驗方案:接口信號的定義如下:port(a : in std_logic;b : in s
2、td_logic;c : in std_logic;d : in std_logic;y : out std_logic_vector(15 downto 0);end decoder;關(guān)鍵部分代碼:process(a,b,c,d) variable comb: std_logic_vector(3 downto 0); begincomb:=a&b&c&d;if comb=0000 then y=0000000000000001;elsif comb=0001 then y=0000000000000010;elsif comb=0010 then y=0000000000000100;el
3、sif comb=0011 then y=0000000000001000;elsif comb=0100 then y=0000000000010000;elsif comb=0101 then y=0000000000100000; elsif comb=0110 then y=0000000001000000;elsif comb=0111 then y=0000000010000000; elsif comb=1000 then y=0000000100000000;elsif comb=1001 then y=0000001000000000; elsif comb=1010 the
4、n y=0000010000000000;elsif comb=1011 then y=0000100000000000;elsif comb=1100 then y=0001000000000000;elsif comb=1101 then y=0010000000000000;elsif comb=1110 then y=0100000000000000;elsif comb=1111 then y=1000000000000000; else y y y y y y y y y y y y y y y y yy=xxxxxxxxxxxxxxxx ;end case ;end proces
5、s;仿真驗證:仿真軟件: active hdl 7.13. 用generate語句構(gòu)造一個串行的十六進制計數(shù)器實驗方案:接口信號的定義如下:entity counter is port( clk : in std_logic; clr : in std_logic; q : out std_logic_vector(3 downto 0) );end counter;關(guān)鍵部分代碼:architecture rtl of counter iscomponent dff port( d : in std_logic; clr : in std_logic; clk : in std_logic;
6、q : out std_logic; qb : out std_logic );end component ; signal q_in: std_logic_vector (4 downto 0) ;begin q_in(0) q_in(i+1),clk=q_in(i),clr=clr,q=q(i),qb=q_in(i+1);end generate;end rtl;仿真驗證:仿真軟件: active hdl 7.1實驗二設(shè)計一個兩位二進制的加法器實驗?zāi)康模?學(xué)會設(shè)計簡單的組合邏輯,并進行功能仿真。實驗方案:先用基本邏輯門設(shè)計一個半加器,再用兩個半加器組合成全加器,再用全加器設(shè)計成二進制加法器
7、。接口定義如下:entity twobit_adder is port( cin : in std_logic; a : in std_logic_vector(1 downto 0); b : in std_logic_vector(1 downto 0); co : out std_logic; s : out std_logic_vector(1 downto 0) );end twobit_adder;關(guān)鍵部分代碼:半加器部分:architecture half_adder of half_adder issignal c,d:std_logic ;begin c=a or b;d=a
8、 nand b;co= not d;s=c and d;end half_adder;全加器部分代碼:u0: half_adder port map (a,b,u0_s,u0_co); u1: half_adder port map (u0_s,cin,s,u1_co); coa(0),b=b(0),cin=cin,s=s(0),co=u0_co); u1: full_adder port map (a=a(1),b=b(1),cin=u0_co,s=s(1),co=co);仿真軟件: active hdl 7.12. 設(shè)計一個兩位的bcd計數(shù)器實驗?zāi)康模簩W(xué)會設(shè)計簡單的時序邏輯,并進行仿真。實
9、驗方案:先設(shè)計一個一位帶進位的bcd計數(shù)器,再以它的進位輸出作為十位計數(shù)器的時鐘輸入。接口定義:entity bcd_counter isport(clk : in std_logic;clr : in std_logic;q0 : out std_logic_vector(3 downto 0);q1 : out std_logic_vector(3 downto 0);end bcd_counter;關(guān)鍵部分代碼:architecture rtl of bcd_counter is signal co: std_logic ;signal in_q0,in_q1: std_logic_ve
10、ctor(3 downto 0);begin q0= in_q0;q1= in_q1;process(clk,clr)beginif (clr=1) thenin_q0=0000;elsif (clkevent and clk=1) thenif (in_q0=1001) thenin_q0=0000;co=1;else in_q0=in_q0+1; co=0;end if;end if;end process;process(co,clr) begin if (clr=1) thenin_q1=0000;elsif (coevent and co=1) then if (in_q1=1001
11、) thenin_q1=0000;else in_q1=in_q1+1;end if;end if ;end process;end rtl;仿真軟件: active hdl 7.1實驗三利用數(shù)組形式描述256x8bits的ram,并利用測試床完成對其讀寫操作。實驗?zāi)康模簩W(xué)會簡單隨機存儲器的讀寫操作,并利用測試臺對其進行測試。接口定義:entity ram is generic (k:integer :=8; w:integer :=8) ;port(wr : in std_logic;rd : in std_logic;cs : in std_logic;din : in std_logic
12、_vector(k-1 downto 0);adr : in std_logic_vector(w-1 downto 0);dout : out std_logic_vector(k-1 downto 0);end ram;關(guān)鍵部分代碼:adr_in=conv_integer(adr);process (wr)begin if(wrevent and wr=1) then wr_rise=now;if(cs=1)thensram(adr_in)=800 ps) report write sram setup time violation severity warning;end process
13、;process(rd,cs,adr_in,wr)begin if(rd=0 and cs=1) thendout=sram(adr_in) after 3 ns;elsedoutz) after 4 ns;end if;end process;process(din)begindin_change300 ps) report read sram hold time violation severity warning;end process;仿真軟件: active hdl 7.1實驗四用vhdl語言設(shè)計uart。實驗?zāi)康模簩W(xué)會用vhdl語言設(shè)計復(fù)雜的電路。實驗方案:uart主要有由數(shù)據(jù)總線
14、接口、控制邏輯、波特率發(fā)生器、發(fā)送部分和接收部分等組成。本設(shè)計主要設(shè)計uart中最重要的發(fā)送部分和接收部分,其他部分設(shè)計不在贅述。功能包括發(fā)送緩沖器(tbr)、發(fā)送移位寄存器(tsr)、幀產(chǎn)生、奇偶校驗、并轉(zhuǎn)串、數(shù)據(jù)接收緩沖器(rbr)、接收移位寄存器(rsr)、幀產(chǎn)生、奇偶校驗、串轉(zhuǎn)并。uart的幀格式下圖所示: uart發(fā)送器的設(shè)計數(shù)據(jù)的發(fā)送是由微處理器控制,微處理器給出wrn信號,發(fā)送器根據(jù)此信號將并行數(shù)據(jù)din7.0鎖存進發(fā)送緩沖器tbr7.0,并通過發(fā)送移位寄存器tsr7.0發(fā)送串行數(shù)據(jù)至串行數(shù)據(jù)輸出端sdo。在數(shù)據(jù)發(fā)送過程中用輸出信號tbre、tsre作為標(biāo)志信號,當(dāng)一幀數(shù)據(jù)由發(fā)送
15、緩沖器tbr7.0送到發(fā)送發(fā)送移位寄存器tsr7.0時,tbre信號為1,而數(shù)據(jù)由發(fā)送移位寄存器tsr7.0串行發(fā)送完畢時,tsre信號為1,通知cpu在下個時鐘裝入新數(shù)據(jù)。發(fā)送器端口信號如下圖所示:部分代碼:process (rst,wrn) -接收數(shù)據(jù)至tbrbeginif rst = 1 thentbr 0) ;elsif wrnevent and wrn = 0 thentbr = din ;end if ;end process ;process (rst,clk16x,clk1x_enable)beginif rst = 1 thenclkdiv = 0000 ;elsif clk
16、16xevent and clk16x = 1 thenif clk1x_enable = 1 thenclkdiv = clkdiv + 0001 ;end if ;end if ;end process ;clk1x = clkdiv(3) ; -產(chǎn)生clk1x時鐘process (rst,clk1x,no_bits_sent,tbr)beginif rst = 1 thensdo = 1 ;tsre = 1 ;tsr = 00000000 ;parity = 1 ;elsif clk1xevent and clk1x = 1 thenif std_logic_vector(no_bits
17、_sent) = 0001 thentsr = tbr ; -發(fā)送緩沖器tbr數(shù)據(jù)進入發(fā)送移位寄存器tsrtsre = 0 ; -發(fā)送移位寄存器空標(biāo)志置“0”elsif std_logic_vector(no_bits_sent) = 0010 thensdo = 0011 and std_logic_vector(no_bits_sent) = 1010 thentsr = tsr(6 downto 0) & 0 ; -從低位到高位進行移位輸出至串行輸出端sdosdo = tsr(7) ;parity = parity xor tsr(7) ; -數(shù)據(jù)位中的1校驗end if ;end if
18、 ;end process ;process (rst,clk1x,clk1x_enable) -產(chǎn)生發(fā)送字符長度和發(fā)送次序計數(shù)器beginif rst = 1 or clk1x_enable = 0 thenno_bits_sent = 0000 ;elsif clk1xevent and clk1x = 1 thenif clk1x_enable = 1 thenno_bits_sent = no_bits_sent + 0001 ;end if ;end if ;end process ;uart接收器的設(shè)計串行數(shù)據(jù)幀和接收時鐘是異步的,發(fā)送來的數(shù)據(jù)由邏輯1變?yōu)檫壿?可以視為一個數(shù)據(jù)幀的
19、開始。接收器先要捕捉起始位,確定rxd輸入由1到0,邏輯0要8個clk16時鐘周期,才是正常的起始位,然后在每隔16個clk16時鐘周期采樣接收數(shù)據(jù),移位輸入接收移位寄存器rsr,最后輸出數(shù)據(jù)dout。還要輸出一個數(shù)據(jù)接收標(biāo)志信號標(biāo)志數(shù)據(jù)接收完。接收器的端口信號如下圖所示:部分代碼:process (clk1x,rst)beginif rst = 1 thenrsr = 00000000 ;rbr = 00000000 ;parity = 1 ;framing_error = 0 ;parity_error = 0001 and std_logic_vector(no_bits_rcvd) 1
20、001 then - 數(shù)據(jù)幀數(shù)據(jù)由接收串行數(shù)據(jù)端移位入接收移位寄存器rsr(0) = rxd2 ;rsr(7 downto 1) = rsr(6 downto 0) ;parity = parity xor rsr(0) ;elsif std_logic_vector(no_bits_rcvd) = 1010 thenrbr = rsr ; -接收移位寄存器數(shù)據(jù)進入接收緩沖器elsif parity = 0 thenparity_error = 1 ;elsif std_logic_vector(no_bits_rcvd) = 1001 and rxd2 = 0 thenframing_err
21、or = 1 ;end if ;end if ;end process ;process (rst,clk1x,clk1x_enable,no_bits_rcvd)beginif rst = 1 or (std_logic_vector(no_bits_rcvd) = 1100 and clk1x_enable = 0) thenno_bits_rcvd = 0000 ;elsif clk1xevent and clk1x = 1 thenif clk1x_enable = 1 thenno_bits_rcvd = no_bits_rcvd + 0001 ;end if ;end if ;en
22、d process ;dout = std_logic_vector(rbr) when rdn = 0 else zzzzzzzz ;end ;uart設(shè)計總模塊將發(fā)送器和接收器模塊組裝起來,就能較容易地實現(xiàn)通用異步收發(fā)器總模塊。總模塊rtl圖如下圖:程序在max+plus ii環(huán)境下的分析波形仿真圖:由于條件限制,數(shù)據(jù)給的太多,從上圖是看不出來的,所以,為了說明設(shè)計的正確性,只給出了一個數(shù)據(jù)。通過波形仿真圖我們可以清楚的看到uart的工作原理。實驗五完成第九章計時電路設(shè)計。實驗?zāi)康模簩W(xué)會設(shè)計稍微復(fù)雜一點的電路,學(xué)會自頂向下的設(shè)計方法。實驗方案:先進行十進制計數(shù)器,六進制計數(shù)器,四進制計數(shù)器
23、等底層模塊的設(shè)計,再運用模塊化的設(shè)計方法,把它們組裝成完整的計時器電路。接口:entity stop_watch isport(sysres : in std_logic;reset_sw : in std_logic;start_stop_sw : in std_logic;clk : in std_logic;dispen : in std_logic;enclk : in std_logic;xinxuanma :out std_logic;segment : out std_logic_vector(6 downto 0);common : out std_logic_vector(5
24、 downto 0);end stop_watch;關(guān)鍵部分代碼:頂層模塊的代碼:architecture rtl of stop_watch is component clkgen port(sysres : in std_logic;en1 : in std_logic;clk : in std_logic;cntclk : out std_logic;keyclk : out std_logic);end component; component keyin port(reset_sw : in std_logic;start_stop_sw : in std_logic;keyclk
25、: in std_logic;clk : in std_logic;res : out std_logic;stst : out std_logic);end component;component ctrl port(sysres : in std_logic;res : in std_logic;stst : in std_logic;cntclk : in std_logic;cnten : out std_logic);end component ;component cntblk port(sysres : in std_logic;clk : in std_logic;cnten
26、: in std_logic;res : in std_logic;secl2 : out std_logic_vector(3 downto 0);secl1 : out std_logic_vector(3 downto 0);sec : out std_logic_vector(3 downto 0);sec10 : out std_logic_vector(2 downto 0);min : out std_logic_vector(3 downto 0);min10 : out std_logic_vector(2 downto 0);end component ; componen
27、t disp port(secl2 : in std_logic_vector(3 downto 0);secl1 : in std_logic_vector(3 downto 0);sec : in std_logic_vector(3 downto 0);sec10 : in std_logic_vector(3 downto 0);min : in std_logic_vector(3 downto 0);min10 : in std_logic_vector(3 downto 0); sysres : in std_logic;clk : in std_logic;dispen : i
28、n std_logic;segment : out std_logic_vector(6 downto 0);common : out std_logic_vector(5 downto 0);end component ; signal cntclk_s :std_logic :=0;signal keyclk_s:std_logic :=0;signal stst_s:std_logic :=0;signal cnten_s:std_logic :=0;signal res_s :std_logic :=0; signal secl2_s:std_logic_vector(3 downto
29、 0):=0000;signal secl1_s:std_logic_vector(3 downto 0):=0000;signal sec_s:std_logic_vector(3 downto 0):=0000;signal min_s:std_logic_vector(3 downto 0):=0000;signal sec10_s:std_logic_vector(3 downto 0):=0000;signal min10_s :std_logic_vector(3 downto 0):=0000; signal sec10_s1:std_logic_vector(2 downto 0):=000;signal min10_s1:std_logic_vector(2 downto 0):=000; beginxinxuanma= cntclk_s; sec10_s=0&sec10_s1;min10_s=0&min10_s1;u0: clkgen port map(sysr
溫馨提示
- 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)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度建筑工程施工合同合同風(fēng)險預(yù)警與防范措施協(xié)議
- 2025年中國兩性霉素B行業(yè)市場全景監(jiān)測及投資策略研究報告
- 個人購買門臉房合同范本
- 上海bim合同范本
- 農(nóng)場自建旅館合同范本
- 代理退稅合同范本
- 2025年度高新技術(shù)產(chǎn)業(yè)公司總經(jīng)理專項聘用合同
- 養(yǎng)殖競標(biāo)合同范本
- 駕校教練車承包合同范本
- 2025年陶瓷化工填料項目可行性研究報告
- QC成果地下室基礎(chǔ)抗浮錨桿節(jié)點處防水施工方法的創(chuàng)新
- 第一章:公共政策理論模型
- 中藥審核處方的內(nèi)容(二)
- (完整)金正昆商務(wù)禮儀答案
- RB/T 101-2013能源管理體系電子信息企業(yè)認證要求
- GB/T 10205-2009磷酸一銨、磷酸二銨
- 公司財務(wù)制度及流程
- 高支模專項施工方案(專家論證)
- 《物流與供應(yīng)鏈管理-新商業(yè)、新鏈接、新物流》配套教學(xué)課件
- 物聯(lián)網(wǎng)項目實施進度計劃表
- MDD指令附錄一 基本要求檢查表2013版
評論
0/150
提交評論