Numbering System Basics
Sign Extension Mode
The C28x can operate on either unsigned binary or two's complement operands. The “Sign
Extension Mode” (SXM) bit, present within a status register of the C28x, identifies whether or
not the sign extension process is used when a value is brought into the accumulator. It is good
programming practice to always select the desired SXM at the beginning of a module to assure
the proper mode.
What is Sign Extension?
What is Sign Extension?
When moving a value from a narrowed width location
When moving a value from a narrowed width location
to a wider width location, the sign bit is extended to fill
to a wider width location, the sign bit is extended to fill
the width of the destination
the width of the destination
Sign extension applies to signed numbers only
Sign extension applies to signed numbers only
It keeps negative numbers negative!
It keeps negative numbers negative!
Sign extension controlled by SXM bit in ST0 register;
Sign extension controlled by SXM bit in ST0 register;
When SXM = 1, sign extension happens automatically
When SXM = 1, sign extension happens automatically
4 bit Example: Load a memory value into the ACC
4 bit Example: Load a memory value into the ACC
1101
1101
memory
memory
=
=
-
-
2
2
3
3
+ 2
+ 2
2
2
+ 2
+ 2
0
0
=
=
-
-
3
3
1111
1111
1101
1101
ACC
ACC
=
=
-
-
2
2
7
7
+ 2
+ 2
6
6
+ 2
+ 2
5
5
+ 2
+ 2
4
4
+ 2
+ 2
3
3
+ 2
+ 2
2
2
+ 2
+ 2
0
0
=
=
-
-
128 + 64 + 32 + 16 + 8 + 4 + 1
128 + 64 + 32 + 16 + 8 + 4 + 1
=
=
-
-
3
3
Load and sign extend
Load and sign extend
C28x - Numerical Concepts & IQmath 8 - 5