📄 subtract.vhd
字号:
------------------------------------------------------------------------------------ Company: -- Engineer: -- -- Create Date: 16:06:42 11/03/2008 -- Design Name: -- Module Name: subtract - Behavioral -- Project Name: -- Target Devices: -- Tool versions: -- Description: ---- Dependencies: ---- Revision: -- Revision 0.01 - File Created-- Additional Comments: ------------------------------------------------------------------------------------library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;---- Uncomment the following library declaration if instantiating---- any Xilinx primitives in this code.--library UNISIM;--use UNISIM.VComponents.all;entity subtract is
generic (
inst_width : INTEGER := 32
);
port (
inst_A : in std_logic_vector(inst_width-1 downto 0);
inst_B : in std_logic_vector(inst_width-1 downto 0);
DIFF : out std_logic_vector(inst_width downto 0)
);
end subtract;
architecture oper of subtract is
signal a_signed, b_signed,diff_signed: SIGNED(inst_width downto 0);
begin
a_signed <= SIGNED(inst_A(inst_width-1) & inst_A);
b_signed <= SIGNED(inst_B(inst_width-1) & inst_B);
diff_signed <= a_signed - b_signed;
DIFF <= std_logic_vector(diff_signed);
end oper;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -