
25 Multiplier/Divider
25-6
EPSON
S1C17003 TECHNICAL MANUAL
S1C17 core
Arithmetic result
register
Selector
Coprocessor
output (16 bits)
Flag output
16 bits
32 bits
Argument 2
Argument 1
Arithmetic
result
Figure 25.5.2: MAC mode data paths
Table 25.5.2: MAC mode operations
Mode
setting
Instruction
Operation
Flag
Remarks
0x07
ld.ca %rd,%rs
res[31:0]
← %rd × %rs + res[31:0]
%rd
← res[15:0]
If overflow occurs
psr (CVZN)
← 0b0100
Other cases
psr (CVZN)
← 0b0000
The arithmetic result
register retains
arithmetic results
until the results
are overwritten by
another operation.
(ext
imm9)
ld.ca %rd,imm7
res[31:0]
← %rd × imm7/16 + res[31:0]
%rd
← res[15:0]
0x17
ld.ca %rd,%rs
res[31:0]
← %rd × %rs + res[31:0]
%rd
← res[31:16]
(ext
imm9)
ld.ca %rd,imm7
res[31:0]
← %rd × imm7/16 + res[31:0]
%rd
← res[31:16]
res: Arithmetic result register
Examples:
ld.cw %r0,0x7 ; Mode setting (signed MAC mode & last 16 bit output mode)
ld.ca %r0,%r1 ; Executes “res = %r0 x %r1 + res” and loads the last 16 bits of the result to %r0 register.
ld.cw %r0,0x13; Mode setting (arithmetic result reading mode & first 16 bit output mode)
ld.ca %r1,%r0 ; Loads first 16 bits of the result to %r1 register.
Overflow flag (V) setting conditions
If the multiplication result sign, arithmetic result register sign, and arithmetic result sign satisfy the following
conditions in MAC operations, an overflow occurs, and the overflow flag (V) is set to 1.
Table 25.5.3: Overflow flag (V) setting conditions
Mode setting
Multiplication result sign Arithmetic result register sign
Arithmetic result sign
0x07
0 (Positive)
1 (Negative)
0x07
1 (Negative)
0 (Positive)
An overflow occurs if positive values are summed giving a negative result in MAC operations or if negative
values are summed giving a positive result. The result is retained in the coprocessor until the overflow flag (V)
is cleared.
Overflow flag (V) clear conditions
The overflow flag (V) set is cleared if the “l(fā)d.ca” instruction is executed for MAC operation without causing
an overflow or if the “l(fā)d.ca” or “l(fā)d.cf” instruction is executed in other than arithmetic result reading
mode.