RMPA

Multiply-and-accumulate operation

RMPA

Repeated MultiPly and Accumulate


[Syntax]

RMPA.size

 

[Operation]

while ( R3 != 0 ) {

R6:R5:R4 = R6:R5:R4 + *R1 * *R2;

R1 = R1 + n;

R2 = R2 + n;

R3 = R3 - 1;

}

Notes 1.

1. If this instruction is executed with R3 set to 0, it is ignored and has no effect on registers and flags.

Notes 2.

2. When the size specifier (.size) is .B, .W, or .L, n is 1, 2, or 4, respectively.

 

[Function]

-

This instruction performs a multiply-and-accumulate operation with the multiplicand addresses specified by R1, the multiplier addresses specified by R2, and the number of multiply-and-accumulate operations specified by R3. The operands and result are handled as signed values, and the result is placed in R6:R5:R4 as an 80-bit datum. Note that the higher-order 16 bits of R6 are set to the value obtained by sign-extending the lower-order 16 bits of R6.

-

The greatest value that is specifiable in R3 is 00010000h

-

The data in R1 and R2 are undefined when instruction execution is completed.

-

Specify the initial value in R6:R5:R4 before executing the instruction. Furthermore, be sure to set R6 to FFFFFFFFh when R5:R4 is negative or to 00000000h if R5:R4 is positive.

-

An interrupt request during execution of this instruction will be accepted, so processing of the instruction will be suspended. That is, execution of the instruction will continue on return from the interrupt processing routine. However, be sure to save the contents of the R1, R2, R3, R4, R5, R6, and PSW when an interrupt is generated and restore them when execution is returned from the interrupt routine.

-

In execution of the instruction, the data may be prefetched from the multiplicand addresses specified by R1 and the multiplier addresses specified by R2, with R3 as the upper limit. For details of the data size to be prefetched, refer to the hardware manual of each product.

Note

The accumulator (ACC) is used to perform the function. The value of ACC after executing the instruction is undefined.

 

[Instruction Format]

Syntax

Size

Processing

Size

Code Size

(Byte)

RMPA.size

B/W/L

size

2

 

[Flag Change]

Flag

C

Z

S

O

Change

 

 

Conditions

S : The flag is set if the MSB of R6 is 1; otherwise it is cleared.

O: The flag is set if the R6:R5:R4 data is greater than 2**53-1 or smaller than -2**53; otherwise it is cleared.

[Description Example]

RMPA.W