Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - ModelSim question/checking the value of a variable

 
Thread Tools Search this Thread
Old 02-18-2004, 06:35 AM   #1
Default ModelSim question/checking the value of a variable


I am attempting to simulate a design in ModelSim. Is a command to get the
simulator to display the current value of a variable? For instance, I would
like to see the current value of a variable (note not signal) called
"nstates"...how might I do this? In matlab, simply typing the value of the
variable would give its current value...what is the vhdl equivalent?

cheers

- Kingsley




kwaj
  Reply With Quote
Old 02-18-2004, 09:20 AM   #2
Jonathan Bromley
 
Posts: n/a
Default Re: ModelSim question/checking the value of a variable
"kwaj" <> wrote in
message news:c0v0t3$47t$...
> I am attempting to simulate a design in ModelSim. Is a command to get the
> simulator to display the current value of a variable? For instance, I

would
> like to see the current value of a variable (note not signal) called
> "nstates"...how might I do this?


You can specify a variable using a hierarchical path at the command
line, just as you would for a signal, but remembering to include
the name of its enclosing process. For example:

entity Device...
architecture D of Device is
begin
P: process
variable V: ...
begin
end process P;
end architecture D;

entity TopLevel...
architecture T of TopLevel is
begin
U: entity work.Device(D); -- instance
end architecture T;

Now you can refer to the variable V from ModelSim's command
line as
/TopLevel/U/P/V
NOTE the process name P in that path.

If you fail to name the process, ModelSim will cook up
a name for you based on its line number in the file.

From the ModelSim GUI, get the Process window, select
the process containing your variable, then bring up a
Variables window.

> In matlab, simply typing the value of the
> variable would give its current value...
> what is the vhdl equivalent?


This is not a VHDL issue. When you're typing at the ModelSim
command prompt you are using Tcl, not VHDL. ModelSim adds
various commands to Tcl, such as [examine] and [force],
allowing you to interact with the running simulator's data
structures.

--

Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * Perl * Tcl/Tk * Verification * Project Services

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, Hampshire, BH24 1AW, UK
Tel: +44 (0)1425 471223 mail:
Fax: +44 (0)1425 471573 Web: http://www.doulos.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.





Jonathan Bromley
  Reply With Quote
Old 02-18-2004, 09:27 AM   #3
Tim Hubberstey
 
Posts: n/a
Default Re: ModelSim question/checking the value of a variable
kwaj wrote:
>
> I am attempting to simulate a design in ModelSim. Is a command to get the
> simulator to display the current value of a variable? For instance, I would
> like to see the current value of a variable (note not signal) called
> "nstates"...how might I do this? In matlab, simply typing the value of the
> variable would give its current value...what is the vhdl equivalent?


Unlike Verilog, VHDL simulation commands are not built into the language
so every simulator is different.

For ModelSim, you can display the value of a variable using the
"Variable" window or access it directly from the command line with:

examine /module_name/process_name/variable_name

You can display it in a wave window with:

add wave /module_name/process_name/variable_name

If you haven't named your processes then ModelSim will have given them
names based on the line numbers of your source file.

All this is covered in the ModelSim Command Reference Manual so I
suggest that next time you try reading the manual before posting.
--
Tim Hubberstey, P.Eng. . . . . . Hardware/Software Consulting Engineer
Marmot Engineering . . . . . . . VHDL, ASICs, FPGAs, embedded systems
Vancouver, BC, Canada . . . . . . . . . . . http://www.marmot-eng.com


Tim Hubberstey
  Reply With Quote
Old 02-18-2004, 12:12 PM   #4
Grigorios Angelis
 
Posts: n/a
Default Re: ModelSim question/checking the value of a variable
I'm not sure if this exactly what you want but you can embed in your code an
assertion statement that reports the value of the variable in the ModelSim
command window like this:

myAssertStatement : assert false report "Value of nstates is " &
integer'image(nstates) & "." severity note;

Assuming that nstates is of type integer (for other types use appropriate
identifier)



"kwaj" <> wrote in message
news:c0v0t3$47t$...
> I am attempting to simulate a design in ModelSim. Is a command to get the
> simulator to display the current value of a variable? For instance, I

would
> like to see the current value of a variable (note not signal) called
> "nstates"...how might I do this? In matlab, simply typing the value of

the
> variable would give its current value...what is the vhdl equivalent?
>
> cheers
>
> - Kingsley
>
>





Grigorios Angelis
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing value with out using variable in query string in PHP! Ali_ggl General Help Related Topics 0 11-29-2008 12:22 PM
Need help on Modelsim VHDL syntax? ASAP:) kaji General Help Related Topics 0 03-14-2007 10:43 PM
Need help on a Modelsim VHDL Syntax? ASAP:) kaji Software 0 03-14-2007 10:43 PM
Need Help on a Modelsim VHDL Syntax....ASAP:) kaji Hardware 0 03-14-2007 10:41 PM
Variable Scope in asp.Net jansi_rk Software 1 09-18-2006 06:05 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46