Vhdl 两个';标准逻辑向量的s补

Vhdl 两个';标准逻辑向量的s补,vhdl,logical-operators,twos-complement,Vhdl,Logical Operators,Twos Complement,我试图将std_逻辑_向量转换为它的两个补码。我试图在向量上执行-2乘法 library ieee; use ieee.std_logic_1164.all; entity twoscomplement is port ( x : in std_logic_vector(15 downto 0); y : out std_logic_vector(15 downto 0) ); end entity; architecture model of twoscompl

我试图将std_逻辑_向量转换为它的两个补码。我试图在向量上执行-2乘法

library ieee;
use ieee.std_logic_1164.all;

entity twoscomplement is 
port ( x : in std_logic_vector(15 downto 0);
       y : out std_logic_vector(15 downto 0)
      );
end entity;

architecture model of twoscomplement is 
signal x_c : std_logic_vector (15 downto 0);

x_c <= (not(x) +'1')*2 ; -- x_c = -2*x

end model;
ieee库;
使用ieee.std_logic_1164.all;
实体2的完成是
端口(x:std_逻辑_向量中(15到0);
y:输出标准逻辑向量(15到0)
);
终端实体;
两个实现的体系结构模型是
信号x_c:std_逻辑_向量(15到0);
添加库

use IEEE.numeric_std.all;
。。。内部建筑

x_c <= signed(x);
x_c添加库

use IEEE.numeric_std.all;
。。。内部建筑

x_c <= signed(x);

x_c尝试转换为整数并使用它们

查看有关转换的此网页。
访问

尝试转换为整数并使用它们

查看有关转换的此网页。
访问

您的具体问题是什么?您是否有需要处理的错误?在信号x_c声明之后缺少一个
begin
。对于-2008年之前添加了使用条款的
使用ieee.numeric_std.all
x\u c不取
std\u逻辑向量的2的补码。拿一个有符号的
数字的2的补码来说,你的具体问题是什么?您是否有需要处理的错误?在信号x_c声明之后缺少一个
begin
。对于-2008年之前添加了使用条款的
使用ieee.numeric_std.all
x\u c不取
std\u逻辑向量的2的补码。取带符号的
数字标准的2的补码。