Note On Mulxu Instruction - Hitachi H8/500 Series Hardware Manual

Table of Contents

Advertisement

3.9.2 Note on MULXU Instruction

Note that in the case described below, the H8/532 multiply instruction does not give correct
results.
(1)
Problem
The result of a squaring operation such as MULXU.B Rn, Rn is indeterminate. This problem
occurs when the same register is specified for the source and destination of a byte
multiplication operation.
This problem occurs only in ZTAT versions of the H8/532. It does not occur in versions
with masked ROM.
(2)
Solution
The problem can be avoided by the following methods.
Place the source and destination operands in different registers.
Example: MULXU.B R4, R4
Use a word multiplication instruction.
Example: MULXU.B R4, R4
Place one of the operands in memory.
Example: MULXU.B R4, R4
This problem occurs only in the H8/532. It does not occur in other chips in the H8/500
Series (such as the H8/520).
(3)
Note on usage of C compiler
Programmers using the C compiler should bear the following programming note in mind.
• Conditions under which the compiler generates a MULXU.B Rn, Rn instruction
The C compiler generates a MULXU.B Rn, Rn instruction when the following two conditions
are satisfied in the source program:
Downloaded from
Elcodis.com
electronic components distributor
MOV.W R4, R5
MULXU.B R5, R4
MULXU.W R4, R4
MOV.W R5, R4
MOV.W R4, @–SP
MULXU.B @(1,SP), R4
ADDS #2, SP
79

Advertisement

Table of Contents
loading

This manual is also suitable for:

H8/532

Table of Contents