【发布时间】:2015-02-07 02:11:03
【问题描述】:
我的输入数据是 2 的补码,我设计的输入是有符号数,所有操作都使用有符号数,我使用 ieee.numeric_std.all 的库,但是当我执行 '+' 时出现错误“找到” 0' 运算符 "+" 的定义,无法确定 "+"" 的精确重载匹配定义。所以我将另一个更改为另一个库 ieee.std_logic_arith.all 并将添加操作作为一个组件进行,它可以工作。 当我使用 testbench 模拟我的代码时,发生错误:实体端口 xin 与组件端口的签名类型不匹配。 我认为这个错误与我的图书馆有关。 谁能帮帮我?
新
我不使用加法器作为组件,下面的代码可以工作
adder: process(clk)
begin
if (clk'event and clk = '1')then
if enable1='1' then
add1 <= (x0(7)&x0) + (x15(8)&x15);
add2 <= (x1(7)&x1) + (x14(8)&x14);
add3 <= (x2(7)&x2) + (x13(8)&x13);
add4 <= (x3(7)&x3) + (x12(8)&x12);
add5 <= (x4(7)&x4) + (x11(8)&x11);
add6 <= (x5(7)&x5) + (x10(8)&x10);
add7 <= (x6(7)&x6) + (x9(8)&x9);
add8 <= (x7(7)&x7) + (x8(8)&x8);
end if;
end if;
end process adder;
我的测试平台库使用use ieee.numeric_std.all;
USE ieee.std_logic_1164.ALL;
use ieee.numeric_std.all;
use ieee.std_logic_textio.all;
use std.textio.all;
ENTITY tb_signedinput IS
END tb_signedinput;
ARCHITECTURE behavior OF tb_signedinput IS
-- Component Declaration
COMPONENT signedinput is
port( Clk : in std_logic;
reset : in std_logic;
enable1 : in std_logic;
Xin : in signed(7 downto 0);
Yout : out signed(19 downto 0)
);
END COMPONENT;
--Inputs
signal Clk : std_logic := '0';
signal reset : std_logic := '0';
signal Xin : signed(7 downto 0) := (others => '0');
signal enable1 : std_logic := '0';
--Outputs
signal Yout : signed(19 downto 0);
-- Array
constant MEMSIZE: integer :=99;
type testarray is array (MEMSIZE downto 0) of signed(7 DOWNTO 0);
signal testvectors: testarray;
shared variable vectornum,outnum: integer;
-- Clock period definitions
constant Clk_period : time := 10 ns;
BEGIN
-- Component Instantiation
uut: signedinput PORT MAP( Clk => Clk,
reset => reset,
Xin => Xin,
enable1 =>enable1,
Yout => Yout );
错误依旧:
Entity port xin does not match with type std_logic_vector of component port
Entity port yout does not match with type std_logic_vector of component port
因此,我再次将我的加法器更改为
add1 <= resize(x0,9) + x15;
语法很好,但在测试台中出现同样的错误..
我的 ISE 类型或库类型有错误吗? 谢谢!
【问题讨论】: