Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - array of file?

 
Thread Tools Search this Thread
Old 11-03-2006, 05:47 PM   #1
Default array of file?


Hi,

I want to write a vhdl testbench which will write some results to file
at each clock edge. The testbench is generic with a parameter called
number_of_channels. For each channel, I want to write the results to
different file "results_<channel_number>.txt"

The file name can be created dynamically but the file pointer that I
need to use the std.textio functions like writeline cannot be created.

-----------------
process (clk)
type text_file_array is array(0 to number_of_channels -1 ) of text; --
<-- fails in compilation
variable results_file : text_file_array;
....
begin
if clk'event and clk='1' then
for index in 0 to number_of_channels-1 loop
write(results_line,"junk");
writeline(results_file(index), results_line);
end loop;
end if;
end process;
--------------------

It seems that VHDL-93 LRM prevents "Elements of file type in composite
types".

Any idea how I can achieve this? Different package or via procedure
etc?

Thanks



hemang
  Reply With Quote
Old 11-03-2006, 06:21 PM   #2
Mike Treseler
 
Posts: n/a
Default Re: array of file?
hemang wrote:

> It seems that VHDL-93 LRM prevents "Elements of file type in composite
> types".


True.
>
> Any idea how I can achieve this? Different package or via procedure
> etc?


I would

1. Package constant arrays of records
for static input.

2. Declare variable arrays of records
to collect variable report data.

3. Write a procedure to format the report
after the test is done.

-- Mike Treseler


Mike Treseler
  Reply With Quote
Old 11-03-2006, 07:49 PM   #3
hemang
 
Posts: n/a
Default Re: array of file?

Mike Treseler wrote:
>
> I would
>
> 1. Package constant arrays of records
> for static input.
>
> 2. Declare variable arrays of records
> to collect variable report data.


I have started going this route. I am collecting the results in arrays
of variables.
>
> 3. Write a procedure to format the report
> after the test is done.


Using a single file variable, I change the pointer once I write the
collected set of data for one channel and move to the next. This seems
to be working, but it limits the length of simulation I can do because
of collection of report data and now if run into memory issues, I will
have to create a block of data to record and then open file, go to the
end of the file, write to it, close file to be opened again for the
next block of data.

do you see any issues in doing anything like this? (probably the only
thing I haven't done so far is to go to the end of the file)

Thanks Mike,

Regards
Hemang



hemang
  Reply With Quote
Old 11-03-2006, 09:05 PM   #4
Mike Treseler
 
Posts: n/a
Default Re: array of file?
hemang wrote:

> Using a single file variable, I change the pointer once I write the
> collected set of data for one channel and move to the next. This seems
> to be working, but it limits the length of simulation I can do because
> of collection of report data and now if run into memory issues, I will
> have to create a block of data to record and then open file, go to the
> end of the file, write to it, close file to be opened again for the
> next block of data.


I would just keep the file open and dump it all,
chan1, chan2, ... chanN.


> do you see any issues in doing anything like this? (probably the only
> thing I haven't done so far is to go to the end of the file)


Try it and see. Simulators are very efficient
storing native types. If I had to break it up,
I would make the test channel generic
and run a tcl loop of vsim -G runs.

-- Mike Treseler


Mike Treseler
  Reply With Quote
Old 11-03-2006, 09:49 PM   #5
hemang
 
Posts: n/a
Default Re: array of file?
Thanks Mike.

A summary of other responses from elsewhere..
I received a few responses with different variations to tackle the
problem

1. Uses generate statement around entity or process and get multiple
files (one file pointer defined using concatenated string with the
entity or process). Folks mentioned that this might be a problem if the
number of files to open are too many (don't know the exact limit..
may be 1000 for 1000 channels?) and modelsim and at times OS can
prevent keeping so many files open at the same time

2. Rapidly open, append, and then close each channel file as I go
through the capture loop. This is painful in terms of simulation time.


3. Write all the results in a single file (with appropriate tags to
identify the results/channel pair) and then do post processing of that
file to create the individual channel files either in vhdl or C or
otherwise.

4. Write all the results in records or arrays and then write the
results to the different file using a single file pointer (which jumps
from one to next after completing the current channels results
writing).. This is memory intensive and can limit the amount of
simulation results that can be captured)

Workaround for 4 is to then write all the results in a fixed size array
and once the array is full, trigger the file writing and then close the
files and continue with the results capturing. Reopen the file, go to
the end of the file and write the next set of block of results.. This
is complicated, but works around all OS and memory limitations.


At this time, I got the case 4 to work in my environment..



hemang
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
SONY DVD RW DW-G120A SOMETIMES FAILS...... atlantic965 DVD Video 0 06-18-2006 10:36 PM
problems backing up dvds Lawrence Traub DVD Video 11 09-27-2005 07:34 PM
Re: Ripping DVDs. Please answer the attached question. - Question.txt Stan Brown DVD Video 19 02-09-2005 11:19 PM
Burn process failed - help! Log file posted for help troubleshooting Michael Mason DVD Video 1 08-16-2004 09:24 PM
Pioneer A05 Problems Bill Stock DVD Video 8 11-28-2003 05:03 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46