中缀运算符“+"没有可行的条目; [英] No feasible entries for infix operator "+"

查看:27
本文介绍了中缀运算符“+"没有可行的条目;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设计一个 2s 补码,但它表明错误可以帮助我解决这个问题.

library ieee;使用 ieee.std_logic_1164.all;使用 IEEE.std_logic_arith.all;实体组合是端口(a : 在 std_logic_vector(7 downto 0);y : out std_logic_vector(7 downto 0));结束补偿;comp 的架构数据流是信号温度:std_logic;开始y<= not(a) + "00000001";结束数据流;

<块引用>

错误:D:/modelsim_projects/2scmpliment.vhd(13): 没有可行的条目用于中缀运算符+".

解决方案

使用 Synopsys 包时,需要在 std_logic_1164 之后添加 std_logic_unsigned 包的使用,如:

使用IEEE.std_logic_unsigned.all;

有了这个,您甚至可以使用整数表示法进行加法,例如:

y <= not(a) + 1;

替代方法是使用 IEEE VHDL 标准 numeric_std 包,并进行如下更改:

library ieee;使用 ieee.std_logic_1164.all;使用 ieee.numeric_std.all;...y <= std_logic_vector(unsigned(not(a)) + 1);

I am designing a 2s complement code but it is showing that error can any one help me with that.

library ieee;
use ieee.std_logic_1164.all;
use IEEE.std_logic_arith.all;

entity comp is
port(a : in std_logic_vector(7 downto 0);
    y : out std_logic_vector(7 downto 0));
end comp;

architecture dataflow of comp is
signal temp: std_logic;
begin
    y<=  not(a) + "00000001";
end dataflow;

Error: D:/modelsim_projects/2scmpliment.vhd(13): No feasible entries for infix operator "+".

解决方案

When using Synopsys packages, you need to add use of the std_logic_unsigned package after std_logic_1164, like:

use IEEE.std_logic_unsigned.all;

With this you can even use integer notation for addition like:

y <= not(a) + 1;

Alternative is to use the IEEE VHDL standard numeric_std package, with changes like:

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
...
  y <= std_logic_vector(unsigned(not(a)) + 1);

这篇关于中缀运算符“+"没有可行的条目;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆