M
Matt North
Guest
Ive got a package called ITRON_VFD which holds a function called CPosition,
Both the package and code calling the function are shown below,
compiling in Leonardo gives the following error -- pkg_test.vhd",line 17:
Error, no feasible entries for subprogram CPosition.
compiling in Modelsim gives the following error --pkg_test.vhd(18): type
error resolving function call: cposition
--Package
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
package ITRON_VFD is
type matrix is array (0 to 2) of bit_vector(7 downto 0);
function CPosition (x, y: bit_vector(7 downto 0)) return matrix;
end ITRON_VFD;
package body ITRON_VFD is
function CPosition (x, y: bit_vector(7 downto 0))
return matrix is variable result: matrix;
constant sc: bit_vector(7 downto 0) := X"10";
type matrix is array (NATURAL range <> of bit_vector(7 downto 0);
begin
result:=(sc, x, y);
return result;
end CPosition;
end ITRON_VFD;
--Code
library IEEE;
use IEEE.std_logic_1164.all;
use WORK.ITRON_VFD.all;
entity test is
port(clk, rst : in std_logic;
outp : out bit_vector(7 downto 0));
end test;
architecture rtl of test is
type abc is array (0 to 2) of bit_vector(7 downto 0);
signal ram: abc;
subtype int_r is integer range 0 to abc'HIGH+1;
signal n: int_r;
begin
ram<=CPosition(X"23", X"44");
process(clk, rst, n, ram)
begin
if rising_edge(clk) then
if rst='0' or n=abc'HIGH+1 then
outp<=X"00";
n<=0;
elsif n<abc'HIGH+1 then
outp<=ram;
n<=n+1;
end if;
end if;
end process;
end rtl;
This is my first project using function calls from my own package and as far
as i can see there isnt any type conflict between the two, the function
expects two bit vectors of length 8 and returns an array of bit vectors.
Any clues.
Thanks,
Matt
Both the package and code calling the function are shown below,
compiling in Leonardo gives the following error -- pkg_test.vhd",line 17:
Error, no feasible entries for subprogram CPosition.
compiling in Modelsim gives the following error --pkg_test.vhd(18): type
error resolving function call: cposition
--Package
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
package ITRON_VFD is
type matrix is array (0 to 2) of bit_vector(7 downto 0);
function CPosition (x, y: bit_vector(7 downto 0)) return matrix;
end ITRON_VFD;
package body ITRON_VFD is
function CPosition (x, y: bit_vector(7 downto 0))
return matrix is variable result: matrix;
constant sc: bit_vector(7 downto 0) := X"10";
type matrix is array (NATURAL range <> of bit_vector(7 downto 0);
begin
result:=(sc, x, y);
return result;
end CPosition;
end ITRON_VFD;
--Code
library IEEE;
use IEEE.std_logic_1164.all;
use WORK.ITRON_VFD.all;
entity test is
port(clk, rst : in std_logic;
outp : out bit_vector(7 downto 0));
end test;
architecture rtl of test is
type abc is array (0 to 2) of bit_vector(7 downto 0);
signal ram: abc;
subtype int_r is integer range 0 to abc'HIGH+1;
signal n: int_r;
begin
ram<=CPosition(X"23", X"44");
process(clk, rst, n, ram)
begin
if rising_edge(clk) then
if rst='0' or n=abc'HIGH+1 then
outp<=X"00";
n<=0;
elsif n<abc'HIGH+1 then
outp<=ram;
n<=n+1;
end if;
end if;
end process;
end rtl;
This is my first project using function calls from my own package and as far
as i can see there isnt any type conflict between the two, the function
expects two bit vectors of length 8 and returns an array of bit vectors.
Any clues.
Thanks,
Matt