Presentation is loading. Please wait.

Presentation is loading. Please wait.

VHDL 邏輯設計 題目:一對十六解多工器 題目:一對十六解多工器 姓名:李國豪 姓名:李國豪 學號:B09322001 學號:B09322001.

Similar presentations


Presentation on theme: "VHDL 邏輯設計 題目:一對十六解多工器 題目:一對十六解多工器 姓名:李國豪 姓名:李國豪 學號:B09322001 學號:B09322001."— Presentation transcript:

1 VHDL 邏輯設計 題目:一對十六解多工器 題目:一對十六解多工器 姓名:李國豪 姓名:李國豪 學號:B09322001 學號:B09322001

2 原理 把一個合成訊號解出成多通道訊號 把一個合成訊號解出成多通道訊號 一對十六解多工器表示輸入只有一個通道, 輸出有十六個 (O0,O1, O2 …..,O15) 通道, 所 以要有四條選擇線控制 I 可以輸出到哪個 O 通道。 一對十六解多工器表示輸入只有一個通道, 輸出有十六個 (O0,O1, O2 …..,O15) 通道, 所 以要有四條選擇線控制 I 可以輸出到哪個 O 通道。

3 真值表

4 當選擇線 S(3)S(2)S(1)S(0) 為 “ 0000 ”, 輸出 O0 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 0000 ”, 輸出 O0 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 0001 ”, 輸出 O1 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 0001 ”, 輸出 O1 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 0010 ”, 輸出 O2 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 0010 ”, 輸出 O2 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 0011 ”, 輸出 O3 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 0011 ”, 輸出 O3 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 0100 ”, 輸出 O4 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 0100 ”, 輸出 O4 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 0101 ”, 輸出 O5 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 0101 ”, 輸出 O5 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 0110 ”, 輸出 O6 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 0110 ”, 輸出 O6 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 0111 ”, 輸出 O7 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 0111 ”, 輸出 O7 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 1000 ”, 輸出 O8 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 1000 ”, 輸出 O8 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 1001 ”, 輸出 O9 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 1001 ”, 輸出 O9 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 1010 ”, 輸出 O10 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 1010 ”, 輸出 O10 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 1011 ”, 輸出 O11 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 1011 ”, 輸出 O11 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 1100 ”, 輸出 O12 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 1100 ”, 輸出 O12 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 1101 ”, 輸出 O13 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 1101 ”, 輸出 O13 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 1110 ”, 輸出 O14 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 1110 ”, 輸出 O14 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 1111 ”, 輸出 O15 為 i 當選擇線 S(3)S(2)S(1)S(0) 為 “ 1111 ”, 輸出 O15 為 i

5 VHDL 程式碼 library ieee; library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_1164.all; entity demux1_16 is entity demux1_16 is port( port( I: in std_logic; -- 輸入訊號線 I: in std_logic; -- 輸入訊號線 S: in integer range 0 to 15; -- 宣告 S 選擇數值範圍只有 0~15 有四條選擇線 S: in integer range 0 to 15; -- 宣告 S 選擇數值範圍只有 0~15 有四條選擇線 O: out std_logic_vector(0 to 15)); -- 輸出線有 16 條 O(15)~O(0) O: out std_logic_vector(0 to 15)); -- 輸出線有 16 條 O(15)~O(0) end; end; architecture main of demux1_16 is architecture main of demux1_16 is begin begin process(I,S) process(I,S) begin -- 利用如果 S 選擇線輸入狀況 begin -- 利用如果 S 選擇線輸入狀況 IF (s=0) then O(0)<=I; -- 輸出等於特定輸入腳 IF (s=0) then O(0)<=I; -- 輸出等於特定輸入腳 else O(0)<='0'; -- 完成解多工器設計 else O(0)<='0'; -- 完成解多工器設計 end if; end if; IF (s=1) then O(1)<=I; else O(1)<='0'; end if; IF (s=1) then O(1)<=I; else O(1)<='0'; end if; IF (s=2) then O(2)<=I; else O(2)<='0'; end if; IF (s=2) then O(2)<=I; else O(2)<='0'; end if; IF (s=3) then O(3)<=I; else O(3)<='0'; end if; IF (s=3) then O(3)<=I; else O(3)<='0'; end if; IF (s=4) then O(4)<=I; else O(4)<='0'; end if; IF (s=4) then O(4)<=I; else O(4)<='0'; end if; IF (s=5) then O(5)<=I; else O(5)<='0'; end if; IF (s=5) then O(5)<=I; else O(5)<='0'; end if; IF (s=6) then O(6)<=I; else O(6)<='0'; end if; IF (s=6) then O(6)<=I; else O(6)<='0'; end if; IF (s=7) then O(7)<=I; else O(7)<='0'; end if; IF (s=7) then O(7)<=I; else O(7)<='0'; end if; IF (s=8) then O(8)<=I; else O(8)<='0'; end if; IF (s=8) then O(8)<=I; else O(8)<='0'; end if; IF (s=9) then O(9)<=I; else O(9)<='0'; end if; IF (s=9) then O(9)<=I; else O(9)<='0'; end if; IF (s=10) then O(10)<=I; else O(10)<='0'; end if; IF (s=10) then O(10)<=I; else O(10)<='0'; end if; IF (s=11) then O(11)<=I; else O(11)<='0'; end if; IF (s=11) then O(11)<=I; else O(11)<='0'; end if; IF (s=12) then O(12)<=I; else O(12)<='0'; end if; IF (s=12) then O(12)<=I; else O(12)<='0'; end if; IF (s=13) then O(13)<=I; else O(13)<='0'; end if; IF (s=13) then O(13)<=I; else O(13)<='0'; end if; IF (s=14) then O(14)<=I; else O(14)<='0'; end if; IF (s=14) then O(14)<=I; else O(14)<='0'; end if; IF (s=15) then O(15)<=I; else O(15)<='0'; end if; IF (s=15) then O(15)<=I; else O(15)<='0'; end if; end process ; end process ; end main; end main;

6 LATTICE 使用 從 開始 程式集 Lattice Semiconductor 開啟檔案

7 新增一個 Project 輸入檔名 選擇 VHDL 格式

8 1. 選擇所要用的裝置 (Device) 3.OK 按下去 2. 選 ispLSI2032E

9 1. 新增一個原始檔 Source 2. 選擇 VHDL Module 格 式 3.OK

10 1. 輸入檔名 mux16_1 2. 實體名稱 3. 結構名稱 4.OK

11 編輯好之後存檔

12 跑看看程式碼有沒有錯 誤

13 設定接腳

14 一一設定接腳 設定好之後 存檔

15 1. 搜尋 Download Cable 2. 燒錄至實驗板就完成了實驗

16 下載吧 !

17 Synplify 的使用 開一個 Project 新的 Project

18 開 NEW HDL File 把程式碼打好 儲存

19 1. 加入檔案 2. 選擇檔案 3. 加入 4.OK

20 程式跑一遍 成功囉

21 閱覽電路圖


Download ppt "VHDL 邏輯設計 題目:一對十六解多工器 題目:一對十六解多工器 姓名:李國豪 姓名:李國豪 學號:B09322001 學號:B09322001."

Similar presentations


Ads by Google