Datasheet
78K0/Ix2 CHAPTER 17 MULTIPLIER
R01UH0010EJ0500 Rev.5.00 570
Feb 28, 2012
17.3 Operation of Multiplier
The result of the multiplication can be obtained by storing the values in the MULA and MULB registers and then reading
the MUL0H and MUL0L registers after waiting for 1 clock. The result can also be obtained after 1 clock or more has
elapsed, even when fixing either of MULA or MULB and rewrite the other of these. The result can be read without
problem, regardless of
whether MUL0H or MUL0L is read in first.
A multiplication source example is shown below.
Example 1: Multiplication of 8 bits by 8 bits
MOV MULAL, #005H
MOV MULBL, #022H
NOP ; 1 clock wait. Doesn’t have to be NOP
MOVW AX, MUL0L ; Acquire multiplication result
Caution In Example 1, set the multiplied data to MULAL and MULBL.
Example 2: Multiplication of 16 bits by 16 bits (using the MOVW instruction for setting the multiplication data)
MOVW MULA, #1234H
MOVW MULB, #5678H
NOP ; 1 clock wait. Doesn’t have to be NOP
MOVW AX, MUL0H ; The result obtained on upper side
PUSH AX
MOVW AX, MUL0L ; The result obtained on lower side
Example 3: Multiplication of 16 bits by 16 bits (using the MOV instruction for setting the multiplication data)
MOV MULAL, #034H
MOV MULAH, #012H
MOV MULBL, #078H
MOV MULBH, #056H
NOP ; 1 clock wait. Doesn’t have to be NOP
MOVW AX, MUL0H ; The result obtained on upper side
PUSH AX
MOVW AX, MUL0L ; The result obtained on lower side
Caution In Example 3, set the higher 8 bits of the multiplied data to MULAH/MULBH after setting the lower 8
bits to MULAL/MULBL. When the higher 8 bits of the multiplied data are the same value and only the
lower 8 bits are to be changed, set the changed value to MULAL/MULBL and re-set the same value to
MULAH/MULBH.