繁体   English   中英

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

[英]Quartus II : can't determine definition of operator “”<=“”

我被一些VHDL代码所困扰。

我正在尝试编译此:

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显示此错误:无法确定运算符“ <=”的定义; 在使用WHEN STATEMENT的行。 我不知道是什么问题。

谢谢你的帮助!!

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

  • 使用ieee.numeric_std定义的unsigned类型。 这是在数字上下文中解释数组的标准方法。 可以将端口信号声明为unsigned或者在每次比较中使用类型转换函数。

  • 在VHDL-2008支持下,请使用ieee.numeric_std_unsigned软件包,该软件包将无符号数字语义添加到std_logic_vector

不要使用非标准的std_logic_arith ,它是一个更早的软件包,类似于numeric_std_unsigned

由于没有定义用于比较unsignedinteger运算符,因此也应使用natural而不是integer作为常量。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM