Array's of files

D

dwerdna

Guest
Hi all

Im trying to create a selection of files for a testbench, but the
compiler is failing on the brackets. I tried the equivalent setup with
a loop statement previously and that failed as well. Is there an easy
way, or will I just need to define unique file names and create a
explicit case statement in my code instead of an indexing signal??

The other option would be to have one bigger 'ReadF.txt' file, but then
I lose flexibility for other tests...

Thanks

Andrew

OUTPUT_WORD : process (gsr, sys_clk)
variable VEC_WR_LINE : line;
variable VEC_RD_LINE : line;
file VEC_WR_FILE : text open write_mode is "WriteF.txt";
file VEC_RD_FILE(0) : text open read_mode is "ReadF.txt";
file VEC_RD_FILE(1) : text open read_mode is "ReadF.txt";
file VEC_RD_FILE(2) : text open read_mode is "ReadF.txt";
file VEC_RD_FILE(3) : text open read_mode is "ReadF.txt";
file VEC_RD_FILE(4) : text open read_mode is "ReadF.txt";
variable file_rd_bit_vec : bit_vector (15 downto 0);
begin
 
dwerdna a écrit :
Hi all

Im trying to create a selection of files for a testbench, but the
compiler is failing on the brackets. I tried the equivalent setup with
a loop statement previously and that failed as well. Is there an easy
way, or will I just need to define unique file names and create a
explicit case statement in my code instead of an indexing signal??

The other option would be to have one bigger 'ReadF.txt' file, but then
I lose flexibility for other tests...

Thanks

Andrew

OUTPUT_WORD : process (gsr, sys_clk)
variable VEC_WR_LINE : line;
variable VEC_RD_LINE : line;
file VEC_WR_FILE : text open write_mode is "WriteF.txt";
file VEC_RD_FILE(0) : text open read_mode is "ReadF.txt";
file VEC_RD_FILE(1) : text open read_mode is "ReadF.txt";
file VEC_RD_FILE(2) : text open read_mode is "ReadF.txt";
file VEC_RD_FILE(3) : text open read_mode is "ReadF.txt";
file VEC_RD_FILE(4) : text open read_mode is "ReadF.txt";
variable file_rd_bit_vec : bit_vector (15 downto 0);
begin
VHDL does not allow you to declare or use array of files.
I don't really understand what you want to do. Why do you want to open
a file
5 times.
If you want to select a file, do it:

constant my_filename : string := filename_chooser;
file vec_rd_file : text open read_mode is my_filename;

or because you are using VHDL-93, try:
file vec_rd_file : text;
....
file_open (vec_rd_file, "xxx.txt");

John.
 
Hi all

Thanks for your comments

I have a simple file which I use to simulate memory. I want to expand
how many reads I do to that memory without increasing the file size.
There is no particular reason in not increasing the file size, except I
use the smaller file in other places. I therefore wanted to open an
array of these files and have a pointer on which file to read from
(exhaust one, and move onto the next).

Thanks

Andrew
 

Welcome to EDABoard.com

Sponsor

Back
Top