Toshiba H1 Series Data Book page 635

32bit micro controller tlcs-900/h1 series
Table of Contents

Advertisement

3.26.3 Operation Examples
(1) Unsigned multiply-accumulate operation
The following shows a setting example for calculating "33333333 + 11111111 × 22222222":
ld
ld
ld
ld
ld
ld
ld
ld
ld
ld
bit
jp
ld
(2) Signed multiply-subtract operation
The following shows a setting example for calculating "33333333 − 11111111 × −22222222":
ld
ld
ld
ld
ld
ld
ld
ld
ld
set
ld
bit
jp
ld
(3) Unsigned multiply-accumulate operation (two multiply-accumulate operations)
The following shows a setting example for calculating "(33333333 + 11111111 × 22222222) +
(11111111 × 44444444)":
ld
ld
ld
ld
ld
ld
ld
ld
ld
ld
ld
ld
bit
jp
ld
(MACCR), 0x08
; Unsigned multiply-accumulate mode
Start calculation by write to MACMB.
xde, 0x00000000
xhl, 0x33333333
xix, 0x11111111
xiy, 0x22222222
(MACORL), xhl
; Write 33333333 to MACORL.
(MACORH), xde
; Clear MACORH.
(MACMA), xix
; Write 11111111 to MACMA.
(MACMB), xiy
; Write 22222222 to MACMB.
xhl, (MACORL)
; Read lower result 0x41FDB975.
7, (MACCR)
nz, ERROR
; Go to error routine, if there is over-flow error
xde, (MACORH)
; Read upper result 0x02468ACF.
(MACCR), 0x25
; Signed multiply-subtract mode
Start calculation by write of "1" to <MOPST>.
xde, 0x00000000
xhl, 0x33333333
xix, 0x11111111
xiy, 0xDDDDDDDE
;
22222222
(MACORL), xhl
; Write 33333333 to MACORL.
(MACORH), xde
; Clear MACORH.
(MACMA), xix
; Write 11111111 to MACMA.
(MACMB), xiy
; Write
5, (MACCR)
xhl, (MACORL)
; Read lower result 0x41FDB975.
7, (MACCR)
nz, ERROR
; Go to error routine, if there is over-flow error
xde, (MACORH)
; Read upper result 0x02468ACF.
(MACCR), 0x08
; Unsigned multiply-accumulate mode
Start calculation by write to MACMB.
xde, 0x00000000
xhl, 0x33333333
xix, 0x11111111
xiy, 0x22222222
xiz, 0x44444444
(MACORL), xhl
; Write 33333333 to MACORL.
(MACORH), xde
; Clear MACORH.
(MACMA), xix
; Write 11111111 to MACMA.
(MACMB), xiy
; Write 22222222 to MACMB.
(MACMB), xiz
; Write 44444444 to MACMB.
xhl, (MACORL)
; Read lower result 0x5F92C5F9.
7, (MACCR)
nz, ERROR
; Go to error routine, if there is over-flow error
xde, (MACORH)
; Read upper result 0x06D3A06D.
92CZ26A-632
; Check over-flow error
22222222 to MACMB.
;
; Check over-flow error
; Check over-flow error
TMP92CZ26A
Calculation start
Calculation start
Calculation start
Calculation start

Advertisement

Table of Contents
loading

This manual is also suitable for:

Tlcs-900Tmp92cz26axbg

Table of Contents