首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Quartus II :无法确定运算符“<=”的定义

Quartus II :无法确定运算符“<=”的定义
EN

Stack Overflow用户
提问于 2014-10-22 21:17:15
回答 1查看 6.5K关注 0票数 0

我有一些VHDL代码。

我正在努力编纂这篇文章:

代码语言:javascript
复制
entity ball is
    port(video_on : in std_logic;
        pixel_x,pixel_y : in std_logic_vector(10 downto 0);
        obj3_r,obj3_g,obj3_b : out std_logic_vector (3 downto 0);
        obj3_on : out std_logic);
end entity;

architecture arch of ball is


-- definimos dimension de izquierda a derecha
constant ball_l : integer :=800;
constant ball_r : integer :=815;

-- definimos dimension de arriba a abajo
constant ball_top : integer :=502;
constant ball_bottom : integer :=522;


begin

obj3_on <= '1' when (ball_l <=pixel_x) and (pixel_x <= ball_r) and (ball_top <= pixel_y) and (pixel_y <= ball_bottom) else 
            '0';

obj3_r <= (others => '0');
obj3_g <= "0111";
obj3_b <= (others => '0');

end arch;

Quartus II显示了这个错误:无法确定操作符“<=”的定义;在使用where语句的行中。我不知道问题出在哪里。

谢谢你的帮助!!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-10-23 00:15:56

您正在尝试在没有定义关系运算符的std_logic_vector类型的信号上使用关系运算符。您可以通过以下方法之一使其工作:

  • 使用在unsigned中定义的ieee.numeric_std类型。这是在数值上下文中解释数组的标准方法。要么将端口信号声明为unsigned,要么在每次比较中使用类型转换函数。
  • 使用VHDL-2008支持,使用ieee.numeric_std_unsigned包将无符号数字语义添加到std_logic_vector中。

不要使用非标准的std_logic_arith,这是一个类似于numeric_std_unsigned的早期包。

对于常量,还应该使用natural而不是integer,因为没有为将unsignedinteger进行比较而定义的运算符。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26517284

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档