ModelSim EE/PLUS Reference Manual The ModelSim Elite Edition for VHDL, Verilog, and Mixed-HDL Simulation
ModelSim /VHDL, ModelSim /VLOG, ModelSim /LNL, and ModelSim /PLUS are produced by Model Technology Incorporated. Unauthorized copying, duplication, or other reproduction is prohibited without the written consent of Model Technology. The information in this manual is subject to change without notice and does not represent a commitment on the part of Model Technology.
Software License Agreement This is a legal agreement between you, the end user, and Model Technology Incorporated (MTI). By opening the sealed package, or by signing this form, you are agreeing to be bound by the terms of this agreement. If you do not agree to the terms of this agreement, promptly return the unopened package and all accompanying items to the place you obtained them for a full refund. Model Technology Software License 1. LICENSE.
from MTI. All copies of the SOFTWARE, whether provided by MTI or made by you, shall remain the property of MTI or its licensors. You will maintain a record of the number and location of all copies of the SOFTWARE made, including copes that have been merged with other software, and will make those records available to MTI or its applicable licensor upon request. 5. TRADE SECRET. The source code of the SOFTWARE is trade secret or confidential information of MTI or its licensors.
Limited Warranty LIMITED WARRANTY. MTI warrants that the SOFTWARE will perform substantially in accordance with the accompanying written materials for a period of 30 days from the date of receipt. Any implied warranties on the SOFTWARE are limited to 30 days. Some states do not allow limitations on duration of an implied warranty, so the above limitation may not apply to you. CUSTOMER REMEDIES.
Table of Contents Software License Agreement . . . . Model Technology Software License . Important Notice . . . . . . . . . Limited Warranty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii iii iv v 1 - Introduction (p23) Software versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Alternate IEEE libraries supplied Rebuilding supplied libraries . . Regenerating your design libraries Verilog resource libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 . 43 . 43 . 44 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5 - ModelSim Command Reference (p67) Syntax conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 dumplog64 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 modelsim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 tssi2mti . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 vcom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 vdel . . . . . . . . . . . . . . . . . . . .
The Main window menu bar . . . . . . . . . . . . . . The Main window tool bar . . . . . . . . . . . . . . . The Main window status bar . . . . . . . . . . . . . . Editing the command line, the current source file, and notepads Dataflow window . . . . . . . . . . . . . . The Dataflow window menu bar . . . . . . Tracing HDL items with the Dataflow window . Saving the Dataflow window as a Postscript file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Wave window action list . . . . . . . . . . . . The Wave window menu bar . . . . . . . . . . . Wave window tool bar . . . . . . . . . . . . . Setting Wave window display properties . . . . . . Adding HDL items in the Wave window . . . . . . Editing and formatting HDL items in the Wave window Sorting a group of HDL items . . . . . . . . . . Finding items by name or value in the Wave window . Searching for item values in the Wave window . . . . Using time cursors in the Wave window . . . . . .
Logic type display preferences . . . . . . . . . . . . . . . . . . . . . . . . . 228 Force mapping preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 ModelSim tools . . . The Button Adder The Macro Helper The Tcl Debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
add button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 add list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 add_menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 add_menucb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 add_menuitem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 add_separator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
down | up drivers echo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 edit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 enablebp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 enable_menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
power report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 power reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344 printenv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 property list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346 property wave pwd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
vcd checkpoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 vcd comment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381 vcd file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382 vcd flush . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 vcd limit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 vcd off . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Project file variables [Library] section [vcom] section [vlog] section . [vsim] section . [lmc] section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11 - Standard Delay Format (SDF) Timing Annotation (p435) Specifying SDF files for simulation Instance specification . . . . SDF specification with the GUI Errors and warnings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 436 437 438 VHDL VITAL SDF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using checkpoint/restore with the FLI . . . . . . . . . . . . . . . . . . . . . . . . 463 Support for Verilog instances . . . . . . . . . . . . . . . . . . . . . . . . . . . 465 Callback functions for sockets - Windows platforms VSIM function descriptions . . . Mapping to VHDL data types Enumerations . . . . . . . Reals and time . . . . . . Arrays . . . . . . . . . . VHDL FLI examples . . . . . . . . . . . . . . . . Using the Verilog PLI . . . . . . . Specifying the PLI file to load . .
14 - Logic Modeling Library and Hardware Modeler (p501) VHDL SmartModel interface SM_ENTITY . . . . . Entity details . . . . . Architecture details . . . Vector ports . . . . . Simulation . . . . . . SPARCstation note . . . Command channel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Technical support - electronic support services . . . . . . . . . . . . . . . . . . . . . 522 Technical support - other channels . . . . . . . . . . . . . . . . . . . . . . . . . 523 Updates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524 Licenses - ModelSim EE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524 Online References . . . . Books and publications Partners . . . . . . Training partners . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C - Using the FLEXlm License Manager (p547) Starting the license server daemon . . . . . . . Locating the license file . . . . . . . . . . Controlling the license file search . . . . . . Manual start . . . . . . . . . . . . . . Automatic start at boot time . . . . . . . . What to do if another application uses FLEXlm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
- Table of Contents ModelSim EE/PLUS Reference Manual
1 - Introduction Chapter contents Software versions . . . . . . . . . . . . . . . . . . 23 ModelSim’s graphic interface . . . . . . . . . . . . . . . . 24 Standards supported . . . . . . . . . . . . . . . . . . . 24 Assumptions . . . . . . . . . . . . . . . . . . . 25 Sections in this document . . . . . . . . . . . . . . . . . 25 Simulation action list . . . . . . . . . . . . . . . . .
ModelSim’s graphic interface While your operating system interface provides the window-management frame, ModelSim controls all internal-window features including menus, buttons, and scroll bars.
Assumptions Assumptions We assume that you are familiar with the use of your operating system. You should be familiar with the window management functions of your graphic interface: either OpenWindows, OSF/Motif, or Microsoft Windows NT/95/98. We also assume that you have a working knowledge of VHDL and Verilog. Although ModelSim is an excellent tool to use while learning HDL concepts and practices, this document is not written to support that goal. If you need more information about HDLs, check out our.
6 - ModelSim EE Graphic Interface (p103) This chapter describes the graphic interface available while operating VSIM, the ModelSim simulator. ModelSim’s graphic interface is designed to provide consistency throughout all operating system environments. 7 - Simulator Command Reference (p245) The simulator commands used to control the VSIM simulator are described in this chapter. These commands are only valid after loading a design with the vsim command (p91) or the via the ModelSim graphical interface.
Simulation action list Additional Tcl and Tk (Tcl’s toolkit) can be found through several Tcl online references (p514). A - Technical Support, Updates, and Licensing (p521) How and where to get tech support, updates and licensing for ModelSim. B - Tips and Techniques (p529) An extended collection of ModelSim usage examples taken from our manuals, and tech support solutions. C - Using the FLEXlm License Manager (p547) This appendix covers Model Technology’s application of FLEXlm for ModelSim licensing.
Simulation step 4 - Simulate a design 5 - Advanced simulation options Refer to these chapters and their associated sections chapter 6 - Setting default simulation options (p207), and Simulator preference variables (p210) chapter 8 - Variable functions (p421) chapter 3 - Simulating VHDL and Verilog designs (p48) chapter 5 - vsim (p91) chapter 6 - Simulating with the graphic interface (p198) chapter 7 - run (p361), force (p319), and step (p371) chapter 9 - Using the TextIO package (p425) chap
Text conventions Text conventions Text conventions used in this manual include: italic text provides emphasis and sets off file and path names bold text indicates commands, command options, and menu choices, as well as package and library logical names monospaced type monospace type is used for program and command examples The right angle (>) is used to connect menu choices when traversing menus as in: File > Save path separators examples will show either UNIX or Windows path separators - use sepa
Where to find our documentation Model Technology’s documentation is available in the following formats and locations: Document Format How to get it Start Here for ModelSim (installation & support reference) paper shipped with ModelSim PDF online find "ee_start_here.pdf" in the "/ /docs" directory; also available from the Support page of our web site: www.model.com Documentation Index PDF online find "ee_doc_index.
Comments Download a free PDF reader with Search Model Technology’s PDF documentation requires an Adobe Acrobat Reader for viewing. The Reader may be installed from the ModelSim CD. It is also available without cost from Adobe at http://www.adobe.com. Be sure to download the Acrobat Reader with Search to take advantage of the index file supplied with our reference manuals; the index makes searching the documentation much faster.
ModelSim EE/PLUS Reference Manual Introduction - 32
2 - Design Libraries Chapter contents Design library contents . . Design unit information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 . 34 Design library types . . . . . . . . . . . . . . . . . 34 Library management commands. . . . . . . . . . . . . . . . 35 Working with design libraries . . . . . Creating a library . . . . . . . Viewing and deleting library contents . . Assigning a logical name to a design library Moving a library . .
Design library contents Design library contents A design library is a directory that serves as a repository for compiled design units. The design units contained in a design library consist of VHDL entities, packages, architectures, configurations, and Verilog modules and UDPs (user defined primitives). The design units are classed as follows: • Primary design units Consists of entities, package declarations, configuration declarations, modules, and UDPs.
Library management commands Library management commands These library management commands are available from the UNIX/DOS command line, or from the ModelSim graphic interface. Only brief descriptions are provided here; for more information and command syntax see the "ModelSim Command Reference" (p67). Command Description vdel (p76) deletes a design unit from a specified library vdir (p78) selectively lists the contents of a library.
Working with design libraries Creating a working library with the graphic interface To create a new library with the ModelSim graphic interface, use the Main VSIM window menu selection: Library > Create a New Library. This brings up a dialog box that allows you to specify the library name along with several mapping options. The Create a New Library dialog box includes these options: Create • a new library and a logical mapping to it Type the new library name into the Library field.
Working with design libraries When you click OK, ModelSim creates the specified library directory and writes a specially-formatted file named _info into that directory. The _info file must remain in the directory to distinguish it as a ModelSim library. Note: It is important to remember that a design library is a special kind of directory; the only way to create a library is to use the ModelSim GUI, or the vlib command (p81). Do not create libraries using UNIX or Windows.
Working with design libraries The Library Contents dialog box includes these options: • Library Select the library you wish to view from the drop-down list. • Name/Details list Entity/architecture pairs are indicated by a box prefix; select a plus (+) box to view the associated architecture, or select a minus (–) box to hide the architecture. You can delete a package, configuration, or entity by selecting it and clicking Delete. This will remove the design unit from the library.
Working with design libraries Library mappings with the GUI To associate a logical name with a library, you select the Library > Browse Libraries command. This brings up a dialog box that allows you to view, add, edit, and delete mappings, as shown below: The Library Browser dialog box includes these options: • Show Choose the mapping and library scope to view from drop-down list. • Library/Type list To view the contents of a library Select the library, then click the View button.
Working with design libraries To edit an existing library mapping Select the desired mapping entry, then click the Edit button. This brings up a dialog box that allows you to modify the logical library name and the pathname to which it is mapped. Selecting Delete removes an existing library mapping, but it does not delete the library (delete the library via UNIX, DOS, or Windows).
Specifying the resource libraries Library search rules The system searches for the mapping of a logical name in the following order: • First the system looks for a modelsim.ini file. • If the system doesn’t find a modelsim.ini file, or if the specified logical name does not exist in the modelsim.ini file, the system searches the current working directory for a subdirectory that matches the logical name.
Specifying the resource libraries Predefined libraries Certain resource libraries are predefined in standard VHDL. The library named std contains the packages standard and textio, which should not be modified. The contents of these packages and other aspects of the predefined language environment are documented in the IEEE Standard VHDL Language Reference Manual, Std 1076-1987 and ANSI/IEEE Std 1076-1993. See also, "Using the TextIO package" (p425).
Specifying the resource libraries Rebuilding supplied libraries Resource libraries are supplied precompiled in the modeltech installation directory. If you need to rebuild these libraries, the sources are provided in the vhdl_src directory; shell scripts are also provided (rebuild_libs.csh and rebuild_libs.sh).
Verilog resource libraries ModelSim supports and encourages separate compilation of distinct portions of a Verilog design. This approach provides more rapid simulation loading and much simpler commands to invoke the simulator. The VLOG compiler is used to compile one or more source files into a specified library. The library thus contains pre-compiled modules and UDPs (as well as VHDL design units) that are drawn from by the simulator as it loads the design. See "Instantiation bindings" (p51).
3 - Compilation and Simulation Chapter contents Compiling VHDL and Verilog designs Creating a design library . . Invoking the VHDL compiler . Invoking the Verilog compiler . Design checking . . . . Dependency checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 . 46 . 46 . 47 . 47 . 47 Simulating VHDL and Verilog designs . . . . . . . Invoking the simulator from the Main transcript window . . . . . . . . . . . . . . 48 .
Compiling VHDL and Verilog designs Compiling VHDL and Verilog designs Compiling is nothing new to VHDL simulation. Unlike most Verilog tools, however, ModelSim provides a compiled Verilog environment – a design is first compiled, and then simulated. This process provides significant speed improvement over an interpreted approach and yet maintains flexibility when you modify your design. You can compile a complete design or subset of a design in one or more invocations of the compiler.
Compiling VHDL and Verilog designs modelsim.ini file (see "System Initialization/Project File" (p413) for more information). See "ModelSim Command Reference" (p67) for more information on the vcom command (p71). Invoking the Verilog compiler ModelSim compiles one or more Verilog design units (modules and UDPs) – in any combination – with a single invocation of vlog (p83), the Verilog compiler.
Simulating VHDL and Verilog designs entity compilation results will remain unchanged and you will not have to recompile design units that depend on the entity. Simulating VHDL and Verilog designs After compiling the design units, you can proceed to simulate your designs with VSIM. This section includes a discussion of simulation from the UNIX or Windows/DOS command line. You can also use the graphic interface for simulation, see "Simulating with the graphic interface" (p198).
Simulating VHDL and Verilog designs The default time resolution can also be changed by modifying the Resolution variable (p420) in the modelsim.ini file. You can view the current resolution by invoking the report command (p354) with the simulator state option. See "System Initialization/Project File" (p413) for more information on modifying the modelsim.ini file. VSIM will set the simulation time resolution to the minimum time precision specified by the ’timescale directives.
Verilog-specific simulation issues VHDL By default, the timing checks within VITAL models are enabled. They are also disabled with the +notimingchecks option. For example: vsim +notimingchecks topmod Verilog-specific simulation issues Verilog object names in commands VERILOG By default, VSIM requires the "/" character as separators in hierarchical names. You can use the "." character instead by setting the PathSeparator variable (p254) to "." in the modelsim.ini file.
Verilog-specific simulation issues You can use this feature to help you write code that ports more easily among Verilog simulators. VSIM matches the event ordering of Cadence's Verilog simulator in many, but not all, cases. VSIM's hazard detection is useful in porting models that rely on Cadence Verilog event ordering. The vsim command (p91) detects the following kinds of hazards: • WRITE/WRITE: Two processes writing to the same variable at the same time.
Verilog-specific simulation issues • VSIM will search inferred libraries from any ‘uselib's in effect at compilation time. • VSIM will search libraries provided by any -L option provided on the VSIM command line. (See vsim (p91) for more information on the –L option.) • VSIM will examine the current work library. • If the referenced design unit is an escaped identifier of the form "library.name", it will search "library" for the design unit "name".
Verilog-specific simulation issues into a specified library. The library thus contains pre-compiled modules and UDPs (as well as VHDL design units) that are drawn from by the simulator as it loads the design. Within a library, distinct modules/UDPs are distinguished by name. Thus it's not possible for two distinct parts to have the same name and at the same time in a single library. From the previous example, it's not possible for both vendors' NAND2 modules to exist within the same library.
Environment variables The additional benefit of this option is that it also allows symbolic library names to be referenced and configured via ModelSim's vmap command (p89). Since this option is unlikely to be supported by other environments, it might be best to protect it with an ‘ifdef: ‘ifdef MODEL_TECH ‘uselib lib=vendorA_lib ‘else ‘uselib dir=/h/vendorA/FPGAlib libext=.
Environment variables Variable Description MODEL_TECH_TCL used by VSIM to find Tcl libraries for: Tcl/Tk 8.0, Tix, and VSIM; defaults to /..
Environment variables Once the variable is set, you can use it for library mappings in the following manner. If using the vmap command (p89) command from DOS prompt: vmap MY_VITAL %MY_PATH% If using vmap from ModelSim/VSIM prompt: vmap MY_VITAL \$MY_PATH (The "\" followed by a "$" will substitute the variable using Tcl syntax.) If you used DOS vmap, the modelsim.ini will appear as below. MY_VITAL = c:\temp\work If you used vmap from ModelSim/VSIM prompt, the modelsim.ini will appear as below.
4 - Mixed VHDL and Verilog Designs Chapter contents Separate compilers, common libraries . . . . . . . . . . . . . . 58 Mapping data types . . . VHDL generics . . . Verilog parameters . . VHDL and Verilog ports Verilog states . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 . 58 . 59 . 59 . 60 VHDL instantiation of Verilog design units. Verilog instantiation criteria . . . Component declaration . .
Separate compilers, common libraries Separate compilers, common libraries VHDL source code is compiled by VCOM and the resulting compiled design units (entities, architectures, configurations, and packages) are stored in a library. Likewise, Verilog source code is compiled by VLOG and the resulting design units (modules and UDPs) are stored in a library.
Mapping data types Type time is treated specially: the Verilog number is converted to a time value according to the ‘timescale directive of the module. Physical and enumeration types receive a value that corresponds to the position number indicated by the Verilog number. In VHDL this is equivalent to T'VAL(P), where T is the type, VAL is the predefined function attribute that returns a value given a position number, and P is the position number.
Mapping data types full Verilog state set. For example, you may wish to convert between vl_logic and your own user-defined type. The vl_logic type is defined in the vl_types package in the pre-compiled verilog library. This library is provided in the installation directory along with the other pre-compiled libraries (std and ieee). The source code for the vl_types package can be found in the files installed with ModelSim. See "Installed technotes" (p28).
Mapping data types Verilog std_logic bit St1 '1' '1' StX 'X' '0' Su0 '0' '0' Su1 '1' '1' SuX 'X' '0' For Verilog states with ambiguous strength: • bit receives '0' • std_logic receives 'X' if either the 0 or 1 strength components are greater than or equal to strong strength • std_logic receives 'W' if both the 0 and 1 strength components are less than strong strength VHDL type bit is mapped to Verilog states as follows: bit Verilog '0' St0 '1' St1 VHDL type std_logic is mapped to Ve
VHDL instantiation of Verilog design units std_logic Verilog 'L' Pu0 'H' Pu1 '–' StX VHDL instantiation of Verilog design units Once you have generated a component declaration for a Verilog module, you can instantiate the component just like any other VHDL component. In addition, you can reference a Verilog module in the entity aspect of a component configuration – all you need to do is specify a module name instead of an entity name.
VHDL instantiation of Verilog design units VHDL and Verilog identifiers The identifiers for the component name, port names, and generic names are the same as the Verilog identifiers for the module name, port names and parameter names. If a Verilog identifier is not a valid VHDL 1076-1987 identifier, it is converted to a VHDL 1076-1993 extended identifier (in which case you must compile the VHDL with the -93 switch).
VHDL instantiation of Verilog design units Verilog identifier VHDL identifier TopMod \TopMod\ top_mod top_mod _topmod \_topmod\ \topmod topmod \\topmod\ \topmod\ vgencomp component declaration vgencomp (p79) generates a component declaration according to these rules: Generic clause A generic clause is generated if the module has parameters. A corresponding generic is defined for each parameter that has an initial value that does not depend on any other parameters.
Verilog instantiation of VHDL design units A port clause is generated if the module has ports. A corresponding VHDL port is defined for each named Verilog port. The VHDL port type is selected by the user from among bit, std_logic, and vl_logic. If the Verilog port has a range, then the VHDL port type is bit_vector, std_logic_vector, or vl_logic_vector. If the range does not depend on parameters, then the vector type will be constrained accordingly, otherwise it will be unconstrained.
Verilog instantiation of VHDL design units Port associations may be named or positional. Use the same port names and port positions that appear in the entity. Named port associations Named port associations are not case sensitive – unless a VHDL port name is an extended identifier (1076-1993). If the VHDL port is an extended identifier, the association is case sensitive and the VHDL identifier’s leading and trailing backslashes are removed before comparison.
5 - ModelSim Command Reference The Model Technology system commands allow you to perform tasks such as creating and manipulating the contents of a HDL design library, compiling HDL source code, and invoking the VSIM simulator on a design unit. These commands are entered from the host operating system command line and must be in lower case.
dumplog64 dumplog64 The dumplog64 command dumps the contents of the vsim.wav file in a readable format. Syntax dumplog64 Arguments The name of the dump file created. Required.
modelsim modelsim The modelsim command starts the ModelSim GUI without prompting you to load a design. This command is valid only for Windows platforms, and may be invoke in one of two ways: • from the DOS prompt, or • from a ModelSim shortcut. To use modelsim arguments with a shortcut, add them to the target line of the shortcut’s properties. (Arguments work on the DOS command line too, of course.
tssi2mti tssi2mti The tssi2mti command is used to convert a vector file in Summit Design Standard Events Format into a sequence of VSIM force (p319) and run (p361) commands. The stimulus is written to the standard output. The source code for tssi2mti is provided in the file tssi2mti.c in the examples directory.
vcom vcom The vcom command is used to invoke VCOM, the Model Technology VHDL compiler. Use VCOM to compile VHDL source code into a specified working library (or to the work library by default). This command may also be invoked from within the simulator with all of the options shown below.
vcom compiler to resolve ambiguous function overloading in favor of the explicit function definition. See additional discussion in the examples. -f Specifies a file with more command line arguments. Allows complex arguments to be reused without retyping. Optional. -just eapbc Directs the compiler to “just” include: e - entities a - architectures p - packages b - bodies c - configurations Any combination in any order can be used, but one choice is required if you use this optional switch.
vcom -nodebug[=ports] Hides the internal data of the compiled design unit. Optional. The design unit’s source code, internal structure, signals, processes, and variables will not display in ModelSim’s windows. In addition, none of the hidden objects may be accessed through the Dataflow window or with VSIM commands. This also means that you cannot set breakpoints or single step within this code. Don’t compile with this switch until you’re done debugging.
vcom -quiet Disable 'loading' messages. Optional. -refresh Regenerates a library image. Optional. By default, the work library is updated; use -work to update a different library. See vcom "Examples" (p74) for more information. -s Instructs the compiler not to load the standard package. Optional. This argument should only be used if you are compiling the standard package itself. -source Displays the associated line of source code before each error message that is generated during compilation.
vcom vcom -nodebug example.vhd Hides the internal data of example.vhd. Models compiled with -nodebug cannot use any of the ModelSim debugging features; any subsequent user will not be able to see into the model. vcom -nodebug=ports level3.vhd levle2.vhd vcom -nodebug top.vhd The first line compiles and hides the internal data, plus the ports, of the lower-level design units, level3.vhd and level2.vhd. The second line compiles the top-level unit, top.vhd, without hiding the ports.
vdel vdel The vdel command deletes a design unit from a specified library. Syntax vdel [-help] [-verbose] [-lib ] [-all] | [ ...] Arguments -help Displays the command’s options and arguments. Optional. -verbose Displays progress message. Optional. -lib Specifies the logical name or pathname of the library that holds the design unit to be deleted. Optional; by default, the design unit is deleted from the work library. -all Deletes an entire library.
vdel Examples vdel -all Deletes the work library. vdel -lib synopsys -all Deletes the synopsys library. vdel xor Deletes the entity named xor and all its architectures from the work library. vdel xor behavior Deletes the architecture named behavior of the entity xor from the work library. vdel base Deletes the package named base from the work library.
vdir vdir The vdir command selectively lists the contents of a design library. Syntax vdir [ -help ] [-l] [ -lib ] [ ] Arguments -help Displays the command’s options and arguments. Optional. -l Prints the version of vcom or vlog that each design unit was compiled under. Also prints the object-code version number that indicates which versions of vcom/vlog and ModelSim are compatible.
vgencomp vgencomp Once a Verilog module is compiled into a library, you can use the vgencomp command to write its equivalent VHDL component declaration to standard output. Optional switches allow you to generate bit or vl_logic port types; std_logic port types are generated by default. Syntax vgencomp [ -help ] [ - ] [ -s ] [ -b ] [ -v ] Arguments -help Displays the command’s options and arguments. Optional. - Specifies the pathname of the working library.
vgencomp Examples This example uses a Verilog module that is compiled into the work library. The module begins as Verilog source code: module top(i1, o1, o2, io1); parameter width = 8; parameter delay = 4.5; parameter filename = "file.
vlib vlib The vlib command creates a design library. Syntax vlib [ -help ] [ -dos | -short ] [ -unix | -long ] Arguments -help Displays the command’s options and arguments. Optional. -dos Specifies that subdirectories in a library have names that are compatible with DOS. Not recommended if you use the vmake (p88) utility. Optional. Default for ModelSim PE. -short Interchangeable with the -dos argument. Optional.
vlib Examples vlib design Creates the design library called design. You can define a logical name for the library using the vmap command (p89) or by adding a line to the library section of the modelsim.ini file that is located in the same directory. The vlib command must be used to create a library directory. Operating system commands cannot be used to create a library directory or index file.
vlog vlog The vlog command is used to invoke VLOG, the Model Technology Verilog compiler. Use vcom (p71) to compile Verilog source code into a specified working library (or to the work library by default). The vlog command is used just like vcom (p71), except that you do not need to compile a module before it is referenced (unless the module is referenced from VHDL). This command may also be invoked from within the simulator with all of the options shown below.
vlog +libext+ Specifies the suffix of files in library directory. Multiple suffixes may be used, for example: +libext+.v+.u. Optional. +librescan Scan libraries in command-line order for all unresolved modules. Optional. -line Specify the starting line number. Optional. +incdir+ Search directory for files included with the ‘include filename compiler directive. Optional. -nodebug[=ports | =pli] Hides the internal data of the compiled design unit. Optional.
vlog -R Causes VSIM to be invoked on the top-level Verilog modules immediately following compilation. VSIM is invoked with the arguments specified by (any arguments available for vsim (p91)). -refresh Regenerates a library image. Optional. By default, the work library is updated; use -work to update a different library. See vlog examples for more information. -source Displays the associated line of source code before each error message that is generated during compilation.
vlog Specifies the name of the Verilog source code file to compile. One filename is required. Multiple filenames can be entered separated by spaces. Examples vlog example.vlg The example compiles the Verilog source code contained in the file example.vlg. vcom -nodebug example.v Hides the internal data of example.v. Models compiled with -nodebug cannot use any of the ModelSim debugging features; any subsequent user will not be able to see into the model. vcom -nodebug=ports level3.v levle2.
vlog implies filenames with a .v or .u suffix (any combination of suffixes may be used). Only referenced definitions will be compiled. vlog -work mylib -refresh The -work option specifies mylib as the library to regenerate. -refresh rebuilds the library image without using source code, allowing models delivered as compiled libraries without source code to be rebuilt for a specific release of ModelSim (4.6 and later only).
vmake vmake The vmake utility allows you to use a UNIX or Windows MAKE program to maintain libraries. The vmake utility is run on a compiled design library, and outputs a makefile that can be used to reconstruct the library.The resulting makefile can then be run with a version of MAKE (not supplied with ModelSim); a MAKE program is included with Microsoft’s Visual C/C++, as well as many other program development environments.
vmap vmap The vmap command defines a mapping between a logical library name and a directory by modifying the modelsim.ini file. It also can be used to display all known mappings or just the current mapping of a specified logical name. Syntax vmap [-help] [-c] [-del] [] [] Arguments -help Displays the command’s options and arguments. Optional. -c Copies the default modelsim.ini file from the ModelSim installation directory to the current directory. Optional.
vmap Examples vmap design /modelsim/designs/wrg101 Establishes the logical name design and maps it to the directory /modelsim/designs/ wrg101. vmap Without any arguments, the vmap command displays all current mappings (based on the contents of the current project file, the modelsim.ini file). vmap my_asic If just a logical name is given, the vmap command will display the current mapping. vmap -del old_asic Used with the -del option, vmap deletes a mapping from the current project file.
vsim vsim The vsim command is used to invoke the VSIM simulator, or to view the results of a previous simulation run (when invoked with the -view switch). You can specify a configuration, an entity/architecture pair, or a module for simulation. If a configuration is specified, it is invalid to specify an architecture. If all arguments are omitted, the Load Design dialog box appears. During elaboration VSIM determines if the source has been modified since the last compile.
vsim Arguments, VHDL and Verilog -help Displays the command’s options and arguments. Optional. -c Specifies that the simulator is to be run in command line mode. Optional. If used, must be the first argument. Also see "Running command-line and batch-mode simulations" (p532) for more information. -i Specifies that the simulator is to be run in interactive mode. Optional. If used, must be the first argument.
vsim Description -lic_nomgc excludes any MGC licenses from the search -lic_nomti excludes any MTI licenses from the search -lic_vlog searches only for ModelSim EE/VLOG licenses -lic_vhdl searches only for ModelSim EE/VHDL licenses -lic_plus searches only for ModelSim EE/PLUS licenses -lic_noqueue do not wait in queue when license is unavailable The options may also be specified with the License variable (p420) in the modelsim.
vsim -restore Specifies that VSIM is to restore a simulation saved with the checkpoint command (p291). Optional. Use the -nocompress switch (above) if compression was turned off when the checkpoint command (p291) was used or if VSIM was initially invoked with nocompress. See additional discussion in "How to use checkpoint/restore" (p530); nocompress is also an option of the restore command (p357).
vsim -trace_foreign Creates two kinds of foreign interface traces: a log of what functions were called, with the value of the arguments, and the results returned; and a set of C-language files to replay what the foreign interface side did. The purpose of the log file is to aid the debugging of your FLI and/or PLI code.
vsim Note: Make sure the Value you specify is appropriate for the declared data type. Type mismatches will cause the specification to be ignored (including no error messages). No spaces are allowed anywhere in the specification, except within quotes when specifying a string value. Multiple -g options are allowed, one for each generic parameter. Name may be prefixed with a relative or absolute hierarchical path to select generics in an instance-specific manner.
vsim Name may be prefixed with a relative or absolute hierarchical path to select generics in an instance-specific manner. For example, Specifying -G/top/u1/tpd=20ns on the command line would only affect the tpd generic on the /top/u1 instance, overriding it with a value of 20ns. Specifying -Gu1/tpd=20ns affects the tpd generic on all instances named u1. Specifying -Gtpd=20ns affects all generics named tpd. If more than one -G option selects a given generic the most explicit specification takes precedence.
vsim -vital2.2b Select SDF mapping for VITAL 2.2b (default is VITAL 95). Optional. Arguments, Verilog -hazards Enables hazard checking in Verilog modules. Optional. -L ... Specifies the design library to search for the specified configuration, entity or module. Optional, if omitted the work library is used. If multiple libraries are specified, each must be preceded by the -L option. -Lf ... Same as -L but libraries are searched before ‘uselib. Optional.
vsim -pli "
vsim Examples vsim -gedge=”low high” -gVCC=4.75 cpu Invokes VSIM on the entity cpu and assigns values to the generic parameters edge and VCC. vsim -view my_design.i03 Instructs VSIM to view the results of a previous simulation run stored in the log file, my_design.i03. Use the -wav option to specify the name of the signal log file to create if you plan to create many files for later viewing. For example: vsim -wav my_design.i01 my_asic structure vsim -wav my_design.i02 my_asic structure ...
wav2log wav2log The wav2log command translates a ModelSim log file (vsim.wav) to a QuickSim II log file. The command reads the vsim.wav log file generated by the list, wave, or log commands in the simulator and converts it to the QuickSim II log file format. You must exit ModelSim before running wav2log because vsim.wav (or other user-specified wave files) are updated dynamically. Syntax wav2log [-help] [-input] [-output] [-inout] [-internal] [-1 ] [-4.1] [-4.
wav2log -4.1 Reads older version (pre-4.2) .wav files. Optional. -4.3 Reads intermediate version (4.2 and 4.3) .wav files. Optional. -quiet Disables error message reporting. Optional. -o Directs the output to be written to the file specified by . Optional. The default destination for the log file is standard out. Specifies the ModelSim log file that you are converting. Required.
6 - ModelSim EE Graphic Interface Chapter contents ModelSim graphic interface quick reference . . . . . . . . . . . 104 Window overview . . . . . . . . . . . . . . . . . . 109 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ModelSim graphic interface quick reference ModelSim graphic interface quick reference VSIM window details Simulator preferences and startup Window features (p110) Setting default simulation options (p207) Window overview (p109) Simulator preference variables (p210) Main window (p116) Simulating with the graphic interface (p198) Dataflow window (p127) List window (p131) Preference variable arrays Process window (p147) Menu preference variables (p217) Signals window (p150) Window preference vari
ModelSim graphic interface quick reference Graphic interface commands The following commands provide control and feedback during simulation as well as the ability to edit, and add menus and buttons to the interface. Only brief descriptions are provided here; for more information and command syntax see the "Simulator Command Reference" (p245).
ModelSim graphic interface quick reference 106 Window control and feedback commands Description search and next (p363) search the specified window for one or more items matching the specified pattern(s) seetime (p366) scrolls the List or Wave window to make the specified time visible transcribe (p377) displays a command in the Main window, then executes the command .wave.tree zoomfull (p396) zoom waveform display to view from 0 to the current simulation time .wave.
ModelSim graphic interface quick reference Window menu and button commands Description change_menu_cmd (p282) changes the command to be executed for a specified menu item label, in the specified menu, in the specified window disable_menu (p300) disables the specified menu within the specified window; useful if you want to restrict access to a group of ModelSim features disable_menuitem (p301) disables a specified menu item within the specified menu_path of the specified window; useful if you want to
ModelSim graphic interface quick reference Customizing the interface Try customizing ModelSim’s interface yourself; use the command examples for add button (p258) and add_menu (p264) to add a button to the Main window, and a new menu to the Signals window (p150). Results of the button and menu commands are shown below. • The pwd button was added to the Main window with the add button command (p258). Buttons can be added to the menu bar and status bar as well.
Window overview Window overview The ModelSim simulation environment consists of nine window types. Multiple windows of each type may be used during simulation (with the exception of the Main window). Make an additional window with the View > New menu selection in the Main window. A brief description of each window follows: • Main window (p116) The main window from which all subsequent VSIM windows are available.
Window features Window features ModelSim’s graphic interface provides many features that add to its usability; features common to many of the windows are described below.
Window features Drag and Drop Drag and drop of HDL items is possible between the following windows. Using the left mouse button, click and release to select an item, then click and hold to drag it. • Drag items from these windows: Dataflow, List, Signals, Source, Structure, Variables, and Wave windows • Drop items in these windows: List and Wave windows Note: Drag and drop works to move items within the List and Wave windows as well.
Window features Finding names, and searching for values • Find HDL item names with the Edit > Find menu selection in these windows: List, Process, Signals, Source, Structure, Variables, and Wave windows. • Search for HDL item values with the Edit > Search menu selection in these windows: List, and Wave windows. You can also: • Locate time markers in the List window with the Markers > Goto menu selection. • Locate time cursors in the Wave window with the Cursor > Goto menu selection.
Window features Customizing menus and buttons Menus can be added, deleted, and modified in all windows. Custom buttons can also be added to window tool bars. See • "Graphic interface commands" (p105), • "Customizing the interface" (p108), • "Customizing menus and buttons" (p113), and • "The Button Adder" (p230) more information. Combine signals into a user-defined bus You can collect selected items in the List window (p131) and Wave window (p168) displays and combine them into a bus named by you.
Window features Tree window hierarchical view ModelSim provides a hierarchical, or "tree view" of some aspect of your design in the Structure, Signals, Variables, and Wave windows.
Window features Tree window action list Action Use Do expand a level left mouse button click on a "+" box/circle collapse a level left mouse button click on a "-" box/circle select a single item left mouse button click on the HDL item name (not the box/circle prefix) select multiple contiguous items (not in Structure window) left mouse button click on the HDL item name and drag to complete selection select a range of contiguous items (not in Structure window) shift + left mouse button sele
Main window Main window The Main window is pictured below as it appears when VSIM is first invoked. Note that your operating system graphic interface provides the windowmanagement frame only; ModelSim handles all internal-window features including menus, buttons, and scroll bars. The menu bar at the top of the window provides access to a wide variety of simulation commands and ModelSim preferences.
Main window The Main window menu bar The menu bar at the top of the Main window lets you access many ModelSim commands and features. The menus are listed below with brief descriptions of the command’s use.
Main window Edit menu Copy copy the selected text Paste paste the previously cut or copied item to the left of the currently selected item Select All delete the selected item field Unselect All combine the selected fields into a user-defined bus; keep copies of the original items rather than moving them; see "Combine signals into a user-defined bus" (p113) Find search the transcript forward or backward for the specified text string Library menu Browse Libraries browse all libraries within the sc
Main window Run menu Run run simulation for one default run length; change the run length with Options > Simulation, or use the Run Length list on the tool bar Run -All run simulation until you stop it; see also the run command (p361) Continue continue the simulation; see also the run command (p361) and the -continue option Run -Next run to the next event time Step single-step the simulator; see also the step command (p371) Step-Over execute without single-stepping through a subprogram
Main window Window menu Initial Layout restore all windows to the size and placement of the initial full-screen layout Cascade cascade all open windows Tile Horizontally tile all open windows horizontally Tile Vertically tile all open windows vertically Icon Children icon all but the Main window Icon All icon all windows Deicon All deicon all windows Customize use The Button Adder (p230) to define and add a button to either the menu bar, tool bar, or status bar of the specified window
Main window Saving the transcript file Variable settings determine the filename used for saving the Main window transcript. If either PrefMain(file) in modelsim.tcl, or TranscriptFile in modelsim.ini file is set, then the transcript output is logged to the specified file. By default the TranscriptFile variable in modelsim.ini is set to transcript. If either variable is set, the transcript contents are always saved and no explicit saving is necessary.
Main window The Main window tool bar k ea er br st e p ov ll co nt in st ep n ru ru n ue ng le n ru -a th n ru rt st a re py st e pa co si gn de d lo a co m pi le Buttons on the Main window tool bar give you quick access to these ModelSim commands and functions.
Main window Main window tool bar buttons Button Menu equivalent Command equivalents Restart restart the current simulation with the option of use current formatting, breakpoints, and log file File > Restart restart Run run the current simulation for the default time length Run > Run … Run Length specify the run length for the current simulation see: restart (p356) see: run (p361) none run see: run (p361) Continue Run continue the current sim
Main window Main window tool bar buttons Button Break stop the current simulation run Menu equivalent Command equivalents none none The Main window status bar Fields at the bottom of the Main window provide the following information about the current simulation: 124 Field Description Now the current simulation time, using the resolution units specified in "Simulating with the graphic interface" (p198), or a larger time unit if one can be used without a fractional remainder Delta the current si
Main window Editing the command line, the current source file, and notepads The following mouse actions and special keystrokes can be used to edit commands in the entry region of the Main window. They can also be used in editing the file displayed in the Source window (p156) and all notepad (p335) windows.
Main window Keystrokes - UNIX Keystrokes - Windows Result < control - d > delete character to the right < control - k > delete to the end of line < control - a > < control - a >, move insertion cursor to beginning of line < control - e > < control - e >, move insertion cursor to end of line < * meta - "<" > none move insertion cursor to beginning of file < * meta - ">" > none move insertion cursor to end of file < control - x > cut selection < control - c > copy selection
Dataflow window Dataflow window The Dataflow window allows you to trace VHDL signals or Verilog nets through your design. Double-click an item with the left mouse button to move it to the center of the Dataflow display.
Dataflow window The Dataflow window menu bar The following menu commands and button options are available from the Dataflow window menu bar.
Dataflow window Tracing HDL items with the Dataflow window The Dataflow window is linked with the Signals window (p150) and the Process window (p147). To examine a particular process in the Dataflow window, click on the process name in the Process window. To examine a particular HDL item in the Dataflow window, click on the item name in the Signals window.
Dataflow window The dialog box has the following options: • Postscript File specify the name of the file to save, default is dataflow.
List window List window The List window displays the results of your simulation run in tabular format. The window is divided into two adjustable panes, which allow you to scroll horizontally through the listing on the right, while keeping time and delta visible on the left.
List window List window action list This action list provides a quick reference to menu selections and mouse actions in the List window. See the "Tree window action list" (p115) for additional information.
List window Action Menu or mouse See also finding an HDL item by name menu selection: Edit > Find "Finding items by name in the List window" (p142) finding the value of an HDL item menu selection: Edit > Search "Searching for item values in the List window" (p142) set, delete or go to a time marker in the listing menu selection: Markers > (choose Add Marker, Delete Marker, or Goto) "Setting time markers in the List window" (p145) The List window menu bar The following menu commands and button o
List window Paste paste the previously cut or copied item to the left of the currently selected item Delete delete the selected item field Combine combine the selected fields into a user-defined bus; keep copies of the original items rather than moving them; see "Combine signals into a user-defined bus" (p113) Select All select all signals in the List window Unselect All deselect all signals in the List window Find... find specified item label within the List window Search...
List window Deicon All deicon all windows Customize use The Button Adder (p230) to define and add a button to either the menu bar, tool bar, or status bar of the specified window lists the currently open windows; select a window name to switch to, or show that window if it is hidden; when the source window is available, the source file name is also indicated; open additional windows from the "View menu" (p118) in the Main window, or use the view command (p388) Setting List window displa
List window • Deltas:Expand Deltas When selected with the Trigger on: Signals check box, displays a new line for each time step on which items change, including deltas within a single unit of time resolution. • Deltas:Collapse Deltas Displays only the final value for each time unit in the List window. • Deltas:No Deltas No simulation cycle (delta) column is displayed in the List window. • Trigger On: Signals Triggers on signal changes. Defaults to all signals.
List window Window Properties page The Window Properties page includes these options: • Label: Full Name Display the full pathname of the item. • Label: Short Name Display the item name without the path. • Name Limit The maximum number of number of rows in the name pane. For additional information on setting window display properties see, "Setting preference variables with the GUI" (p211).
List window Adding items from the Main window command line Invoke the add list (p260) command to add one or more individual items; separate the names with a space: add list You can add all the items in the current region with this command: add list * Or add all the items in the design with: add list -r /* Adding items with a List window format file To use a List window format file you must first save a format file for the design you are simulating.
List window Editing and formatting HDL items in the List window Once you have the HDL items you want in the List window, you can edit and format the list to create the view you find most useful. (See also, "Adding HDL items to the List window" (p137)) To edit an item: Select the item’s label at the top of the List window or one of its values from the listing. Move, copy or remove the item by selecting commands from the List window Edit menu (p133) menu.
List window The Modify Signal Properties dialog box includes these options: • Signal Shows the item you selected with the mouse. • Label Allows you to specify the label that is to appear at the top of the List window column for the specified item. • Radix Allows you to specify the radix (base) in which the item value is expressed. The default radix is symbolic, which means that for an enumerated type, the List window lists the actual values of the enumerated type of that item.
List window • Trigger: Does not trigger line Selecting this option in the List Signals window specifies that a change in the value of the selected item does not affect the List window. The trigger specification affects the trigger property of the selected item. See also, "Setting List window display properties" (p135).
List window In the first List window, the HDL items are formatted as symbolic and use an item change to trigger a line; the field width was changed to accommodate the default label width. The window divider maintains the time and delta in the left pane; signals in the right pane may be viewed by scrolling. For the second listing, the specification for triggering was changed to a 100-ns strobe, and the item radix for a, b, cin, and sum is now decimal.
List window The List Signal Search dialog box includes these options: • Signal Name This indicates the item currently selected in the List window; the subject of the search. • Search Options: Ignore Glitches Ignore zero width glitches in VHDL signals and Verilog nets. The List Signal Search dialog expands with Search for Signal Value selected (shown below) • Search Options: Reverse Direction Select to search the list from bottom to top. Deselect to search from top to bottom.
List window The expression may involve more than one signal but is limited to signals logged in the List window. Expressions may include constants, variables and macros. If no expression is specified, the search will give an error. See "GUI_expression_format" (p236) for information on creating an expression. To help build the expression, click the Use Expression Builder button to open "The GUI Expression Builder" (p242).
List window Setting time markers in the List window From the List window select Markers > Add Marker to tag the selected list line with a marker. The marker is indicated by a thin box surrounding the marked line. The selected line uses the same indicator, but its values are highlighted. Delete markers by first selecting the marked line, then making the Markers > Delete Marker menu selection. Finding a marker Choose a specific marked line to view with Markers > Goto menu selection.
List window Key Action scroll listing down by page searches forward (down) to the next transition on the selected signal searches backward (up) to the previous transition on the selected signal (does not function on HP workstations) opens the find dialog box; find the specified item label within the list display Saving List window data to a file From the List window select Edit > Write List (format) to save the List window data in one of these formats: •
Process window Process window The Process window displays a list of processes and indicates the pathname of the instance in which the process is located. Each HDL item in the scrollbox is preceded by one of the following indicators: • Indicates that the process is scheduled to be executed within the current delta time. • Indicates that the process is waiting for a VHDL signal or Verilog net or variable to change or for a specified time-out period.
Process window The Process window menu bar The following menu commands and button options are available from the Process window menu bar.
Process window Customize use The Button Adder (p230) to define and add a button to either the menu bar, tool bar, or status bar of the specified window lists the currently open windows; select a window name to switch to, or show that window if it is hidden; when the source window is available, the source file name is also indicated; open additional windows from the "View menu" (p118) in the Main window, or use the view command (p388) Active/In Region toggle button Active Displays all the
Signals window Signals window The Signals window shows the names and values of HDL items in the current region (which is selected in the Structure window). Items may be sorted in ascending, descending, or declaration order.
Signals window The Signals window menu bar The following menu commands are available from the Signals window menu bar.
Signals window Cascade cascade all open windows Tile Horizontally tile all open windows horizontally Tile Vertically tile all open windows vertically Icon Children icon all but the Main window Icon All icon all windows Deicon All deicon all windows Customize use The Button Adder (p230) to define and add a button to either the menu bar, tool bar, or status bar of the specified window lists the currently open windows; select a window name to switch to, or show that window if it i
Signals window The Force dialog box includes these options: • Signal Name Specify the signal or net for the applied stimulus. • Value Initially displays the current value, which can be changed by entering a new value into the field. A value can be specified in radixes other than decimal by using the form (for VHDL and Verilog, respectively): base#value -or- b|o|d|h’value 16#EE or h’EE, for example, specifies the hexadecimal value EE.
Signals window • Repeat Allows you to specify the time interval after which the stimulus is to be repeated. A value of 0 indicates that the stimulus is not to be repeated. • Force When you click the Force button, a force command (p319) is issued with the parameters you have set and echoed in the Main window.
Signals window Adding items from the Main window command line Another way to add items to the Wave or List window or the log file is to enter the one of the following commands at the VSIM prompt (choose either the add list (p260), or log (p325) command): add list | add wave | log You can add all the items in the current region with this command: add list | add wave | log * Or add all the items in the design with: add list | add wave | log -r /* If the target window (Wave or List)
Source window Source window The Source window allows you to view and edit your HDL source code. Select an item in the Structure window (p162) or use the File menu to add a source file to the window, then select a process in the Process window (p147) to view that process; an arrow next to the line numbers indicates the selected process. (Your source code can remain hidden if you wish, see "Source code security and nodebug" (p534).
Source window The Source window menu bar The following menu commands are available from the Source window menu bar. File menu New edit a new source file Open select a source file to open Use Source specifies an alternative file to use for the current source file; this alternative source mapping exists for the current simulation only Source Directory add to a list of directories (the SourceDir variable in modelsim.
Source window Options menu Options open the Source Options dialog box, see "Setting Source window options" (p161) Window menu 158 Initial Layout restore all windows to the size and placement of the initial full-screen layout Cascade cascade all open windows Tile Horizontally tile all open windows horizontally Tile Vertically tile all open windows vertically Icon Children icon all but the Main window Icon All icon all windows Deicon All deicon all windows Customize use The Button Adder (p
Source window The Source window tool bar er ov st ep st ep d fin t py pa st e co cu fil e ce ur so ve sa lo ad so ur ce fil e Buttons on the Source window tool bar gives you quick access to these ModelSim commands and functions.
Source window Source window tool bar buttons Button Menu equivalent Other equivalents Paste paste the copied text to the cursor location Edit > Paste see: "Editing the command line, the current source file, and notepads" (p125) Find find the specified text string within the source file; match case option Edit > Find none Step steps the current simulation to the next HDL statement none step Step Over HDL statements are executed but treated as simple statements instead of entered and traced line
Source window You can also invoke the examine (p313) and/or describe (p298) command on the command line or in a macro. Setting Source window options Access the Source window options with this Source menu selection: Options > Options.
Structure window Structure window The Structure window provides a hierarchical view of the structure of your design. An entry is created by each HDL item within the design. (Your design structure can remain hidden if you wish, see "Source code security and -nodebug" (p534).) HDL items you can view The following HDL items for VHDL and Verilog are represented by hierarchy within Structure window.
Structure window Instance name components in the Structure window An instance name displayed in the Structure window consists of the following parts: where: instantiation label (architecture) entity or module • instantiation label Indicates the label assigned to the component or module instance in the instantiation statement. • entity or module Indicates the name of the entity or module that has been instantiated.
Structure window Edit menu Copy copy the current selection in the Structure window Sort sort the structure tree in either ascending, descending, or declaration order Unselect All unselect all items in the Structure window Find...
Variables window Variables window The Variables window lists the names of HDL items within the current process, followed by the current value(s) associated with each name. The pathname of the current process is displayed at the bottom of the window. (The internal variables of your design can remain hidden if you wish, see "Source code security and nodebug" (p534).) HDL items you can view The following HDL items for VHDL and Verilog are viewable within the Variables window.
Variables window The Variables window menu bar The following menu commands are available from the Variables window menu bar.
Variables window Window menu Initial Layout restore all windows to the size and placement of the initial full-screen layout Cascade cascade all open windows Tile Horizontally tile all open windows horizontally Tile Vertically tile all open windows vertically Icon Children icon all but the Main window Icon All icon all windows Deicon All deicon all windows Customize use The Button Adder (p230) to define and add a button to either the menu bar, tool bar, or status bar of the specified window
Wave window Wave window The Wave window, like the List window, allows you to view the results of your simulation. In the Wave window, however, you can see the results as HDL item waveforms and their values. The Wave window is divided into two windowpanes: the left pane displays item names and their values at the active cursor (located in the right pane); the right pane displays waveforms corresponding to each item and any cursors you may have added.
Wave window You can resize the windowpanes by clicking and dragging the bar between the two windowpanes. Waveform and signal-name formatting are easily changed via the Prop menu (p172). You can reuse any formatting changes you make by saving a Wave window format file, see "Adding items with a Wave window format file" (p177). Wave window action list This action list provides a quick reference to menu selections and mouse actions in the Wave window.
Wave window Action Menu or mouse See also reformat items, change their display colors, and position them within the window menu selection: Prop > Display Props...
Wave window File menu Write Postscript save the waveform display as a Postscript file Load Format run a Wave window format (do) file previously saved with Save Format Save Format saves the current Wave window display and signal preferences to a do (macro) file; running the DO file will reformat the Wave window to match the display as it appeared when the DO file was created Close close this copy of the Wave window; you can create a new window with View > New from the "The Main window menu bar" (p117
Zoom menu Zoom selection: Full, In, Out, Last, or Range to change the waveform display range Prop menu Display Props set display properties for all items in the window: delta settings, trigger on selection, strobe period, and label size Signal Props set label, radix, trigger on/off, and field width for the selected item (use the menu selections below to quickly change individual properties) Radix set the selected item’s radix Format set the waveform format for the selected item Color
Wave window Wave window tool bar ea br -a k ll n n ru e in u nt co zo ru ru n fu ll ea om ar t2 m zo o ou in om zo om zo x 2x n n iti o iti o ns ns t ra d fin d fin ev pr ne io u le s te t ra cu cu r d de ad xt so r rs or st e pa t py co cu at fo rm e av w ve sa lo ad w av e fo rm at The Wave window tool bar gives you quick access to these ModelSim commands and functions.
Wave window Wave window tool bar buttons Button 174 Menu equivalent Other options Copy copy the selected signal in the signalname pane Edit > Copy none Paste paste the copied signal above another selected signal Edit > Paste see: "Editing the command line, the current source file, and notepads" (p125) Add Cursor add a cursor to the center of the waveform pane Cursor > Add Cursor none Delete Cursor delete the selected cursor from the window Cursor > Delete Cursor none Find Previous Transitio
Wave window Wave window tool bar buttons Button Menu equivalent Other options Zoom area use the cursor to outline a zoom area Zoom > Zoom Range see: "Zooming - changing the waveform display range" (p185) Zoom Full zoom out to view the full range of the simulation from time 0 to the current time Zoom > Zoom Full see: "Zooming - changing the waveform display range" (p185) Run run the current simulation for the default time length Main menu: Run > Run use the run command at the VSI
Wave window Setting Wave window display properties You can define the item name width and the cursor snap distance of all items in the Wave window with the Prop > Display Props... menu selection. The Wave Window Properties dialog box includes these options: • Max Signal Name Width Sets the item name width. This is especially useful for items that have a long pathname. Choose a maximum name width setting, say 10 characters, and then item pathnames longer than 10 characters are truncated on the left.
Wave window Adding items from the Main window command line To add specific HDL items to the window, enter (separate the item names with a space): add wave You can add all the items in the current region with this command: add wave * Or add all the items in the design with: add wave -r /* Adding items with a Wave window format file To use a Wave window format file you must first save a format file for the design you are simulating.
Wave window Editing and formatting HDL items in the Wave window Once you have the HDL items you want in the Wave window, you can edit and format the list in the name/value pane to create the view you find most useful. (See also, "Adding HDL items in the Wave window" (p176).) To edit an item: Select the item’s label in the left name/value windowpane or its waveform in the right windowpane. Move, copy or remove the item by selecting commands from the Wave window Edit menu (p171) menu.
Wave window The Wave Signal Properties dialog box includes these options: • Signal Indicates the name of the currently selected signal. • Label Allows you to specify a new label (in the name/value pane) for the selected item. • Height Allows you to specify the height (in pixels) of the waveform. • Color Lets you override the default color of a waveform by selecting a new color from the color palette, or by entering an X-Windows color name.
Wave window • Format: Analog Step Displays a waveform of an integer, real or time type, with the height and offset determined by the Pixels = specification and the value of the item. • Format: Analog Interpolated Displays the waveform in interpolated style. • Format: Analog Backstep Displays the waveform in backstep style. Used for power calculations. • Format: Literal Displays the waveform as a box containing the item value (if the value fits the space available).
Wave window Choose either the Name or Value field to search from the drop-down menu, and enter the value to search for in the Find field. Find the item by searching Forward (down) or Reverse (up) through the Wave window display. Searching for item values in the Wave window Select an item in the Wave window. From the Wave window menu bar select Edit > Search to bring up the Wave Signal Search dialog box.
Wave window • Search Options: Search for Expression Reveals the Search Expression field and the Use Expression Builder button; searches for the expression specified in the Search Expression field evaluating to a boolean true. Wave Signal Search dialog box with Search for Signal Value selected The expression may involve more than one signal but is limited to signals logged in the List window. Expressions may include constants, variables, and macros.
Wave window • Search Occurrences You can search for the nth transition or the n-th match on value or expression; Search Occurrences indicates the number of transitions or matches for which to search. The result of your search is indicated at the bottom of the dialog box: "Found match: time 225 delta 0" in the illustration above.
Wave window Finding a cursor Choose a specific cursor view with Cursor > Goto menu selection. The cursor value (on the Goto list) corresponds to the simulation time of that cursor. Making cursor measurements Each cursor is displayed with a time box showing the precise simulation time at the bottom. When you have more than one cursor, each time box appears in a separate track at the bottom of the display. VSIM also adds a delta measurement showing the time difference between the two cursor positions.
Wave window Finding next and previous transitions You can move the cursors to the next and previous transition of the selected item with the Find Transition buttons on the toolbar: Find Previous Transition locate the previous signal value change for the selected signal Find Next Transition locate the next signal value change for the selected signal Zooming - changing the waveform display range Zooming lets you change the simulation range in the windowpane display.
Wave window Zooming with the toolbar buttons Use these buttons on the Wave window toolbar to zoom.
Wave window Wave window keyboard shortcuts Using the following keys when the mouse cursor is within the Wave window will cause the indicated actions: Key Action i I or + zoom in o O or - zoom out f or F zoom full l or L zoom last r or R zoom range scroll waveform display up scroll waveform display down scroll waveform display left scroll waveform display right scroll waveform display up by page scroll waveform d
Wave window Saving the waveform display as a Postscript file Use the File > Write Postscript menu selection in the Wave window to save a Postscript file of the waveform windowpane. The file will contain all the waveforms that are visible in the waveform pane; the item names will appear to the left of the waveforms. The output is controlled by the dialog box shown below. The Write Postscript dialog box includes these options: • Postscript File specify the Postscript file to create, the default is wave.
Wave window • pages wide indicates the number of pages to be output based on the paper size and time settings; if set, the time-width per page is automatically computed • Plot Signals specify whether to plot All signals, only those currently Visible, or only those currently Selected Changing the output resolution The postscript writing routines filter out postscript commands for points that are closer than the plot resolution. This dramatically reduces the size of some postscript files.
Wave window The vsim.ps include file The Postscript file that VSIM creates includes a file named vsim.ps that is shipped with ModelSim. The file is "included" in the Postscript output from the waveform display; it sets the fonts, spacing, and print header and footer (the font and spacing is based on those used in the Wave window). If you want to change any of the Postscript defaults, you can do it by making changes in this file.
Compiling with the graphic interface Compiling with the graphic interface To compile either VHDL or Verilog designs, select the Compile button on the Main window toolbar. The Compile HDL Source Files dialog box opens as shown below.
Setting default compile options Locating source errors during compilation If a compiler error occurs during compilation, a red error message is printed in the Main transcript. Double-click on the error message to open the source file in an editable Source window with the error hilighted.
Setting default compile options VHDL compiler options page Flag Warnings on: • Unbound Component Flags any component instantiation in the VHDL source code that has no matching entity in a library that is referenced in the source code, either directly or indirectly. Edit the Show_Warning1 variable (p416) in the modelsim.ini to set a permanent default. • Process without a wait statement Flags any process that does not contain a wait statement or a sensitivity list.
Setting default compile options Check for: • Synthesis Turns on limited synthesis-rule compliance checking. Edit the CheckSynthesis variable (p417) in the modelsim.ini to set a permanent default. • Vital Compliance Toggle Vital compliance checking. Edit the NoVitalCheck variable (p417) in the modelsim.ini to set a permanent default. Optimize for: • std_logic_1164 Causes the compiler to perform special optimizations for speeding up simulation when the multi-value logic package std_logic_1164 is used.
Setting default compile options Although it is not intuitively obvious, the = operator is overloaded in the std_logic_1164 package. All enumeration data types in VHDL get an “implicit” definition for the = operator. So while there is no explicit = operator, there is an implicit one. This implicit declaration can be hidden by an explicit declaration of = in the same package (LRM Section 10.3).
Setting default compile options Verilog compiler options page • Enable run-time hazard checks Enables the runtime hazard checking code. Same as the -hazards switch for the vlog command (p83). For more information see "Hazard detection" (p50). Edit the Hazard variable (p417) in the modelsim.ini to set a permanent default. • Don’t put debugging info in library Models compiled with this option do not use any of the ModelSim debugging features. Consequently, your user will not be able to see into the model.
Setting default compile options • Disable loading messages Disables loading messages in the Transcript window. Same as the -quiet switch for the vlog command (p83). Edit the Quiet variable (p417) in the modelsim.ini to set a permanent default. • Show source lines with errors Causes the compiler to display the relevant lines of code in the transcript. Same as the -source switch for the vlog command (p83). Edit the Show_source variable (p416) in the modelsim.ini to set a permanent default.
Simulating with the graphic interface Simulating with the graphic interface The Load Design dialog box is activated (along with theMain window (p116)) when VSIM is initially invoked, or when the Load Design button is selected from the toolbar. Four pages - Design, VHDL, Verilog, and SDF - allow you to select various simulation options. You can switch between pages to modify settings, then begin simulation by selecting the Load button.
Simulating with the graphic interface Design selection page The Design page includes these options: • Simulator Resolution (-time []) The drop-down menu sets the simulator time units. • Library Specifies a library for viewing in the Design Unit list box. You can use the drop-down list (click the arrow) to select a "mapped" library or you can type in a library name. You can also use the Browse button to locate a library among your directories.
Simulating with the graphic interface command (p81). Once the library is selected you can view its design units within the Design Unit list box. • Simulate ( | | [()]) Specifies the design unit(s) to simulate. You can simulate several Verilog toplevel modules or a VHDL top-level design unit in one of three ways: 1. Type a design unit name (configuration, module, or entity) into the field, separate additional names with a space.
Simulating with the graphic interface VHDL settings page The VHDL page includes these options: Generics The Add button opens a dialog box that allows you to specify the value of generics within the current simulation; generics are then added to the Generics list. You may also select a generic on the listing to Delete or Edit (opens the dialog box below).
Simulating with the graphic interface From Specify a Generic dialog box you can set the following options. • Generic Name (-g ) The name of the generic parameter. You can make a selection from the drop-down menu or type it in as it appears in the VHDL source (case is ignored).
Simulating with the graphic interface Verilog settings page The Verilog page includes these options: • Delay Selection (+mindelays | +typdelays | +maxdelays) Use the drop-down menu to select timing for min:typ:max expressions. Also see: "Timing check disabling" (p49). • Additional Search Libraries (-L ) Specifies one or more libraries to search for the design unit(s) you wish to simulate. Type in a library name or use the Browse button to locate a library within your directories.
Simulating with the graphic interface Make certain your selection is a valid ModelSim library - it must include an _info file and must have been created from ModelSim’s vlib command (p81). Pulse Options • Disable pulse error and warning messages (+no_pulse_msg) Disables path pulse error warning messages. • Rejection Limit (+pulse_r/) Sets module path pulse rejection limit as percentage of path delay. • Error Limit (+pulse_e/) Sets module path pulse error limit as percentage of path delay.
Simulating with the graphic interface SDF settings page The SDF page includes these options: SDF Files The Add button opens a dialog box that allows you to specify the SDF files to load for the current simulation; files are then added to the Region/File list. You may also select a file on the listing to Delete or Edit (opens the dialog box below).
Simulating with the graphic interface From the Specify an SDF File dialog box you can set the following options. • SDF file ([] = ) Specifies the SDF file to use for annotation. Use the Browse button to locate a file within your directories. • Apply to region Specifies the design region to use with the selected SDF options. • Delay Selection (-sdfmin | -sdftyp | -sdfmax) Drop-down menu selects delay timing (min, typ or max) to be used from the specified SDF file.
Setting default simulation options Setting default simulation options Use the Options > Simulation... menu selection to bring up the Simulation Options dialog box shown below. Options you may set for the current simulation include: default radix, default force type, default run length, iteration limit, warning suppression, and break on assertion specifications. OK accepts the changes made and closes the dialog box. Apply makes the changes with the dialog box open so you can test your settings.
Setting default simulation options The Default page includes these options: • Default Radix Sets the default radix for the current simulation run. You can also use the radix (p352) command to set the same temporary default. A permanent default can be set by editing the DefaultRadix variable (p253) in the modelsim.ini file. The chosen radix is used for all commands (force (p319), examine (p313), change (p281) are examples) and for displayed values in the Signals, Variables, Dataflow, List, and Wave windows.
Setting default simulation options Assertion settings page The Assertions page includes these options: • Break on Assertion Selects the assertion severity that will stop simulation. Edit the BreakOnAssertion variable (p253) in the modelsim.ini to set a permanent default. • Ignore Assertions For Selects the assertion type to ignore for the current simulation. Multiple selections are possible. Edit the IgnoreFailure, IgnoreError, IgnoreWarning, or IgnoreNote (p254) variables in the modelsim.
Simulator preference variables Simulator preference variables Simulator preference variables give you control over fonts, colors, prompts, window positions and other simulator window characteristics. Preference files, which contain Tcl commands that set preference variables, are loaded before any windows are created, and so will affect all windows. Additional preferences may be set in the modelsim.ini file (see "System Initialization/Project File" (p413)). The modelsim.
Simulator preference variables Setting preference variables with the GUI Use the Options > Edit Preferences... menu selection to open the Preferences dialog box shown below. Preference variable options include: window fonts, colors, window size and location (window geometry), and the user_hook variable. ModelSim user_hook variables (p226) allow you to specify Tcl procedures to be called when a new window is created. Use the Apply button to set temporary defaults for the current simulation.
Simulator preference variables The By Window page includes these options: • Window Select the window type to modify; the color and font changes you make apply to all windows of this type. The Source window view allows you to preview source examples for either VHDL or Verilog. When you select the Source window, you can change preferences based on VHDL or Verilog source.
Simulator preference variables By Name page The By Name includes these options: • Preference Select the preference to change and click the Change Value button. Enter the new value into the field provided in the resulting dialog box. In addition to window preferences (listed by window name in the Preference list), you may also set: • Batch Specify the user_hook variables (p226) to use in batch-mode simulation, multiple procedures may be specified when separated by a space. See also, "Batch mode" (p533).
Simulator preference variables • Default Set default colors and fonts for menus and tree windows, also fill colors for VHDL (box) and Verilog (arc) structure symbols; these may be changed for individual windows. • Geometry Set the default size and position for the selected window type; used for the geometry of any newly-created window. This option will only exist after preferences have been saved for the first time (using the Save button).
Simulator preference variables Setting preferences from the ModelSim command line In addition to the GUI, all preferences can be set from the ModelSim command line in the Main window (p116). Note that if you save to a preference file other than modelsim.tcl you must refer to it with the MODELSIM_TCL (p55) environment variable. Set variables temporarily in the current environment with the set command:.
Preference variable arrays Preference variable arrays Preference variables are Tcl arrays, indexed by name.
Preference variable arrays Menu preference variables Menu variables set GUI preferences for all menus within all ModelSim windows. These variables may be set with the graphic interface or modified from the command line. See "Setting preference variables with the GUI" (p211) and "Setting preferences from the ModelSim command line" (p215) for more information.
Preference variable arrays Variable Example value PrefDataflow(fillColor) grey60 PrefDataflow(outlineColor) pink PrefDataflow(valueColor) yellow Dataflow window Postscript output variables Postscript output of the Dataflow window is setup with these variables. Variable Values/description Example value PrefDataflow(ColorMap) mapping from screen to PS colors {white {0.00.00.
Preference variable arrays Variable Description Example value PrefList(isTrigger) if 1, signals will trigger the list display, default is 1 0, 1 PrefList(MarkerSelectWidth) width in pixels of region sensitive to selecting marker only 100 PrefList(shortName) 0 corresponds to Full Name, and 1 to Short Name , default is 0 0, 1 Main window preference variables These variables may be set with the graphic interface or modified from the command line.
Preference variable arrays Variable Example value PrefMain(font) $PrefDefault(textFont) PrefMain(background) white PrefMain(foreground) black PrefMain(insertBackground) black PrefMain(promptColor) navy PrefMain(errorColor) red PrefMain(assertColor) blue PrefMain(prefFile) modelsim.tcl Process window preference variables These variables may be set with the graphic interface or modified from the command line.
Preference variable arrays Variable Example value PrefSignals(font) $PrefDefault(textFont) PrefSignals(background) "forest green" PrefSignals(foreground) white PrefSignals(selectBackground) white PrefSignals(selectForeground) "forest green" Source window preference variables These variables may be set with the graphic interface or modified from the command line.
Preference variable arrays Structure window preference variables These variables may be set with the graphic interface or modified from the command line. See "Setting preference variables with the GUI" (p211) and "Setting preferences from the ModelSim command line" (p215) for more information.
Preference variable arrays Wave window preference variables These variables may be set with the graphic interface or modified from the command line. See "Setting preference variables with the GUI" (p211) and "Setting preferences from the ModelSim command line" (p215) for more information.
Preference variable arrays Library design unit preference variables These variables may be set with the graphic interface or modified from the command line. See "Setting preference variables with the GUI" (p211) and "Setting preferences from the ModelSim command line" (p215) for more information.
Preference variable arrays Variable Example value PrefDataflow(geometry) 258x255+260+615 PrefStartup(geometry) +300+200 Geometry preference variables If you change the window positions and invoke this command: write pref ./modelsim.tcl An additional set of geometry preference variables are written to modelsim.tcl with a higher priority. On the next invocation of the vsim (p393) command you will get the newly-saved positions.
Preference variable arrays user_hook variables The user_hook preference variable allows you to specify Tcl procedures to be called when a new window is created, or when the simulator is used in batch mode. Multiple procedures may be separated with a space. For window-specific user_hooks, each procedure added will be called after the window is created, with a single argument: the full Tk path name of the window that was just created.
Preference variable arrays Variable Initial value PrefProcess(user_hook) "" PrefSource(user_hook) "" PrefList(user_hook) "" PrefWave(user_hook) "" PrefDataflow(user_hook) "" The addons variable In addition to window and batch user_hooks, the PrefVsim(addOns) variable provides a user_hook that allows you to integrate add-ons with VSIM. Refer to any vendor-supplied instructions for specifics about connecting third-party addons to VSIM.
Preference variable arrays Variable Example value ListTranslateTable(LOGIC_0) {‘0’ FALSE} ListTranslateTable(LOGIC_1) {‘1’ TRUE} ListTranslateTable(LOGIC_Z) {‘Z’ ‘z’} ListTranslateTable(LOGIC_W) {‘W’} ListTranslateTable(LOGIC_L) {‘L’} ListTranslateTable(LOGIC_H) {‘H’} ListTranslateTable(LOGIC_DC) {‘-’} Logic type display preferences The next group of preference variables allow you to control how each of the nine internal logic types are graphically displayed in the Wave window.
Preference variable arrays Variable Example value LogicStyleTable(LOGIC_DC) {DoubleDash blue 1} Force mapping preferences The ForceTranslateTable is used only for vectors, and maps how a string of digits are mapped into enumerations. First, digits 0, 1, X and Z are mapped in the obvious way into LOGIC_0, LOGIC_1, LOGIC_X and LOGIC_Z. Then the ForceTranslateTable is used to map from there to the enumeration appropriate for the type of signal being forced.
ModelSim tools ModelSim tools Several tools are available from the Main window menu bar. • "The Button Adder" (p230) Allows you to add a temporary function button or tool bar to any window. • "The Macro Helper" (p231) Creates macros by recording mouse movements and key strokes. UNIX only. • "The Tcl Debugger" (p232) Helps you debug your Tcl procedures. The Button Adder The ModelSim Button Adder creates a single button, or a combined button and tool bar in any currently opened VSIM window.
ModelSim tools Justify the button within the menu bar/tool bar with these selections: • Right places the button on the right side of the menu/tool bar. • Left adds the button on the left side of the menu/tool bar. • Top places the button at the top/center of the menu bar or tool bar. • Bottom places the button at the bottom/center of the menu bar or tool bar. The Macro Helper This tool is available for UNIX only.
ModelSim tools The Tcl Debugger We would like to thank Gregor Schmid for making TDebug available for use in the public domain. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of FITNESS FOR A PARTICULAR PURPOSE. Starting the debugger TDebug is installed with ModelSim and is configured to run from the Macro > Tcl Debugger menu selection. Make sure you use the ModelSim and TDebug menu selections to invoke and close the debugger.
ModelSim tools The TDebug chooser has three parts. At the top the current interpreter, vsim.op_ , is shown. In the main section there are two list boxes. All currently defined procedures are shown in the left list box. By clicking the left mouse button on a procedure name, the procedure gets prepared for debugging and its name is moved to the right list box. Clicking a name in the right list box returns a procedure to its normal state.
ModelSim tools The debugger window is divided into the main region with the name of the current procedure (Proc), a listing in which the expression just executed is highlighted, the Result of this execution and the currently available Variables and their values, an entry to Eval expressions in the context of the current procedure and some button controls for the state of the debugger. A procedure listing displayed in the main region will have a darker background on all lines that have been prepared.
ModelSim tools Breakpoints To set/unset a breakpoint, double-click inside the listing. The breakpoint will be set at the innermost available expression that contains the position of the click. There's no support for conditional or counted breakpoints. The Eval entry supports a simple history mechanism available via the and keys. If you evaluate a command while stepping through a procedure, the command will be evaluated in the context of the procedure, otherwise at global level.
GUI_expression_format GUI_expression_format The GUI_expression_format is an option of several VSIM commands that operate within ModelSim’s GUI environment. The expressions allow the use of criteria to locate and examine HDL items within the List and Wave windows.
GUI_expression_format The enumeration types supported are any VHDL enumerated type. Enumeration literals may be used in the expression as long as some variable of that enumeration type is referenced in the expression. This is useful for subexpressions of the form: (/memory/state == reading) Grouping and precedence Operator precedence generally follows that of the C language, but we recommend liberal use of parentheses.
GUI_expression_format Constants Type Values boolean value 0 1 true false TRUE FALSE integer [0-9]+ real number |([].
GUI_expression_format Array variables Variable Type Name of a signal -- VHDL signals of type bit or std_logic_vector -- VLOG register -- VLOG net array A subrange or index may be specified in either VHDL or VLOG syntax.
GUI_expression_format Operator Description Operator Description nand/NAND bitwise nand mod/MOD arithmetic modulus or/OR bitwise or rem/REM arithmetic remainder Note: Arithmetic operators use the std_logic_arith package.
GUI_expression_format clk’rising && (mystate == reading) && (/top/u3/addr == 32’habcd1234) Evaluates to a boolean 1 when signal clk just changed from low to high and signal mystate is the enumeration reading and signal /top/u3/addr is equal to the specified 32-bit hex constant; otherwise is 0. (/top/u3/addr and 32’hff000000) == 32’hac000000 Evaluates to a boolean 1 when the upper 8 bits of the 32-bit signal /top/u3/adder equals hex ac.
The GUI Expression Builder The GUI Expression Builder The GUI Expression Builder is a feature of the Wave and List Signal Search dialog boxes, and the List trigger properties dialog box. It aids in building a search expression that follows the "GUI_expression_format" (p236).
The GUI Expression Builder To search for when a signal reaches a particular value Select the signal in the Wave window and press this Expression Builder button: Add Selected_Signal(s) ==value. This will enter a subexpression consisting of ( == ). You may then edit the value string to be the value of your choice. After editing type to save the change.
- ModelSim EE Graphic Interface ModelSim EE/PLUS Reference Manual
7 - Simulator Command Reference Chapter contents Command return values . . . . . . . . . . . . . . . . . 246 Syntax conventions . . . . . . . . . . . . . . . . . 246 Command history shortcuts . . . . . . . . . . . . . . . . 247 Numbering conventions . . . . . . . . . . . . . . . . . 247 HDL item pathnames . . . . . . . . . . . . . . . . . 249 Wildcard characters . . . . . . . . . . . . . . . . . .
Command return values Command return values All simulator commands are invoked using Tcl. For most commands that write information to the Main window, that information is also available as a Tcl result. By using command substitution the results can be made available to another command or assigned to a Tcl variable. For example: set aluinputs [find -in alu/*] Sets variable "aluinputs" to the result of the find command (p317). The subsections below describe the notation conventions for the commands.
Command history shortcuts Command history shortcuts The simulator command history may be reviewed, or commands may be reused, with these shortcuts at the ModelSim/VSIM prompt: Shortcut Description !! repeats the last command !n repeats command number n; n is the VSIM prompt number, i.e.
Numbering conventions Element Description value specifies the numeric value, expressed in the specified radix; required # is a delimiter between the radix and the value; the first # sign is required if a radix is used, the second is always optional Examples 16#FFca23# 2#11111110 -23749 The second VHDL number style is: base "value" Element Description base specifies the base; binary: B, octal: O, hex: X; required value specifies digits in appropriate base with optional underscore separators; def
HDL item pathnames Examples ‘b11111110 8‘b11111110 ‘Hffca23 21‘H1fca23 -23749 HDL item pathnames VHDL and Verilog items are organized hierarchically. Each of the following HDL items creates a new level in the hierarchy: • VHDL component instantiation statement, block statement, and package • Verilog module instantiation, named fork, named begin, task and function Multiple levels in a pathname Multiple levels in a pathname are separated by the character specified in the PathSeparator variable.
HDL item pathnames Relative path names Relative path names do not start with the path separator, and are relative to the current environment. The current environment defaults to the first top-level entity or module and may be changed by the environment command or by clicking on hierarchy levels in the structure window.
Wildcard characters block1/u2/clk specifies the item clk, two levels down from the current environment array_sig(4) specifies an index of an array item array_sig(1 to 10) specifies a slice of an array item in VHDL syntax mysignal(31:0) specifies a slice of an array item in partial Verilog syntax record_sig.field specifies a field of a record Wildcard characters Wildcard characters can be used in HDL item names in some simulator commands.
Tcl variables Tcl variables Tcl variables can be referenced in simulator commands by preceding the name of the variable with the dollar sign ($) character. The simulator uses global Tcl variables for simulator state variables, simulator control variables, simulator preference variables and user-defined variables. Note that case is significant in variable names.
Tcl variables Examples echo "The time is $now $resolution." will result in: The time is 12390 10ps. If you do not want the dollar sign to denote a simulator variable, precede it with a "\" character. For example, \$now will not be interpreted as the current simulator time. Simulator control variables The following predefined Tcl variables control various aspects of VSIM simulation. Case is significant in variable names. Most simulator control variables can be initialized in the modelsim.ini file.
Tcl variables Variable name Value range Purpose IgnoreFailure 0,1 if 1, ignore assertion failures IgnoreNote 0,1 if 1, ignore assertion notes IgnoreWarning 0,1 if 1, ignore assertion warnings IterationLimit positive integer limit on simulation kernel iterations during one time delta, default is 5000 ListDefaultIsTrigger 0,1 if 1, the default is for signals to trigger the list display, default is 1 ListDefaultShortName 0,1 1 corresponds to Short Name, and 0 to Full Name, default is 1 Nu
Tcl variables Variable name Value range Purpose UserTimeUnit fs, ps, ns, us, ms, sec, min, hr specifies the default units to use for the " []" argument to the run command (p361), default is "ns"; NOTE - the value of this variable must be set equal to, or larger than, the current simulator resolution - to determine the current time unit, invoke the report command (p354) with the "simulator control" option WaveSignalNameWidth 0, positive or negative integer when 0, VSIM display
Simulation time units User-defined variables User-defined variables are available with the Tcl set command. See the Tcl man pages (Main window: Help > Tcl Man Pages) for information on the set command. Like simulator variables, user-defined variables are preceded by a dollar sign when referenced.
abort abort The abort command halts the execution of a macro file interrupted by a breakpoint or error. When macros are nested, you may choose to abort the last macro only, abort a specified number of nesting levels, or abort all macros. The abort command may be used within a macro to return early. Syntax abort [ | all] Arguments | all An integer giving the number of nested macro levels to abort; all aborts all levels. Optional. Default is 1.
add button add button The add button command adds a user-defined button to the Main window button bar. New buttons are added to the right end of the bar. You can also add buttons with a ModelSim tool: "The Button Adder" (p230). Returns the path name of the button widget created. Syntax add button [Disable | NoDisable] [{option value...}] Arguments The label to appear on the face of the button. Required.
add button Examples add button pwd {transcribe pwd} NoDisable Creates a button labeled "pwd" that invokes the transcribe command (p377) with the pwd Tcl command, and echoes the command and its results to the Main window. The button remains active during a run. The pwd button example is available in the following DO file: / modeltech/examples/ addbutton.do. You can run the DO file to add the pwd button shown in the illustration, or modify the file for different results.
add list add list The add list command lists VHDL variables, and Verilog nets and registers, and their values in the List window. If no port mode is specified, all interface items and internal items are listed. Without arguments, the command displays the List window. The add list command also allows specification of user-defined buses.
add list -in For use with wild card searches. Specifies that the scope of the search is to include ports of mode IN if they match the item_name specification. Optional. -out For use with wild card searches. Specifies that the scope of the search is to include ports of mode OUT if they match the item_name specification. Optional. -inout For use with wild card searches. Specifies that the scope of the search is to include ports of mode INOUT if they match the item_name specification. Optional.
add list -width Specifies column width in characters. Optional. -label Specifies an alternative signal name to be displayed as a column heading in the listing. Optional. This alternative name is not valid in a force (p319) or examine (p313) command, however. It can optionally be used in a search and next command (p363) with the list option. Specifies the name of the item to be listed. Optional. Wildcard characters are allowed.
add list add list clk -not a b c d Lists clk, a, b, c, and d only when clk changes. add list -s 100 The list is updated every 100 time units. add list -not clk a b c d Lists clk, a, b, c, and d every 100 time units. add list -del Includes the iteration number in the listing. add list -hex {mybus {msb opcode(8 downto 1) data}} Creates a user-defined bus named "mybus" consisting of three signals; the bus is displayed in hex.
add_menu add_menu The add_menu command adds a menu to the menu bar of the specified window, using the specified menu name. The menu may be justified to the left or right side of the menu bar. Use the add_menuitem (p268), add_separator (p269), add_menucb (p266), and add_submenu (p270) commands to complete the menu. Returns the full Tk pathname of the new menu. Color and other Tk properties of the menu may be changed, after creating the menu, using the Tk menu widget configure command.
add_menu # # add_menu add_menuitem add_separator add_submenu add_menuitem add_menuitem add_submenu add_menucb WindowName ---------$wname $wname $wname $wname $wname $wname $wname $wname Menu MenuItem label Command ----------------------- ------mine mine "Do My Own Thing..." $cmd1 mine ;#---------------------------mine changeCase mine.changeCase "To Upper" $cmd2 mine.changeCase "To Lower" $cmd3 mine vars mine.
add_menucb add_menucb The add_menucb command creates a checkbox within the specified menu of the specified window. A checkbox is a small box with a label. Clicking on the box will toggle the state, from on to off or the reverse. When the box is "on", the Tcl global variable is set to . When the box is "off", the global variable is set to . Also, if something else changes the global variable, its current state is reflected in the state of the checkbox. Returns nothing.
add_menucb See also add_menu command (p264), add_menuitem command (p268), add_separator command (p269), add_submenu command (p270), and the change_menu_cmd command (p282) The add_menucb command is also used as part of the add_menu (p264) example.
add_menuitem add_menuitem The add_menuitem command creates a menu item within the specified menu of the specified window. May be used within a submenu. Returns nothing. Syntax add_menuitem [] Arguments Tk path of the window containing the menu. Required. Name of the Tk menu widget plus submenu path. Required. Text to be displayed. Required.
add_separator add_separator The add_separator command adds a separator as the next item in the specified menu path in the specified window. Returns nothing. Syntax add_separator Arguments Tk path of the window containing the menu. Required. Name of the Tk menu widget plus submenu path. Required.
add_submenu add_submenu The add_submenu command creates a cascading submenu within the specified menu_path of the specified window. May be used within a submenu. Returns the full Tk path to the new submenu widget. Syntax add_submenu [] Arguments Tk path of the window containing the menu. Required. Name of the Tk menu widget plus submenu path. Required. Name to be displayed on the submenu. Required.
add wave add wave The add wave command adds VHDL signals, and Verilog nets and registers to the Wave window. It also allows specification of user defined buses. Syntax add wave [-window ] [-expand ] [-expandall ] [[-recursive] [-in] [-out] [-inout] [-internal] [-ports] [-] [-] [-height ] [-color ] [-offset ] [-scale ] [-label ] [ | { [-flatten] { sig1 sig2 sig3 ... } }] ... ] ...
add wave -inout For use with wild card searches. Specifies that the scope of the search is to include ports of mode INOUT if they match the item_name specification. Optional. -internal For use with wild card searches. Specifies that the scope of the search is to include internal items if they match the item_name specification. Optional. -ports For use with wild card searches. Specifies that the scope of the listing is to include ports of modes IN, OUT, or INOUT. Optional.
add wave before moving to the new time. See "Editing and formatting HDL items in the Wave window" (p178). -height Specifies the height (in pixels) of the waveform. Optional. -color Specifies the color used to display a waveform. Optional. These are the standard X Window color names, or rgb value (e.g., #357f77); enclose 2-word names (“light blue”) in quotes. -offset Modifies an analog waveform’s position on the display. Optional.
add wave { [-flatten] { sig1 sig2 sig3 ... } } Creates a user-defined bus in place of ; ‘sigi’ are signals to be concatenated within the user-defined bus. Optional. The following option is available: -flatten Creates an array signal that cannot be expanded to show waveforms of individual elements. Gives greater flexibility in the types of elements that can be combined, but loses the original element names.
alias alias The alias command creates a new Tcl procedure that evaluates the specified commands. Used to create a user-defined alias. Any arguments passed on invocation of the alias will be passed through to the specified commands. Returns nothing. Syntax alias "" Arguments Specifies the new procedure name to be used when invoking the commands. Required. Specifies the command or commands to be evaluated when the alias is invoked. Required. Examples alias myquit "write list .
batch_mode batch_mode The batch_mode command returns a 1 if VSIM is operating in batch mode, otherwise returns a 0. It is typically used as a condition in an if statement. Examples Some GUI commands do not exist in batch mode. If you want to write a script that will work in or out of batch mode you can also use the batch_mode command to determine which command to use.
bd bd The bd command deletes a breakpoint. Syntax bd Arguments Specifies the name of the source file in which the breakpoint is to be deleted. Required. The filename must match the one used to previously set the breakpoint, including whether a full pathname or a relative name was used. Specifies the line number of the breakpoint to be deleted. Required. Examples bd alu.vhd 127 Deletes the breakpoint at line 127 in the source file named alu.vhd.
bp bp The bp or breakpoint command sets a breakpoint. If the source file name and line number are omitted, or the -query option is used, this command lists all the breakpoints that are currently set. Otherwise, the command sets a breakpoint in the specified file at the specified line. Once set, the breakpoint affects every instance in the design. Syntax bp [-query] [ [{ ...}]] Arguments -query Returns a list of the currently set breakpoints. Optional.
bp Examples bp Lists all existing breakpoints in the design, together with the source file names and any commands that have been assigned to breakpoints. bp -query testadd.vhd Lists the line number of all breakpoints in testadd.vhd. bp alu.vhd 147 Sets a breakpoint in the source file alu.vhd at line 147. bp alu.vhd 147 {do macro.do} Executes the macro.do macro file after the breakpoint. bp test.vhd 22 {echo [exa var1]; echo [exa var2]} Sets a breakpoint at line 22 of the file test.
cd cd The Tcl cd command changes the VSIM local directory to the specified directory. See the Tcl man pages (Main window: Help > Tcl Man Pages) for any cd command options. Returns nothing. Syntax cd
Description After you change the directory with cd, VSIM continues to write the vsim.wav file in the directory where the first add wave (p271), add list (p260) or log (p325) command was executed.change change The change command modifies the value of a VHDL variable or Verilog register variable. The simulator must be at a breakpoint or paused after a step command (p371) to change a VHDL variable. Syntax change Arguments Specifies the name of a variable. Required. The variable name must specify a scalar type or a one-dimensional array of character enumeration.
change_menu_cmd change_menu_cmd The change_menu_cmd command changes the command to be executed for a specified menu item label, in the specified menu, in the specified window. The menu_path and label must already exist for this command to function. Returns nothing. Syntax change_menu_cmd
check contention add check contention add The check contention add command enables contention checking for the specified nodes. The allowed nodes are Verilog nets and VHDL signals of std_logic and std_logic_vector. Any other node types and nodes that don't have multiple drivers are silently ignored by the command. Syntax check contention add [-r] [-in] [-out] [-inout] [-internal] [-ports] ... Arguments -r Specifies that contention checking is enabled recursively into subregions.
check contention config check contention config The check contention config command allow you to write checking messages to a file (default displays the message on your screen). You may also configure the contention time limit. Syntax check contention config [-file ] [-time ] Arguments -file Specifies a file to write contention messages to. Optional. If this option is selected, the messages are not displayed to the screen.
check contention off check contention off The check contention off command disables contention checking for the specified nodes. Syntax check contention off [-all] [-r] [-in] [-out] [-inout] [-internal] [-ports] ... Arguments -all Disables contention checking for all nodes that have checking enabled. Optional. -r Specifies that contention checking is disabled recursively into subregions. Optional; if omitted, contention check disabling is limited to the current region.
check float add check float add The check float add command enables float checking for the specified nodes. The allowed nodes are Verilog nets and VHDL signals of type std_logic and std_logic_vector (other types are silently ignored). Syntax check float add [-r] [-in] [-out] [-inout] [-internal] [-ports] ... Arguments -r Specifies that float checking is enabled recursively into subregions. Optional; if omitted, float check enabling is limited to the current region.
check float config check float config The check float config command allows you to write checking messages to a file (default displays the message on your screen). You may also configure the float time limit. Syntax check float config [-file ] [-time ] Arguments -file Specifies a file to write float messages to. Optional. If this option is selected, the messages are not displayed to the screen. -time Specifies a time limit that a node may be floating. Optional.
check float off check float off The check float off command disables float checking for the specified nodes. Syntax check float off [-all] [-r] [-in] [-out] [-inout] [-internal] [-ports] ... Arguments -all Disables float checking for all nodes that have checking enabled. Optional. -r Specifies that float checking is disabled recursively into subregions. Optional; if omitted, float check disabling is limited to the current region. -in Disables checking on nodes of mode IN. Optional.
check stable on check stable on The check stable on command enables stability checking on the entire design. Design stability checking detects when circuit activity has not settled within a user-defined period for synchronous designs. Syntax check stable on [-file ] [-period
check stable off check stable off The check stable off command disables stability checking. You may later enable it with check stable on (p289), and meanwhile, the clock cycle numbers and boundaries are still tracked. See the check stable on command (p289). Syntax check stable off Arguments None.
checkpoint checkpoint The checkpoint command saves the state of your simulation. The checkpoint command saves the simulation kernel state, the vsim.wav file, the list of the HDL items shown in the List and Wave windows, the file pointer positions for files opened under VHDL and the Verilog $fopen system task, and the states of foreign architectures.
configure configure The configure (config) command invokes the List or Wave widget configure command for the current default List or Wave window. To change the default window, use the view command (p388). Returns the values of all attributes if no options, or the value of one attribute when one option and no value. Syntax configure list|wave [-window ] [
configure Arguments, List window only -delta [all | collapse | none] The all option displays a new line for each time step on which items change, collapse displays the final value for each time unit, and none turns off the display of the delta column. To use -delta, -usesignaltriggers must be set to 1 (on). Optional. -gateduration The duration for gating to remain open expressed in x number of default timescale units.
configure -gridcolor Specifies the background grid color; the default is grey50. Optional.
configure # # # # # # # # # # # # {-busycursor busycursor BusyCursor watch watch} {-delta delta Delta all all} { -timeunits timeunits TimeUnits {} ns } {-fastload fastload FastLoad 0 0} {-fastscroll fastscroll FastScroll 0 0} {-foreground foreground Foreground black Black} {-fg foreground} {-fixwidth fixwidth Width 52 130} {-fixoffset fixoffset Offset 0 0} {-font font Font *courier-medium-r-normal-*-12-* -adobe-courier-medium-rnormal--12-*-*-*-*-*} {-h height} {-height height Height 15 187} {-highlightcol
configure config list -strobeperiod Displays the current value of the strobeperiod attribute. config list -strobeperiod {50 ns} -strobestart 0 -usestrobe 1 Sets the strobe waveform and turns it on. config wave -vectorcolor blue Sets the wave vector color to blue.
delete delete The delete command removes HDL items from either the List or Wave window. Syntax delete list | wave [-window ] ... Arguments list | wave Specifies the target window for the delete command. Required. -window Specifies the name of the List or Wave window to target for the delete command (the view command (p388) allows you to create more than one List or Wave window). Optional.
describe describe The describe command displays information about the specified HDL item. The description is displayed in the Main window (p116). The following kinds of items can be described: • VHDL signals, variables, and constants • Verilog nets and registers All but VHDL variables and constants may be specified as hierarchical names.
disablebp disablebp The disablebp command temporarily turns off all existing breakpoints. To turn the breakpoints back on again, use the enablebp command (p309). Syntax disablebp Arguments None.
disable_menu disable_menu The disable_menu command disables the specified menu within the specified window. The disabled menu will become grayed-out, and nonresponsive. Returns nothing. Syntax disable_menu Arguments Tk path of the window containing the menu. Required. Note that the path for the Main window may be expressed as main or "". All other window pathnames begin with a period (.) as shown in the example below. Name of the Tk menu-widget path.
disable_menuitem disable_menuitem The disable_menuitem command disables a specified menu item within the specified menu_path of the specified window. The menu item will become grayed-out, and nonresponsive. Returns nothing. Syntax disable_menuitem
do do The do command executes commands contained in a macro file. A macro file can have any name and extension. An error encountered during the execution of a macro file causes its execution to be interrupted, unless an onerror command (p339) has specified the resume command (p358). Syntax do [ ...] Arguments Specifies the name of the macro file to be executed. Required. The name can be a pathname or a relative file name.
do Using other VSIM commands with macros If you are executing a macro (DO file) when your simulation hits a breakpoint or causes a run-time error, VSIM interrupts the macro and returns control to the command line, where the following commands may be useful. (Any other legal command may be executed as well.
down | up down | up The down | up command searches for signal transitions or values in the specified List window. It executes the search on signals currently selected in the window, starting at the time of the active cursor. A condition to search for may also be identified by an expression using the -expr command option. The active cursor moves to the found location.
down | up the selected signal is displayed. Case is ignored, but otherwise must be an exact string match -- don't-care bits are not yet implemented. Specifies to find the nth match. Optional. If less than n are found, the number found is returned with a warning message, and the marker is positioned at the last match. Examples Returns 1 if a match is found, 0 if not. If the nth match is requested and only m are found, m < n, then it returns m.
drivers drivers The drivers command displays in the Main window the current value and scheduled future values for all the drivers of a specified VHDL signal or Verilog net. The driver list is expressed relative to the top most design signal/net connected to the specified signal/net. If the signal/net is a record or array, each subelement is displayed individually. This command reveals the operation of transport and inertial delays and assists in debugging models. Syntax drivers ...
echo echo The echo command displays a specified message in the VSIM Main window. Syntax echo Arguments Specifies the message text to be displayed. Required. If the text string is surrounded by quotes, blank spaces are displayed as entered. If quotes are omitted, two or more adjacent blank spaces are compressed into one space. Examples echo “The time is $now ns.” If the current time is 1000 ns, this command produces the message: The time is 1000 ns.
edit edit The edit command invokes the editor specified by the EDITOR environment variable. Syntax edit [] Arguments Specifies the name of the file to edit. Optional. If the is omitted, the editor opens the current source file.
enablebp enablebp The enablebp command turns on all breakpoints turned off by the disablebp command (p299). Syntax enablebp Arguments None.
enable_menu enable_menu The enable_menu command enables a previously-disabled menu. The menu will be changed from grayed-out to normal, and will become responsive. Returns nothing. Syntax enable_menu Arguments Tk path of the window containing the menu. Required. Note that the path for the Main window may be expressed as main or "". All other window pathnames begin with a period (.) as shown in the example below. Name of the Tk menu-widget path.
enable_menuitem enable_menuitem The enable_menuitem command enables a previously-disabled menu item. The menu item will be changed from grayed-out to normal, and will become responsive. Returns nothing. Syntax enable_menuitem Arguments Tk path of the window containing the menu. Required. Note that the path for the Main window may be expressed as main or "". All other window pathnames begin with a period (.) as shown in the example below.
environment environment The environment, or env command, allows you to display or change the current region/signal environment. Syntax environment [] Arguments Specifies the pathname to which the current region/signal environment is to be changed. Optional; if omitted, the command causes the pathname of the current region/signal environment to be displayed. Multiple levels of a pathname must be separated by the character specified in the PathSeparator variable (p254).
examine examine The examine, or exa command, examines one or more HDL items, and displays current values (or the values at a specified previous time) in the Main window (p116). It optionally can compute the value of an expression of one or more items.
examine An expression to be evaluated. Optional. If the -time argument is present, the expression will be evaluated at the specified time, otherwise it will be evaluated at the current simulation time. See "GUI_expression_format" (p236) for the format of the expression. The expression must be placed within curly braces. The expression argument to the examine statement can only involve signals that have been logged in the List window.
examine examine -expr {clk’event && (/top/xyz == 16’hffae)} Because -time is not specified, this expression will be evaluated at the current simulation time. Note the signal attribute and array constant specified in the expression. Commands like find (p317) and examine return their results as a Tcl list (just a blank-separated list of strings). You can do things like: foreach sig [find ABC*] {echo "Signal $sig is [exa $sig]" ...} if {[examine -bin signal_12] == “11101111XXXZ”} {...
exit The exit command exits the simulator and the ModelSim application. Syntax exit [-force] Argument -force Quits without asking for confirmation. Optional; if this argument is omitted, ModelSim asks you for confirmation before exiting.
find find The find command displays the full pathnames of all HDL items in the design whose names match the name specification you provide. If no port mode is specified, all interface items and internal items are found (that is, all items of modes IN, OUT, INOUT, and INTERNAL). Syntax find [-recursive] [-in] [-out] [-inout] [-internal] [-ports] ... Arguments -recursive Specifies that the scope of the search is to descend recursively into subregions.
find Examples find -r /* Finds all items in the entire design. find * Displays the names of all items in the current region. Additional search options To search for HDL items within a specific display window, use the search and next (p363) or the menu sequence: Edit > Find ....
force force The force command allows you to apply stimulus to VHDL signals and Verilog nets interactively. Since force commands (like all VSIM commands) can be included in a macro file, it is possible to create complex sequences of stimuli. Syntax force [-freeze | -drive | -deposit] [-repeat ] [] [, ...] Arguments -freeze Freezes the item at the specified value until it is forced again or until it is unforced with a noforce command (p332). Optional.
force name. The item name must specify a scalar type or a one-dimensional array of character enumeration. You may also specify a record subelement, an indexed array, or a sliced array, as long as the type is one of the above. Required. Specifies the value that the item is forced to. The specified value must be appropriate for the type. Required.
force Examples force input1 0 Forces input1 to 0 at the current simulator time. force bus1 01XZ 100 ns Forces bus1 to 01XZ at 100 nanoseconds after the current simulator time. force bus1 16#f @200 Forces bus1 to 16#F at the absolute time 200 measured in the resolution units selected at simulation start-up. force input1 1 10, 0 20 -r 100 Forces input1 to 1 at 10 time units after the current simulator time and to 0 at 20 time units after the current simulation time.
getactivecursortime getactivecursortime The getactivecursortime gets the time of the active cursor in the Wave window. Returns the time value. Syntax getactivecursortime [-window ] Arguments -window Use this option to specify an instance of the Wave window that is not the default. Otherwise, the default Wave window is used. Optional. Use the view command (p388) to change the default window.
getactivemarkertime getactivemarkertime The getactivemarkertime command gets the time of the active marker in the List window. Returns the time value. If -delta is specified, returns time and delta. Syntax getactivemarkertime [-window ] [-delta] Arguments -window Use this option to specify an instance of the List window that is not the default. Otherwise, the default List window is used. Optional. Use the view command (p388) to change the default window.
lecho lecho The lecho command takes one or more Tcl lists as arguments and pretty-prints them to the Transcript window. Returns nothing. Syntax lecho ... Arguments ... Any Tcl list created by a VSIM command or user procedure. Examples lecho [configure wave] Prints the Wave window configuration list to the Transcript window.
log log The log command creates a log file containing simulation data for all HDL items whose names match the provided specifications. Items (VHDL variables, and Verilog nets and registers) that are displayed using the add list (p260) and add wave (p271) commands are automatically recorded in the log file. If no port mode is specified, the log file contains data for all items in the selected region whose names match the item name specification.
log -internal Specifies that the log file is to include data for internal items whose names match the specification. Optional. -howmany Returns an integer indicating the number of signals found. Optional. Specifies the item name which you want to log. Required. Multiple item names may be specified. Wildcard characters are allowed. Examples log -r /* Logs all items in the design. log -out * Logs all output ports in the current design unit.
lshift lshift The lshift command takes a Tcl list as argument and shifts it in-place one place to the left, eliminating the 0th element. The number of shift places may also be specified. Returns nothing. Syntax lshift [] Arguments Specifies the Tcl list to target with lshift. Required. Specifies more than one place to shift. Optional. Default is 1. Examples proc myfunc args { # throws away the first two arguments lshift args 2 ...
lsublist lsublist The lsublist command returns a sublist of the specified Tcl list that matches the specified Tcl glob pattern. Syntax lsublist Arguments Specifies the Tcl list to target with lsublist. Required. Specifies the pattern to match within the using Tcl glob-style matching. Required. Examples In the example below, variable ‘t’ returns "structure signals source".
macro_option macro_option This command is available for UNIX only. The macro_option command controls the speed and delay of macro (DO file) playback, plus the level of debugging feedback. If invoked without any options macro_option returns all current settings; returns a specific setting if invoked with an option and no argument. Syntax macro_option [speed [fast | demo]| delay [ | debug []] Arguments speed fast | demo Set the macro playback speed to fast or demo. Optional.
.main clear .main clear The .main clear command clears the Main window (p116) transcript. The behavior is the same as the Main window File > Clear Transcript menu selection. Syntax .main clear Arguments None.
next next See "search and next" (p363) for information on the next command.
noforce noforce The noforce command removes the effect of any active force (p319) commands on the selected HDL items. The noforce command also causes the item’s value to be re-evaluated. Syntax noforce ... Arguments Specifies the name of a item. Required. Must match the item name used in the force command (p319). Multiple item names may be specified. Wildcard characters are allowed.
nolog nolog The nolog command suspends writing of data to the log file for the specified signals. A flag is written into the log file for each signal turned off, and the gui displays question marks for the signal until logging (for the signal) is turned back on. Logging can be turned back on by issuing another log command (p325) or by doing a nolog -reset.
nolog -ports Specifies that the scope of the search is to exclude all port. Optional. -internal Specifies that the log file is to exclude data for internal items whose names match the specification. Optional. -howmany Returns an integer indicating the number of signals found. Optional. Specifies the item name which you want to unlog. Required. Multiple item names may be specified. Wildcard characters are allowed. Examples nolog -r /* Unlogs all items in the design.
notepad notepad The notepad is a simple text editor. It may be used to view and edit ascii files or create new files. When a file is specified on the command line, the editor will initially come up in read-only mode. This mode can be changed from the Notepad Edit menu. See "Editing the command line, the current source file, and notepads" (p125) for a list of editing shortcuts. Returns nothing. Syntax notepad [-r | -edit] Arguments Name of the file to be displayed.
nowhen nowhen The nowhen command deactivates selected when (p398) commands. Syntax nowhen [] Arguments Used to identify individual when commands. Optional. Examples when -label 99 b {echo “b changed”} … nowhen 99 This nowhen command deactivates the when (p398) command labeled 99. nowhen * This nowhen command deactivates all when (p398) commands.
onbreak onbreak The onbreak command is used within a macro; it specifies a command to be executed when running a macro that encounters a breakpoint in the source code. Using the onbreak command without arguments will return the current onbreak command string. Use an empty string to change the onbreak command back to its default behavior (i.e., onbreak ""). In that case, the macro will be interrupted after a breakpoint occurs (after any associated bp command (p278) string is executed).
onElabError onElabError The onElabError command specifies one or more commands to be executed when an error is encountered during elaboration. The command is used by placing it within the modelsim.tcl file or a macro. During initial design load onElabError may be invoked from within the modelsim.tcl file; during a simulation restart onElabError may be invoked from a macro. Use the onElabError command without arguments to return to a prompt. Syntax onElabError { [ [; ] ...
onerror onerror The onerror command is used within a macro; it specifies one or more commands to be executed when a running macro encounters an error. Using the onerror command without arguments will return the current onerror command string. Use an empty string to change the onerror command back to its default behavior (i.e., onbreak ""). Use onerror with a resume command (p358) to allow an error message to be printed without halting the execution of the macro file.
pause pause The pause command placed within a macro interrupts the execution of that macro. Syntax pause Arguments None. Description When you execute a macro and that macro gets interrupted, the prompt will change to: VSIM (pause)7> This “pause” prompt reminds you that a macro has been interrupted. When a macro is paused, you may invoke another macro, and if that one gets interrupted, you may even invoke another — up to a nesting level of 50 macros.
play play This command is available for UNIX only. The play command replays a sequence of keyboard and mouse actions, which were previously saved to a file with the record command (p353). Returns nothing. Note: Play returns immediately; the playback proceeds in the background. Caution must be used when putting play commands in do (macro) files. Syntax play Arguments Specifies the recorded file to replay. Required.
power add power add The power add command is used prior to the power report command (p343). Data produced by these commands can be translated (by a Synopsys utility) to drive the Synopsys power analysis tools. This command specifies the signals or nets to track for power information. Returns nothing. Syntax power add [-in] [-out] [-internal] [-ports] [-r] ... Arguments -in Select only inputs. Optional. -out Select only outputs. Optional. -ports Select only design ports. Optional.
power report power report The power report command is used subsequent to the power add command (p342). Data produced by these commands can be translated (by a Synopsys utility) to drive the Synopsys power analysis tools. This command writes out the power information for the specified signals or nets. The report can be written to a file or to the Transcript window. Returns nothing. Syntax power report [-all] [-noheader] [-file ] Arguments -all Writes information on all items logged. Optional.
power reset power reset The power reset command selectively resets power information to zero for the signals or nets specified with the power add command (p342). Returns nothing. Syntax power reset [-in] [-out] [-internal] [-ports] [-r] Arguments -in Reset only inputs. Optional. -out Reset only outputs. Optional. -ports Reset only design ports. Optional. -internal Reset only design internal signals or nets. Optional. -r Do the wildcard search recursively. Optional. ...
printenv printenv The printenv command echoes to the Transcript window the current names and values of all environment variables. If variable names are given as arguments, prints only the names and values of the specified variables. Returns nothing. All results go to the Transcript window. Syntax printenv [...] Arguments ... Specifies the name(s) of the environment variable to print. Optional.
property list property list The property list command changes one or more properties of the specified signal, net or register in the List window (p131). The properties correspond to those than can be specified using the List window Prop > Display Props menu selection. At least one argument must be used.
property wave property wave The property wave command changes one or more properties of the specified signal, net or register in the Wave window (p168). The properties correspond to those than can be specified using the Wave window Prop > Display Props menu selection. At least one argument must be used.
property wave -radix The can be expressed as: Symbolic, Bin, Oct, Dec or Hex. Choosing symbolic means that item values are not translated. Optional. -scale Specifies the waveform scale relative to the unscaled size value of 1. Valid only when format is specified as analog. Optional. Specifies a name or wildcard pattern to match the full path names of the signals, nets or registers for which you are defining the property change. Required.
pwd pwd The Tcl pwd command displays the current directory path in the Main transcript window. Returns nothing. Syntax pwd Arguments None.
quietly quietly The quietly command turns off transcript echoing for the specified command. Syntax quietly Arguments Specifies the command for which to disable transcript echoing. Required. Any results normally echoed by the specified command will not be written to the Main window transcript. To disable echoing for all commands use the transcript command (p378) with the -quietly option.
quit quit The quit command exits the simulator. Syntax quit [-force] [-sim] Arguments -force Quits without asking for confirmation. Optional; if this argument is omitted, VSIM asks you for confirmation before exiting. -sim Unloads the current design in the simulator without exiting ModelSim. All files opened by the simulation will be closed including the log file (vsim.wav).
radix radix The radix command specifies the default radix to be used. The command can be used at any time. The specified radix is used for all commands (force (p319), examine (p313), change (p281), etc.) as well as for displayed values in the Signals, Variables, Dataflow, List, and Wave windows. Syntax radix [-symbolic | -binary | -octal | -decimal | -hexadecimal | -unsigned | -ascii] Arguments Any unique abbreviation may be used. Optional. Also, -signed may be used as an alias for -decimal.
record record This command is available for UNIX only. The record command starts recording a replayable trace of all keyboard and mouse actions. Record and play operations may also be run from the macro-helper menu item of the macro menu. Returns nothing. Syntax record [] Arguments Specifies the file for the saved recording. If is not specified, the recording terminates.
report report The report command displays the value of all simulator control variables, or the value of any simulator state variables relevant to the current simulation. Syntax report simulator control | simulator state Arguments simulator control Displays the current values for all simulator control variables. simulator state Displays the simulator state variables relevant to the current simulation. Examples report simulator control Displays all simulator control variables.
report report simulator state Displays all simulator state variables. Only the variables that relate to the design being simulated are displayed: # now = 0.
restart restart The restart command reloads the design elements and resets the simulation time to zero. Only design elements that have changed are reloaded. Syntax restart [-force] [-nobreakpoint] [-nolist] [-nolog] [-nowave] Arguments -force Specifies that the simulation will be restarted without requiring confirmation in a popup window. Optional (unless being used in a macro file). -nobreakpoint Specifies that all breakpoints will be removed when the simulation is restarted. Optional.
restore restore The restore command restores the state of a simulation that was saved with a checkpoint command (p291) during the current invocation of VSIM, this we call a "warm restore". The items restored are: simulation kernel state, vsim.wav file, HDL items listed in the List and Wave windows, file pointer positions for files opened under VHDL and under Verilog $fopen, and the saved state of foreign architectures. If you want to restore while running VSIM, use this command.
resume resume The resume command is used to resume execution of a macro file after a pause command (p340) , or a breakpoint. It may be input manually or placed in an onbreak (p337) command string. (Placing a resume command in a bp (p278) command string does not have this effect.) The resume command can also be used in an onerror (p339) command string to allow an error message to be printed without halting the execution of the macro file. Syntax resume Arguments None.
right | left right | left The right | left command searches right (next) or left (previous) for signal transitions or values in the specified Wave window. It executes the search on signals currently selected in the window, starting at the time of the active cursor. A condition to search for may also be identified by an expression using the -expr command option. The active cursor moves to the found location.
right | left -value Specify a value of the signal to match. Must be specified in the same radix that the selected waveform is displayed. Case is ignored, but otherwise must be an exact string match -don't-care bits are not yet implemented. Only one signal may be selected, but that signal may be an array. Optional. Specifies to find the nth match. If less than n are found, the number found is returned with a warning message, and the cursor is positioned at the last match. Optional.
run run The run command advances the simulation by the specified number of timesteps. Syntax run [ []| -all | -continue | -next | -step | -stepover] Arguments [] Specifies the number of timesteps for the simulation to run. The number may be fractional. Optional.
run Examples run 1000 Advances the simulator 1000 timesteps. run 10.4 ms Advances the simulator the appropriate number of timesteps corresponding to 10.4 milliseconds. run @8000 Advances the simulator to timestep 8000.
search and next search and next The search and next commands search the specified window for one or more items matching the specified pattern(s). The search starts at the item currently selected, if any; otherwise starts at the window top. Default action is to search downward until the first match, then move the selection to the item found, and return the index of the item found. The search can be continued using the next command. Returns the index of a single match, or list of matching indices.
search and next -field Selects different fields to test, depending on the window type: Window n=1 n=2 n=3 default structure instance ent/mod [arch] instance signals name - cur. value name process status label fullpath fullpath variables name - cur. value name wave name - cur. value name list label fullname - label Default behavior for the List window is to attempt to match the label and if that fails, try to match the full signal name.
search and next Description With the -all option, the entire window is searched, the last item matching the pattern is selected, and a Tcl list of all corresponding indices is returned. With the -toggle option, items found are selected in addition to the current selection. For the List window, the search is done on the names of the items listed, that is, across the header. To search for values of signals in the List window, use the down | up command (p304).
seetime seetime The seetime command scrolls the List or Wave window to make the specified time visible. For the List window, a delta can be optionally specified as well. Returns: nothing Syntax seetime list|wave [-window ] [-select] [-delta ] Arguments list|wave Specifies the target window type. Required. -window Use this option to specify an instance of the Wave or List window that is not the default. Optional. Otherwise, the default wave or List window is used.
shift shift The shift command shifts macro parameter values down one place, so that the value of parameter $2 is assigned to parameter $1, the value of parameter $3 is assigned to $2, etc. The previous value of $1 is discarded. The shift command and macro parameters are used in macro files. If a macro file requires more than nine parameters, they can accessed using the shift command. To determine the current number of macro parameters, use the argc variable (p252) . Syntax shift Arguments None.
show show The show command lists HDL items and subregions visible from the current environment. The items listed include: • VHDL signals, and instances • Verilog nets, registers, tasks, functions, instances and memories The show command returns its results as a formatted Tcl string; to eliminate formatting, use the Show command. Syntax show [-all] [] Arguments -all Display all names at and below the specified path recursively. Optional.
splitio splitio The splitio command operates on a VHDL inout or out port to create a new signal having the same name as the port suffixed with "__o". The new signal mirrors the output driving contribution of the port. Syntax splitio [-outalso | -outonly] [-r] ... Arguments -outalso Allows splitio to work on out ports as well as inout ports. Optional. -outonly Allows splitio to work only on out ports. Optional. -r Specifies that the port selection occurs recursively into subregions.
status status The status command lists all current interrupted macros. The listing shows the name of the interrupted macro, the line number at which it was interrupted, and prints the command itself. It also displays any onbreak (p337) or onerror (p339) commands that have been defined for each interrupted macro. Syntax status Arguments None. Examples The transcript below contains examples of resume (p358), and status commands. VSIM (pause) 4> status # Macro resume_test.
step step The step command steps to the next HDL statement. Current values of local variables may be observed at this time using the variables window. VHDL procedures, functions and Verilog tasks can optionally be skipped over . When a wait statement or end of process is encountered, time advances to the next scheduled activity. The Process and Source windows will then be updated to reflect the next activity.
stop stop The stop command is used with the when command (p398) to stop simulation in batch files. The stop command has the same effect as hitting a breakpoint. The stop command may be placed anywhere within the body of the when command. Syntax stop Arguments None. Note: Use the run command (p361) with the -continue option to continue the simulation run, or the resume command (p358) to continue macro execution.
tb tb The tb (traceback) command displays a stack trace for the current process in the Transcript window. This lists the sequence of HDL function calls that have been entered to arrive at the current state for the active process. Syntax tb Arguments None.
toggle add toggle add The toggle add command enables collection of toggle statistics for the specified nodes. The allowed nodes are Verilog nets and VHDL signals of type bit, bit_vector, std_logic, and std_logic_vector (other types are silently ignored). Syntax toggle add [-r] [-in] [-out] [-inout] [-internal] [-ports] ... Arguments -r Specifies that toggle statistic collection is enabled recursively into subregions.
toggle reset toggle reset The toggle reset command resets the toggle counts to zero for the specified nodes. Syntax toggle reset [-all] [-r] [-in] [-out] [-inout] [-internal] [-ports] ... Arguments -all Resets toggle statistic collection for all nodes that have toggle checking enabled. Optional. -r Specifies that toggle statistic collection is reset recursively into subregions. Optional; if omitted, the reset is limited to the current region.
toggle report toggle report By default the toggle report command displays to the screen a list of all nodes that have not transitioned to both 0 and 1 at least once. Also displayed is a summary of the number of nodes checked, the number that toggled, the number that didn't toggle, and a percentage that toggled. Syntax toggle report [-file ] [-summary] [-all] Arguments -file Specifies a file to write the report to. If this option is selected, the report is not displayed to the screen.
transcribe transcribe The transcribe command displays a command in the Main window, then executes the command. Transcribe directs commands to the Main window transcript from an external event such as a menu pick or button selection, it may not be used from the command line or a macro. The add button (p258) and add_menuitem (p268) commands can utilize transcribe. Returns nothing. Syntax transcribe Arguments Specifies the command to execute. Required.
transcript transcript The transcript command controls echoing of commands executed in a macro file; also works at top level in batch mode. If no option is specified, the current setting is reported. Syntax transcript [on | off | -q | quietly] Arguments on Specifies that commands in a macro file will be echoed to the Transcript window as they are executed. Optional. off Specifies that commands in a macro file will not be echoed to the Transcript window as they are executed. Optional.
vcd add vcd add The vcd add command adds the specified items to the VCD file. The allowed items are Verilog nets and variables and VHDL signals of type bit, bit_vector, std_logic, and std_logic_vector (other types are silently ignored). All vcd add commands must be executed at the same simulation time. The specified items are added to the VCD header and their subsequent value changes are recorded in the VCD file.
vcd checkpoint vcd checkpoint The vcd checkpoint command dumps the current values of all VCD variables to the VCD file. While simulating, only value changes are dumped. Related Verilog task: $dumpall Syntax vcd checkpoint Arguments None. See also See "Value Change Dump (VCD) Files" (p491) for more information on VCD files.
vcd comment vcd comment The vcd comment command inserts the specified comment in the VCD file. Syntax vcd comment Arguments Comment to be included in the VCD file. Required. Must be quoted by double quotation marks or curly brackets. See also See "Value Change Dump (VCD) Files" (p491) for more information on VCD files.
vcd file vcd file The vcd file command specifies the filename and state mapping for the VCD file created by a vcd add command (p379). The vcd file command is optional. If used, it must be issued before any vcd add commands. Related Verilog task: $dumpfile Syntax vcd file [] [-nomap] [-map ] [-direction] [-dumpports] Arguments Specifies the name of the VCD file that is created (the default is dump.vcd). Optional. -nomap Affects only VHDL signals of type std_logic.
vcd file Note that the quotes in the example above are a Tcl convention for command strings that include spaces. -direction Affects only VHDL ports. Optional.
vcd flush vcd flush The vcd flush command flushes the contents of the VCD file buffer to the VCD file. Related Verilog task: $dumpflush Syntax vcd flush Arguments None. See also See "Value Change Dump (VCD) Files" (p491) for more information on VCD files. Verilog tasks are documented in the IEEE 1364 standard.
vcd limit vcd limit The vcd limit command specifies the maximum size of the VCD file (by default, limited to available disk space). When the size of the file exceeds the limit, a comment is appended to the file and VCD dumping is disabled. Related Verilog task: $dumplimit Syntax vcd limit Arguments Specifies the maximum VCD file size in bytes. Required. See also See "Value Change Dump (VCD) Files" (p491) for more information on VCD files.
vcd off vcd off The vcd off command turns off VCD dumping and records all VCD variable values as x. Related Verilog task: $dumpoff Syntax vcd off Arguments None. See also See "Value Change Dump (VCD) Files" (p491) for more information on VCD files. Verilog tasks are documented in the IEEE 1364 standard.
vcd on vcd on The vcd on command turns on VCD dumping and records the current values of all VCD variables. By default, vcd on is automatically performed at the end of the simulation time that the vcd add (p379) commands are performed. Related Verilog task: $dumpon Syntax vcd on Arguments None. See also See "Value Change Dump (VCD) Files" (p491) for more information on VCD files. Verilog system tasks are documented in the IEEE 1364 standard.
view view The view command will open a ModelSim window and bring that window to the front of the display. If multiple instances of a window exist, view will change the default window of that type to the specified window. Using the -new option, view will create an additional instance of the specified window type and set it to be the default window for that type.
view -new Creates a new instance of the window type specified with the option. New window names are created by appending an integer to the window type, starting with 1, then incrementing the integer. ... Specifies the ModelSim window type to view. Multiple window types may be used; at least one type (or wildcard) is required.
vmap vmap The vmap command (identical to the ModelSim vmap command (p89), but invoked within VSIM) defines a mapping between a logical library name and a directory by modifying the modelsim.ini file. With no arguments, reads the appropriate modelsim.ini file(s) and prints the current VHDL logical library to physical directory mappings. Returns nothing. Syntax vmap [-del] [] [] Arguments -del Deletes the mapping specified by from the current project file. Optional.
vcom vcom The vcom command compiles VHDL design units. The syntax and arguments for this command are identical to those for the vcom command (p71) that is invoked from the UNIX command line prior to simulation. Returns nothing. Syntax and Arguments See the vcom command (p71) for syntax and arguments.
vlog vlog The vlog command compiles Verilog design units. The syntax and arguments for this command are identical to those for the vlog command (p83) that is invoked from the UNIX command line prior to simulation. Returns nothing. Syntax and Arguments See the vlog command (p83) for syntax and arguments.
vsim vsim The vsim command loads a new design into the simulator. The syntax and arguments for this command are identical to those for the ModelSim vsim command (p91) with one exception, the -c option is not supported. With no options, vsim brings up the Startup dialog box, allowing you to specify the design and options; the Startup dialog box will not be presented if you specify any options. Returns nothing. Syntax and Arguments See the vsim command (p91) for syntax and arguments.
vsim vsim The vsim commands return information about the current VSIM executable. vsimDate Returns the date the executable was built, such as "Apr 10 1997". vsimId Returns the identifying string, such as "ModelSim 5.1". vsimVersion Returns the version as used by the licensing tools, such as "1997.04".
vsource vsource The vsource command displays an HDL source file in the VSIM Source window. This command is used in order to set a breakpoint in a file other than the one currently displayed in the Source window (p156). Syntax vsource [] Arguments Specifies a relative or full pathname. Optional. If filename is omitted the source file for the current design context is displayed. Examples vsource design.vhd vsource /old/design.
.wave.tree zoomfull .wave.tree zoomfull The .wave.tree zoomfull command redraws the display to show the entire simulation from time 0 to the current simulation time. The behavior is the same as Wave window (p168) Zoom > Zoom Full menu selection. Syntax .wave.tree zoomfull Arguments None.
.wave.tree zoomrange .wave.tree zoomrange The .wave.tree zoomrange command allows you to enter the beginning and ending times for a range of time units to be displayed. The behavior is the same as Wave window (p168) Zoom > Zoom Range menu selection. Syntax .wave.tree zoomrange f1 f2 Arguments f1 f2 Sets the waveform display to zoom from time f1 to f2, where f1 and f2 are floating point numbers. Required. Either range number may include an optional VHDL resolution time-unit.
when when The when command allows you to instruct VSIM to perform actions when the specified conditions are met; for example, you can use the when command to break on a signal value. Conditions can include the following HDL items: VHDL signals, and Verilog nets and registers. Use the nowhen command (p336) to deactivate when commands. The when command uses a when_condition_expression to determine whether or not to perform the action.
when The operands may be item names, signame’event, or constants. Subexpressions in parentheses are permitted. The command will be executed when the expression is evaluated as TRUE or 1.
when The multi-line when command below does not use a label and has two conditions. When the conditions are met, an echo (p307) and a stop (p372) command will be executed.
where where The where command displays information about the system environment. This command is useful for debugging problems where VSIM cannot find the required libraries or support files. Syntax where Arguments None. Description The where command displays three important system settings: current directory This is the current directory that VSIM was invoked from, or was specified on the VSIM command line. Once in VSIM the current directory cannot be changed.
..tree color ..tree color The ..tree color command sets the color of the specified window field to the indicated color name. The color information is written to "Preference variable arrays" (p216). Syntax ..tree color Arguments Specifies the name of the window for the color change. The Process, Signals, Structure, Variables, or Wave window may be specified. Required. Specifies field for color change. Required.
write format write format The write format command records the names and display options of the HDL items currently being displayed in the List or Wave window. The file created is comprised of a file of add list (p260), add wave (p271), and configure (p292) commands. This file may be invoked with the do command (p302) to recreate the List or Wave window format on a subsequent simulation run.
write list write list The write list command records the contents of the most recently opened, or specified List window in a list output file. This file contains simulation data for all HDL items displayed in the List window: VHDL signals - and Verilog nets and registers. Syntax write list [-events] [-window ] Arguments -events Specifies to write print-on-change format. Optional. Default is tabular format. -window Specifies a List window using the full Tk path. Optional.
write preferences write preferences The write preferences command saves the current GUI preference settings to a Tcl preference file. Settings saved include the current window location and size. Syntax write preferences Arguments Specify the name for the preference file. Optional. If the file is named modelsim.tcl ModelSim will read the file each time VSIM is invoked. To use a preference file other than modelsim.
write report write report The write report command prints a summary of the design being simulated including a list of all design units (VHDL configurations, entities, and packages and Verilog modules) with the names of their source files. Syntax write report [] Arguments Specifies the name of the output file where the data is to be written. Optional. If the is omitted, the report is written to the Transcript window. Examples write report alu.
write transcript write transcript The write transcript command writes the contents of the Main window transcript to the specified file. The resulting file can be used to replay the transcribed commands as a DO file (macro). Syntax write transcript [] Arguments Specifies the name of the output file where the data is to be written. Optional. If the is omitted, the transcript is written to a file named transcript.
write tssi write tssi The write tssi command records the contents of the default or specified List window in a “TSSI format” file. The file contains simulation data for all HDL items displayed in the List window that can be converted to TSSI format (VHDL signals and Verilog nets). A signal definition file is also generated. The List window needs to be using symbolic radix in order for write tssi to produce useful output.
write tssi std_ulogic State Characters SEF State Characters Input Output Bidirectional U N X ? X N X ? 0 D L 0 1 U H 1 Z Z T F W N X ? L D L 0 H U H 1 - N X ? Bidirectional logic values are not converted because only the resolved value is available. The TSSI ASCII In Converter and ASCII Out Converter can be used to resolve the directionality of the signal and to determine the proper forcing or expected value on the port.
write wave write wave The write wave command records the contents of the most currently opened, or specified Wave window in PostScript format. The output file can then be printed on a PostScript printer. Syntax write wave [-window ] [-width ] [-height ] [-margin ] [-start ] [-end ] [-perpage ] [-pagecount ] [-landscape] [-portrait] Arguments -window Specifies a Wave window using the full Tcl path. Optional.
write wave -portrait Use portrait (vertical) orientation. Optional. The default is landscape (horizontal). Specifies the name of the PostScript output file. Required. Examples write wave alu.ps Saves the current data in the Wave window in a file named alu.ps. write wave -win .wave2 group2.ps Saves the current data in window ‘wave2’ in a file named group2.ps. write wave -start 600ns -end 800ns -perpage 100ns top.ps Writes two separate pages to top.
- Simulator Command Reference ModelSim EE/PLUS Reference Manual
8 - System Initialization/Project File Chapter contents Location of the modelsim.ini file . . . . . . . . . . . . . . 414 Choosing project files . . . . . . . . . . . . . . 414 Reading variable values from the .ini file . . . . . . . . . . . . 414 Project file variables . . . . . . . . . . . . . 415 Variable functions . . . . . . . . . Environment variables . . . . . . . Creating a transcript file . . . . . . Using a startup file . . . . . . . .
Location of the modelsim.ini file Location of the modelsim.ini file The ModelSim tools look for a modelsim.ini file in these locations: • at the location specified by the MODELSIM (p55) environment variable, • in the current directory if no environment variable exists. • then in the directory where the executable exists (/install_dir/modeltech/ ) • then in the parent of the directory where the executable is (/install_dir/ modeltech) Note: You can modify the modelsim.
Project file variables GetIniInt Reads the integer value for the specified variable. GetIniReal Reads the real value for the specified variable. GetProfileString [] Reads the string value for the specified variable in the specified section. Optionally provides a default value if no value is present. Examples Setting Tcl variables with values from the modelsim.ini file is one use of these Tcl functions.
Project file variables [Library] section Variable name Value range Purpose verilog any valid path; may include environment variables sets path to the library containing VHDL/Verilog type mappings; default is /..
Project file variables [vcom] section Variable name Value range Purpose Show_Warning4 0, 1 if 0, turns off no-space-in-time-literal warnings; default is on Show_Warning5 0, 1 if 0, turns off multiple-drivers-on-unresolvedsignal warnings; default is on Optimize_1164 0, 1 if 0, turns off optimization for IEEE std_logic_1164 package; default is on Explicit 0, 1 if 1, turns on resolving of ambiguous function overloading in favor of the "explicit" function declaration (not the one automatically cr
Project file variables [vcom] section Variable name Value range Purpose ScalarOpts 0, 1 if 1, activate optimizations on expressions that don’t involve signals, waits or function/ procedure/task invocations [vlog] section Variable name Value range Purpose Hazard 0, 1 if 1, turns on Verilog hazard checking (orderdependent accessing of global vars); default is off NoDebug 0, 1 if 1, turns off inclusion of debugging info within design units; default is to include Quiet 0, 1 if 1, turns off "lo
Project file variables [vsim] section Variable name Value range Purpose AssertionFormat "** %S: %R\n Time: %T Iteration: %D%I\n" sets the message to display after a break on assertion; message formats include: %S - severity level %R - report message %T - time of assertion %D - delta %I - instance or region pathname (if available) %% - print ’%’ character BreakOnAssertion 0-4 defines severity of assertion that causes a simulation break (0 = note, 1 = warning, 2 = error, 3 = failure, 4 = fatal), defa
Project file variables [vsim] section Variable name Value range Purpose IgnoreWarning 0,1 if 1, ignore assertion warnings IterationLimit positive integer limit on simulation kernel iterations during one time delta, default is 5000 License any single controls ModelSim license file search; license options include: nomgc - excludes MGC licenses nomti - excludes MTI licenses vlog - only use VLOG license vhdl - only use VHDL license plus - only use PLUS license noqueue - do not wait
Variable functions [vsim] section Variable name Value range Purpose TranscriptFile any valid filename file for saving command transcript; environment variables many be included in the path name; default is "transcript"; the size of this file can be controlled with the MTI_TF_LIMIT variable (p55) UserTimeUnit fs, ps, ns, us, ms, sec, min, hr specifies the default units to use for the " []" argument to the run command (p361), default is "ns"; NOTE - the value of this variable m
Variable functions Examples [Library] work = $HOME/work_lib test_lib = ./$TESTNUM/work ... [vsim] IgnoreNote = $IGNORE_ASSERTS IgnoreWarning = $IGNORE_ASSERTS IgnoreError = 0 IgnoreFailure = 0 Tip: There is one environment variable, MODEL_TECH, that you cannot — and should not — set. MODEL_TECH is a special variable set by Model Technology software. Its value is the name of the directory from which the VCOM compiler or VSIM simulator was invoked.
Variable functions Using a startup file The system initialization file allows you to specify a command or a do file that is to be executed after the design is loaded. For example: ; VSIM Startup command Startup = do mystartup.do The line shown above instructs VSIM to execute the commands in the macro file named mystartup.do. ; VSIM Startup command Startup = run -all The line shown above instructs VSIM to run until there are no events scheduled.
Variable functions Force command defaults The VSIM force command has -freeze, -driver, and -deposit options. When none of these is specified, then -freeze is assumed for unresolved signals and -drive is assumed for resolved signals. This is designed to provide compatibility with version 4.1 and earlier force files. But if you prefer -freeze as the default for both resolved and unresolved signals, you can change the defaults in the modelsim.ini file.
9 - The TextIO Package Chapter contents Using the TextIO package . . . . . . . . . . Syntax for file declaration . . . . . . . . . Using STD_INPUT and STD_OUTPUT within ModelSim . . . . . . . . . . . . . . . . . . 425 426 427 TextIO implementation issues . . . . . Writing strings and aggregates . . . . Reading and writing hexadecimal numbers Dangling pointers . . . . . . . The ENDLINE function . . . . . The ENDFILE function . . . . . . Using alternative input/output files . . . Providing stimulus .
Using the TextIO package Syntax for file declaration The VHDL’87 syntax for a file declaration is: file identifier : subtype_indication is [ mode ] file_logical_name ; where "file_logical_name" must be a string expression. The VHDL’93 syntax for a file declaration is: file identifier_list : subtype_indication [ file_open_information ] ; If a file is declared within an architecture, process, or package, the file is opened when you start the simulator and is closed when you exit from it.
TextIO implementation issues TextIO implementation issues Writing strings and aggregates A common error in VHDL source code occurs when a call to a WRITE procedure does not specify whether the argument is of type STRING or BIT_VECTOR. For example, the VHDL procedure: WRITE (L, "hello"); will cause the following error: ERROR: Subprogram "WRITE" is ambiguous. In the TextIO package, the WRITE procedure is overloaded for the types STRING and BIT_VECTOR.
TextIO implementation issues Reading and writing hexadecimal numbers The reading and writing of hexadecimal numbers is not specified in standard VHDL. The Issues Screening and Analysis Committee of the VHDL Analysis and Standardization Group (ISAC-VASG) has specified that the TextIO package reads and writes only decimal numbers. To expand this functionality, ModelSim supplies hexadecimal routines in the package io_utils, which is located in the file io_utils.vhd.
TextIO implementation issues The ENDFILE function In the VHDL Language Reference Manuals, IEEE Std 1076-1987 and IEEE Std 1076-1993, the ENDFILE function is listed as: -- function ENDFILE (L: in TEXT) return BOOLEAN; As you can see, this function is commented out of the standard TextIO package. This is because the ENDFILE function is implicitly declared, so it can be used with files of any type, not just files of type TEXT.
- The TextIO Package ModelSim EE/PLUS Reference Manual
10 - ModelSim and VITAL Chapter contents Obtaining the VITAL specification and source code . . . . . . . . . 432 VITAL packages. . . . . . . . . . . . . . . . . . . 432 ModelSim VITAL compliance . . VITAL compliance checking . VITAL compliance warnings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432 433 433 Compiling and Simulating with accelerated VITAL packages . . . . . . .
Obtaining the VITAL specification and source code Obtaining the VITAL specification and source code VITAL ASIC Modeling Specification The IEEE 1076.4 VITAL ASIC Modeling Specification is available from the Institute of Electrical and Electronics Engineers, Inc.: IEEE Customer Service Hoes Lane Tiscataway, NJ 08855-1331 Tel: (800)678-4333 ((908)562-5420 from outside the U.S.) Fax: (908)981-9667 home page: http://www.ieee.
ModelSim VITAL compliance VITAL compliance checking Compliance checking is important in enabling VITAL acceleration; to qualify for global acceleration, an architecture must be VITAL-level-one compliant. VCOM automatically checks for VITAL 3.0 compliance on all entities with the VITAL_Level0 attribute set, and all architectures with the VITAL_Level0 or VITAL_Level1 attribute set. If you are using VITAL 2.
Compiling and Simulating with accelerated VITAL packages Compiling and Simulating with accelerated VITAL packages VCOM automatically recognizes that a VITAL function is being referenced from the ieee library and generates code to call the optimized built-in routines. Optimization occurs on two levels: • VITAL Level-0 optimization This is a function-by-function optimization. It applies to all level-0 architectures, and any level-1 architectures that failed level-1 optimization.
11 - Standard Delay Format (SDF) Timing Annotation Chapter contents Specifying SDF files for simulation . Instance specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 436 VHDL VITAL SDF . . . . . SDF to VHDL generic matching . . . . . . . . . . . . . . . . . . . . . . . . . . 438 438 Verilog SDF . . . . . . . . The $sdf_annotate system task . . SDF to Verilog construct matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Specifying SDF files for simulation Specifying SDF files for simulation ModelSim supports SDF versions 1.0 through 2.1. The simulator’s built-in SDF annotator automatically adjusts to the version of the file.
Specifying SDF files for simulation SDF specification with the GUI As an alternative to the command-line options, you may specify SDF files in the "Load Design" dialog box (p198) under the SDF tab. This dialog box is presented if you invoke the simulator without any arguments or if you select "Load New Design..." under the simulator’s file menu. For Verilog designs, you may also specify SDF files by using the $sdf_annotate system task. See "The $sdf_annotate system task" (p440) for more details.
VHDL VITAL SDF Errors and warnings Errors issued by the SDF annotator while loading the design prevent the simulation from continuing, whereas warnings do not. Use the -sdfnoerror option with vsim (p91) to change SDF errors to warnings so that the simulation can continue. Warning messages can be suppressed by using vsim with either the -sdfnowarn or +nosdfwarn options. Another option is to use the SDF page from the Load Design dialog box (shown above).
VHDL VITAL SDF SDF construct Matching VHDL generic name (IOPATH a y (3)) tpd_a_y (IOPATH (posedge clk) q (1) (2)) tpd_clk_q_posedge (INTERCONNECT u1/y u2/a (5)) tipd_a (SETUP d (posedge clk) (5)) tsetup_d_clk_noedge_posedge (HOLD (negedge d) (posedge clk) (5)) thold_d_clk_negedge_posedge (SETUPHOLD d clk (5) (5)) tsetup_d_clk & thold_d_clk (WIDTH (COND (reset==1’b0) clk) (5)) tpw_clk_reset_eq_0 Resolving errors If the simulator finds the cell instance but not the generic then an error messa
Verilog SDF If none of the generic names look like VITAL timing generic names, then perhaps the VITAL library cells are not being used. If the generic names do look like VITAL timing generic names but don’t match the names expected by the annotator, then there are several possibilities: • The vendor’s tools are not conforming to the VITAL specification. • The SDF file was accidentally applied to the wrong instance.
Verilog SDF "" String that specifies the configuration file. Optional. Currently not supported, this argument is ignored. "" String that specifies the log file. Optional. Currently not supported, this argument is ignored. "" String that specifies delay selection. Optional. The allowed strings are "minimum", "typical", "maximum", and "tool_control". Case is ignored and the default is "tool_control".
Verilog SDF SDF to Verilog construct matching The annotator matches SDF constructs to corresponding Verilog constructs in the cells. Usually, the cells contain path delays and timing checks within specify blocks. For each SDF construct, the annotator locates the cell instance and updates each specify path delay or timing check that matches. An SDF construct may have multiple matches, in which case each matching specify statement is updated with the SDF timing value.
Verilog SDF DEVICE is matched to primitives or specify path delays: SDF Verilog (DEVICE y (5)) and u1(y, a, b); (DEVICE y (5)) (a => y) = 0; (b => y) = 0; If the SDF cell instance is a primitive instance, then that primitive’s delay is annotated. If it is a module instance, then all specify path delays are annotated that drive the output port specified in the DEVICE construct (all path delays are annotated if the output port is omitted).
Verilog SDF RECOVERY is matched to $recovery: SDF Verilog (RECOVERY (negedge reset) (posedge clk) (5)) $recovery(negedge reset, posedge clk, 0); REMOVAL is matched to $removal: SDF Verilog (REMOVAL (negedge reset) (posedge clk) (5)) $removal(negedge reset, posedge clk, 0); SKEW is matched to $skew: SDF Verilog (SKEW (posedge clk1) (posedge clk2) (5)) $skew(posedge clk1, posedge clk2, 0); WIDTH is matched to $width: SDF Verilog (WIDTH (posedge clk) (5)) $width(posedge clk, 0); PERIOD is matc
Verilog SDF Optional edge specifications Timing check ports and path delay input ports may have optional edge specifications. The annotator uses the following rules to match edges: • A match occurs if the SDF port does not have an edge. • A match occurs if the specify port does not have an edge. • A match occurs if the SDF port edge is identical to the specify port edge. • A match occurs if explicit edge transitions in the specify port edge overlap with the SDF port edge.
Verilog SDF match occurs if any of the explicit edges in the specify port match any of the explicit edges implied by the SDF port. For example, SDF Verilog (SETUP data (posedge clock) (5)) $setup(data, edge[01, 0x] clk, 0); Optional conditions Timing check ports and path delays may have optional conditions. The annotator uses the following rules to match conditions: • A match occurs if the SDF does not have a condition.
SDF for Mixed VHDL and Verilog Designs (from the timescale directive), then the path delay receives a value of 20ps. The SDF value of 16ps is rounded to 20ps. Interconnect delays are rounded to the time precision of the module that contains the annotated MIPD. SDF for Mixed VHDL and Verilog Designs Annotation of a mixed VHDL and Verilog design is very flexible. VHDL VITAL cells and Verilog cells may be annotated from the same SDF file.
Troubleshooting Troubleshooting Several common mistakes in SDF annotation are outlined below. Specifying the wrong instance By far, the most common mistake in SDF annotation is to specify the wrong instance to the simulator’s SDF options. The most common case is to leave off the instance altogether, which is the same as selecting the top-level design unit.
Troubleshooting Mistaking a component or module name for an instance label Another common error is to specify the component or module name rather than the instance label. For example, the following invocation is wrong for the above testbenches: vsim -sdfmax /testbench/myasic=myasic.sdf testbench This results in the following error message: ERROR: myasic.sdf: The design does not have an instance named ’/testbench/myasic’.
Obtaining the SDF specification Obtaining the SDF specification SDF specification is available from Open Verilog International: Lynn Horobin phone: (408)358-9510 fax: (408)358-3910 email: info@ovi.org home page: http://www.ovi.
12 - VHDL Foreign Language Interface and Verilog PLI Chapter contents Compiling and linking FLI and PLI applications Windows NT/95/98 linking . . . . . SunOS 4 linking . . . . . . . Solaris linking . . . . . . . . HP700 linking . . . . . . . . IBM RISC/6000 linking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452 453 453 453 454 454 Using the VHDL FLI with foreign architectures Declaring the FOREIGN attribute .
Compiling and linking FLI and PLI applications All of the PLI routines described in the IEEE Std 1364-1995 are implemented (except the vpi_* routines). The corresponding veriuser.h and acc_user.h include files are located in the ModelSim /include directory. A complete list of routines supported is listed in installed text files, see /modeltech/ docs/technotes. Note: The Tcl C interface is included in the FLI; you’ll find tcl.h in the /modeltech/include directory.
Compiling and linking FLI and PLI applications The following platform-specific instructions show you how to compile and link your FLI and PLI application so it can be loaded by VSIM. In most cases gcc and cc compiler instructions are shown. Windows NT/95/98 linking Under Windows NT/95/98 VSIM loads a 32-bit dynamically linked library for each FLI or PLI application. The following compile and link steps are used to create the necessary .
Compiling and linking FLI and PLI applications HP700 linking VSIM loads shared libraries on the HP700 workstation. A shared library is created by creating object files that contain position-independent code (use the +z compiler option) and by linking as a shared library (use the -b linker option). Use these gcc or cc compiler commands: gcc compiler: gcc -c -fpic -I//modeltech/include app.c ld -b -o app.sl app.o -lc cc compiler: cc -c +z -I//modeltech/include app.c ld -b -o app.
Compiling and linking FLI and PLI applications for AIX 3.2 (choose gcc or cc compiler commands) gcc compiler: gcc -c -I//modeltech/include app.c ld -T521 -H512 -btextro -bhalt:4 -bnodelcsect\ -o app.sl app.o -e _nostart -bE:app.exp\ -bI://modeltech/rs6000/mti_exports cc compiler: cc -c -I//modeltech/include app.c cc -o app.sl app.o -bE:app.exp\ -bI://modeltech/rs6000/mti_exports\ -bM:SRE -e _nostart for AIX 4.
Using the VHDL FLI with foreign architectures Note: Although compilation and simulation switches are platform-specific, references to load shared objects are the same for all platforms. For information on loading objects see "Declaring the FOREIGN attribute" (p456), "Declaring the subprogram in VHDL" (p458) for the FLI , and "Specifying the PLI file to load" (p483) for the PLI.
Using the VHDL FLI with foreign architectures parameter A string that is passed to the initialization function. This part is preceded by a semicolon and is optional. If the initialization function has a leading '+' or '-', both the VHDL architecture body and the foreign module will be elaborated. If '+' is used (as in the example below), the VHDL will be elaborated first, and if the '-' is used, the VHDL will be elaborated after the foreign init function is called.
Using the VHDL FLI with foreign subprograms • creates one or more processes (a C function that can be called when a signal changes) • sensitizes each process to a list of signals The declaration of an initialization function is: init_func(region, param, generics, ports) regionID region; char *param; interface_list *generics; interface_list *ports; The function specified in the foreign attribute is called during elaboration.
Using the VHDL FLI with foreign subprograms You will also need to write a subprogram body for the subprogram, but it will never be called.
Using the VHDL FLI with foreign subprograms Parameters of class CONSTANT or VARIABLE VHDL Type IN Access Record -- Not supported -- INOUT/OUT class SIGNAL IN "Enumeration" refers to everything that is declared in VHDL as an enumeration with 256 or fewer elements. For example: BIT, BOOLEAN, CHARACTER, STD_LOGIC. "Array" refers to everything that is declared in VHDL as an array. For example: STRING, BIT_VECTOR, STD_LOGIC_VECTOR. Arrays are not NULL terminated.
Using the VHDL FLI with foreign subprograms C subprogram example Functions declared in this code, in_params and out_params, have parameters and return types that match the procedures in the subsequent package declaration (pkg). #include #include "mti.
Using the VHDL FLI with foreign subprograms /* Convert a VHDL String array into a NULL terminated string */ static char *get_string(varID id) { static char buf[1000]; typeID type; int len; mti_GetArrayVarValue(id, buf); type = mti_GetVarType(id); len = mti_TickLength(type); buf[len] = 0; return buf; } Package (pkg) example The declared FOREIGN attribute links the C functions (declared above) to VHDL procedures (in_params and out_params) in pkg.
Using checkpoint/restore with the FLI vhdl_integer : vhdl_enum : vhdl_real : vhdl_array : begin report "ERROR: end; end; OUT OUT OUT OUT integer; severity_level; real; string) is foreign subprogram out_params not called"; Entity (test) example The VHDL entity test contains calls to procedures (in_params and out_params) that are declared in pkg and linked to functions in the original C subprogram. entity test is end; use work.pkg.
Using checkpoint/restore with the FLI from mti routines. Pointers that you save and restore must be global, not variables on the stack. If you choose not to use the MTI provided memory allocation functions, you will have to explicitly save and restore your allocated memory structures as well. You must code your model assuming that the code could reside in a different memory location when restored.
Support for Verilog instances } else if (mti_IsFirstInit()) { ip = (inst_rec *)mti_Malloc(sizeof(inst_rec)); /* malloc changed to mti_Malloc */ ip->in1 = mti_FindPort(ports, "in1"); ip->in2 = mti_FindPort(ports, "in2"); outp = mti_FindPort(ports, "out1"); ip->out1 = mti_CreateDriver(outp); proc = mti_CreateProcess("p1", do_and, ip); mti_Sensitize(proc, ip->in1, MTI_EVENT); mti_Sensitize(proc, ip->in2, MTI_EVENT); } else { /* do whatever you might want to do for restart */ /*...
Callback functions for sockets - Windows platforms mti_GetTopRegion Gets the first top-level module. Use mti_NextRegion to get additional top-level modules. mti_GetPrimaryName Gets the module name. mti_GetSecondaryName Returns NULL for Verilog modules.
VSIM function descriptions VSIM function descriptions The VSIM function descriptions listed below are in alphabetic order by function name. The function declarations are in the mti.h header file located in the ModelSim installation directory. void mti_AddCommand(char *cmd_name, funcptr func) Adds a VSIM command. The cmd_name case is significant. The VSIM command interpreter subsequently recognizes the command and calls the user supplied function whenever the command is recognized.
VSIM function descriptions void mti_AddRestoreCB (funcptr func, void *param) Causes the function to be called on a warm restore. This function can not be used for cold restores (vsim -restore) as function entry points may be located at different places after a cold restore. void mti_AddSaveCB (funcptr func, void *param) Causes the function to be called when a checkpoint operation is performed. The parameter supplied is copied and passed through to the function.
VSIM function descriptions void mti_Command(char *cmd) Executes the VSIM command identified by cmd. The string contains the command just as it would be typed at the VSIM prompt. Echoes results. typeID mti_CreateArrayType(long left, long right, typeID elem_type) Creates a new typeID that describes an array type. Left and right specify the bounds of the array. Elem_type specifies the type of the elements of the array. driverID mti_CreateDriver(signalID sig) Creates a driver on a signal.
VSIM function descriptions signalID mti_CreateSignal(char *name, regionID region, typeID type) Creates a new signal. If “name” is not NULL, the signal will appear in the VSIM signal window. The name will be forced to lower case. unsigned long mti_Delta() Returns the simulator iteration count for the current time step. void mti_Desensitize(processID proc) Disconnects a C process from the signals it is sensitive to, i.e., undoes the connection created by the mti_Sensitize call.
VSIM function descriptions then the following call returns the string “$abc/xyz”: mti_FindProjectEntry(“myconfig”, “myentry”, 0) The function returns NULL if the project entry does not exist. regionID mti_FindRegion(char *nm) Returns the regionID for the region identified by nm. The region name may be either a full hierarchical name or a relative name. A relative name is relative to the region set by the VSIM environment command (p312) (the top level region is the default).
VSIM function descriptions free C-library function). If buf is not NULL, then VSIM copies the value into buf and returns buf. void * mti_GetArrayVarValue(varID var, void * buf) Gets the value of an array variable. If buf is NULL, then VSIM returns a pointer to the value, which should be treated as read-only data. If buf is not NULL, then VSIM copies the value into buf and returns buf. regionID mti_GetCurrentRegion(void) Returns the regionID of the current region.
VSIM function descriptions char * mti_GetRegionFullName(regionID reg) Returns the full hierarchical name of the region. The name is stored in a buffer that is overwritten on each call to this function. Do not free this pointer. The operation is the same for Verilog instances. int mti_GetRegionKind PROTO((regionID reg)) Given a region return it's kind (i.e. Verilog or VHDL). The value returned is one of the values defined in acc_user.h or acc_vhdl.h.
VSIM function descriptions responsible for freeing this memory with the free C-library function). If buf is not NULL, then VSIM copies the value into buf and returns buf. typeID mti_GetSignalType(signalID sig) Returns the typeID for the signal. long mti_GetSignalValue (signalID sig) Gets the value of a scalar signal except TIME and DOUBLE which require GetSignalValueIndirect. void * mti_GetSignalValueIndirect(signalID sig, void * buf) Gets the value of a signal of any type.
VSIM function descriptions relative name is relative to the region set by the VSIM environment (p312) command (the top level region is the default). NULL is returned if the variable is not found. The caller can read or modify the value of the variable provided that the type of the variable is known. Given the variable's data type, the caller can interpret the storage pointed to by the returned pointer.
VSIM function descriptions { Tcl_Interp *interp = mti_Interp(); int stat = mti_Cmd("examine foo"); if (stat == TCL_OK) { printf("Examine foo results = %s\n", interp->result); } else { printf("Command Error: %s\n", interp->result); } } int mti_IsColdRestore (void) Returns 1 when a “cold” restore operation is in progress. Otherwise returns 0. A “cold” restore is when VSIM has been terminated and is re-invoked with the -restore commandline option.
VSIM function descriptions time64 *mti_NowIndirect(time64 *time_buf) Returns a structure containing the upper and lower 32 bits of the 64-bit current simulation time. If time_buf is NULL, then VSIM allocates memory for the value and returns a pointer to it (the caller is responsible for freeing this memory with the free C-library function). If time_buf is not NULL, then VSIM copies the value into time_buf and returns time_buf.
VSIM function descriptions long mti_RestoreLong (void) Returns sizeof(long) bytes of data read from the checkpoint file. void mti_RestoreProces (processID proc, char *name, funcptr func, void *param) Updates the corresponding call to mti_CreateProcess(). The first argument is the processID that was returned from the original mti_CreateProcess() call. The remaining arguments are the same as the original mti_CreateProcess() call.
VSIM function descriptions void mti_ScheduleWakeup(processID process, DELAY delay) Schedules the process to be called after a delay. A process may have no more than one pending wake-up call. A call to mti_ScheduleWakeup cancels a prior pending wake-up call regardless of the delay values. The delay time units are equivalent to the current simulator time unit setting. See mti_Resolution.
VSIM function descriptions long mti_TickLength(typeID type) Returns the value of type'LENGTH. long mti_TickRight(typeID type) Returns the value of type'RIGHT. void mti_TraceActivate PROTO((void)) Turns trace back on if trace was suspended. void mti_TraceOff() Turns off foreign interface tracing and initiates a dump of callback-related information to the replay files. void mti_TraceOn(int level, char *tag) Optional way to turn on FLI/PLI tracing. NOT RECOMMENDED.
VSIM function descriptions Mapping to VHDL data types Many FLI functions have parameters and return values that represent VHDL object values. This section describes how the object values are mapped to the various VHDL data types. VHDL data types are identified in the C interface by a typeID handle. A typeID handle can be obtained for a signal by calling mti_GetSignalType and for a variable by calling mti_GetVarType.
VSIM function descriptions “long” before being passed as a non-array scalar object value across the C interface. The mti_GetSignalValue function can be used to get the value of any non-array scalar signal object except TIME and REAL which use GetSignalValueIndirect. Use mti_GetVarValue and mti_GetVarValueIndirect for variables. Enumerations Enumeration object values are equated to the position number of the corresponding identifier or character literal in the VHDL type declaration.
Using the Verilog PLI VHDL FLI examples Several examples that illustrate how to use the foreign language interface and an include file are shipped with ModelSim EE. Example one uses these VHDL source and C code files: example1.vhd example1.c Example two uses one VHDL source code file and several C files: foreign.vhd dumpdes.c gates.c monitor.c Example three is an entire VHDL testbed: test_circuit.vhd tester.vhd xcvr.vhd tester.c vectors You’ll find the include file is at: //modeltech/mti.
Using the Verilog PLI The Veriuser entry also accepts a list of shared objects. Each shared object is an independent PLI application that must contain an init_usertfs entry point that registers the application's tasks and callback functions. An example entry in the modelsim.ini file is: Veriuser = app1.so app2.so app3.so VSIM also supports two alternative methods of specifying the PLI files to load: the vsim (p91) -pli command line option and the PLIOBJS (p55) environment variable.
Using the Verilog PLI no provision for obtaining handles to generics, types, constants, attributes, subprograms, and processes. However, some of these objects can be manipulated through the ModelSim VHDL foreign interface (mti_* routines). See "VSIM function descriptions" (p467).
FLI and PLI tracing PLI TF routines and Reason flags The most current listing of PLI TF (utility) routines and reason flags supported by ModelSim /PLUS is available on-line. See "Installed technotes" (p28). FLI and PLI tracing The foreign interface tracing feature is available for tracing user foreign language calls made to the MTI VHDL FLI and to the MTI Verilog PLI interface. Turning on the tracing activates tracing for both interfaces.
FLI and PLI tracing Invoking a trace To invoke the trace, call vsim (p91) with the -trace_foreign option: Syntax vsim -trace_foreign [-tag ] Arguments Specifies these actions: Action Result 1 create log only writes a local file called "mti_trace_" 2 create replay only writes local files called "mti_data_.c", "mti_init_.c", "mti_replay_.c" and "mti_top_.
FLI and PLI tracing vsim -trace_foreign 1 -tag 2 mydesign creates a log file with a tag of "2" The tracing operations will provide tracing during all user foreign code-calls, including VHDL foreign process call-backs, PLI user tasks and functions (calltf, checktf, sizetf and misctf routines), and Verilog VCL call-backs.
FLI and PLI tracing Replaying a Verilog PLI session To replay the C files, compile mti_top_.c as appropriate for the platform you are working on, as for any PLI code, and set the Veriuser line in your modelsim.ini file to point to the appropriate resulting object file. Since the foreign interface tracing is preliminary, there may be cases in which you need to hand edit some C files to compile or run properly. An example is when you have a design with more than one PLI object file.
- VHDL Foreign Language Interface and Verilog PLI ModelSim EE/PLUS Reference Manual
13 - Value Change Dump (VCD) Files Chapter contents ModelSim VCD commands and VCD tasks . . . . . . . . 492 Resimulating a VHDL design from a VCD file . . . Extracting the proper stimulus for bidirectional ports Specifying a filename and state mappings . . . Creating the VCD file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492 492 493 493 A VCD file from source to output VHDL source code . . . VCD simulator commands . VCD output . . . . . . . . . . .
ModelSim VCD commands and VCD tasks ModelSim VCD commands and VCD tasks ModelSim VCD commands map to IEEE 1364 VCD system tasks and appear in the VCD file along with the results of those commands. The table below shows the mapping of the extended VCD commands to the IEEE 1364 keywords.
Resimulating a VHDL design from a VCD file signal must be captured in the VCD file along with its related bidirectional port. See the description of the splitio command (p369) for more details. Specifying a filename and state mappings After using splitio , the VCD filename and state mapping are specified using the vcd file command (p382) with the -nomap -direction options. Note that the -nomap option is not necessary if the port types on the top-level design are bit or bit_vector.
A VCD file from source to output Now, to resimulate using the VCD file: vsim -c -t ps -vcdread dump.vcd dut VSIM 1> run 1000 VSIM 2> quit Note: You must manually invoke the run command (p361) even when using -vcdread. A VCD file from source to output The following example shows the VHDL source, a set of simulator commands, and the resulting VCD output. VHDL source code The design is a simple shifter device represented by the following VHDL source code: library IEEE; use IEEE.STD_LOGIC_1164.
A VCD file from source to output VCD simulator commands At simulator time zero (around 9 am on 4/12/96), the designer executes the following commands and quits the simulator at time 1200: vcd file output.
A VCD file from source to output VCD output $comment File created using the following command: vcd file output.vcd direction $date Fri Apr 12 09:07:17 1996 $end $version ModelSim EE/PLUS 5.
A VCD file from source to output 0& 0' 0( 0) 0* 0+ 1, $end #350 0! #400 1! 1+ #450 0! #500 1! 1* #550 0! #600 1! 1) #650 0! #700 1! 1( #750 0! #800 1! 1' #850 0! #900 1! 1& #950 0! ModelSim EE/PLUS Reference Manual #1000 1! 1% #1050 0! #1100 1! 1$ #1150 0! 1" 0$ 0% 0& 0' 0( 0) 0* 0+ 0, #1200 1! $dumpa ll 1! 1" 1# 0$ 0% 0& 0' 0( 0) 0* 0+ 0, $end Value Change Dump (VCD) Files - 497
Capturing port driver data with -dumpports Capturing port driver data with -dumpports Some ASIC vendor’s toolkits read a VCD file format that provides details on port’s drivers. This information can be used, for example, to drive a tester. See the ASIC vendor’s documentation for toolkit specific information. Execute the vcd file command (p382) with the -dumpports option to specify that you are capturing port driver data.
Capturing port driver data with -dumpports Strength values The values are based on Verilog strengths: Strength VHDL std_logic mappings 0 highz ’Z’ 1 small 2 medium 3 weak 4 large 5 pull ’W’,’H’,’L’ 6 strong ’U’,’X’,’0’,’1’,’-’ 7 supply Port identifier code The is an integer preceded by < that starts at zero and is incremented for each port in the order the ports are specified in the vcd add commands (p379). Also, the variable type recorded in the VCD header is "port".
Capturing port driver data with -dumpports Example VCD output from -dumpports The following is an example VCD file created with the -dumpports option: $comment File created using the following command: vcd file results/dump1 -dumpports $end $date Tue Jan 20 13:33:02 1998 $end $version ModelSim Version 5.
14 - Logic Modeling Library and Hardware Modeler Chapter contents VHDL SmartModel interface SM_ENTITY . . . Entity details . . . Architecture details . . Vector ports . . . . Simulation . . . . SPARCstation note . . Command channel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
VHDL SmartModel interface VHDL SmartModel interface The interface to a SmartModel Library model (SML model for short) is no different than any other model in the VHDL design; that is, the interface is through an entity declaration. The key difference is that the architecture for a SML model is a foreign architecture. That means that the architecture is not described in VHDL, but instead is an executable binary.
VHDL SmartModel interface SM_ENTITY To simulate an SML model with VSIM you must first create the corresponding entity and foreign architecture. The SM_ENTITY tool is provided to automate this task. It takes SML model names as input and writes VHDL output to stdout. The LMC_HOME environment variable must be set to the root of the SmartModel Library installation tree before you invoke SM_ENTITY.
VHDL SmartModel interface sm_entity cy7c285 produces this output from SM_ENTITY for a model of a Cypress 64K x 8 PROM (SML model name cy7c285): library ieee; use ieee.std_logic_1164.
VHDL SmartModel interface Entity details • The entity name is the SML model name (you may manually change this name if you like). • The port names are the same as the SML model port names (these names must not be changed). If the SML model port name is not a valid VHDL identifier, then SM_ENTITY automatically converts it to a valid name. Note that in this example the port "WAIT" was converted to "WAIT_PORT" because WAIT is a VHDL reserved word. • The port types are std_logic.
VHDL SmartModel interface DelayRange : STRING := "Max"; MemoryFile : STRING := "memory" ); port ( A : in std_logic_vector (15 downto 0); CS : in std_logic; O : out std_logic_vector (7 downto 0); WAIT_PORT : inout std_logic ); end component; for all: cy7c285 use entity work.
VHDL SmartModel interface coming from the SmartModel Library. For example, a SML error message is prefixed with the following line: ** Error (SmartModel): SPARCstation note With SunOS 4.1.3, there are additional steps to take in order to simulate with the SmartModel Library. First, add the path to the Logic Modeling SWIFT software to the LD_LIBRARY_PATH environment variable; for example: setenv LD_LIBRARY_PATH $LMC_HOME/lib/sun4SunOS.
There are also some SmartModel Library commands that apply globally to the current simulation session rather than to models. The form of a SML session command is: lmcsession "" Once again, consult your SmartModel Library documentation for details on these commands. SmartModel Windows for VHDL Some models in the SmartModel Library provide access to internal registers. This feature is called SmartModel Windows, and is available for VHDL only.
Each command requires a window instance argument that identifies a specific model instance and window name. For example, /top/u1/wa refers to window wa in model instance /top/u1. lmcwin read The read command displays the current value of a window. The optional radix argument is -binary, -decimal, or -hexadecimal (these names may be abbreviated). The default is to display the value using the std_logic characters.
Verilog SmartModel interface Memory arrays A memory model usually makes the entire register array available as a window. In this case, the window commands operate only on a single element at a time. The element is selected as an array reference in the window instance specification. For example, to read element 5 from the window memory mem: lmcwin read /top/u2/mem(5) Omitting the element specification defaults to element 0. Also, continuous monitoring is limited to a single array element.
Logic Modeling Hardware Modeler just like any other Verilog modules in ModelSim Verilog. Details on the Verilog shells are in the SmartModel Library Simulator Interface Manual (see "LMTV usage documentation" (p510)). The command line plus options and LMTV system tasks described in that document also apply to ModelSim. Changing the default time precision After you have compiled your design you are ready to simulate.
Logic Modeling Hardware Modeler The following VSIM commands are available for hardware models: lm_vectors on|off [] lm_measure_timing on|off [] lm_timing_checks on|off [] lm_loop_patterns on|off lm_unknowns on|off [] These commands are described in the Logic Modeling documentation.
15 - Using Tcl Chapter contents Tcl commands . . . . . . . Command separator. . . . . Command substitution . . . . Multiple-line commands . . . Evaluation order . . . . . Tcl relational expression evaluation System commands . . . . . Variable substitution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Tcl commands Tcl print references Two sources of information about Tcl are Tcl and the Tk Toolkit by John K. Ousterhout, published by Addison-Wesley Publishing Company, Inc., and Practical Programming in Tcl and Tk by Brent Welch published by Prentice Hall. Tcl online references The following are a few of the many Tcl references available: • When using ModelSim make this VSIM Main window menu selection: Help > Tcl Man Pages. • Tcl man pages are also available at: www.elf.org/tcltk-man-html/contents.
Tcl commands pwd read regexp regsub rename return scan seek set split string switch tell time trace source unset uplevel upvar while Note: ModelSim command names that conflict with Tcl commands have been renamed or have been replaced by Tcl commands.
Tcl commands The %name substitution is no longer supported. Everywhere %name could be used, you now can use [examine -value - name] which allows the flexibility of specifying command options. The radix specification is optional. Command separator A semicolon character (;) works as a separator for multiple commands on the same line. It is not required at the end of a line in a command sequence.
Tcl commands • However, if a literal cannot be represented as a number, you must quote it, or Tcl will give you an error. For instance: if {[exa var_2] == 001Z}... will give an error. if {[exa var_2] == "001Z"}... will work okay. • Don't quote single characters in single quotes: if {[exa var_3] == 'X'}... will give an error if {[exa var_3] == "X"}... will work okay. • For the equal operator, you must use the C operator "==" . For not-equal, you must use the C operator "!=".
List processing List processing In Tcl a "list" is a set of strings in curly braces separated by spaces. Several Tcl commands are available for creating lists, indexing into lists, appending to lists, getting the length of lists and shifting lists. These commands are: Command syntax Description lappend var_name val1 val2 ... appends val1, val2, etc. to list var_name lindex list_name index return the index-th element of list_name; the first element is 0 linsert list_name index val1 val2 ...
Tcl examples Command Description lecho (p324) takes one or more Tcl lists as arguments and pretty-prints them to the VSIM Main window lshift (p327) takes a Tcl list as argument and shifts it in-place one place to the left, eliminating the 0th element lsublist (p328) returns a sublist of the specified Tcl list that matches the specified Tcl glob pattern printenv (p345) echoes to the VSIM Main window the current names and values of all environment variables Tcl examples The following Tcl/ModelSim e
This is an example of using the Tcl while loop to copy a list from variable a to variable b, reversing the order of the elements along the way: set b "" set i [expr[llength $a]-1] while {$i >= 0} { lappend b [lindex $a $i] incr i -1 } This example uses the Tcl for command to copy a list from variable a to variable b, reversing the order of the elements along the way: set b "" for {set i [expr [llength $a] -1]} {$i >= 0} {incr i -1} { lappend b [lindex $a $i] } This example uses the Tcl foreach command to
A - Technical Support, Updates, and Licensing Technical support - by telephone Mentor Graphics customers In North America For customers who purchased products from Mentor Graphics in North America, and are under a current support contract, technical telephone support is available from the central SupportCenter by calling toll-free 1-800-547-4303. The coverage window is from 6:00am to 5:30pm Pacific Time. All coverage is provided Monday through Friday, excluding Mentor Graphics holidays.
Technical support - electronic support services Technical support - electronic support services Mentor Graphics customers Mentor Graphics Customer Support offers a SupportNet-Email server for North American and European companies that lets customers find product information or submit service requests (call logs) to the SupportCenter 24 hours a day, 365 days a year. The server will return a call log number within minutes.
Technical support - other channels • ModelSim Version: (Use the Help About dialog box with Windows; type vcom for UNIX workstations.
Updates Updates Mentor customers: getting the latest version via FTP You can ftp the latest EE or PE version of the software from the SupportNet site at ftp://supportnet.mentorg.com/pub/mentortech/modeltech/. Instructions are there as well. A valid license file from Mentor Graphics is needed to uncompress the ModelSim EE files. A password from Model Technology is required to uncompress the ModelSim PE files. Contact license@model.com if you are a current PE customer and need a password.
Licenses - ModelSim EE All customers: ModelSim EE licensing ModelSim EE uses Globetrotter’s FLEXlm license manager and files. Globetrotter FLEXlm license files contain lines that can be referred to by the word that appears first on the line. Each kind of line has a specific purpose and there are many more kinds of lines that MTI does not use. A license.dat file example SERVER hostname 11111111 1650 DAEMON modeltech ./modeltech ./options FEATURE vcom modeltech 1998.
Licenses - ModelSim EE A DAEMON line specifies the name of the license daemon and the locations of the daemon and options files it will use. This is the full path to the modeltech daemon. In the example file, the UNIX "./" means "look in the current directory". This is the directory in which the server was started. If the server is to be started from another directory, the full path to the modeltech and options files would need to be added to this line. For example, DAEMON modeltech /usr/mti5.
Online References Lines that start with "#" are comments. If you want to learn more about the tools that license ModelSim, read the license manager appendix in the ModelSim reference manual, and visit GLOBEtrotter at http://www.globetrotter.com/home.htm. All customers: maintenance renewals and EE licenses When maintenance is renewed, a new license file that incorporates the new maintenance expiration date will be automatically sent to you.
- Technical Support, Updates, and Licensing ModelSim EE/PLUS Reference Manual
B - Tips and Techniques Appendix contents How to use checkpoint/restore . . . . . . . . . . 530 Running command-line and batch-mode simulations . . . . . . . . . 532 Passing parameters to macros . . . . . . . . . . . . . . . . . . 534 Source code security and -nodebug . . . . . . . . . . . . . . 534 Saving and viewing waveforms . . . . . . . . . . . . . . . 535 Setting up libraries for group use . . . . . . . . . . . . . .
How to use checkpoint/restore How to use checkpoint/restore The checkpoint (p291) and restore (p357) commands will save and restore the simulator state within the same invocation of VSIM or between VSIM sessions. If you want to restore while running VSIM, use the restore command (p357), this we call a "warm restore". If you want to start up VSIM and restore a previouslysaved checkpoint, use the -restore switch with the vsim command (p91), this we call a "cold restore".
How to use checkpoint/restore The checkpoint file is normally compressed. If there is a need to turn off the compression, you can do so by setting a special Tcl variable. Use: set CheckpointCompressMode 0 to turn compression off, and turn compression back on with: set CheckpointCompressMode 1 You can also control checkpoint compression using the modelsim.
Running command-line and batch-mode simulations Running command-line and batch-mode simulations The typical method of running ModelSim is interactive: you push buttons and/or pull down menus in a series of windows in the GUI (graphic user interface). But there are really three specific modes of VSIM operation: GUI, command line, and batch. Here are their characteristics: • GUI mode This is the usual interactive mode; it has graphical windows, push-button menus, and a command line in the text window.
Running command-line and batch-mode simulations During simulation a transcript file is created containing any messages to stdout. A transcript file created in command-line mode may be used as a DO file if you invoke the transcript on command (p378) after the design loads (see the example below). The transcript on command will write all of the commands you invoke to the transcript file.
Passing parameters to macros Passing parameters to macros In ModelSim, you invoke macros with the do command: Syntax do [ ...] Arguments Specifies the name of the macro file to be executed. Specifies values that are to be passed to the corresponding parameters $1 through $9 in the macro file. Multiple parameter values must be separated by spaces.
Saving and viewing waveforms window will not display internal variables. In addition, none of the hidden objects may be accessed through the Dataflow window or with VSIM commands. Even with the data hiding of -nodebug, there remains some visibility into models compiled with -nodebug. The names of all design units comprising your model are visible in the library, and the user may invoke vsim (p91) directly on any of these design units and see the ports.
Setting up libraries for group use 2 When you return to work the next day after running several batch jobs, you can start up VSIM in its viewing mode with this command and the appropriate .wav files: vsim -view wavesav1.wav Now you will be able to use the Waveform and List windows normally. Setting up libraries for group use By adding an “others” clause to your modelsim.ini file, you can have a hierarchy of library mappings. If the ModelSim tools don’t find a mapping in the modelsim.
Bus float checking message is also issued when the contention ends. The bus contention checking commands can be used on VHDL and Verilog designs. These bus checking commands are in the "Simulator Command Reference" (p245): • check contention add (p283) • check contention config (p284) • check contention off (p285) Bus float checking Bus float checking detects nodes that are in the high impedance state for a time equal to or exceeding a user-defined limit. This is an error in some technologies.
Toggle checking Toggle checking Toggle checking counts the number of transitions to 0 and 1 on specified nodes. Once the nodes have been selected, a toggle report may be requested at any time during the simulation. The toggle commands can be used on VHDL and Verilog designs.
Referencing source files with location maps See "System Initialization/Project File" (p413) for more information on modifying the modelsim.ini file. Also see "Installed technotes" (p28) for more information on Tcl commands. And see "Simulator control variables" (p253) for more information on Tcl variables.
Referencing source files with location maps Use these two steps to map your files: 1 Set the environment variable MGC_LOCATION_MAP to the path to your location map file. 2 Specify the mappings from physical pathnames to logical pathnames: $SRC /home/vhdl/src /usr/vhdl/src $IEEE /usr/modeltech/ieee Pathname syntax The logical pathnames must begin with $ and the physical pathnames must begin with /. The logical pathname is followed by one or more equivalent physical pathnames.
Modeling memory in VHDL Modeling memory in VHDL VHDL users might be tempted to model a memory using signals.
Modeling memory in VHDL entity memory is generic(add_bits : integer := 12; data_bits : integer := 32); port(add_in : in std_ulogic_vector(add_bits-1 downto 0); data_in : in std_ulogic_vector(data_bits-1 downto 0); data_out : out std_ulogic_vector (data_bits-1 downto 0); cs, mwrite : in std_ulogic; do_init : in std_ulogic); subtype word is std_ulogic_vector(data_bits-1 downto 0); constant nwords : integer := 2 ** add_bits; type ram_type is array(0 to nwords-1) of word; end; architecture style_93 of memory
Modeling memory in VHDL architecture style_87 of memory is begin memory: process (cs) ----------------------variable ram : ram_type; ----------------------variable address : natural; begin if rising_edge(cs) then address := sulv_to_natural(add_in); if (mwrite = '1') then ram(address) := data_in; data_out <= ram(address); else data_out <= ram(address); end if; end if; end process; end style_87; architecture bad_style_87 of memory is ---------------------signal ram : ram_type; ---------------------begin mem
Modeling memory in VHDL use std.standard.all; library ieee; use ieee.std_logic_1164.
Modeling memory in VHDL if (tempn mod 2) = 1 then x(i) := '1'; end if; tempn := tempn / 2; end loop; return x; end natural_to_sulv; end conversions; ModelSim EE/PLUS Reference Manual Tips and Techniques - 545
- Tips and Techniques ModelSim EE/PLUS Reference Manual
C - Using the FLEXlm License Manager Appendix contents Starting the license server daemon . . . . . Locating the license file. . . . . . . Manual start . . . . . . . . . . Automatic start at boot time . . . . . What to do if another application uses FLEXlm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548 548 548 549 549 Format of the license file . . . . . . . . . . . . . . . . 550 Format of the daemon options file . . . . . . .
Starting the license server daemon Starting the license server daemon Locating the license file When the license manager daemon is started, it must be able to find the license file. The default location is /usr/local/flexlm/licenses/license.dat. You can change where the daemon looks for the license file by one of two methods: • By starting the license manager using the -c option. • By setting the LM_LICENSE_FILE (p54) environment variable to the path of the file.
Starting the license server daemon cd //modeltech/ lmgrd -c license.dat >& report.log where ../ can be sun4, sunos5, hp700, or rs6000. This can be done by an ordinary user; you do not need to be logged in as root. Automatic start at boot time You can cause the license manager daemon to start automatically at boot time by adding the following line to the file /etc/rc.boot or to /etc/rc.local: //modeltech//lmgrd -c //license.
Format of the license file Format of the license file The ModelSim EE license files contain three types of lines: SERVER lines, DAEMON lines, and FEATURE lines.
Format of the daemon options file NOLOG Causes messages of the specified type to be filtered out of the daemon’s log output. To use the daemon options capability, you must create a daemon options file and list its pathname as the fourth field on the line that begins with DAEMON modeltech.
License administration tools License administration tools lmstat License administration is simplified by the lmstat utility. lmstat allows a user of FLEXlm to instantly monitor the status of all network licensing activities. lmstat allows a system administrator at a user site to monitor license management operations, including: • which daemons are running; • which users are using individual features; and • which users are using features served by a specific DAEMON.
License administration tools -s Displays the status of the specified server node(s). -t Sets the lmstat time-out to the specified value. lmdown The lmdown utility allows for the graceful shutdown of all license daemons (both lmgrd and all vendor daemons) on all nodes. Syntax lmdown -c [] If not supplied here, the license file used is in either /user/local/flexlm/licenses/ license.
lmreread The lmreread utility causes the license daemon to reread the license file and start any new vendor daemons that have been added. In addition, all preexisting daemons will be signaled to reread the license file for changes in feature licensing information. Syntax lmreread [daemon] [-c ] Note: If the -c option is used, the license file specified will be read by the daemon, not by lmgrd. lmgrd rereads the file it read originally.
Index A abort simulator command 257 Absolute time, see time add button simulator command 258 add list simulator command 260 add wave simulator command add_menu simulator command 264 add_menucb simulator command 266 add_menuitem simulator command 268 add_separator simulator command 269 add_submenu simulator command 270 alias simulator command 275 architecture simulator state variable 252 argc simulator state variable 252 arithmetic project file variable 416 Arrays indexes 250 slices 250 AssertionFormat proj
literals in commands 50 referencing environment variables 255 See ModelSim commands See VSIM commands VSIM Tcl commands 518 Comment characters in VSIM commands 67, 246 Compilation and Simulation 45–56 Compiling locating source errors 192 Verilog designs 46, 83 VHDL designs 46, 71 at a specified line number (-line ) 72 selected design units (-just eapbc) 72 standard package (-s) 74 Component declaration generating VHDL from Verilog 64 with vgencomp 64 configuration simulator state variable 252 Configurations
edit simulator command 308 Editing in notepad windows 125 in the Main window 125 in the Source window 125 EDITOR environment variable 54 Email Model Technology’s email address 31 enable_menu simulator command 310 enable_menuitem simulator command 311 enablebp simulator command 309 Entities selecting for simulation 99 entity simulator state variable 252 Environment displaying or changing pathname 312 environment simulator command 312 Environment variables 54 expanding with FindProjectEntry FLI function 470 f
assigning or overriding values with -g and -G 95 examining generic values 313 VHDL 58 getactivecursortime simulator command 322 getactivemarkertime simulator command 323 Graphic interface 103–243 GUI_expression_format 236 GUI expression builder 242 syntax 237 H Hazard detection, Verilog 50 Hazard project file variable (VCOM) 417 Hazard project file variable (VLOG) 418 HDL items defined 29 history shortcuts 247 HOME environment variable 54 Home page Model Technology’s home-page URL 31 I ieee project file v
License locating the license file 548 License project file variable 420 Licensing obtain your license 524 List window (see also, Windows) 131 ListDefaultIsTrigger simulator control variable 254 ListDefaultShortName simulator control variable 254 LM_LICENSE_FILE environment variable 54 Locating source errors during compilation 192 Location maps referencing source files 539 Log file of binary signal values 325 log simulator command 325 Logic Modeling hardware modeler instantiation 511 SmartModel changing the
vdir 78 vgencomp 79 vlib 81 vlog 83 vmake 88 vmap 89 vsim 91 wav2log 101 MODELSIM environment variable 55 modelsim ModelSim command 69 modelsim.ini, see Project files modelsim.
mti_GetVarValue 475 mti_GetVarValueIndirect 475 mti_HigherRegion 475 mti_Image 475 mti_Interp 475 mti_IsColdRestore 476 mti_IsFirstInit 476 mti_IsRestore 476 mti_Malloc 476 mti_NextProcess 476 mti_NextRegion 476 mti_NextSignal 476 mti_Now 476 mti_NowIndirect 477 mti_NowUpper 477 mti_PrintMessage 477 mti_Realloc 477 mti_RemoveRestoreCB 477 mti_RemoveSaveCB 477 mti_Resolution 477 mti_RestoreBlock 477 mti_RestoreChar 477 mti_RestoreLong 478 mti_RestoreProces 478 mti_RestoreShort 478 mti_RestoreString 478 mti_S
nowhen simulator command 336 NumericStdNoWarnings project file variable 420 NumericStdNoWarnings simulator control variable 254 O onbreak simulator command 337 onElabError simulator command 338 onerror simulator command 339 Online reference files 28 Operating systems supported 24 Optimize for std_logic_1164 194 Optimize_1164 project file variable 417 P Packages standard 42 textio 42 Parameters, for macros 534 PathSeparator project file variable 420 PathSeparator simulator control variable 254 pause simula
of signals in Wave window 272 specifying in List window 140 specifying in Signals window 153 to examine 314 radix simulator command 352 Rebuilding supplied libraries 43 record simulator command 353 Records changing values of 165 Reference files, online 28 Refreshing library images 43, 74, 85 Register variables adding to the Wave and List windows 154 displaying values in Signals window 150 saving values as binary log file 154 viewing waveforms 168 report simulator command 354 Resolution project file variable
creating a signal log file 325 displaying drivers of 306 displaying environment of 312 displaying in Dataflow window 127 displaying values in Signals window 150 examining values 313 finding 317 forcing signal and net values 152 indexing arrays 250 pathnames in VSIM commands 249 saving values as binary log file 154 selecting signal types to view 152 specifying force time 320 specifying radix of in List window 261 specifying radix of in Wave window 272 specifying radix of signal to examine 314 viewing wavefor
T tb simulator command 373 Tcl 513–520 command separator 516 command substitution 515 evaluation order 516 history shortcuts 247 Man Pages in Help menu 120 relational expression evaluation 516 simulator control variables 253 variable substitution 492, 517 Tcl file, see Project files Technical support 521 Text editing, see Editing Text strings finding in the List window 142 finding in the Wave window 180 TextIO package 425 alternative I/O files 429 containing hexadecimal numbers 428 dangling pointers 428 END
LD_LIBRARY_PATH, and SHLIB_PATH 457 MGC_HOME, and MGC_WD 457 simulator state variables iteration number 252 name of entity or module as a variable 252 resolution 252 simulation time 252 Variables, setting environment variables 54 modelsim.
source code viewing 156 VHDL93 project file variable 416 view simulator command 388 Viewing design hierarchy 114 VITAL compiling and simulating with accelerated VITAL packages 434 compliance warnings 433 obtaining the specification 432 VITAL packages 432 vlib ModelSim command 81 vlog ModelSim command 83 vlog simulator command 392 vmake ModelSim command 88 vmap ModelSim command 89 vmap simulator command 390 VSIM commands notation conventions 246 variables referenced in 252 abort 257 add list 260 add wave 271
play 341 power add 342 power report 343 power reset 344 printenv 345 property list 346 property wave 347 pwd 349 quietly 350 quit 351 radix 352 record 353 report 354 restart 356 restore 357 see also checkpoint/restore resume 358 right | left 359 run 361 seetime 366 shift 367 show 368 splitio 369 status 370 step 371 stop 372 tb (traceback) 373 toggle add 374 toggle report 376 toggle reset 375 transcribe 377 transcript 378 vcd add 379 vcd checkpoint 380 vcd comment 381 vcd file 382 vcd flush 384 vcd limit 385
adding buttons 230 Dataflow window 127 tracing signals and nets 129 List window 131 adding HDL items 137 adding signals with a log file 154 examining simulation results 141 formatting HDL items 139 locating time markers 112 output file 404 saving the format of 403 saving to a file 146 setting display properties 135 Main window 116 adding user-defined buttons 258 status bar 124 text editing 125 time and delta display 124 tool bar 122 Process window 147 displaying active processes 147 specifying next process
Thank you for purchasing ModelSim! Model Technology A M E N T O R G R A P H I C S C O M P A N Y