![]() |
|
|
|||||||
![]() |
VHDL - ModelSim question/checking the value of a variable |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
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 |
|
|
|
|
#2 |
|
Posts: n/a
|
"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 |
|
|
|
#3 |
|
Posts: n/a
|
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 |
|
|
|
#4 |
|
Posts: n/a
|
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 |
|
![]() |
| Thread Tools | Search this Thread |
|
|
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 |