0

我被一些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 语句的那一行。我不知道问题是什么。

谢谢你的帮助!!

4

1 回答 1

1

您正在尝试对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常量,因为没有定义用于比较unsigned的运算符integer

于 2014-10-23T00:15:56.350 回答