Subtract with borrow (dalu), Operation assembler syntax – Freescale Semiconductor StarCore SC140 User Manual

Page 696

Advertising
background image

A-382

SC140 DSP Core Reference Manual

SBC

SBC

Subtract With Borrow (DALU)

SBC

Description

Status and Conditions that Affect Instruction

Status and Conditions Changed by Instruction

Example

sub d0,d1,d1
sbc d2,d3

Operation

Assembler Syntax

Db – Dc – C

→ Dd

SBC Dc,Dd

SBC Dc,Dd

Subtracts the first data register (Dc) from the second (Dd), then subtracts the borrow (C bit) and stores the
result in the second data register (Dd). The source operands are a data register pair. The destination register
is the second register of the pair.

This instruction can be used in multiple-precision subtraction as illustrated in the example, which is a
64-bit subtraction.

Register Address

Bit Name

Description

SR[0]

C

Subtracted as a borrow from the LSB.

SR[5:4]

S[1:0]

Scaling mode bits determine which bits in the result are used in the Ln bit
calculation.

Register Address

Bit Name

Description

EMR[2]

DOVF

Set if the result cannot be represented in 40 bits.

Ln

L

Calculates and updates the Ln bit in the destination register.

SR[0]

C

Calculates and updates the carry bit in the status register.

Note:

The carry bit is set correctly for multiple-precision arithmetic using long word operands if the extension of the destination

data register is the sign-extension of bit 31.

Register/Memory Address

Before

After

D0

$00 0000 0008

L1:D1

$0:$00 0000 0005

$0:$FF FFFF FFFD

SR

$00E4 0000

$00E4 0001

D2

$00 0000 0003

L3:D3

$0:$00 0000 0005

$0:$00 0000 0001

Advertising