Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
11 years ago

generated file name vhdl

Hello guys,

I have this issue. I have in the process declarations 2 varaibles of type FILE :

MODULE(A)

PROCESS(clk)

FILE ei : text IS OUT "ei.txt";

FILE ej : text IS OUT "ej.txt";

begin

---

This module is generated in the top level entity several times. Each module has its own ID.

Do you know how to generate a different file name for each module?(something like for the first module ei_1.txt ej_2.txt)

Thanks

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Hello guys,

    I have this issue. I have in the process declarations 2 varaibles of type FILE :

    MODULE(A)

    PROCESS(clk)

    FILE ei : text IS OUT "ei.txt";

    FILE ej : text IS OUT "ej.txt";

    begin

    ---

    This module is generated in the top level entity several times. Each module has its own ID.

    Do you know how to generate a different file name for each module?(something like for the first module ei_1.txt ej_2.txt)

    Thanks

    --- Quote End ---

    Try this:

    
    signal id_str : string(1 downto 1) := "1";
    signal filename : string(8 downto 1) := "ei_" & id_str & ".txt";
    

    if your id is integer input you need to have function to convert it to string
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    not a function, you can use the 'image attribute:

    constant filename : string(8 downto 1) := "ei_" & integer'image(id_str) & ".txt";