⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 add.vhd

📁 一些很好的FPGA设计实例
💻 VHD
字号:
----------方案1:in/out=signed-----------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
-----------------------------------------
entity add is
  port (a,b clk: in signed (3 downto 0);
      sum: out signed (4 downto 0));
end add;
-----------------------------------------
architecture add1 of add is
begin 
sum <= a+b;
end add1;
-----------方案2:out=integer-------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
-----------------------------------
entity add2 is
  port (a,b clk: in signed (3 downto 0);
      sum: out integer range -16 to 15 );
end add2;
------------------------------------
architecture add3 of add2 is
begin 
sum <= conv_integer (a+b);
end add3;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -