Technical data

when
ModelSim EE/PLUS Reference Manual Simulator Command Reference
-
399
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.
The formal BNF syntax is:
condition ::= Name | { expression }
expression ::= expression AND relation
| expression OR relation
| relation
relation ::= Name = Literal
| Name /= Literal
| Name ' EVENT
| ( expression )
Literal ::= '<char>' | “<bitstring>” | <bitstring>
Note:
The "=" operator can occur only between a Name and a Literal. This means that you cannot compare
the value of two signals, i.e., Name = Name is not possible.
{<command>}
Can be any VSIM or Tcl command or series of commands with one exception, the
run
command (p361) may not be used with the
when
command. Required. The command
sequence usually contains the
stop
command (p372) that sets a flag to break the simulation
run after the command sequence is completed. Multiple-line commands can be used.
Examples
The when command below instructs the simulator to display the value of item c in
binary format when there is a clock event, the clock is 1, and the value of b is
01100111, and then to stop.
when -label when1 {clk’event and clk=’1’ and b = “01100111”}{
echo “Signal c is [exa -bin c]"
stop }
The
when
command below is labeled “a” and will cause VSIM to echo the
message “b changed” whenever the value of the item b changes.
when -label a b {echo “b changed”}