Array in an entity declaration ?

C

Chabrie

Guest
Hello togehter,

in the toplevel design, there is an signal "type array of bytes". The
Signal Declarations is described below:

Type ArrayOfBytes is Array (31 downto 0) of std_logic_vector(7 downto 0);
signal test : ArrayOfBytes ;

Now I want to use the signal "test" in a subprogram.

Is there a possibility to add the array of the the toplevel to the port
describtion of the entity declaration of the subprogram?

Something like that:

entity subrogram is

port ( test: in Array (31 downto 0) of std_logic_vectro (7
downto 0);

end entity subprogram;



Best regards
Carsten
 
On Fri, 09 May 2008 10:41:33 +0200, Chabrie
<cchabrie_at_lumino_dot_de@noname.de> wrote:

Hello togehter,

in the toplevel design, there is an signal "type array of bytes". The
Signal Declarations is described below:

Type ArrayOfBytes is Array (31 downto 0) of std_logic_vector(7 downto 0);
signal test : ArrayOfBytes ;
Put the Type declaration in a package, say, mytypes, and use that in
your toplevel design.
Now I want to use the signal "test" in a subprogram.

Is there a possibility to add the array of the the toplevel to the port
describtion of the entity declaration of the subprogram?

Something like that:

entity subrogram is

port ( test: in Array (31 downto 0) of std_logic_vectro (7
downto 0);

end entity subprogram;
No, it's easier than that.

use work.mytypes.all;
-- makes all of my types visible
entity subprogram is
port (
test : in ArrayOfBytes
)
end entity subprogram;

Or

use work.mytypes;
-- now my types aren't automatically visible, to clash with local names
entity subprogram is
port (
test : in work.mytypes.ArrayOfBytes
)
end entity subprogram;

- Brian
 
On May 9, 4:41 am, Chabrie <cchabrie_at_lumino_dot...@noname.de>
wrote:
Hello togehter,

in the toplevel design, there is an signal "type array of bytes". The
Signal Declarations is described below:

Type ArrayOfBytes is Array (31 downto 0) of std_logic_vector(7 downto 0);      
signal  test    : ArrayOfBytes ;

Is there a possibility to add the array of the the toplevel to the port
describtion of the entity declaration of the  subprogram?

Something like that:

entity subrogram is

        port ( test: in Array (31 downto 0) of std_logic_vectro (7
downto 0);

end entity subprogram;
No, it would be of the form
entity subrogram is
port ( test: in ArrayOfBytes);
end entity subprogram;

This would imply then that the definition of 'ArrayOfBytes' would have
to be visible in the entity as well, which means you should move the
definition out of the architecture where you have it now and put it
into a package and add a 'use
work.my_package_that_contains_ArrayOfBytes_definition;' statement.

KJ
 
Chabrie <cchabrie_at_lumino_dot_de@noname.de> posted
on Fri, 09 May 2008 10:41:33 +0200:
|--------------------------------------------------------------------------|
|"[..] |
| |
|Type ArrayOfBytes is Array (31 downto 0) of std_logic_vector(7 downto 0); |
|signal test : ArrayOfBytes ; |
| |
|Now I want to use the signal "test" in a subprogram. |
| |
|Is there a possibility to add the array of the the toplevel to the port |
|describtion of the entity declaration of the subprogram? |
| |
|Something like that: |
| |
|entity subrogram is |
| |
| port ( test: in Array (31 downto 0) of std_logic_vectro (7 |
|downto 0); |
| |
|end entity subprogram;" |
|--------------------------------------------------------------------------|

Your toplevel test and your port test should not have incompatible
types, but you have incorrectly declared the port test to be of
an anonymous type instead of ArrayOfBytes.

Regards,
Colin Paul Gloster
 

Welcome to EDABoard.com

Sponsor

Back
Top