IDEC MicroSmart User Manual

Page 237

Advertising
background image

11: B

INARY

A

RITHMETIC

I

NSTRUCTIONS

« FC4A M

ICRO

S

MART

U

SER

S

M

ANUAL

»

11-5

Repeat Operation in the MUL Instruction

Since the MUL (multiplication) instruction uses two destination operands, the result is stored to destination operands as
described below. Source operands S1 and S2 and destination operand D1 can be designated to repeat individually or in
combination. When destination operand D1 is not designated to repeat, the final result is set to destination operand D1 and
D1+1. When repeat is designated, consecutive operands as many as the repeat cycles starting with the designated operand
are used.

Since the repeat operation works similarly on the word and integer data types, the following examples are described using
the word data type.

Repeat One Source Operand

When only S1 (source) is designated to repeat, the final result is set to destination operands D1 and D1+1.

Repeat Destination Operand Only

When only D1 (destination) is designated to repeat, the same result is set to 6 operands starting with D1.

Repeat Two Source Operands

When S1 and S2 (source) are designated to repeat, the final result is set to destination operands D1 and D1+1.

Repeat Source and Destination Operands

When S1 (source) and D1 (destination) are designated to repeat, different results are set to 6 operands starting with D1.

Repeat All Source and Destination Operands

When all operands are designated to repeat, different results are set to 6 operands starting with D1.

I1

REP

3

S1 R

D10

D1 –

D30

D10

S1 (Repeat = 3)

D1 (Repeat = 0)

S2 –

D20

S2 (Repeat = 0)

×

(D30)

D20

(D31)

D11
D12

Ч

Ч

D20
D20

(D30)

D30

(D31)

D31

SOTU

MUL(W)

I1

REP

3

S1 –

D10

D1 R

D30

D10

S1 (Repeat = 0)

D1 (Repeat = 3)

S2 –

D20

S2 (Repeat = 0)

×

D30

D20

D31

D10
D10

Ч

Ч

D20
D20

D32
D34

D33
D35

SOTU

MUL(W)

I1

REP

3

S1 R

D10

D1 –

D30

D10

S1 (Repeat = 3)

D1 (Repeat = 0)

S2 R

D20

S2 (Repeat = 3)

×

(D30)

D20

(D31)

D11
D12

Ч

Ч

D21
D22

(D30)

D30

(D31)

D31

SOTU

MUL(W)

I1

REP

3

S1 R

D10

D1 R

D30

D10

S1 (Repeat = 3)

D1 (Repeat = 3)

S2 –

D20

S2 (Repeat = 0)

×

D30

D20

D31

D11
D12

Ч

Ч

D20
D20

D32
D34

D33
D35

SOTU

MUL(W)

I1

REP

3

S1 R

D10

D1 R

D30

D10

S1 (Repeat = 3)

D1 (Repeat = 3)

S2 R

D20

S2 (Repeat = 3)

×

D30

D20

D31

D11
D12

Ч

Ч

D21
D22

D32
D34

D33
D35

SOTU

MUL(W)

Advertising