122-32000 Parallax Inc, 122-32000 Datasheet - Page 263

MANUAL PROPELLER

122-32000

Manufacturer Part Number
122-32000
Description
MANUAL PROPELLER
Manufacturer
Parallax Inc
Datasheets

Specifications of 122-32000

Accessory Type
Manual
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
Propeller Education (PE) Kit
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
expression 5 + 2 is then evaluated and the result, 7, is stored into
equals 0 and
Since Sign-Extend 7 and Post-Clear are always assignment operators, the rules of
Intermediate Assignments apply to them (see page 253).
Sign-Extend 15 or Post-Set ‘
This operator is a special, immediate operator that has a dual purpose depending on which
side of the variable it appears on. It can only be used in run-time variable expressions. The
Sign-Extend 15 form of the operator appears to the left of a variable and the Post-Set form
appears to the right of a variable.
The following is an example of the Sign-Extend 15 operator form:
Y := ~~X + 50
The Sign-Extend 15 operator in this example extends the sign of the value,
from bit 15 up to bit 31. A 32-bit signed integer is stored in twos-complement form and the
most significant bit (31) indicates the sign of the value (positive or negative). There may be
times where calculations on simple data result in word-sized values that should be treated as a
signed integer in the range of -32768 to +32767. When you need to perform further
calculations with those word-sized values, use the Sign-Extend 15 operator to convert the
number into the proper 32-bit signed integer form.
represents the value -300, which in 16-bit twos-complement form is actually the value 65,236
(%11111110 11010100). The
all the way up to bit 31, converting the number to the proper 32-bit twos-complement form of
-300 (%11111111 11111111 11111110 11010100). Adding that sign-extended value to 50
results in -250, the intended result, whereas it would have resulted in 65,286 without the
proper sign extension.
The following is an example of the Post-Set operator form.
Y := X~~ + 2
The Post-Set operator in this example sets the variable to -1 (all bits high) after providing its
current value for the next operation. In this example if
the current value for the expression (6 + 2) to be evaluated later, then would store -1 in
The expression 6 + 2 is then evaluated and the result, 8, is stored into
X
Since Sign-Extend 15 and Post-Set are always assignment operators, the rules of Intermediate
Assignments apply to them (see page 253).
equals -1 and
Y
equals 7.
Y
equals 8.
~~X
~~
portion of the expression extends the sign bit from bit 15
X
started out as 6,
In the above example, assume
Propeller Manual v1.0 · Page 263
Y
. After this statement,
Y
. After this statement,
X~~
would provide
X
in this case,
X
X
X
.

Related parts for 122-32000