Motorola dsp assembler Reference Manual



Yüklə 4,8 Kb.
Pdf görüntüsü
səhifə14/91
tarix08.10.2017
ölçüsü4,8 Kb.
#3546
1   ...   10   11   12   13   14   15   16   17   ...   91

Expressions
Operator Precedence
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
3-7
3.6.6
  Logical operators
Logical AND
(&&)
Logical OR
(||)
The logical AND operator returns an integer 1 if both of its operands are nonzero; other-
wise, it returns an integer 0.
The logical OR operator returns an integer 1 if either of its operands is nonzero; otherwise
it returns an integer 0.
The types of the operands may be either integer or floating point; the memory space at-
tribute of the result is None.  Logical operators are primarily intended for use with the con-
ditional assembly IF directive, but can be used in any expression.
3.7
  OPERATOR PRECEDENCE
Expressions are evaluated with the following operator precedence:
1.  parenthetical expression (innermost first)
2.  unary plus, unary minus, one’s complement, logical negation
3.  multiplication, division, mod
4.  addition, subtraction
5.  shift
6.  relational operators:   less, less or equal, greater, greater or equal
7.  relational operators:  equal, not equal
8.  bitwise AND, OR, EOR
9.  logical AND, OR
Operators of the same precedence are evaluated left to right.  Valid operands include nu-
meric constants, literal ASCII strings, and symbols.  The one’s complement, shift, and bit-
wise operators cannot be applied to floating point operands.  That is, if the evaluation of
an expression (after operator precedence has been applied) results in a floating point
number on either side of any of these operators, an error will be generated.
3.8
  FUNCTIONS
The Assembler has several built-in functions to support data conversion, string compari-
son, and transcendental math computations.  Functions may be used as terms in any ar-
bitrary expression.  Functions may have zero or more arguments, but must always be
followed by open and closed parentheses.  Function arguments which are expressions
must be absolute expressions except where noted.  Arguments containing external refer-
ences are not allowed.  There must be no intervening spaces between the function name


Expressions
Functions
3-8
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
and the opening parenthesis, and there must be no spaces between comma-separated
arguments.
Assembler functions can be grouped into five types:
1.  Mathematical functions
2.  Conversion functions
3.  String functions
4.  Macro functions
5.  Assembler mode functions
3.8.1
  Mathematical Functions
The mathematical functions comprise transcendental, random value, and min/max func-
tions, among others:
ABS
- Absolute value
ACS
- Arc cosine
ASN - 
Arc 
sine
AT2
- Arc tangent
ATN
- Arc tangent
CEL
- Ceiling function
COH
- Hyperbolic cosine
COS
- Cosine
FLR
- Floor function
L10
- Log base 10
LOG
- Natural logarithm
MAX
- Maximum value
MIN
- Minimum value
POW
- Raise to a power
RND
- Random value
SGN
- Return sign
SIN
- Sine
SNH
- Hyperbolic sine
SQT
- Square root
TAN
- Tangent
TNH
- Hyperbolic tangent
XPN
- Exponential function


Expressions
Functions
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
3-9
3.8.2
  Conversion Functions
The conversion functions provide conversion between integer, floating point, and fixed
point fractional values:
CVF
- Convert integer to floating point
CVI
- Convert floating point to integer
CVS
- Convert memory space
FLD
- Shift and mask operation
FRC
- Convert floating point to fractional
LFR
- Convert floating point to long fractional
LNG
- Concatenate to double word
LUN
- Convert long fractional to floating point
RVB
- Reverse bits in field
UNF
- Convert fractional to floating point
3.8.3
  String Functions
String functions compare strings, return the length of a string, and return the position of a
substring within a string:
LEN
- Length of string
POS
- Position of substring in string
SCP
- Compare strings
3.8.4
  Macro Functions
Macro functions return information about macros:
ARG
- Macro argument function
CNT
- Macro argument count
MAC
- Macro definition function
MXP
- Macro expansion function


Expressions
Functions
3-10
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
3.8.5
  Assembler Mode Functions
Miscellaneous functions having to do with Assembler operation:
CCC
- Cumulative cycle count
CHK
- Current instruction/data checksum
CTR
- Location counter type
DEF
- Symbol definition function
EXP
- Expression check
INT
- Integer check
LCV
- Location counter value
LST
LIST directive flag value
MSP
- Memory space
REL
- Relative mode function
Individual descriptions of each of the Assembler functions follow.  They include usage
guidelines, functional descriptions, and examples.
@ABS()
Returns the absolute value of  as a floating point value.  The memory
space attribute of the result will be None.
Example:
MOVE
#@ABS(VAL),D4.S
; load absolute value
@ACS()
Returns the arc cosine of  as a floating point value in the range zero
to pi.  The result of  must be between -1 and 1.  The memory space
attribute of the result will be None.
Example:
ACOS
=
@ACS(-1.0)
; ACOS  =  3.141593
@ARG( | )
Returns integer 1 if the macro argument represented by  or
is present, 0 otherwise.  If the argument is a symbol it must be single-quoted and
refer to a dummy argument name.  If the argument is an expression it refers to the
ordinal position of the argument in the macro dummy argument list.  A warning will
be issued if this function is used when no macro expansion is active.  The memory
space attribute of the result will be None.
Example:
IF
@ARG(TWIDDLE)
; twiddle factor provided?


Yüklə 4,8 Kb.

Dostları ilə paylaş:
1   ...   10   11   12   13   14   15   16   17   ...   91




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə