?? sumador2.vhd
字號:
library ieee;
use ieee.std_logic_1164.all;
ENTITY sumador IS
GENERIC(SIZE: INTEGER);
PORT(a :IN STD_LOGIC_VECTOR(SIZE - 1 downto 0);
b :IN STD_LOGIC_VECTOR(SIZE - 1 downto 0);
cin :IN STD_LOGIC;
s :OUT STD_LOGIC_VECTOR(SIZE - 1 downto 0);
cout :OUT STD_LOGIC);
END sumador;
architecture josan of sumador is
component fa
PORT(
a :IN STD_LOGIC;
b :IN STD_LOGIC;
cin :IN STD_LOGIC;
s :OUT STD_LOGIC;
cout :OUT STD_LOGIC);
END component;
signal acarreo :STD_LOGIC_VECTOR(SIZE downto 0);
begin
acarreo(0) <= cin;
suma: for i in 0 to SIZE - 1 generate
suma1bit: fa
port map(a => a(i),
b => b(i),
cin => acarreo(i),
s => s(i),
cout => acarreo(i+1));
end generate;
cout <= acarreo(SIZE);
end josan;
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -