Creating Multi Files

OP #4909577
Rate this post
useful
not useful
Im exporting the data to a  file using print but now I need to solve 
this system for different values of my parameters and i dont want to 
create different files manually. Does anyone knows how can I create 
different files to store the different solutions i get for the different 
values of my parameters?

Sorry for my english and thanks!
OP #4909886
Rate this post
useful
not useful
I am using VHDL language.

Different data should be write into  different files by creating 
manually...

Below is the equivalent C code. I am not able convert it to VHDL..

FILE *files[numfiles];
for (int i = 0; i < numfiles; i++)
{
    char filename[20];
    sprintf(filename, "results%d.dat", i);
    files[i] = fopen(filename, "w");
}
Guest #4910108
Rate this post
useful
not useful
Here is a starting point:
1
entity multiple_files_tb is
2
end entity multiple_files_tb;
3

4
library std;
5
use std.textio.all;
6

7
architecture testbench of multiple_files_tb is
8

9
    constant filename : string := "results";
10

11
begin
12

13
    main: process
14
        file        outfile : text;
15
        variable    status  : file_open_status;
16
        variable    l       : line;
17
    begin
18
        for index in 0 to 20000 loop
19
            file_open( status,  outfile, filename & integer'image( index) & ".dat", write_mode);
20
            if status = open_ok then
21
                write( l, "this is file nr. " & integer'image( index));
22
                writeline( outfile, l);
23
            else
24
                report "error opening file " & integer'image( index);
25
            end if;
26
            file_close( outfile);
27
        end loop;
28
        wait; -- forever
29
    end process;
30
end architecture testbench;

Text and file processing is no fun in VHDL. I would write everything 
with a tag in a single file.
After that you could any better tool for processing like python, matlab, 
c, you-name-it.

Duke
Moderator (Company: Titel) #4911274
Rate this post
useful
not useful
Christin K. wrote:
> Can you suggest where can i get materials on File system in VHDL.
Look there somewhere around page 500:
http://xilinx.eetrend.com/files-eetrend-xilinx/forum/201404/7000-11806-the_designers_guide_to_vhdlpeter_j.ashenden.pdf

And there was stefanvhdl.org ...
As a pity its offline now, but with wayback you ca look a captured 
version of the page:
https://web.archive.org/web/20160914062538/http://stefanvhdl.com/vhdl/html/index.html

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now