EmbDev.net

Forum: FPGA, VHDL & Verilog Creating Multi Files


von Christin K. (christinkimeri)


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!

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
Christin K. wrote:
> Im exporting the data to a  file using print
From WHERE?

> Does anyone knows how can I create different files
With WHAT?
What language do you use?

: Edited by Moderator
von Christin K. (christinkimeri)


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");
}

von Duke Scarring (Guest)


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

von Christin K. (christinkimeri)


Rate this post
useful
not useful
Thanks a lot Duke Scarring.

       Requirement is in VHDL.Can you suggest where can i get materials 
on File system in VHDL.

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


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

: Edited by Moderator
von Christin K. (christinkimeri)


Rate this post
useful
not useful
Thank you lkmiller..

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.