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
    Likes Received:
    0
    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. Advertisements

  2. scottcarl

    scottcarl

    Joined:
    May 4, 2007
    Messages:
    49
    Likes Received:
    0
    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. Advertisements

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. shank
    Replies:
    3
    Views:
    879
    Jukka K. Korpela
    Oct 15, 2003
  2. Riko Wichmann

    comment out more than 1 line at once?

    Riko Wichmann, Nov 30, 2004, in forum: Python
    Replies:
    15
    Views:
    1,231
    Skip Montanaro
    Nov 30, 2004
  3. Marc Boeren
    Replies:
    2
    Views:
    471
    Jim Dovis
    Dec 1, 2004
  4. Superman
    Replies:
    0
    Views:
    368
    Superman
    Feb 27, 2007
  5. Andrew Greensted

    Concatenate TEXTIO line type

    Andrew Greensted, Feb 6, 2008, in forum: VHDL
    Replies:
    6
    Views:
    6,440
    Jim Lewis
    Feb 8, 2008
  6. cmac
    Replies:
    9
    Views:
    255
    Richard Cornford
    Nov 13, 2004
  7. Gancy
    Replies:
    4
    Views:
    435
    Rasto Levrinc
    Feb 3, 2005
  8. dec135@msn.com
    Replies:
    3
    Views:
    242
    Gary Herron
    Dec 23, 2013
Loading...