2016年5月13日 星期五

vhdl 4 bit adder

vhdl 4 bit adder





library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_arith.all;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
 
entity adder_4bit is
     port(
         a : in STD_LOGIC_VECTOR(3 downto 0);
         b : in STD_LOGIC_VECTOR(3 downto 0);
         carry : out STD_LOGIC;
         sum : out STD_LOGIC_VECTOR(3 downto 0)
         );
end adder_4bit;

architecture adder_4bit_arc of adder_4bit is
 
signal Temp1 : std_logic_vector (4 downto 0);

begin 
    Temp1 <= ("0" &  a ) + b ; 
    sum <=Temp1 (3 downto 0);
    carry <= Temp1(4);
end adder_4bit_arc;            


沒有留言:

張貼留言

作業2 MQTT (Relay + DHT22) 控制 ------- 利用Node-Red

作業2 MQTT (Relay + DHT22) 控制 ------- 利用Node-Red 1) 安裝Node-Red  https://ithelp.ithome.com.tw/articles/10201795 https://www.youtube.com/watch?v...