
Most driver statement operands may be expressions. Expressions are formed just as they are in most programming languages. The simplest expressions are variable names, net names, and numbers. Numbers may be specified in decimal, octal, or hexadecimal. Decimal numbers begin with a non-zero digit and contain only the digits 0-9. Octal numbers begin with a zero and contain only the digits 0-7. Hexadecimal numbers begin with the characters 0x or 0X and contain only the digits 0-9 and a-f (A-F may also be used).
The operators +, -, *, and / may be used to perform addition, subtraction, multiplication and division. Unary + and - may also be used. (Warning though, all driver variables and all nets are treated as unsigned integers.)
The operator "->" may be used to assign a value to a variable or to a net. The form of this expression is <value>-><variable> or <value>-><net>. The assignment expression has a value equal to the value assigned to the variable or net.
The operators ==, !=, <, >, <=, and >= may be used to do equal, not equal, less than, greater than, less than or equal to, and greater than or equal to comparisons. Thus to compare a variable xyz equal to 5, use the expression xyz==5. A comparison operator will produce the value 1 if the comparison is true and 0 if the comparison is false. This value may be used, in an arbitrary way, in other expressions. The operator "==" may be abbreviated as "=".
The operators &, |, and ! (the AND, OR, and NOT functions) may be used to create complex conditions. These operators treat any non-zero value as true and zero as false. They produce 1 for a true result and 0 for a false result. This result may be used arbitrarily in other expressions.
A set of expressions may be evaluated by separating them with commas as in the following.
0x64->a,2->b,3->c
If an expression of this form is used in another expression, its value is the value of the last expression.
Operator priority is given from low to high in the following table. The table also indicates whether a particular operator is left-associative, right-associative, or non-associative. Operators of equal precedence are listed on the same line.
right , (comma)
left ->
right !
left |
left &
non as. == != < > <= >=
right Unary + Unary -
left + -
left * /