Textio - read the same line more than once?

Discussion in 'VHDL' started by westkite, Oct 25, 2007.

  1. westkite

    westkite

    Joined:
    Oct 11, 2007
    Messages:
    3
    Hey

    The following will read each line in a file until the end.

    process
    begin
    while not (ENDFILE(TestFile)) loop
    readline(TestFile,line_ind);
    ...
    if (x=Y) then
    exit;
    end if;
    ...
    end loop;
    end process;

    What if you want to read the file one more time.

    I want to read the test vectors from a file. When all the test vectors are read the whole thing shall start all over.

    Hope you can help me.

    Regards
    Thomas
     
    westkite, Oct 25, 2007
    #1
    1. Advertising

  2. westkite

    scottcarl

    Joined:
    May 4, 2007
    Messages:
    49
    Location:
    USA
    westkite,

    There are 2 ways to do this. 1) Declare your TestFile twice but give it a name such as TestFile2, or copy your original TestFile.txt to a different file altogether. When you finish with the first reading jump into a new identical process and iterate on TestFile2.
    2) At the end of this process do a close_file(TestFile) --> Note that some simulators have failed on this command before so watch out and get the syntex correct. After the file_close() command rerun this process again.

    Scott C
     
    scottcarl, Nov 5, 2007
    #2
    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. Riko Wichmann

    comment out more than 1 line at once?

    Riko Wichmann, Nov 30, 2004, in forum: Python
    Replies:
    15
    Views:
    1,006
    Skip Montanaro
    Nov 30, 2004
  2. Marc Boeren
    Replies:
    2
    Views:
    384
    Jim Dovis
    Dec 1, 2004
  3. Superman
    Replies:
    0
    Views:
    290
    Superman
    Feb 27, 2007
  4. cmac
    Replies:
    9
    Views:
    172
    Richard Cornford
    Nov 13, 2004
  5. Gancy
    Replies:
    4
    Views:
    187
    Rasto Levrinc
    Feb 3, 2005
Loading...

Share This Page