16位加法器.vhd
来自「清华大学Altera FPGA工程师成长手册(光盘视频)」· VHDL 代码 · 共 19 行
VHD
19 行
LIBRARY IEEE; //调用标准库文件
use ieee.std_logic_1164.all ;
use ieee.std_logic_unsigned.all ;
entity add16 is //定义实体
port( //定义端口
cin : in std_logic ;
a , b : in std_logic_vector(15 downto 0) ;
s : out std_logic_vector(15 downto 0)) ;
end add16 ;
architecture behavior of add16 is
signal st : std_logic_vector(16 downto 0) ;
signal ag,bg : std_logic_vector(16 downto 0) ;
begin
ag<='0'&a ;
bg<='0'&b ;
st<=ag+bg+cin ;
s<=st(15 downto 0) ;
end behavior ;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?