Mohsen
Mohsen

Reputation: 63

How can I see a variable's value for debugging VHDL code in modelsim?

I want to see a variable's value for debugging my code. But, I can see only signals and input and outputs value when I put mouse pointer on them, like in this picture (state is a signal here):

I can see signal's value

But, I can't see value of the variable tmp:

I cannot see variable's value

How can I see also the value of variables?

Upvotes: 6

Views: 8203

Answers (2)

Martin Zabel
Martin Zabel

Reputation: 3659

You can oberserve the variable value by single-stepping through the respective process.

  1. Start the simulation and open the source file containing the respective process.

  2. Set a breakpoint at the beginning of the process and run the simulation until the breakpoint is triggered with the command run -all.

  3. Now, you can observe the variable value by

    a) hovering the mouse over it, or by

    b) selecting menu View -> Locals and navigating to the process in the design hierarchy.

  4. Now, you can single-step through the process with the command step. You will see, how the variable value changes until the process suspends. Continue the simulation with run -all until the breakpoint is triggered again.

Upvotes: 3

Matthew
Matthew

Reputation: 13977

There's one way:

i) Run the simulation for a very short time, eg 1 ns.

ii) Click on View -> Locals

iii) Navigate to the point in your design where the variable is and you will see it in the Locals window. Add it to the Waves.

iv) Run the rest of your simulation.

Upvotes: 3

Related Questions