Numbering System Basics
C2000 Microcontroller Workshop - Numerical Concepts 8 - 5
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?
When moving a value from a narrowed width location to a
wider width location, the sign bit is extended to fill the width
of the destination
Sign extension applies to signed numbers only
It keeps negative numbers negative!
Sign extension controlled by SXM bit in ST0 register; When
SXM = 1, sign extension happens automatically
4 bit Example: Load a memory value into the ACC
1101
memory
= -2
3
+ 2
2
+ 2
0
= -3
ACC
= -2
7
+ 2
6
+ 2
5
+ 2
4
+ 2
3
+ 2
2
+ 2
0
= -128 + 64 + 32 + 16 + 8 + 4 + 1
= -3
Load and sign extend
1111
1101