[ Excluded figure or table. ] Simulator Command DictionaryNotation Conventions QuickHDL User's and Reference Manual, 8.5_4.6c 8-1 Chapter 8 Simulator Command Dictionary The simulator commands used to control the QuickHDL simulator are described in this section. These commands are valid only after loading a design by using the qhsim command or the graphical interface. The commands here are entered either in macro files or on the command line of the main window and are not case-sensitive. The commands are also automatically entered on the command line when you use the graphical user interface of the QuickHDL simulator. Note that in addition to the commands documented in this section, you can add the Tcl commands described in Appendices E and F. A qhsim command switch determines which set of commands is enabled. The larger set Ð all those in this section plus the Tcl commands Ð is the default. Appendix G, Tips and Techniques, gives additional information on using several of the commands in this section. This additional information is referenced from the ªSee alsoº section of these commands. The subsections below describe the notation conventions for the commands. Following this are detailed descriptions of each command in alphabetical order by command name. Notation Conventions The syntax elements of the commands are signified as follows: < >Angled brackets surrounding a syntax item indicate a user-defined argument. Do not enter the brackets in commands. [ Excluded figure or table. ] QuickHDL User's and Reference Manual, 8.5_4.6c 8-2 Notation ConventionsSimulator Command Dictionary [ ]Square brackets indicate an optional item; if the brackets surround several words, all must be entered as a group. The brackets are not entered. ¼An ellipsis follows an item that may appear more than once. The ellipsis itself does not appear in commands. |The vertical bar indicates a choice between items on either side of it. Do not include the bar in the command. UPPERcaseUppercase letters in the command syntax are required; lowercase letters may be omitted. [ Excluded figure or table. ] Because Verilog identifiers are case sensitive, identifiers in simulation commands are case sensitive by default. VHDL identifiers are considered to be lower case. For example, to use the simulation command examine on the value of a Verilog register named MyRegister, you would type the following: examine MyRegister To avoid case-mismatching problems, the TCL variable ObjectsCaseSensitivite and the corresponding entry in the quickhdl.ini file are ignored. For more information, see ªCase Sensitivity Requirements in VHDL/Verilog Instantiationsº on page 4-8 monospaced Monospaced type is used in examples. -- #Comments are preceded by the number sign (#) or by two hyphens (--). Numbers in non-decimal radixes are expressed using the form: -radix#value where: ±Indicates a negative number. [ Excluded figure or table. ] Simulator Command DictionarySignal Pathnames QuickHDL User's and Reference Manual, 8.5_4.6c 8-3 radixCan be any base in the range 2 through 16. By default, numbers are assumed to be decimal. #Is a required delimiter between the radix and the value. valueSpecifies the numeric value, expressed in the specified radix. Signal Pathnames Signals are organized hierarchically. Each package, block statement, and component instantiation statement creates a new level in the hierarchy. Signal names can be absolute or relative. Absolute names are preceded by a slash (/), which signifies the top level. Relative pathnames are relative to the current signal environment. The special names referring to the current signal environment (.) and the parent environment (..) can also be used. [ Excluded figure or table. ] By default, the slash (/) is used as the separator in hierarchical names. If you want to use a period (.) instead, you can set the VerilogNaming variable to 1, as follows: set VerilogNaming 1 For more information on signal environments, see the environment command on page 8-38. Array signals can be sliced or indexed. Indexes must be numeric, since the simulator does not know the actual index types. Fields in record signals can be specified using the form: signal_name.field_name Examples clkSpecifies the signal clk in the current environment. /clkSpecifies the signal clk in the top-level design unit. (These are equivalent if the environment is /.) [ Excluded figure or table. ] QuickHDL User's and Reference Manual, 8.5_4.6c 8-4 Wildcard CharactersSimulator Command Dictionary /block1/u2/clkSpecifies the signal clk, two levels down from the top-level design unit. block1/u2/clkSpecifies the signal clk, two levels down from the current environment. (This and the previous example are equivalent if the environment is /.) array_sig(4)Specifies an index of an array signal. array_sig(1 to 10) Specifies a slice of an array signal. record_sig.field Specifies a field of a record. Wildcard Characters Wildcard characters can be used in signal names in some simulator commands. Conventions for wildcards are as follows: *Matches any sequence of characters. ?Matches any single character. You can use square brackets [ ] in wildcard specifications if you place the entire name in curly braces { }: {[abcd]}Matches any character in the specified set. {[a±d]}Matches any character in the specified range. {[^a±d]}Matches any character not in the set. Examples *Matches all signals. {*[0-9]}Matches all signals ending in a digit. [ Excluded figure or table. ] Simulator Command DictionaryValues of VHDL Objects QuickHDL User's and Reference Manual, 8.5_4.6c 8-5 {?in*[0-9]}Matches such signal names as pin1, fin9, and binary2. Values of VHDL Objects Values of VHDL objects, such as variables and signals, can be referenced in simulator commands by preceding the name of the VHDL object with the percent % character. For example: ... if {%counter = 23} ... ... Values of VHDL variables can only be accessed after a step command or at a breakpoint in the VHDL region in which they exist. If you want to prevent the percent sign from being interpreted as a VHDL object, double the percent sign. For example, %%counter will not be interpreted as a VHDL object. If you need more flexibility in specifying the radix of the VHDL variable, use Tcl command substitution. For example: ... if { [examine -bin counter] = ª01101110 } ... Variables Variables can be referenced in simulator commands by preceding the name of the variable with the dollar sign ($) character. The simulator looks first for the simulator state variables, then UNIX environment variables, then simulator control variables and user-defined variables. Simulator State Variables The available simulator variables are listed below. Note that case is not important. $nRepresents a macro parameter, where n can be an integer in the range 1-9. [ Excluded figure or table. ] QuickHDL User's and Reference Manual, 8.5_4.6c 8-6 VariablesSimulator Command Dictionary argcReturns the total number of macro parameters passed. $architectureReturns the name of the top-level architecture currently being simulated. For a configuration, this variable returns an empty string. $deltaReturns the number of the current simulator iteration. $entityReturns the name of the top-level entity currently being simulated. $envReturns the pathname of the current signal environment. $nowReturns the current simulation time, which is a number expressed in the current simulation time resolution. $resolutionReturns the current simulation time resolution. For example: echo ªThe time is $now $resolution.º The example will result in: The time is 12390 microseconds. If you want to prevent the dollar sign as denoting a simulator variable, repeat the dollar sign. For example, $$now will not be interpreted as the current simulator time. Verilog Literals Verilog style literals are allowed in a QHSIM command. You may use either Verilog or VHDL style literals independent of the type of object operated on. For example, the following command may modify either a Verilog or VHDL variable: change var ©hff [ Excluded figure or table. ] Simulator Command DictionaryVariables QuickHDL User's and Reference Manual, 8.5_4.6c 8-7 Simulator Control Variables When you are running qhsim in the Tcl mode, there are a number of predefined Tcl variables that control aspects of the simulator that were previously only accessible via the quickhdl.ini file or a dialog box in the graphical interface. These control variables are shown in Table 8-1. Table 8-1. Simulator Control Variables Variable Name Value Range Purpose BreakOnAssertion 0-4 Defines severity of assertion that causes a simulation break (0 = note, 2 = error, 3 = failure, 4 = fatal) CheckpointCompress Mode 0,1 If 1, checkpoint/restore files are compressed DefaultForceKind freeze, drive, or deposit If 1, checkpoint/restore files are compressed DefaultRadix 0, 2, 8, 10, 16 same as Default Radix field of Main>Props simulation category popup menu. DelayFileOpen 0, 1 same as DefaultFileOpen field of quickhdl.ini file EnableXdefaultsWrite 0, 1 if 1, enables writing of the $HOME/.Xdefaults file when qhsim colors are changed. IgnoreNote 0,1 If 1, ignore assertion notes IgnoreWarning 0,1 If 1, ignore assertion warnings IgnoreError 0,1 If 1, ignore assertion errors IgnoreFailure 0,1 If 1, ignore assertion failures InterpolateAnalog 0, 1 if 1, draws diagonal lines between successive analog values, otherwise draws rectilinear lines. IterationLimit positive integer Limit on simulation kernel iterations during one time delta [ Excluded figure or table. ] QuickHDL User's and Reference Manual, 8.5_4.6c 8-8 VariablesSimulator Command Dictionary Table 8-1. Simulator Control Variables [continued] ListCollapseDeltas 0, 1 same as the Deltas field of the List>Props>Defaults popup. A1 indicates that deltas will be collapsed. ListDefaultsTrigger 0, 1 Same as the Trigger field of the List>Props>Defaults popup. A 1 indicates that signals will trigger the list display. List DefaultShortName 0, 1 Same as the Trigger field of the List>Props>Defaults popup. A 1 corresponds to Short Name and to Full Name. ListStrobePeriod positive integer same as the Strobe Period field of the List>Props>Triggers popup menu. ListStrobeStart positive integer same as the ªFirst strobe atº field of the List>Props>Triggers popup menu. ListUseSignalTriggers 0, 1 same as the Signals button of the Trigger on field of the List>Props>Triggers popup. A 1 indicates that signal triggering is active. ListUseStrobe 0, 1 same as the Signals button of the Trigger on field of the List>Props>Triggers popup. A 1 indicates that strobe is active. NumericStdNo Warnings 0, 1 if a 1, warnings generated within the accelerated numeric_std and numeric_bit packages are suppressed ObjectsCaseSensitive 0,1 NOTE: This variable and the corresponding quickhdl.ini entry are currently ignored by QuickHDL. RunLength positive integer Default simulation length, in units of simulation resolution SignalViewMask 0-15 determines what kinds of signals are displayed. the value is a sum of the following: view input 1 view outputs 2 view inouts 4 view internals 8 [ Excluded figure or table. ] Simulator Command DictionaryVariables QuickHDL User's and Reference Manual, 8.5_4.6c 8-9 Table 8-1. Simulator Control Variables [continued] StdArithNoWarnings 0, 1 if a 1, warnings generated within the accelerated Synopsys packages suppressed SupressTclResult 0,1 If 1, all qhsim command -quiet switches are activated and all Tcl command results are suppressed from the screen display TclEscapeString string Characters that are allowed to follow a backslash and be interpreted as a Tcl escape sequence (if UseTclEscapes is ªonº) UseTclEscapes on, off If ªoffº, all printable characters except the backslash (\) and double quote (ª) are allowed to follow the \ at the beginning of an extended identifier appearing in Tcl command; If ªonº, those defined in the TclEscapeString are interpreted as Tcl escape sequences VerilogNaming 0, 1 if a 1, hierarchical paths are entered on the command line and printed in Verilog notation. Extended identifiers my be entered using Verilog notation. WaveSignalName Width positive integer same as the Max Signal Name Width field of the Wave>Props>Display popup menu. Because Verilog identifiers are case sensitive, identifiers in qhsim commands are now case sensitive by default. VHDL identifiers are considered to be lower case. For example, to examine the value of a Verilog register named MyRegister, you would type the following qhsim command: examine MyRegister Note that the commands tcl_escapes and set_tcl_escapes have the same effect as the last two variables in the preceding table. User-Defined Variables User-defined variables are available with the set command. Like simulator variables, user-defined variables are preceded by a dollar sign when referenced. Create a variable with the set command: [ Excluded figure or table. ] QuickHDL User's and Reference Manual, 8.5_4.6c 8-10 Simulation Time UnitsSimulator Command Dictionary set var user1 Use the variable in a command like: echo ªuser1 = $user1º In prior releases, the backslash (\) was used to prevent the dollar sign ($) and per cent character (%) from being interpreted as references to simulator variables or to VHDL objects. In VHDL 93, the backslash is used to delimit extended identifiers, so to escape the dollar sign or per cent sign, use two of the characters, as in this example: ECHO ª$$now = $nowº FORCE string_signal ªstring with %% embeddedº Simulation Time Units You can specify the time unit for delays in all the simulator commands: force clk 1 50 ns, 1 100 ns -repeat 1 us run 2 ms Note that all the time units in a simulator command need not be the same. Unless you specify otherwise as in the examples above, simulation time is always expressed using the resolution units that are specified at the beginning of a simulation session in the Startup window. By default, the specified time units are assumed to be relative to the current time unless the value is preceded by the character @, which signifies an absolute time specification. [ Excluded figure or table. ] Simulator Command DictionarySimulation Time Units QuickHDL User's and Reference Manual, 8.5_4.6c 8-11 abort The abort command halts the execution of a macro file interrupted by a breakpoint. Usage ABOrt See also onbreak resume run [ Excluded figure or table. ] QuickHDL User's and Reference Manual, 8.5_4.6c 8-12 Simulation Time UnitsSimulator Command Dictionary bd The bd command deletes a breakpoint. Usage BD Arguments - Specifies the name of the VHDL source file in which the breakpoint is to be deleted. 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. Examples bd alu.vhd 127 Deletes the breakpoint at line 127 in the source file named alu.vhd. [ Excluded figure or table. ] Simulator Command DictionarySimulation Time Units QuickHDL User's and Reference Manual, 8.5_4.6c 8-13 bp The bp (breakpoint) command sets a breakpoint. If the source file name and line number are omitted, 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. Usage BP [ [ { ¼ } ] ] Arguments -filename Specifies the name of the VHDL source file in which the breakpoint is to be set; if omitted, all current breakpoints are listed. -line_number Specifies the line number at which the breakpoint is to be set; if omitted, all current breakpoints are listed. -command Specifies one or more QuickHDL commands that are to be executed at the breakpoint. Optional. Any text that follows the line number is treated as a command. Multiple commands must be separated by semicolons (;) unless Tcl is used, in which case commands may be placed on multiple lines. When Tcl is used, the entire command must be placed within curly braces, { }. You many include a continue command as the last command in the bp command string. It is an error to execute any commands within a bp command string following a continue, run, or step command. This applies if macros are used with the bp command string as well. A resume command should not be used. If many commands are needed after the breakpoint, they can be placed in a macro file. [ Excluded figure or table. ] QuickHDL User's and Reference Manual, 8.5_4.6c 8-14 Simulation Time UnitsSimulator Command Dictionary Examples bp Lists all existing breakpoints, together with the source file names and any commands that have been assigned to breakpoints. bp alu.vhd 147 Sets a breakpoint in the VHDL 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 {exa var1; exa var2} Sets a breakpoint at line 22 of the file test.vhd and examines the values of variables var1 and var2. bp test.vhd 14 if $$now /= 100 cont; endif bp test.vhd 14 {if {$now /= 100} then {cont} } Non-Tcl and Tcl versions are shown above. Sets a breakpoint in every instantiation of the file test.vhd at line 14. When that breakpoint is executed, the command is run. This command causes the simulator to continue if the current simulation time is not 100. [ Excluded figure or table. ] Using two dollar signs ($$) prevents the $now variable from being evaluated until the breakpoint. Otherwise, it would be evaluated when the bp command is entered. In Tcl, two dollar signs are not needed because the curly braces postpone evaluation of everything they enclose. [ Excluded figure or table. ] Simulator Command DictionarySimulation Time Units QuickHDL User's and Reference Manual, 8.5_4.6c 8-15 change The change command modifies the value of a variable. The simulator must be at a breakpoint or paused after a step command. Usage CHAnge Arguments -variable Specifies the name of a variable. The variable 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. -value Defines a value for the variable. The specified value must be appropriate for the type of the variable. Examples cha count 16#FFFF Changes the value of the variable count to the hexadecimal value FFFF. See also force [ Excluded figure or table. ] QuickHDL User's and Reference Manual, 8.5_4.6c 8-16 Simulation Time UnitsSimulator Command Dictionary 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 ] ... Description of Contention Checking Bus contention checking detects bus fights on nodes that have multiple drivers. A bus fight occurs when two or more drivers drive a node with the same strength and that strength is the strongest of all drivers currently driving the node. The following table provides some examples for two drivers driving a std_logic signal: Table 8-2. Bus Contention Examples driver 1 driver 2 fight Z Z no 0 0 yes 1 Z no 0 1 yes L 1 no L H yes Detection of a bus fight results in an error message specifying the node and its drivers current driving values. If a node©s drivers later change value and the node is still in contention, a message is issued giving the new values of the drivers. A message is also issued when the contention ends. The bus contention checking commands can be used on VHDL and Verilog designs. [ Excluded figure or table. ] Simulator Command DictionarySimulation Time Units QuickHDL User's and Reference Manual, 8.5_4.6c 8-17 Arguments ±rSpecifies that contention checking is enabled recursively into subregions. Optional; if omitted, contention check enabling is limited to the current region. ±inEnables checking on nodes of mode IN. Optional. ±outEnables checking on nodes of mode OUT. Optional. ±inoutEnables checking on nodes of mode INOUT. Optional. ±internalEnables checking on internal items. Optional. ±portsEnables checking on nodes of modes IN, OUT, or INOUT. Optional. Enables checking for the named node. See also check contention config check contention off ªBus Contention Checkingº on page G-11 [ Excluded figure or table. ] QuickHDL User's and Reference Manual, 8.5_4.6c 8-18 Simulation Time UnitsSimulator Command Dictionary 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 ] [-command Description See ªDescription of Contention Checkingº on page 8-16 Arguments ±file Specifies a file to write contention 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 in contention. Optional. Contention is detected if a node is in contention for as long as or longer than the limit. The default limit is 0. -command switch allows the report to be generated by a custom TCL command that takes 6 arguments and gets called in the following sequence: -init {} {} {} {} This call occurs once and the filename argument value is determined by the -file option (can be an empty string). -violation This call occurs for each violation. The signalname argument is the hierarchical name of the signal. The start argument is the time that the signal contention started. The finish argument is the time that the violation is reported. The duration is the difference between start [ Excluded figure or table. ] Simulator Command DictionarySimulation Time Units QuickHDL User's and Reference Manual, 8.5_4.6c 8-19 and finish. The limit argument is the constraint specified with the - time option (0 if not specified). The times are strings that include the resolution (for example: ª100 nsº). -driver {} {} {} Each violation is followed by two or more of these calls. The drivername argument is the hierarchical name of the driving process or driving output port. The drivervalue argument is the value of the driver. -end {} {} {} {} {} This call terminates the list of drivers. -done {} {} {} {} {} This call occurs at the end of the simulation. Contention Message Reporting There is no explicit command to view the message file. The default error message format look like the following: ** Error: Contention violation on /test/sig(1). Now: 130 ns Start: 120 ns Duration: 10 ns Constraint: 5 ns /test/a/n01 = 0 /test/b/n01 = 1 ** Error: Contention violation on /test/sig(1). Now: 140 ns Start: 130 ns Duration: 10 ns Constraint: 5 ns /test/a/n01 = 0 /test/b/n01 = 1 /test/c/n02 = 1 where /test/a is the instance and n01 is the pin, etc. If the contention time was less than 5 ns, then no error would occur in this example. You can customize the report format through the -command usage model. [ Excluded figure or table. ] QuickHDL User's and Reference Manual, 8.5_4.6c 8-20 Simulation Time UnitsSimulator Command Dictionary Checkpoint/Reset. When the designer checkpoints a design, the message file is closed. When a designer resets the simulator the contention checking mode and configuration are retained. See also ªBus Contention Checkingº on page G-11 [ Excluded figure or table. ] Simulator Command DictionarySimulation Time Units QuickHDL User's and Reference Manual, 8.5_4.6c 8-21 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 ] ... Description See ªDescription of Contention Checkingº on page 8-16 Arguments ±allDisables contention checking for all nodes that have checking enabled. Optional. ±rSpecifies that contention checking is disabled recursively into subregions. Optional; if omitted, contention check disabling is limited to the current region. ±inDisables checking on nodes of mode IN. Optional. ±outDisables checking on nodes of mode OUT. Optional. ±inoutDisables checking on nodes of mode INOUT. Optional. ±internalDisables checking on internal items. Optional. ±portsDisables checking on nodes of modes IN, OUT, or INOUT. Optional. Disables checking for the named node. See also check contention add check contention config ªBus Contention Checkingº on page G-11 [ Excluded figure or table. ] QuickHDL User's and Reference Manual, 8.5_4.6c 8-22 Simulation Time UnitsSimulator Command Dictionary 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 ] ... Description of 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. Detection of a float violation results in an error message identifying the node. A message is also issued when the float violation ends. The bus float checking commands can be used on VHDL and Verilog designs. Arguments ±rSpecifies that float checking is enabled recursively into subregions. Optional; if omitted, float check enabling is limited to the current region. ±inEnables checking on nodes of mode IN. Optional. ±outEnables checking on nodes of mode OUT. Optional. ±inoutEnables checking on nodes of mode INOUT. Optional. ±internalEnables checking on internal items. Optional. ±portsEnables checking on nodes of modes IN, OUT, or INOUT. Optional. Enables checking for the named node. [ Excluded figure or table. ] Simulator Command DictionarySimulation Time Units QuickHDL User's and Reference Manual, 8.5_4.6c 8-23 See also ªBus Float Checkingº on page G-12 [ Excluded figure or table. ] QuickHDL User's and Reference Manual, 8.5_4.6c 8-24 Simulation Time UnitsSimulator Command Dictionary check float config The check float config command allow 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 ] Description See ªDescription of Float Checkingº on page 8-22 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. An error is detected if a node is floating for as long as or longer than the limit. The default limit is 0. See also ªBus Float Checkingº on page G-12 [ Excluded figure or table. ] Simulator Command DictionarySimulation Time Units QuickHDL User's and Reference Manual, 8.5_4.6c 8-25 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 ] ... Description See ªDescription of Float Checkingº on page 8-22 Arguments ±allDisables float checking for all nodes that have checking enabled. Optional. ±rSpecifies that float checking is disabled recursively into subregions. Optional; if omitted, float check disabling is limited to the current region. ±inDisables checking on nodes of mode IN. Optional. ±outDisables checking on nodes of mode OUT. Optional. ±inoutDisables checking on nodes of mode INOUT. Optional. ±internalDisables checking on internal items. Optional. ±portsDisables checking on nodes of modes IN, OUT, or INOUT. Optional. Disables checking for the named node. See also ªBus Float Checkingº on page G-12 [ Excluded figure or table. ] QuickHDL User's and Reference Manual, 8.5_4.6c 8-26 Simulation Time UnitsSimulator Command Dictionary 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