J
Joachim Parsch
Guest
Hi,
I have the following problem:
There is an entity, which serves as an interface for
n applications (n is generic).
Example:
entity random is
generic (n: integer);
port (
any_vector: in std_logic_vector(n-1 downto 0);
any_other: out std_logic_vector(n-1 downto 0)
);
end entity;
architecture more_random of random is
type vector_array is array (0 to (n-1)) of std_logic_vector(15 downto 0);
begin
--do something with any_vector and vector_array to produce any_other
end more_random;
So far, so good.
But now I want to use the type "vector_array" for a port of the entity.
Something like:
entity random is
generic (n: integer);
port (
any_vector: in std_logic_vector(n-1 downto 0);
any_more: in vector_array;
any_other: out std_logic_vector(n-1 downto 0)
);
end random;
Where can I put the type definition into?
If I put it in an external library, the compiler moans about the unknown n.
If I put it in the entity-header in front of the ports, the compiler moans, that
the entity-header should end after the type declaration.
If I put it in the entity-header after the ports, the compiler moans about the
unknown type "vector_array".
Is there a solution for this? In the component declaration one level above
there is no problem:
architecture bla of blue is
type vector_array is array (0 to (n-1)) of std_logic_vector(15 downto 0);
component random is
generic (n: integer);
port (
any_vector: in std_logic_vector(n-1 downto 0);
any_more: in vector_array;
any_other: out std_logic_vector(n-1 downto 0)
);
end component;
Regards
Joachim
I have the following problem:
There is an entity, which serves as an interface for
n applications (n is generic).
Example:
entity random is
generic (n: integer);
port (
any_vector: in std_logic_vector(n-1 downto 0);
any_other: out std_logic_vector(n-1 downto 0)
);
end entity;
architecture more_random of random is
type vector_array is array (0 to (n-1)) of std_logic_vector(15 downto 0);
begin
--do something with any_vector and vector_array to produce any_other
end more_random;
So far, so good.
But now I want to use the type "vector_array" for a port of the entity.
Something like:
entity random is
generic (n: integer);
port (
any_vector: in std_logic_vector(n-1 downto 0);
any_more: in vector_array;
any_other: out std_logic_vector(n-1 downto 0)
);
end random;
Where can I put the type definition into?
If I put it in an external library, the compiler moans about the unknown n.
If I put it in the entity-header in front of the ports, the compiler moans, that
the entity-header should end after the type declaration.
If I put it in the entity-header after the ports, the compiler moans about the
unknown type "vector_array".
Is there a solution for this? In the component declaration one level above
there is no problem:
architecture bla of blue is
type vector_array is array (0 to (n-1)) of std_logic_vector(15 downto 0);
component random is
generic (n: integer);
port (
any_vector: in std_logic_vector(n-1 downto 0);
any_more: in vector_array;
any_other: out std_logic_vector(n-1 downto 0)
);
end component;
Regards
Joachim