Subtract Two 16-Bit Integers on Upper and Lower Register Halves SUB2

Execution

if (cond)

{

 

 

 

(lsb16(src1) − lsb16(src2)) lsb16(dst);

 

 

(msb16(src1) − msb16(src2)) msb16(dst);

 

 

}

 

 

else nop

 

 

Pipeline

 

 

 

Pipeline

E1

 

 

Stage

 

 

 

 

 

Read

src1, src2

 

Written

dst

 

Unit in use

.S

 

 

 

 

Instruction Type

Single-cycle

Delay Slots

0

See Also

ADD2, SSUB, SUB, SUBC, SUBU

Example 1

SUB2 .S1 A3, A4, A5

 

Before instruction

1 cycle after instruction

A3

A4

A5

1105 6E30h

1105 6980h

xxxx xxxxh

4357

28208

A3

4357

27008

A4

 

 

A5

1105 6E30h

1105 6980h

0000 04B0h

4357 28208

4357 27008

0 1200

Example 2

SUB2 .S2X B1,A0,B2

 

 

 

 

Before instruction

 

 

 

A0

 

 

33

12913

A0

 

0021

3271h

 

 

 

 

58

6984

 

 

B1

003A

1B48h

B1

 

 

 

 

 

 

 

B2

xxxx xxxxh

 

 

B2

 

 

 

 

 

 

 

Signed 16-MSB integer

Signed 16-LSB integer

1 cycle after instruction

0021 3271h

003A 1B48h

0019 E8D7h

25−5929

SPRU733

Instruction Set

3-269

Page 329
Image 329
Texas Instruments TMS320C67X/C67X+ DSP manual ADD2, SSUB, SUB, SUBC, Subu, Pipeline Stage Read