我有一些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显示了这个错误:无法确定操作符“<=”的定义;在使用where语句的行中。我不知道问题出在哪里。
谢谢你的帮助!!
发布于 2014-10-23 00:15:56
您正在尝试在没有定义关系运算符的std_logic_vector类型的信号上使用关系运算符。您可以通过以下方法之一使其工作:
unsigned中定义的ieee.numeric_std类型。这是在数值上下文中解释数组的标准方法。要么将端口信号声明为unsigned,要么在每次比较中使用类型转换函数。ieee.numeric_std_unsigned包将无符号数字语义添加到std_logic_vector中。不要使用非标准的std_logic_arith,这是一个类似于numeric_std_unsigned的早期包。
对于常量,还应该使用natural而不是integer,因为没有为将unsigned与integer进行比较而定义的运算符。
https://stackoverflow.com/questions/26517284
复制相似问题