Forum Discussion

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

State Machine Names in ModelSim

Hi All,

I have a question about state machines in ModelSim. When I simulate a Verilog design that includes a state machine and add the state register to the wave window in modelsim, it shows me the numerical value of the state. It would be nice if it converted that numerical value to the name I gave it in the source code. I've dug around in the documentation but do not see any reference to making that happen.

My state machine coding style is to declare each state value as a localparam, which then get assigned to a state register. In SignalTap, for instance, these values automatically get converted to names in its waveform window.

Is there a straightforward way to do this? Or am I simply expecting/wishing for something that does not exist?

4 Replies

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

    AFAIK, the only way to achieve that is to use System Verilog instead of plain Verilog and use "enum" types for the state.

    Example:

    enum { S_FIRST, S_SECOND, S_THIRD } state;
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thank you, rbugalho.

    I had not thought of that possibility. I this case however, my design conforms to Verilog 2001, so I hesitate to apply that technique. Should be useful elsewhere though.

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

    Questa has automatic state machine recognition.

    In modelsim, you can use a user defined radix to display your state machine symbols. See the radix command in the reference manual or user defined radix in the User Guide.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Dave_59,

    That is exactly the feature I was looking for!

    Thanks for pointing it out.

    -Martin