Textio - read the same line more than once?

Joined
Oct 11, 2007
Messages
3
Reaction score
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
 
Joined
May 4, 2007
Messages
49
Reaction score
0
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
 

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

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top