如何用局部变量整数减去输入std_vector?

How to subtract input std_vector with local variable integer?

我有这个输入向量,我必须从我的内部变量中减去它

entity f11 is
    Port ( CLK : in  STD_LOGIC;
             ANIMATE : in  STD_LOGIC;
             MAKE : in STD_LOGIC;
             X_vga : in STD_logic_vector(6 downto 0);
             Y_vga : in STD_logic_vector(6 downto 0);
             X_pos : out STD_logic_vector(6 downto 0);
             Y_pos : out STD_logic_vector(6 downto 0);
          VALID : out STD_LOGIC
      );
end f11;

architecture basic of f11 is

TYPE data_out IS ARRAY(0 TO 5) OF std_logic; 
TYPE mem_data IS ARRAY(0 TO 6) OF data_out; 
SIGNAL ALIVE : STD_LOGIC := '0';
variable f11_data : mem_data := (
        ( '0', '0', '0', '0', '1', '0'),
          ( '0', '0', '0', '1', '0', '1'),
          ( '0', '1', '1', '0', '1', '0'),
          ( '1', '1', '1', '1', '0', '1'),
          ( '0', '1', '1', '0', '1', '0'),
          ( '0', '0', '0', '1', '0', '1'),
          ( '0', '0', '0', '0', '1', '0')
          );

variable pos_x : integer := 8;  
variable pos_y : integer := 8;  


variable xvga : integer ;  
variable yvga : integer ;  
process(CLK) 
 begin
    if(rising_edge(CLK)) then
        xvga:= to_integer(unsigned(X_vga));
        yvga:= to_integer(unsigned(Y_vga));
        if(MAKE = '1')then ALIVE <= MAKE;end if;
        if( xvga <= pos_x + 5 and  yvga <= pos_y + 6 ) then 
        VALID <= f11_data ( xvga - pos_x )(xvga - pos_y) and ALIVE ;
        end if;
    end if;


end process;


X_pos <= pos_x;
 Y_pos <= pos_y;

end basic;

它一直给我一个错误

Error (10482): VHDL error at f11.vhd(53): object "to_integer" is used but not declared

我真的不知道如何解决这个问题,或者有没有其他方法可以让我减去这两个值,有没有一些参考 material 我可以研究一下,因为我是对这些东西真的很陌生,谢谢!

您需要使用 IEEE 库中的 numeric_std 才能使用 to_integer

将此添加到文件顶部:

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;