1 expression block operation – Micromod MOD: 1800P - MOD 30ML Identity Module (Version 2) Algorithms, Tables and Sequential Logic Functions User Manual
Page 14

Logic Functions - Book 2
EXPRESSION BLOCK
8-6
8.2.1
Expression Block Operation
Operator precedence in an expression starts with the unary (single operand) operators and
continues with the binary (double operand) operators. The order of evaluation can be
changed using parentheses or the conditional operators. The order of precedence is:
1.
**
(RAISED_TO_THE_POWER)
2.
SQRT
(SQUARE_ROOT),
MOM
(MOMENTARY),
!
(Logical NOT),
ABS
(ABSOLUTE),
EXP
(EXPONENTIAL),
NLOG (NATURAL_LOG),
LOG
(LOG_10),
INT
(INTEGER)
3.
*
(TIMES),
/
(DIVIDE),
4.
+
(PLUS),
–
(MINUS)
NOTE:
May be interpreted as a sign if immediately before mnemonic
(I1+I2). Use I1++I2 or I1+ I2 to be sure.
5.
<
(LESS_THAN),
>
(GREATER_THAN),
<=
(LESS_THAN_OR_EQUAL),
>=
(GREATER_THAN_OR_EQUAL),
6.
==
(EQUALS),
!=
(UNEQUAL)
7.
&&
(Logical AND)
8.
| |
(Logical OR)
Data Considerations During Evaluation
For Boolean operators, data of any type is considered TRUE if non-zero. For logical
operations, all operands are scaled to DISCRETE during evaluation.
For comparison or arithmetic operations, all operands are scaled to floating point during
evaluation. DATE operands are expanded to include the century and treated as 4 byte
unsigned integers. Prior to applying the operator(s), if the year is in the range 0–89, 100 is
added to make comparisons work properly across the calendar year 2000 (valid for 1990 to
2089). Thus 3/18/95 (stored internally as $5F0312) is treated as $005F0312, or decimal
6226706, while 7/25/2012, (stored internally as $0C0719) is treated as $00700719, or decimal
7341849. HEX and ASCII operands are not allowed.
Evaluation Results
The result of an expression evaluation is DISCRETE if the last operator processed was
logical, or FLOATING POINT if it was arithmetic. This result is then scaled to the configured
data types for the result and auxiliary result outputs of the expression block.
The MOMENTARY Operator
The MOMENTARY operator allows a user to embed an ‘edge detection’ in an expression.
The result of the MOMENTARY operation is TRUE only if its operand was FALSE in the most
recent evaluation and is now TRUE. Note that the MOMENTARY operator is distinct from the
MOMENTARY DISCRETE input data type.
The INTEGER Operator