I'm having the errors below on converting a std_logic_vector to integer.I've googled the problem to fix it but I didn't find an answer. Please help me.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.std_logic_arith.all;
use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity packet_size is
generic(
fifo_MaxDepth:integer range 0 to 256:=16
);
port(
fifo_tlast:in std_logic_vector(fifo_MaxDepth -1 downto 0);
depth:in std_logic_vector(fifo_MaxDepth -1 downto 0);
rd_ptr,wr_ptr:in integer range 0 to fifo_MaxDepth - 1;
pckt_size:out integer range 0 to fifo_MaxDepth
);
end packet_size;
architecture Behavioral of packet_size is
signal temp:integer range 0 to 256:=0;
variable finish_flag:bit:='0';
variable PacketSize_temp:integer range 0 to fifo_MaxDepth;
begin
process (fifo_tlast,rd_ptr,wr_ptr) is
begin
temp<=to_integer(unsigned(depth)); --THE CONVERT STATEMENT IS HERE
for i in rd_ptr to temp loop
if(finish_flag='0') then
PacketSize_temp:=PacketSize_temp + 1;
if(fifo_tlast(i)='1') then
finish_flag:='1';
end if;
end if;
end loop;
end process;
end Behavioral;
and my errors are(the line 53 refers to the convert statement)
ERROR:HDLCompiler:607 - "I:\xilinx\Deficit-Round_Rrobbin\packet_size.vhd" Line 53: Multiple declarations of unsigned included via multiple use clauses; none are made directly visible
ERROR:HDLCompiler:432 - "I:\xilinx\Deficit-Round_Rrobbin\packet_size.vhd" Line 53: Formal <arg> has no actual or default value.
ERROR:HDLCompiler:541 - "I:\xilinx\Deficit-Round_Rrobbin\packet_size.vhd" Line 53: Type integer is not an array type and cannot be indexed.
ERROR:HDLCompiler:854 - "I:\xilinx\Deficit-Round_Rrobbin\packet_size.vhd" Line 45: Unit <behavioral> ignored due to previous errors.