Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - Declaring ports with a complicated array type

 
Thread Tools Search this Thread
Old 12-09-2003, 07:25 PM   #1
Default Declaring ports with a complicated array type


Hi,

I would like to declare an entity that has a port with type

array (1 to columns) of signed (width-1 downto 0)

where both "columns" and "width" are generics of the entity. How can
I do that?

The natural (for me at least) formulation would be along the lines of

entity matrix_source is

generic (
filename : string;
rows, columns : integer;
row_delay, column_delay : integer;
zero_rows : integer;
width : integer);

subtype value is signed (width-1 downto 0);
type value_vector is array (natural range <>) of value;

port (
clk : in std_logic;
rst : in std_logic;
data : out value_vector (1 to columns));

end matrix_source;

However, this is not legal VHDL since ports can not follow entity
declarative items such as the type declarations.

I would be happy to put "value" and "value_vector" into a package but
I can't since "width" is a generic and unknown to that package.

I tried to use a multi-dimensional unconstrained array such as

type signed_vector is array (natural range <>, natural range <>)
of std_logic;

and used it as

port (
data : out signed_vector (1 to columns, width-1 downto 0));

but that is unnatural (to me) since you than need to write stuff like

data (col, width-1 downto 0) <= to_signed (..., width);

which is not only unnatural but also illegal VHDL since you can't
slice a multi-dimensional array.

I must be missing something...

Thanks in advance!

--
Marius Vollmer AG Datentechnik / E-Technik
Tel: +49-231-755-3036 Universität Dortmund
Fax: +49-231-755-3251 Otto-Hahn-Str.4
http://www-dt.e-technik.uni-dortmund.de 44221 Dortmund, Germany


Marius Vollmer
  Reply With Quote
Old 12-09-2003, 08:55 PM   #2
Mike Treseler
 
Posts: n/a
Default Re: Declaring ports with a complicated array type
Marius Vollmer wrote:

> The natural (for me at least) formulation would be along the lines of
>
> entity matrix_source is
>
> generic (
> filename : string;
> rows, columns : integer;
> row_delay, column_delay : integer;
> zero_rows : integer;
> width : integer);
>
> subtype value is signed (width-1 downto 0);
> type value_vector is array (natural range <>) of value;
>
> port (
> clk : in std_logic;
> rst : in std_logic;
> data : out value_vector (1 to columns));


If this is for synthesis, consider saving
the data structures for internal variables
and keep the entity ports simple.

If this is for simulation, consider
not using an entity interface at all.


-- Mike Treseler



Mike Treseler
  Reply With Quote
Old 12-09-2003, 09:29 PM   #3
Marius Vollmer
 
Posts: n/a
Default Re: Declaring ports with a complicated array type
Mike Treseler <> writes:

> Marius Vollmer wrote:
>
>> The natural (for me at least) formulation would be along the lines of
>> entity matrix_source is
>> generic (
>> filename : string;
>> rows, columns : integer;
>> row_delay, column_delay : integer;
>> zero_rows : integer;
>> width : integer);
>> subtype value is signed (width-1 downto 0);
>> type value_vector is array (natural range <>) of value;
>> port (
>> clk : in std_logic;
>> rst : in std_logic;
>> data : out value_vector (1 to columns));

>
> If this is for synthesis, consider saving
> the data structures for internal variables
> and keep the entity ports simple.
>
> If this is for simulation, consider
> not using an entity interface at all.


Thanks for your answer.

The entity is for providing test data to a synthesized circuit during
simulation. So it's both for simulation _and_ for synthesis.

I have now put all types in a package, fixing the value of "width"
over all "matrix_sources", but it still is annoying that VHDL doesn't
seem to allow the construction above, for syntax reasons.


Marius Vollmer
  Reply With Quote
Old 12-09-2003, 10:25 PM   #4
Mike Treseler
 
Posts: n/a
Default Re: Declaring ports with a complicated array type
Marius Vollmer wrote:

> The entity is for providing test data to a synthesized circuit during
> simulation. So it's both for simulation _and_ for synthesis.
>
> I have now put all types in a package, fixing the value of "width"
> over all "matrix_sources"


Glad you got it working.

> but it still is annoying that VHDL doesn't
> seem to allow the construction above, for syntax reasons.


That is one reason why it is standard practice
*not* to instance the testbench, but to drive test data
directly from signals in the architecture of
a null entity.

-- Mike Treseler



Mike Treseler
  Reply With Quote
Old 12-10-2003, 02:41 AM   #5
Jim Lewis
 
Posts: n/a
Default Re: Declaring ports with a complicated array type

The VHDL-200X Fast-Track is considering the following extensions:
type std_logic_matrix is array (natural range<>) of std_logic_vector;

Then you could declare a signal or port as follows:
signal A : std_logic_matrix(7 downto 0)(5 downto 0) ;

Similarly, a subtype declaration:
subtype Matrix_5x5 is std_logic_matrix(4 downto 0)(4 downto 0) ;

The intent then would be that these get added to the
standard packages (1164 and numeric_std).

There are additional proposals. You can find information about
vhdl-200x at: http://www.eda.org/vhdl-200x/
vhdl-200x fast track: http://www.eda.org/vhdl-200x/vhdl-200x-ft

There is a link to the proposals, meeting notes, and the
reflector at each of the above webpages.


Cheers,
Jim
P.S.
IEEE standards policies and procedures require that anyone that
has a vested in a standard be able to attend meetings and comment
on the working groups work (meaning: although we encourage
people to join IEEE and DASC, non-members are permitted
to join reflector - even do work).
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~
Jim Lewis
Director of Training private.php?do=newpm&u=
SynthWorks Design Inc. http://www.SynthWorks.com
1-503-590-4787

Expert VHDL Training for Hardware Design and Verification
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~


Mike Treseler wrote:

> Marius Vollmer wrote:
>
>> The entity is for providing test data to a synthesized circuit during
>> simulation. So it's both for simulation _and_ for synthesis.
>>
>> I have now put all types in a package, fixing the value of "width"
>> over all "matrix_sources"

>
>
> Glad you got it working.
>
>> but it still is annoying that VHDL doesn't
>> seem to allow the construction above, for syntax reasons.

>
>
> That is one reason why it is standard practice
> *not* to instance the testbench, but to drive test data
> directly from signals in the architecture of
> a null entity.
>
> -- Mike Treseler




Jim Lewis
  Reply With Quote
Old 12-10-2003, 01:30 PM   #6
Marius Vollmer
 
Posts: n/a
Default Re: Declaring ports with a complicated array type
Jim Lewis <> writes:

> The VHDL-200X Fast-Track is considering the following extensions:
> type std_logic_matrix is array (natural range<>) of std_logic_vector;


They will also need to change VHDL itself to allow unconstrained
arrays as elements of arrays, right? (Just to check my
understanding.)


Marius Vollmer
  Reply With Quote
Old 12-10-2003, 07:48 PM   #7
Jim Lewis
 
Posts: n/a
Default Re: Declaring ports with a complicated array type
Correct.

Marius Vollmer wrote:

> Jim Lewis <> writes:
>
>
>>The VHDL-200X Fast-Track is considering the following extensions:
>> type std_logic_matrix is array (natural range<>) of std_logic_vector;

>
>
> They will also need to change VHDL itself to allow unconstrained
> arrays as elements of arrays, right? (Just to check my
> understanding.)


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~
Jim Lewis
Director of Training private.php?do=newpm&u=
SynthWorks Design Inc. http://www.SynthWorks.com
1-503-590-4787

Expert VHDL Training for Hardware Design and Verification
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~



Jim Lewis
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Eclipse - Axis2 - Java Webservices Error amanjsingh Software 1 10-09-2007 09:03 AM
Need help on Modelsim VHDL syntax? ASAP:) kaji General Help Related Topics 0 03-14-2007 10:43 PM
Need help on a Modelsim VHDL Syntax? ASAP:) kaji Software 0 03-14-2007 10:43 PM
Need Help on a Modelsim VHDL Syntax....ASAP:) kaji Hardware 0 03-14-2007 10:41 PM
Re: USB issue ... some USB 2 ports working only in USB 1 mode hungsolo2005@yahoo.com A+ Certification 0 06-14-2006 08:26 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46