Array of strings?

T

Tricky

Guest
Im trying to bring in a load of file paths into a testbench via
generics (I use generics an an area for stuff other users are allowed
to modify). I really need an array of strings for the file paths
because I need to match the length to another generic that is an
array, otherwise the TB should fail.

Now I know I could easily do this with VHDL 2008 like:

type str_array_t is array(natural range <>) of string;

but lets assume for the moment that we cannot use VHDL 2008. am I
stuck, going to have to use a separate generic for each file path,
which makes the TB far more verbose because I wont be able to do a
loop to read in all of the files.

I thought about using an array of lines, but the problem with pointers
is that they have to be variables, and I would have to set the paths
up in a process. Ideally Id like to read the files before time starts.

Im guessing Im stuck, and this is exactly why they brought
unconstrained array elements into the language.
 
On Thu, 19 Mar 2009 04:19:57 -0700 (PDT), Tricky
<Trickyhead@gmail.com> wrote:

Im trying to bring in a load of file paths into a testbench via
generics (I use generics an an area for stuff other users are allowed
to modify). I really need an array of strings for the file paths
because I need to match the length to another generic that is an
array, otherwise the TB should fail.
How about one great big string, with all the file paths
separated by some convenient separator character
such as horizontal-tab?

You could then parse these out into a bunch of LINE
variables, or (maybe better) keep them in the
original string and save the (start, end) character
position of each filename in an array of pairs of integer.

Yes, the second technique would be better because you
could do it all in functions at elaboration time;
no nasty pointers anywhere. The same scanning function
could tie up your set of filenames with the other
array, and throw an assert failure if the lengths
don't match.
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 

Welcome to EDABoard.com

Sponsor

Back
Top