VHDL實(shí)驗(yàn)新及答案PPT課件

上傳人:紅** 文檔編號(hào):20741855 上傳時(shí)間:2021-04-17 格式:PPT 頁(yè)數(shù):32 大?。?88KB
收藏 版權(quán)申訴 舉報(bào) 下載
VHDL實(shí)驗(yàn)新及答案PPT課件_第1頁(yè)
第1頁(yè) / 共32頁(yè)
VHDL實(shí)驗(yàn)新及答案PPT課件_第2頁(yè)
第2頁(yè) / 共32頁(yè)
VHDL實(shí)驗(yàn)新及答案PPT課件_第3頁(yè)
第3頁(yè) / 共32頁(yè)

下載文檔到電腦,查找使用更方便

12 積分

下載資源

還剩頁(yè)未讀,繼續(xù)閱讀

資源描述:

《VHDL實(shí)驗(yàn)新及答案PPT課件》由會(huì)員分享,可在線閱讀,更多相關(guān)《VHDL實(shí)驗(yàn)新及答案PPT課件(32頁(yè)珍藏版)》請(qǐng)?jiān)谘b配圖網(wǎng)上搜索。

1、實(shí) 驗(yàn) 1熟 悉 實(shí) 驗(yàn) 環(huán) 境 , 完 成 下 述 實(shí) 驗(yàn) 內(nèi) 容 :1. 2輸 入 與 門 、 2輸 入 或 門 、 2輸 入 異 或 門 及非 門 的 設(shè) 計(jì) 。2. D觸 發(fā) 器 的 設(shè) 計(jì) 。3. 帶 有 異 步 清 零 、 異 步 置 位 功 能 的 邊 沿 JK觸發(fā) 器 的 設(shè) 計(jì) 。 非 門 LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; ENTITY NOT IS PORT(A:IN STD_LOGIC; Y:OUT STD_LOGIC); END ENTITY NOT; ARCHITECTURE ART OF NOT IS BEGIN

2、Y= NOT A; END ARCHITECTURE ART; 異 或 門 LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; ENTITY XOR2 IS PORT(A,B:IN STD_LOGIC; Y:OUT STD_LOGIC); END ENTITY XOR2; ARCHITECTURE ART OF XOR2 IS BEGIN Y=A XOR B; END ARCHITECTURE ART; D觸 發(fā) 器 的 設(shè) 計(jì) library ieee; use ieee.std_logic_1164.all; entity d_chufa is port

3、( clk,d:in std_logic; q:out std_logic); end d_chufa; architecture behav of d_chufa is begin process(clk)is begin if(clk event and clk=1)then q=d; end if; end process; end behav; 異 步 清 零 、 異 步 置 位 功 能 的 邊 沿 JK觸 發(fā) 器 library ieee; use ieee.std_logic_1164.all; entity jk is port( pset,clr,clk,j,k:in std_

4、logic; q,qb:out std_logic); end entity; architecture behav of jk is signal q_s,qb_s:std_logic; begin process(pset,clr,clk,j,k) begin if(pset=0)and(clr=1)then q_s=1;qb_s=0; elsif(pset=1)and(clr=0)then q_s=0;qb_s=1; elsif(clk event and clk=1)then if(j=0)and(k=1)then q_s=0;qb_s=1; elsif(j=1)and(k=0)the

5、n q_s=1;qb_s=0; elsif(j=1)and(k=1)then q_s=not q_s; qb_s=not qb_s; end if; end if; q=q_s; qb=qb_s; end process; end behav; 實(shí) 驗(yàn) 2 1實(shí) 驗(yàn) 內(nèi) 容 : 完 成 下 述 模 塊 的 設(shè) 計(jì) , 實(shí) 現(xiàn) 真 值 表 中的 半 加 與 半 減 的 功 能 。提 示 信 息 : 將 加 法 與 減 法 區(qū) 分 成 兩 個(gè) 功 能 模 塊 ,使 用 BLOCK語(yǔ) 句 將 構(gòu) 造 體 分 為 兩 大 部 分 。輸 入 值 半 加 法 器 (A+B) 半 減 法 器 (A-B)A

6、B Sum Car Difference Borrow0 00 11 01 1 0 01 01 00 1 0110 0100 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity half is port ( a,b:in std_logic; sum,car,dif,bor:out std_logic); end half; architecture behav of half is begin g1:block begin sum=a xor b; car=a xor b; en

7、d block g1; g2:block begin dif=a xor b; bor=(not a) and b; end block g2; end behav; 實(shí) 驗(yàn) 2 2實(shí) 驗(yàn) 內(nèi) 容 : 設(shè) 計(jì) 一 個(gè) 4位 加 減 法 器 .要 求 : a,b: 數(shù) 據(jù) 輸 入 ; sub: 控 制 端 , 高 電 平 實(shí) 現(xiàn) 加 法 功 能 , 低 電 平 實(shí) 現(xiàn) 減 法 功 能 ; s: 和 與 差 的 輸 出 ; co: 進(jìn) 位 與 借 位 的 輸 出 。 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsi

8、gned.all; entity subadd is port(sub:in std_logic; a,b:in std_logic_vector(3 downto 0); s:out std_logic_vector(3 downto 0); co:out std_logic); end entity subadd; architecture behav of subadd is signal temp:std_logic_vector(4 downto 0); begin process(sub,a,b) begin if sub=1 then temp=a+b; else temp=a-

9、b; end if; end process; s=temp(3 downto 0); co=temp(4); end behav; 實(shí) 驗(yàn) 3 1實(shí) 驗(yàn) 內(nèi) 容 : 如 下 表 所 示 為 4位 雙 向 通 用 移 位 寄 存器 74LS194的 真 值 表 , 編 寫 程 序 描 述 該 邏 輯 ,仿 真 其 功 能 。 library ieee; use ieee.std_logic_1164.all; entity ls194 is port ( clr,s0,s1,clk,l,r:in std_logic; p:in std_logic_vector(3 downto 0); q:o

10、ut std_logic_vector(3 downto 0); end ls194; architecture behav of ls194 is signal qs:std_logic_vector(3 downto 0); begin process(clr,s0,s1,clk,l,r)is begin if(clr=0)then qs=0000; elsif(clk event and clk=1)then if(s1=1)and(s0=1)then qs=p; elsif(s1=0)and(s0=1)then if(r=1)then qs(3)=1; qs(2 downto 0)=q

11、s(3 downto 1); elsif(r=0)then qs(3)=0; qs(2 downto 0)=qs(3 downto 1); end if; elsif(s1=1)and(s0=0)then if(l=1)then qs(0)=1; qs(3 downto 1)=qs(2 downto 0); elsif(l=0)then qs(0)=0; qs(3 downto 1)=qs(2 downto 0); end if; end if; end if; q=qs; end process; end behav; 實(shí) 驗(yàn) 3 2實(shí) 驗(yàn) 內(nèi) 容 : 3 8譯 碼 器 的 設(shè) 計(jì) (要 求

12、 用WITH SELECT語(yǔ) 句 完 成 ) ( 圖 形 見(jiàn) 下 頁(yè) ) 。提 示 信 息 :常 見(jiàn) 的 3 8譯 碼 器 的 真 值表 如 右 : A0 A1 A20 0 00 0 10 1 00 1 1 1 0 01 0 11 1 01 1 1 Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y71 0 0 0 0 0 0 00 1 0 0 0 0 0 00 0 1 0 0 0 0 00 0 0 1 0 0 0 00 0 0 0 1 0 0 00 0 0 0 0 1 0 0 0 0 0 0 0 0 1 00 0 0 0 0 0 0 1 當(dāng) EN 1時(shí) , 譯 碼 器 正 常 工 作 ; 當(dāng) EN

13、=0時(shí) ,譯 碼 器 不 動(dòng) 作 。A0A1A2EN Y0Y7 library ieee; use ieee.std_logic_1164.all; entity decode3to8 is port(a:in std_logic_vector(2 downto 0); en:in std_logic; y:out std_logic_vector(7 downto 0); end decode3to8; architecture behav of decode3to8 is signal sel:std_logic_vector(3 downto 0); begin sel=a with s

14、el select Ydoutdoutdoutdoutdoutdoutdoutdoutdoutdoutdoutdoutdoutdoutdoutdoutdout=0000000; end case; end process; end behav; 實(shí) 驗(yàn) 4 2實(shí) 驗(yàn) 內(nèi) 容 : 設(shè) 計(jì) 完 成 一 個(gè) 7位 的 偶 同 位 產(chǎn) 生 器 。提 示 信 息 : 同 位 共 分 為 兩 種 形 式 :奇 同 位 : 數(shù) 據(jù) 位 與 奇 同 位 的 1的 個(gè) 數(shù) 為 奇 數(shù) 。偶 同 位 : 數(shù) 據(jù) 位 與 偶 同 位 的 1的 個(gè) 數(shù) 為 偶 數(shù) 。n位 的 偶 同 位 產(chǎn) 生 器 的 輸 入 信

15、號(hào) 為 n位 , 輸 出 信 號(hào) 為n+1位 , 其 中 前 n位 為 輸 入 信 號(hào) , 最 后 一 位 為 偶 同 位 位 ,且 保 證 輸 出 的 n+1位 信 息 中 1的 個(gè) 數(shù) 為 偶 數(shù) 個(gè) 。 ( 奇 同位 產(chǎn) 生 器 工 作 原 理 類 似 ) library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity tongwei is port ( a:in std_logic_vector(6 downto 0); c:

16、out std_logic_vector(7 downto 0); end entity; architecture behav of tongwei is signal temp:std_logic; begin temp=a(0)xor a(1)xor a(2)xor a(3)xor a(4)xor a(5)xor a(6); c=a end behav; 實(shí) 驗(yàn) 5 1實(shí) 驗(yàn) 內(nèi) 容 : 完 成 1位 全 加 器 的 設(shè) 計(jì) 。提 示 信 息 : 輸 入 為 A,B,C, 其 中 A、 B為 輸 入數(shù) 據(jù) , C為 輸 入 的 進(jìn) 位 標(biāo) 志 位 ; 輸 出 為 Sum和Car, 其 中

17、 Sum為 本 次 運(yùn) 算 結(jié) 果 位 , Car為 本次 進(jìn) 位 標(biāo) 志 位 。 cbasum cbcabacar library ieee; use ieee.std_logic_1164.all; entity fulladd is port ( a,b,c:in std_logic; car,s:out std_logic); end entity fulladd; architecture behav of fulladd is begin s=a xor b xor c ; car=(a and b)or(b and c)or(c and a); end behav; 實(shí) 驗(yàn) 5

18、2實(shí) 驗(yàn) 內(nèi) 容 : 完 成 4位 全 加 法 器 的 設(shè) 計(jì) 。提 示 信 息 : 一 個(gè) 4位 的 全 加 法 器 可 以 由 4個(gè) 1位 的全 加 法 器 級(jí) 聯(lián) 而 成 。 A(0)B(0) S(0)C(1)C(2)C(3)Co A(1) B(1)S(1)S(2)S(3) A(2) B(2)A(3)B(3) library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity fulladd4 is port( a,b:in std

19、_logic_vector(3 downto 0); c0:out std_logic; s:out std_logic_vector(3 downto 0); end fulladd4; architecture str of fulladd4 is signal c1,c2,c3:std_logic; signal t:std_logic; component fulladd port(a,b,c:in std_logic; car,sum:out std_logic); end component; begin t=0; u1: fulladd port map(a(0),b(0),t,

20、c1,s(0); u2: fulladd port map(a(1),b(1),c1,c2,s(1); u3: fulladd port map(a(2),b(2),c2,c3,s(2); u4: fulladd port map(a(3),b(3),c3,c0,s(3); end architecture str; 實(shí) 驗(yàn) 6 1實(shí) 驗(yàn) 內(nèi) 容 : 設(shè) 計(jì) 一 個(gè) 3bits的 可 逆 計(jì) 數(shù) 器 。提 示 信 息 : 由 名 稱 可 以 知 道 , 它 的 計(jì) 數(shù) 方 式 可以 加 ( 檢 測(cè) 到 CLK時(shí) 鐘 的 上 升 沿 , 計(jì) 數(shù) 器 加1) , 也 可 以 減 ( 檢 測(cè) 到 C

21、LK時(shí) 鐘 的 上 升 沿 ,計(jì) 數(shù) 器 減 1) 。 使 用 一 個(gè) 控 制 信 號(hào) DIR決 定 計(jì)數(shù) 器 是 作 加 法 或 減 法 的 動(dòng) 作 。 updncount_3 is port(clk,clr,updn:in std_logic; qa,qb,qc:out std_logic); end library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity updncount_3; architecture rtl of updncount_3 is signal count_3:

22、std_logic_vector(2 downto 0); begin qa=count_3(0); qb=count_3(1); qc=count_3(2); process (clr,clk) begin if (clr=1) then count_30); elsif (clkevent and clk=1) then if (updn=1) then count_3=count_3+1; else count_3=count_3-1; end if; end if; end process; end rtl 實(shí) 驗(yàn) 6 2實(shí) 驗(yàn) 內(nèi) 容 : 分 頻 器 設(shè) 計(jì) 。要 求 :( 1) 設(shè)

23、 計(jì) 一 個(gè) 占 空 比 為 50%的 6分 頻 器 ;( 2) 設(shè) 計(jì) 一 個(gè) 占 空 比 為 1:2的 6分 頻 器 。提 示 信 息 : 占 空 比 為 時(shí) 鐘 周 期 中 高 電 平 與 低 電平 之 比 。 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; entity fdiv is generic(N:integer:=6); port( clkin:in std_logic; clkout:out std_logic

24、); end fdiv; architecture a of fdiv is signal cnt:integer range 0 to n/2-1; n=6 signal temp:std_logic; begin process(clkin) begin if(clkinevent and clkin=1)then if(cnt=n/2-1)then cnt=0; temp=not temp; else cnt=cnt+1; end if; end if; end process; clkout=temp; end a; LIBRARY IEEE; use ieee.std_logic_1

25、164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity shiyan62 is port ( clkin:in std_logic; rest:in std_logic; clk6fen:out std_logic); end; architecture rtl of shiyan62 is signal counter:std_logic_vector(0 to 2); begin process(clkin,counter,rest) begin if rest=0 then counte

26、r=000; elsif clkinevent and clkin=1then if counter5 then counter=counter+1; if counter3 then clk6fen=1; else clk6fen=0; end if; else counter=000; end if; end if ; end process; end architecture rtl; 實(shí) 驗(yàn) 7 1實(shí) 驗(yàn) 內(nèi) 容 : 設(shè) 計(jì) 完 成 一 10進(jìn) 制 加 法 計(jì) 數(shù) 器 。 該 計(jì) 數(shù) 器具 有 同 步 置 數(shù) 、 同 步 清 零 的 功 能 。輸 入 信 號(hào) 為 : clk,clr,e

27、n,datain輸 出 信 號(hào) 為 : dataout,co當(dāng) 輸 入 信 號(hào) clr 1時(shí) , 計(jì) 數(shù) 器 清 零 ;當(dāng) 置 數(shù) 信 號(hào) en=1時(shí) , 計(jì) 數(shù) 器 裝 入 輸 入 datain為 計(jì)數(shù) 初 值 重 新 計(jì) 數(shù) ;其 它 情 況 下 , 計(jì) 數(shù) 器 進(jìn) 行 10進(jìn) 制 加 法 計(jì) 數(shù) , 每 計(jì) 數(shù) 到9時(shí) , 輸 出 co 1, 表 示 進(jìn) 位 。 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity count10 is port ( clr,clk,en:in

28、 std_logic; datain:in std_logic_vector(3 downto 0); co:out std_logic; dataout:out std_logic_vector(3 downto 0); end count10; architecture behav of count10 is signal tmp:std_logic_vector(3 downto 0); begin process(clk) begin if(clk event and clk=1)then if(clr=1)then tmp=0000; elsif(en=1)then tmp=data

29、in; elsif(tmp=1001)then tmp=0000;co=1; else tmp=tmp+1;co=0; end if; end if; end process; dataout=tmp; end behav; 實(shí) 驗(yàn) 7 2實(shí) 驗(yàn) 內(nèi) 容 : 設(shè) 計(jì) 完 成 100進(jìn) 制 加 法 計(jì) 數(shù) 器 。要 求 : 采 用 構(gòu) 造 體 結(jié) 構(gòu) 化 描 述 方 式 由 2個(gè) 10進(jìn) 制 計(jì) 數(shù) 器 級(jí) 聯(lián) 而 成 頂 層 文 件 : library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; ent

30、ity count100 is port(clk:in std_logic; co:out std_logic; dout1,dout2:out std_logic_vector(3 downto 0); end count100; architecture behave of count100 is component count10 is port(clk:in std_logic; co:out std_logic; dataout:out std_logic_vector(3 downto 0); end component; signal temp:std_logic; begin

31、u1:count10 port map(clk,temp,dout1); u2:count10 port map(temp,co,dout2); end behave; 底 層 文 件 : library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity count10 is port(clk:in std_logic; co:out std_logic; dataout:out std_logic_vector(3 downto 0); end count10; architecture behave of count10 is signal temp:std_logic_vector(3 downto 0); begin dataout=temp; process(clk) begin if(clkevent and clk=1)then if(temp=1001)then temp=0000; co=1; else temp=temp+1; co=0; end if; end if; end process; end behave;

展開(kāi)閱讀全文
溫馨提示:
1: 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
2: 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
3.本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
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ì)自己和他人造成任何形式的傷害或損失。

最新文檔

相關(guān)資源

更多
正為您匹配相似的精品文檔
關(guān)于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權(quán)所有   聯(lián)系電話:18123376007

備案號(hào):ICP2024067431號(hào)-1 川公網(wǎng)安備51140202000466號(hào)


本站為文檔C2C交易模式,即用戶上傳的文檔直接被用戶下載,本站只是中間服務(wù)平臺(tái),本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權(quán)或隱私,請(qǐng)立即通知裝配圖網(wǎng),我們立即給予刪除!