ModelSim SE/EE Quick Guide

Model Technology
A
M E N T O R
G R A P H I C S
www.model.com
Email: support@model.com
sales@model.com
Phone: 503-641-1340
Installation / Environment / Licensing
Documentation
ModelSim Start Here: http://www.model.com/pdf/se_start.pdf
ModelSim Tutorial: http://www.model.com/pdf/se_tutor.pdf
Globetrotter FlexLM Doc: http://www.globetrotter.com/manual.htm
Web - Download the Latest Release
http://www.model.com/support/download.html
ftp://ftp.model.com/pub/
(206.103.63.81) [Fast]
ftp://support.model.com/pub/model.com/
(206.103.57.2)
[Slow]
Environment Variables (see ModelSim cmd "printenv")
LM_LICENSE_FILE
Required
Pathname of license.dat file
DOPATH
Optional
Search path for ".do" files
EDITOR
Optional
Specifies editor for "edit" cmd
MODELSIM
Optional
Pathname of modelsim.ini file
MODELSIM_TCL
Optional
List of modelsim.tcl files
MODEL_TECH_TCL
Optional
Pathname to Tcl/Tk libraries
MODEL_TECH
Don’t Set
Used internally by ModelSim
MGC_LOCATION_MAP
Optional
Used as "soft" path to find files
MTI_TF_LIMIT
Optional
Limits Transcript file size (k)
PLIOBJS
Optional
Used to load PLI object files
TMPDIR
Optional
Used by VSIM for temp space
Mentor Graphics Licensing Environment Variable
MGLS_LICENSE_FILE
Pathname for Mentor license file
MGLS_HOME
Pathname for Mentor Licensing
PATH Environment Variable
Unix: Add /<install_dir>/modeltech/bin to $path
PC: PATH will be updated automatically during install
Starting the License Server
Unix: Copy license.dat file to /<install_dir>/modeltech/<platform>/
Run /<install_dir>/modeltech/<platform>/START_SERVER
PC: Run /<install_dir>/modeltech/win32/flexlm.cpl
Use "Setup" and "Control" tabs to configure and start server
Licensing Diagnostics
Unix: Run /<install_dir>/modeltech/<platform>/lmstat –a
or lmdiag
PC: Run /<install_dir>/modeltech/win32/lmutil lmstat –a or lmutil lmdiag
Invoking ModelSim
Unix: Run /<install_dir>/modeltech/bin/vsim
PC: Start->Programs->Model Tech->ModelSim
-orPC: Double-click on: <install_dir>/modeltech/win32/modelsim.exe
Wave Window
<left mouse button>
<middle mouse button>
<right mouse button>
<ctrl-f>
<tab> (go right)
<shift-tab> (go left)
i I or + | o O or f or F | l or L
add wave <item> <item>
add wave *
add wave –r /*
add wave –label <name> <item>
add wave abus(31:15)
view wave
view wave –new
.wave.tree zoomfull
.wave.tree zoomrange <f1> <f2>
write wave
Select signal / Place cursor
Zoom In
Zoom Popup Menu
Find next item
Search forward for next edge
Search backward for next edge
Zoom in | Zoom out
Zoom full | Zoom Last
Wave specific signals/nets
Wave signals/nets in scope
Wave all signals/nets in design
Wave and rename a signal/net
Wave a slice of a bus
Display wave window
Display additional wave window
Zoom full
Zoom Range
Print wave window to file
Copyright © 2000, Model Technology Incorporated
Reproduction Permitted (and encouraged!)
ModelSim Editions
ModelSim-PE
ModelSim-SE/EE
C O M P A N Y
ModelSim SE/EE 5.4 Quick Guide
Web:
General Information - Last Updated: 03/24/00
Personal Edition (FPGA, Basic Functionality)
Special Edition / Elite Edition (ASIC signoff,
Code Coverage, Performance Analyzer)
ModelSim Products
ModelSim-VHDL
VHDL Compiler, Simulator, Debugger
ModelSim-VLOG
Verilog Compiler, Simulator, Debugger
ModelSim-PLUS
VHDL & Verilog Compiler, Siumlator, Debugger
ModelSim-LNL
VHDL or Verilog Compiler, Simulator, Debugger
ModelSim Definitions
LNL
Language Neutral Licensing (VHDL or Verilog)
SKS
Single Kernel Simulator
Quick Guide Notes
Find this document at http://www.model.com/pdf/se_guide.pdf
Commands in bold are typed at the ModelSim> or VSIM> prompts
Licensing Help
http://www.model.com/resources/licensing/licensing_help.html
Key ModelSim Commands (see Command Reference for more)
Command
Where used:
(Sh)ell,
(M)odelSim>
(V)SIM>
Description
For details on these commands refer to the
ModelSim Reference Manual
vcom
vdel
vdir
vlib
vlog
vmap
vsim
Sh, M, V
Sh, M, V
Sh, M, V
Sh, M, V
Sh, M, V
Sh, M, V
Sh, M, V
VHDL Compiler (see below)
Deletes a design unit from a specific library
Lists the contents of a library
Creates a design library
Verilog Compiler (see below)
Defines or displays library mappings
VHDL and/or Verilog Simulator (see below)
add button
add list | wave
add log
alias
bp, bd
cd
change
checkpoint
configure
delete
do
drivers
echo
edit
environment
examine
find
force
history
log
.main clear
noforce
notepad
printenv
property
pwd
radix
report
report
restart
restore
resume
right | left
run
search | next
seetime
view
vsource
when
where
write
M, V
V
V
M, V
V
Sh, M, V
V
V
M, V
V
M, V
V
M, V
M, V
M, V
M, V
V
V
M, V
M, V
M, V
V
M, V
M, V
V
M, V
M, V
M, V
M, V
V
M, V
M, V
V
V
V
V
M, V
V
M, V
M, V
M, V
M, V
M, V
M, V
M, V
M, V
M, V
M, V
M, V
Sh
Sh
Sh
Adds a button (e.g., add button MyRun {run 5000} )
Add signals to the List or Wave windows
Log signals to vsim.wlf file for analysis later
Create a user defined alias (e.g., alias h "history" )
Set/Clear a breakpoint (see Managing Breakpoints below)
Change directory
Modify a VHDL variable or Verilog register
Save the state of you simulation (see restore)
Configure List or Wave window attributes
Remove HDL item from List or Wave window
Execute a file of commands (e.g., do macro.do )
Display current and future value of signal or net drivers
Display message (e.g., echo "Time is $now ns." )
Invoke editor specified by the EDITOR env variable
Display or change current region/signal environment
Examine one or more HDL items (e.g., exa /top/clk )
Display pathnames of matching HDL items
Force signals or nets (e.g., force clk 1 10, 0 20 –r 100 )
List previous commands
Same as add log above
Clears the Main window transcript
Release signals or nets from force commands
Simple text editor
Display names and values of environment variables
Change List or Wave signal attributes (color, radix, etc.)
Display current path in Main transcript window
Change the default radix in all windows
report simulator control returns all control variable values
report simulator state returns all state variable values
Restart the simulator
Restore the simulation state from a previous checkpoint
Resume macro execution after a pause command
Search in wave window for next transition or –expr
Advance simulation time (e.g., run 1000 )
Search specified window for next item matching pattern
Scroll List or Wave window to time (e.g., seetime wave 500)
Open a ModelSim window and pop it to the top
Display HDL source file in Source window
Perform action on condition (e.g., when clk=1 {echo clk} )
Display info about the environment
Records names, window contents and preferences to a file
Toggle thru last commands
Move to beginning of line
Move to end of line
Copy the selection in the Main transcript window
Paste to the Main transcript window (see <ctrl-c> )
Repeat last command, Repeat nth command
Repeat cmd starting "abc"
Replace "abc" in previous command with "xyz"
Dump the contents of the vsim.wlf file in a readable form
Create VHDL component from compiled Verilog module
Print a makefile for a library
↑↓
<ctrl-a>
<ctrl-e>
<ctrl-c>
<ctrl-v>
!! | !n
!abc
^abc^xyz
dumplog64
vgencomp
vmake
vsim
vlog
vcom
Key Arguments (use –help for full list)
[-help]
Display vsim syntax help
[-version]
Returns vsim version
[-c ]
Run in cmd line mode
[-do "cmd" | <file>]
Run cmd or file at startup
[-f <filename>]
Pass in args from file
[-g|G<name=value>]
Set VHDL Generic values
[-hazards]
Enable hazard checking
[-l <logfile>]
Save transcript to log file
[+notimingchecks]
Disable timing checks
[-quiet]
Disable loading messages
[-restore <filename>]
Restore a simulation
[-sdf{min|typ|max}
Apply SDF timing data e.g.,
<region>=<sdffile>]
sdfmin /top=MySDF.txt
[-sdfnowarn]
Disable SDF warnings
[-t [<mult>]<unit> ]
Time resolution (shell only)
[-view <filename>]
Log file for VSIM to view
[-wav <filename>]
VSIM log file to create
[<libname>.<config>
Configuration, Module or
| <module>
Entity/Arch to simulate
| <entity>[(<arch>)]]
Examples
vsim top
vsim -lib mywork top -do commands.do
Key Arguments (use –help for full list)
[-help]
Display vcom syntax help
[-version]
Returns vcom version
[-93] [-87]
Choose VHDL-1993 or 1987
[-check_synthesis]
Turn on synthesis checker
[-debugVA]
Print VITAL opt status
[-explicit]
Resolve ambiguous overloads
[-f <filename>]
Pass in arguments from file
[-nocheck]
Disable run time range checks
[-nodebug]
Strip internal names
[-novitalcheck]
Disable VITAL95 checking
[-nowarn <#>]
Disable individual warning msg
[-O0]
Disable optimization
[-quiet]
Disable loading messages
[-refresh]
Regenerate library image
[-work <libname>]
Specify work library
<filename(s)>
VHDL file(s) to be compiled
Examples
vcom MyDesign.vhd
vcom -93 –work /lib/mylib util.vhd
vcom -refresh
Files
modelsim.ini
Managing Breakpoints
bp
bd
disablebp
onbreak
Sets a breakpoint; without arg shows all bps
Deletes a breakpoint
Turn off all breakpoints
Define what to do when a breakpoint is hit
during a macro (e.g., onbreak {resume})
Perform actions under certain conditions
when
Examples
bp alu.vhd 147 {do macro.do}
Set breakpoint
bd alu.vhd 147
Clear breakpoint
when –label when1 {clk’event and b="01100111"} {
echo "Signal c is [examine –bin c]" stop }
Use "when" to show the current whens.
modelsim.tcl
startup.do
transcript
vsim.wlf
my_project.mpf
System Initialization or Project file;
stores library locations, simulator
resolution, paths, etc.
Window sizes, positions, colors,
etc.; user Tcl/Tk code
Default name of macro executed
after design is loaded See "startup="
line in modelsim.ini
Default filename that ModelSim
transcript window activity is saved to
Default name of simulation log file
saved by VSIM
ModelSim project file
modelsim.ini
Copy modelsim.ini to current directory
Execute vmap -c
Loading order (stops after finding first file)
1. $MODELSIM environment variable
2. Current directory if $MODELSIM is not set
3. In /<install_dir>/modeltech/<platform> directory
4. In /<install_dir>/modeltech directory
For Detailed Information see:
ModelSim User’s Manual "ModelSim Variables"
modelsim.tcl
Loading order
Always loads: /<install_dir>/modeltech/tcl/vsim/pref.tcl
Loads the first found from:
1. $MODELSIM_TCL if it exists (":" separated list)
(all files in list are loaded)
2. Current directory ./modelsim.tcl
3. $HOME/modelsim.tcl
Standards Supported
Tcl/Tk
Environment Variable
MODELSIM_TCL
Online Documentation
Help->Tcl Help
Help->Tcl Syntax
Help->Tcl Man Pages
Help->Technotes->MTI_Widgets
Language Syntax
command arg1 arg2 arg3 …
Language Syntax: Commands
set <var> <value>
expr <math expression>
exec <ShellCommand>
info <option> <procedure name>
winfo <option> <window name>
Language Syntax: Procedures
proc name {arglist} {body}
proc diag {a b} {
set c [expr sqrt($a*$a + $b*$b)]
return $c
}
Language Syntax: Conditionals
if {boolean} {bodytrue} else {bodyfalse}
if {$now < 10000} {echo $now}
Language Syntax: Loops
while {boolean} {body}
foreach loopVar {valuelist} {cmdBody}
for {initial} {test} {final} {body}
Poking around in ModelSim Tcl/Tk
info
Get info on a Tcl construct
info xx
Find out the args to info
winfo
Get info on Tk widgets
winfo xx
Find out args to winfo
winfo children . Return the subwidgets to ModelSim
lecho [configure wave] Get wave props
Key Arguments (use –help for full list)
[-help]
Display vlog syntax help
[-version]
Returns vlog version
[-compat]
Disable event order optimizations
[-f <filename>]
Pass in arguments from file
[-hazards]
Enable run-time hazard checking
[-nodebug]
Hide internal variables & structure
[-quiet]
Disable loading messages
[-R <simargs>]
Invoke VSIM after compile
[-refresh]
Regenerate lib to current version
[-work <libname>]
Specify work library
[-v <library_file>]
Specify Verilog source library
<filename(s)>
Verilog file(s) to be compiled
Examples
vlog top.v
vlog –work mylib –refresh
Examples
#Print the string length of "Hello, World!"
set len [string length "Hello, World!" ]
echo "Hello, World! is $len characters long!"
#Create a button in the wave window that does something
apply_button_adder wave controls right red white SayHi {echo hi}
#Display the Tcl/Tk source code to apply_button_adder
info body apply_button_adder
#Set the right mouse button to execute "drivers" on selected signal
bind .signals.tree <Button-3> {
set signalnum [.signals.tree index anchor]
set signalline [.signals.tree get2 $signalnum]
set signalname [lindex $signalline 0]
echo [drivers $signalname]
}
#Create a separate window containing most used functions:
toplevel .hot
frame .hot.run
frame .hot.zoom
pack .hot.run .hot.zoom -side top
button .hot.run.b1 -text "Run 10" -command {run 10}
button .hot.run.b2 -text "Run 100" -command {run 100}
button .hot.run.b3 -text "Run 1000" -command {run 1000}
pack .hot.run.b1 .hot.run.b2 .hot.run.b3 -side left
label .hot.zoom.l1 -text "Zoom: "
pack .hot.zoom.l1 -side left
button .hot.zoom.b1 -text "Full" -command {.wave.tree zoomfull}
button .hot.zoom.b2 -text "4x" -command {WaveZoom .wave out 4.0}
button .hot.zoom.b3 -text "1/4x" -command {WaveZoom .wave in 4.0}
pack .hot.zoom.b1 .hot.zoom.b2 .hot.zoom.b3 -side left
#Figure out how to change one of the Run buttons in .hot
winfo children .hot
winfo children .hot.run
.hot.run.b2 configure -fg red
.hot.run.b2 configure –text "Run 67"
.hot.run.b2 configure –command {run 67}
VHDL
IEEE 1076-1987
IEEE 1076-1993
VITAL 2.2b & ‘95
Verilog
IEEE Std 1364-1995
PLI 1.0
Timing
SDF 1.0, 2.0, & 2.1
Value Change Dump
VCD for Verilog and VHDL
More Info . . .
Paper and Online (see docs sub-directory)
se_start.pdf
Start Here
se_man.pdf
User’s Manual
se_cmds.pdf
Command Reference
se_tutor.pdf
ModelSim Tutorial
Technical Notes
www.model.com/support/technote/index.html
See <install_dir>/modeltech/docs/technotes
Company Periodical
ModelUser (req via modeluser@model.com)
ModelSim Help Pulldown
Help > Release Notes
Help > Tcl Man Pages
Training
http://www.model.com/support/training.html
This Quick Guide
http://www.model.com/pdf/se_guide.pdf
Copyright © 2000,
Model Technology Incorporated
Reproduction Permitted (and encouraged!)
1020-0100