Forum Discussion

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

[ModelSim] How to see local variables in VHDL procedures in waveforms?

Hi All,

How can I see the variables, which were locally defined in the VHDL procedures, in the waveform? Somehow I cannot see nor the procedures themselves nor their variables.

Should I apply any switch during compilation (like -vopt +acc, etc)?

BTW, how can I add the '-vopt +acc' option for vcom in the modelsim.ini file, so that the files compilation will be performed always with these switches?

Thank you!

5 Replies

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

    afaik, you cant. variables in Procedures only have scope to the procedure and only exist when the procedure is called. So cannot be seen on a waveform. You will have to debug them using console outputs.

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

    --- Quote Start ---

    You will have to debug them using console outputs.

    --- Quote End ---

    How can I do so?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Using textio, there is a default file called OUTPUT that allows you to write to the simulator console.

    you can do it one of two ways.

    1. Like normal textio, write to a line then write the line to the console:

    
    variable l : line;
    write(l, string'("This is some debug text"));
    writeline(OUTPUT, l);
    

    or write drictly to output. Heres a nice little wrapper procedure for you.

    
    procedure echo (arg : in string := "") is
    begin
        std.textio.write(std.textio.output, arg);
    end procedure echo;
    --echos to console with a newline at the end
    procedure echol(arg          : in string := "") is
    begin
        std.textio.write(std.textio.output, arg & LF);
    end procedure echol;
    
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    you can label your process and then add it to the waveform manually. To do this:

    1- Generate a simple waveform without variables

    2- save it with .do format. For example my_wave_1.do

    3- Manually open the my_wave_1.do file in a text editor and add your variable to a line. You can copy/paste previous lines for simplicity. Then replace the signal name with your variable name: dut/my_process/v_variable

    4- Save your edited .do file

    5- now run in the console: do my_wave_1.do

    6- Run Simulation
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    you can label your process and then add it to the waveform manually. To do this:

    1- Generate a simple waveform without variables

    2- save it with .do format. For example my_wave_1.do

    3- Manually open the my_wave_1.do file in a text editor and add your variable to a line. You can copy/paste previous lines for simplicity. Then replace the signal name with your variable name: dut/my_process/v_variable

    4- Save your edited .do file

    5- now run in the console: do my_wave_1.do

    6- Run Simulation

    --- Quote End ---

    The OP asked for procedures not processes.