I would like to repeatedly read a file containing a certain set of data; and in
doing so emulating some data providing device in my testbench.
Is it possible to rewind to the start of the file? Or what other means are
available to archieve something like that, say under Modelsim? Piping? ???
Any tips or tricks are certainly welcome ...
Thanks in advance, Guido
--
___ _ phone:+49-30-3463-7126 _____________ Guido Pohl
/ _ . __/ _ /_)_ /_ / fax: -8126 / GMD Fokus =CC TIP=
/__/_(_(_(_(_(_(_) _/ (_)_/ (_(_ / Kaiserin-Augusta-Allee 31
po...@fokus.gmd.de (/ ________________________/ D-10589 Berlin, Germany
Yes it is possible to rewind a file, at least if you use vhdl 93. There you
can close and reopen files with the procedures file_open and file_close in
the textio package.
It is inpossible to do with vhdl 87. A file you open is automaticly closed
at the end of the vhdl execution. You can only store the filecontent in a
variable..
Johan Van Dyck
Johan.v...@philips.com
"Guido Pohl" <po...@fokus.gmd.de> schreef in bericht
news:3925168B...@fokus.gmd.de...
>It is inpossible to do with vhdl 87. A file you open is automaticly closed
>at the end of the vhdl execution. You can only store the filecontent in a
>variable..
To be more precise, in vhdl87, AFAIK, a file is open at the elaboration.
Thus, you can reopen a file, if it is declared in a procedure.
Tristan.
Here is a process showing file reading looping:
read_from_file: process(Clk)
variable indata_line: line;
variable indata: integer;
file input_data_file: text open read_mode is "input_file.bin";
begin
if rising_edge(Clk) then
readline(input_data_file,indata_line);
read(indata_line,indata);
I <= conv_std_logic_vector(indata,8);
if endfile(input_data_file) then
report "end of file -- looping back to start of file";
file_close(input_data_file);
file_open(input_data_file,"input_file.bin");
end if;
end if;
end process;
Good Luck,
Tony
"Guido Pohl" <po...@fokus.gmd.de> wrote in message
Tony Nelson wrote:
> Hello,
>
> Here is a process showing file reading looping:
--
P.S. Please note the new email address and website url
-Ray Andraka, P.E.
President, the Andraka Consulting Group, Inc.
401/884-7930 Fax 401/884-7950
email r...@andraka.com
http://www.andraka.com or http://www.fpga-guru.com
seriously though, does your example work? (i haven't tried to
compile and run it but) it seems like the line
> file input_data_file: text open read_mode is "input_file.bin";
should be
file input_data_file : text;
in order to be closed and opened again. that is, only the file
handle should be declared, delaying the opening for a later
time. it seems like if you defined the file handle and opened
it at the same time, you would get a status or mode error when
you tried to open it again. comments, anyone?
NaV
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!