strings in verilog

R

rik

Guest
Hi

I was having an issue with strings in verilog. I have a JTAG state
machine and a testbench running it. I am moving through different JTAG
states which are referenced by 4bit binary # as

TlR = 4'b0000
RTI = 4'b0001
............
...........
In my rtl I had something like,
reg[4:0] pres_state;

`define TLR 4'b0000
`define RTI 4'b0001
.........

reg[4:0] pres_state;
reg[4:0] next_state;


always@ (posedge tclk)
.......
pres_state <= next_state;


When I simulate it, and see the waves on the waveform window its gets
really difficult to decode the states by looking at numbers, so I was
thinking whether I can use characters to represent different JTAG
states.
I had something like this,

reg [3*8:0] pres_state;

But I found ascii values of different states represented on the
waveform. Do you guys know the reason. So how can I represent strings
in stead of numbers?
I know I can use $display but I want my strings to appear inside my
waveforms.


Thanks
Rik
 
rik wrote:
But I found ascii values of different states represented on the
waveform. Do you guys know the reason.
Because that is how strings are represented in Verilog (and programming
languages in general).


I know I can use $display but I want my strings to appear inside my
waveforms.
This is not an issue with Verilog. This is an issue with your waveform
viewer. If it has the capability to display the ASCII characters for a
value, then you can use that. If not, then you can't. It might even
have the capability of taking your original hardware encodings and
printing the mnemonic names for the state. It is all a matter of the
tool you are using.
 
Thanks for the reply. I am using cadence simvision. Can you give me an
idea about how to do it in simvision??

Rik


sharp@cadence.com wrote:
rik wrote:

But I found ascii values of different states represented on the
waveform. Do you guys know the reason.

Because that is how strings are represented in Verilog (and programming
languages in general).


I know I can use $display but I want my strings to appear inside my
waveforms.

This is not an issue with Verilog. This is an issue with your waveform
viewer. If it has the capability to display the ASCII characters for a
value, then you can use that. If not, then you can't. It might even
have the capability of taking your original hardware encodings and
printing the mnemonic names for the state. It is all a matter of the
tool you are using.
 
Add something like this to your code...

//synopsys translate_off
reg [3*8:0] ascii_pres_state;

always @
case(pres_state)
TIR: begin ascii_pres_state = "TIR";end
RTI: begin ascii_pres_state = "RTI"; end
...and so on

endcase

//synopsys translate_on

Then, when you pull up signals in simvision, select "ascii_pres_state".. and
change view to display ASCII.

In addition, having "ascii_" as your prefix, it makes it easier to find
ascii variables



"rik" <ritwikbiswas@gmail.com> wrote in message
news:1162619006.720186.159830@b28g2000cwb.googlegroups.com...
Thanks for the reply. I am using cadence simvision. Can you give me an
idea about how to do it in simvision??

Rik


sharp@cadence.com wrote:
rik wrote:

But I found ascii values of different states represented on the
waveform. Do you guys know the reason.

Because that is how strings are represented in Verilog (and programming
languages in general).


I know I can use $display but I want my strings to appear inside my
waveforms.

This is not an issue with Verilog. This is an issue with your waveform
viewer. If it has the capability to display the ASCII characters for a
value, then you can use that. If not, then you can't. It might even
have the capability of taking your original hardware encodings and
printing the mnemonic names for the state. It is all a matter of the
tool you are using.
 
Hi Rik,

the feature you are looking for is "Mnemonic Map" feature in Simvision.
It is used to rename the binary strings, change the color of the
waveforms drawn in the Simvision Waveform window. It beautifies the
waveforms and makes it easier to debug.

You must have the version of NC-Sim/Simvision that supports that. You
can even automate any waveform dumped to a database by running a TCL
script, because Mnemonic Map feature has a TCL command, like almost all
other features in Simvision have. Consult the manual and search
"Mnemonic Map".

Utku

rik schrieb:

Thanks for the reply. I am using cadence simvision. Can you give me an
idea about how to do it in simvision??

Rik
e the capability of taking your original hardware encodings and
printing the mnemonic names for the state. It is all a matter of the
tool you are using.
 
Utku Özcan wrote:
the feature you are looking for is "Mnemonic Map" feature in Simvision.
I was pretty sure something like this was available. Thanks for
providing more detailed info.
..
 

Welcome to EDABoard.com

Sponsor

Back
Top