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

Discussion in 'VHDL' started by py, Dec 19, 2013.

  1. py

    py Guest

    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
     
    py, Dec 19, 2013
    #1
    1. Advertising

  2. Re: How to load multiple test vector files, where the filename comefrom generic parameters?

    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
     
    Nicolas Matringe, Dec 19, 2013
    #2
    1. Advertising

  3. py

    py Guest

    Re: How to load multiple test vector files, where the filename comefrom generic parameters?

    Thanks! I was stump earlier due to uneven filename length. This file of files approach sounds good.
     
    py, Dec 19, 2013
    #3
  4. Re: How to load multiple test vector files, where the filename comefrom generic parameters?

    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
     
    Nicolas Matringe, Dec 20, 2013
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Sm9l?=

    Extract filename from a filename typed by user

    =?Utf-8?B?Sm9l?=, Aug 23, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,068
    Travis Murray
    Aug 24, 2004
  2. Replies:
    1
    Views:
    1,603
    Roland de Ruiter
    Jun 15, 2006
  3. Ed
    Replies:
    10
    Views:
    46,721
    alok000707
    Jul 13, 2010
  4. Replies:
    8
    Views:
    1,999
    Csaba
    Feb 18, 2006
  5. Beauregard T. Shagnasty

    Re: filename.gif or filename.gif.jpg?

    Beauregard T. Shagnasty, May 30, 2008, in forum: HTML
    Replies:
    1
    Views:
    812
    Jonathan N. Little
    May 30, 2008
Loading...

Share This Page