How to load multiple test vector files, where the filename come fromgeneric parameters?

P

py

Hi,

For my test bench design, I coded an input procedure that loops continuously. In each iteration, it opens a vector file and load the content as test stimulus.

What I'm trying to do is pipe in the filenames as generic parameters. At the moment, I can only do something ugly like this:


for ii in 0 to G_NUM_TEST_CYCLE-1 loop
if ii=0 then
readline_nospace(f_data_ref, rline);
elsif ii = 1 then
readline_nospace(f_data_ref_1, rline);
elsif ii = 2 then
readline_nospace(f_data_ref_2, rline);
....


Is there a way to create an array string (if so what's the syntax? I am using vhdl2008) to specify a set of index-able filenames?


Thanks
 
N

Nicolas Matringe

Le 19/12/2013 19:52, py a écrit :
Hi,

For my test bench design, I coded an input procedure that loops continuously. In each iteration, it opens a vector file and load the content as test stimulus.
What I'm trying to do is pipe in the filenames as generic parameters. [...]
Is there a way to create an array string (if so what's the syntax? I am using vhdl2008) to specify a set of index-able filenames?

Hello
You can define an array of strings but they will have to have the same
length (all elements of an array mut be of the exact same type)
A more flexible way would be to read the file names from a single file:

variable filename : line;
file filenames_file, tb_file : text;

while not endfile(filenames_file) loop
readline(filenames_file, filename); -- Read the file name
file_open(tb_file, filename.all, read_mode); -- Open the file
while not endfile(tb_file) loop
<read the file and do whatever needs to be done>
end loop;
file_close(tb_file);
end loop;

Nicolas
 
P

py

Thanks! I was stump earlier due to uneven filename length. This file of files approach sounds good.
 
N

Nicolas Matringe

Le 20/12/2013 00:59, py a écrit :
Thanks! I was stump earlier due to uneven filename length. This file of files approach sounds good.
It's ben a while since I've used this, my code may need some rework but
the basic ideas is there.

Nicolas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top