Motorola dsp assembler Reference Manual



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

MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
3-1
Chapter 3
 EXPRESSIONS
3.1
  INTRODUCTION
An expression represents a value which is used as an operand in an Assembler instruc-
tion or directive.  An expression is a combination of symbols, constants, operators, and
parentheses.  Expressions may contain user-defined labels and their associated integer
or floating point values, and/or any combination of integers, floating point numbers, or
ASCII literal strings.  In general, white space (a blank or tab) is not allowed between the
terms and operators of an Assembler expression.  Expressions otherwise follow the con-
ventional rules of algebra and boolean arithmetic.
3.2
  ABSOLUTE AND RELATIVE EXPRESSIONS
An expression may be either relative or absolute.  An absolute expression is one which
consists only of absolute terms, or is the result of two relative terms with opposing signs.
A relative expression consists of a relative term by itself or only in combination with abso-
lute terms.
When the Assembler is operating in relative mode all address expressions must adhere
to the above definitions for absolute or relative expressions.  This is because only these
types of expressions will retain a meaningful value after program relocation.  For example,
when relative terms are paired with opposing signs, the result is the difference between
the two relative terms, which is an absolute value.  However, if two positive relative terms
are added together the result is unpredictable based on the computed values of the terms
at relocation time.
3.3
  EXPRESSION MEMORY SPACE ATTRIBUTE
A symbol is associated with either an integer or a floating point value which is used in
place of the symbol during the expression evaluation. Each symbol also carries a memory
space attribute of either XYLProgram, EMI, or None. Constants and floating point ex-
pressions always have a memory space attribute of None. The result of an expression will
always have a memory space attribute associated with it. The unary logical negate oper-
ator, relational operators, and some functions return values that have a memory space at-
tribute of N. The result of an expression that has only one operand (and possibly the unary
negate or unary minus operator) always has the memory attribute of that operand. Ex-


Expressions
Expression Memory Space Attribute
3-2
DSP ASSEMBLER REFERENCE MANUAL
MOTOROLA
pressions that involve two or more operands and operators other than those mentioned
above derive the memory space attribute of the result by examining the operands on the
left and right side of an operator as shown in the following chart:
Left Operand Memory Space Attribute
     
X
Y
L
P
EN
Right Operand
X
X
*
X
*
*X
Memory Space
Attribute
Y
*
Y
Y
*
*Y
L
X
Y
L
*
*L
P
*
*
*
P
*P
E
*
*
*
*
EE
N
X
Y
L
P
EN
* = Represents an illegal operation that will result in an error.
Notice that L memory space is regarded as a union of both X and Y space.  In expressions
that have one element that has a memory space attribute of L and another element with
a memory space attribute of either X or Y, the result will have the more restrictive memory
space attribute (X or Y).
The memory space attribute is regarded by the Assembler as a type, in the same sense
that high level languages use type for variables. Symbols that are assigned memory
space attributes of XYLP, or E are assumed to be addresses and therefore can only
have values between zero and the maximum address of the target processor. Only sym-
bols that have a memory space attribute of N can have values greater than the maximum
address of the target machine.
Memory space attributes become important when an expression is used as an address.
Errors will occur when the memory space attribute of the expression result does not match
the explicit or implicit memory space specified in the source code.  Memory spaces are
explicit when the address has any of the following forms:
X:
 
Y:

L:

P:

E:

The memory space is implicitly P when an address is used as the operand of a DO,
branch, or jump-type instruction.


Expressions
Internal Expression Representation
MOTOROLA
DSP ASSEMBLER REFERENCE MANUAL
3-3
Expressions used for immediate addressing can have any memory space attribute.
3.4
  INTERNAL EXPRESSION REPRESENTATION
Expression value representation internal to the Assembler is dependent on the word size
of the target processor.  The Assembler supports a word and a double word integer format
internally.  The actual storage size of an expression value is dependent upon the magni-
tude of the result, but the Assembler is capable of representing signed integers up to 64
bits in length.  These longer integer representations are useful when performing data ini-
tialization in L memory space.
Internal floating point representation is almost entirely dependent upon the host environ-
ment, but in general floating point values are stored in double precision format.  This
means that there are ordinarily 64 bits of storage allotted for a floating point number by
the Assembler, with 11 bits of exponent, 53 bits of mantissa, and an implied binary point.
3.5
  CONSTANTS
Constants represent quantities of data that do not vary in value during the execution of a
program.  
3.5.1
  Numeric Constants
Numeric constants can be in one of three bases:
Binary
Binary constants consist of a percent sign (%) followed by a string 
of binary digits (0,1).
Example:
%11010
Hexadecimal
Hexadecimal constants consist of a dollar sign ($) followed by a 
string of hexadecimal digits (0-9, A-F, a-f).
Example:
$12FF, $12ff
Decimal
Decimal constants can be either floating point or integer.  Integer 
decimal constants consist of a string of decimal (0-9) digits op-
tionally preceded by a grave accent  (`).  Floating point constants 
are indicated either by a preceding, following, or included decimal 
point or by the presence of an upper or lower case ‘E’ followed by 
the exponent.
Example:
12345
(integer)
6E10
(floating point)


Yüklə 4,8 Kb.

Dostları ilə paylaş:
1   ...   8   9   10   11   12   13   14   15   ...   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ə