dsp56800e Freescale Semiconductor, Inc, dsp56800e Datasheet - Page 620

no-image

dsp56800e

Manufacturer Part Number
dsp56800e
Description
16-bit Digital Signal Controller Core
Manufacturer
Freescale Semiconductor, Inc
Datasheet
SUB.W
Operation:
D – S →
Description: Subtract the source operand from the destination register, and store the result in the destination (D).
Usage:
Example:
Explanation of Example:
Condition Codes Affected:
A-276
Before Execution
A2
D
0
The source operand (except for a short immediate operand) is first sign extended internally to form a
20-bit value; this value is concatenated with 16 zero bits to form a 36-bit value when the destination is
one of the four accumulators. A short immediate (0–31) source operand is zero extended before the
subtraction. The subtraction is then performed as a 20-bit operation. Condition codes are calculated
based on the size of the destination.
This instruction can be used for both integer and fractional two’s-complement data.
SUB.W
Prior to execution, the 16-bit value at memory location X:$4000 is $0058, and the 36-bit A accumula-
tor contains the value $0:0058:1234. The SUB.W instruction automatically sign extends the memory
value to 20 bits and subtracts the result from the A2:A1 portion of the accumulator. The result is stored
back in A1.
L
E
U
N
Z
V
C
LF
15
— Set if overflow has occurred in the result
— Set if the extension portion of the 20-bit result is in use
— Set if the 20-bit result is unnormalized
— Set if the high-order bit of the result is set
— Set if the result equals zero (accumulator bits 35–0 or bits 15–0 of a 16-bit register)
— Set if overflow has occurred in the result
— Set if a borrow occurs from the high-order bit of the result
(no parallel move)
0058
P4
14
A1
X:$4000
X:(R2),A ; 16-bit subtraction
13
P3
SR
P2
12
MR
DSP56800E Core Reference Manual
P1
11
1234
0058
0300
A0
P0
10
Subtract Word
I1
9
Assembler Syntax:
SUB.W
I0
8
SZ
7
After Execution
6
L
A2
0
5
E
S,D
U
4
CCR
0000
A1
X:$4000
N
3
(no parallel move)
SR
2
Z
Freescale Semiconductor
V
1
1234
0058
0310
C
0
A0
SUB.W

Related parts for dsp56800e