Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16614 Discussions

State Machine Names in ModelSim

Altera_Forum
Honored Contributor II
3,693 Views

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?
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
2,006 Views

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;
0 Kudos
Altera_Forum
Honored Contributor II
2,006 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
2,006 Views

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.
0 Kudos
Altera_Forum
Honored Contributor II
2,006 Views

Dave_59, 

That is exactly the feature I was looking for! 

Thanks for pointing it out. 

-Martin
0 Kudos
Reply