【问题标题】:Xilinx ISE: found '0' definitions of operator "+", cannot determine exact overloaded matching definition for "+"Xilinx ISE:找到运算符“+”的“0”定义,无法确定“+”的精确重载匹配定义
【发布时间】:2020-07-01 07:34:48
【问题描述】:

我正在将 Bin 写入 BCD 代码乘法器,在顶部模块中 Xilinx ISE 给出了这个错误:

第 30 行:找到运算符“+”的“0”定义,无法确定准确 “+”的重载匹配定义

虽然我已将端口映射到顶部模块

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
-- library UNISIM;
-- use UNISIM.VComponents.all;

entity EightDisplayControl is
    Port ( clk : in  STD_LOGIC;
           leftL, near_leftL : in  STD_LOGIC_VECTOR (3 downto 0);
           near_rightL, rightL : in  STD_LOGIC_VECTOR (3 downto 0);
           leftR, near_leftR : in  STD_LOGIC_VECTOR (3 downto 0);
           near_rightR, rightR : in  STD_LOGIC_VECTOR (3 downto 0);
           select_display : out  STD_LOGIC_VECTOR (7 downto 0);
           segments : out  STD_LOGIC_VECTOR (6 downto 0));
end EightDisplayControl;

architecture Behavioral of EightDisplayControl is
    signal Display      : std_logic_vector(2 downto 0);
    signal div      : std_logic_vector(16 downto 0);
    signal convert_me : std_logic_vector(3 downto 0);
begin

div<= div+1 when rising_edge(clk);
Display <= div(16 downto 14); 

process(Display, leftL, near_leftL, near_rightL, rightL, leftR, near_leftR, near_rightR, rightR)
begin
    if    Display ="111" then select_display <= "11111110"; convert_me <= leftL;
    elsif Display ="110" then select_display <= "11111101"; convert_me <= near_leftL;
    elsif Display ="101" then select_display <= "11111011"; convert_me <= near_rightL;
    elsif Display ="100" then select_display <= "11110111"; convert_me <= rightL; 
    elsif Display ="011" then select_display <= "11101111"; convert_me <= leftR; 
    elsif Display ="010" then select_display <= "11011111"; convert_me <= near_leftR; 
    elsif Display ="001" then select_display <= "10111111"; convert_me <= near_rightR; 
    else                              select_display <= "01111111"; convert_me <= rightR; 
    end if;
end process;

decoder : entity work.segment_decoder 
        port map (convert_me, segments); 

end Behavioral;

【问题讨论】:

  • 请检查 VHDL 常见问题解答:tams.informatik.uni-hamburg.de/vhdl/doc/faq/FAQ1.html#4.11 简而言之,std_logic_vector + 整数:无法完成。更现代的编码是使用 IEEE.numeric_std 对向量进行算术运算
  • 那么我应该更改哪些代码? @vermaete
  • @BananaGuy 将 div 信号更改为无符号类型。
  • 好的,将 IEEE.numeric_std 更改为 IEEE.std_logic_unsigned? @Tricky 当我更改它时,有更多错误
  • 你有邮箱吗? @Tricky

标签: vhdl fpga xilinx xilinx-ise


【解决方案1】:

正如在 cmets 中已经说明的那样,问题在于您将信号 div 定义为 std_logic_vector。 IEEE.numeric_std 库没有为 std_logic_vector 定义加法运算。

查看我们看到的库:

--============================================================================

-- Id: A.3
function "+" (L, R: UNSIGNED) return UNSIGNED;
-- Result subtype: UNSIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
-- Result: Adds two UNSIGNED vectors that may be of different lengths.

-- Id: A.4
function "+" (L, R: SIGNED) return SIGNED;
-- Result subtype: SIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
-- Result: Adds two SIGNED vectors that may be of different lengths.

-- Id: A.5
function "+" (L: UNSIGNED; R: NATURAL) return UNSIGNED;
-- Result subtype: UNSIGNED(L'LENGTH-1 downto 0).
-- Result: Adds an UNSIGNED vector, L, with a non-negative INTEGER, R.

-- Id: A.6
function "+" (L: NATURAL; R: UNSIGNED) return UNSIGNED;
-- Result subtype: UNSIGNED(R'LENGTH-1 downto 0).
-- Result: Adds a non-negative INTEGER, L, with an UNSIGNED vector, R.

-- Id: A.7
function "+" (L: INTEGER; R: SIGNED) return SIGNED;
-- Result subtype: SIGNED(R'LENGTH-1 downto 0).
-- Result: Adds an INTEGER, L(may be positive or negative), to a SIGNED
--         vector, R.

-- Id: A.8
function "+" (L: SIGNED; R: INTEGER) return SIGNED;
-- Result subtype: SIGNED(L'LENGTH-1 downto 0).
-- Result: Adds a SIGNED vector, L, to an INTEGER, R.

--============================================================================

这清楚地表明只支持添加无符号、有符号、自然和整数的函数。

正如@Tricky 在 cmets 中所说,您需要将 div 定义为无符号。

【讨论】:

  • 还有 IEEE Std 1076-2008 包 numeric_std_unsigned 它通过封装将 std_logic_vector 视为无符号类型并提供相同的功能。
  • 确实有,但仅与 VHDL-2008 及更高版本兼容。大多数工具将默认使用 VHDL-93,我不想将这个问题与对此的讨论混淆。
  • 我必须创建什么样的测试平台?
  • @BananaGuy 我不确定,我猜是蓝色的。说真的,在你原来的问题和我的回答的背景下,你在评论中的问题没有意义。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-09-25
  • 1970-01-01
  • 2018-04-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多