Presentation is loading. Please wait.

Presentation is loading. Please wait.

使用VHDL設計—4位元加法器 通訊一甲 B09622048 楊穎穆.

Similar presentations


Presentation on theme: "使用VHDL設計—4位元加法器 通訊一甲 B09622048 楊穎穆."— Presentation transcript:

1 使用VHDL設計—4位元加法器 通訊一甲 B 楊穎穆

2 目錄 目的 設計原理 程式 實驗結果 參考資料

3 目的 1. 使用VHDL設計一個4位元加法器電路 此電路有A與B輸入各4位元 前一進位Ci 輸出有和S與進位Cy 2. 將電路加以模擬
2. 將電路加以模擬 3. 將程式燒錄到IC執行 4. 將以上原理撰寫成PPT格式報告交出 5. 將以上原理與操作過程講述一便並錄製成影音檔交出

4 設計原理 a3 b3 a2 b2 a1 b1 a0 b0 cy ci s3 s2 s1 s0 0101 +) 1100 1 0001
+) 主要是由四個全加器所組成。 a3 b3 a2 b2 a1 b1 a0 b0 FA FA FA FA cy ci s3 s2 s1 s0

5 程式 library ieee; use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity add is 電路內部要做的電路名稱 port( 接腳 a,b : in std_logic_vector(3 downto 0); --輸入腳為a,b,且內部各有四個位元數 ci : in std_logic; 輸入腳位ci,代表前一進位 s : out std_logic_vector(3 downto 0); --輸出腳位 s,內部有四個位元數 cy : out std_logic 輸出腳位cy,代表進位 ); end;

6 architecture behav of add is --電路內部結構
signal sum : std_logic_vector(4 downto 0); --表示sum內部有五個位元數 begin process(a,b,ci) 處理內部要輸入的訊號a,b,ci s<=sum(3 downto 0); --將sum的前四個位元,搬入到輸出 s cy<=sum(4); 將sum第五個位元,搬入到cy進位 sum<=('0'& a)+('0'& b)+("0000"& ci); --將a,b輸入的值前各串一個‘0’,ci前串上“0000”,相加的值 搬入到sum end process; 結束process程式 end behav; 程式結束

7 實驗結果(1) 當我輸入a為“1001”,b輸入為“1001”,兩者相加得到的值為“0010”,cy進位為‘1’ 。
當我輸入a為“1001”,b輸入為“1001”,ci輸入為‘1’時,三者相加得到的值為“0011”,cy進位為‘1’ 。

8 實驗結果(2) 當我輸入a為“0101”,b輸入為“1100”,兩者相加得到的值為“0001”,cy進位為‘1’ 。
當我輸入a為“1110”,b輸入為“1010”, ci輸入為‘1’時,三者相加得到的值為“1001”,cy進位為‘1’ 。

9 參考資料 主要的資料內容是參考王志湖老師上課所教授的內容及“數位邏輯”這本書。

10 END


Download ppt "使用VHDL設計—4位元加法器 通訊一甲 B09622048 楊穎穆."

Similar presentations


Ads by Google