【发布时间】: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