30 DIVIDER (DIV)
S1C33L26 TECHNICAL MANUAL
Seiko Epson Corporation
30-1
Divider (DIV)
30
The S1C33L26 has an embedded coprocessor that provides a signed/unsigned 16
÷
16-bit division function.
This section explains how to use the divider.
C33 PE Core
Operation result
register
Argument 2 (divisor)
Argument 1 (dividend)
16 bits
Coprocessor
output (32 bits)
Operation results
16-bit quotient and 16-bit remainder
÷
Mode setting
Divider
1 Divider Block Diagram
Figure 30.
Operation mode
The coprocessor operates according to the operation mode specified by the application program. As listed in
Table 30.1, the coprocessor supports two operations.
The operation mode can be specified with a 6-bit data by writing it to the mode setting register in the divider.
Use a “
do.c
” instruction for this writing.
do.c imm6
imm6
[5:0] is written to the mode setting register.
1 Mode Settings
Table 30.
Setting value
(D[5:0])
Operation mode
0x8
Unsigned division mode
Performs unsigned division.
0x9
Signed division mode
Performs signed division.
Other
Reserved
Division
The division function performs “A (16 bits) = B (16 bits)
÷
C (16 bits), D (16 bits) = remainder.”
To perform a division, set the operation mode to 0x8 (unsigned division) or 0x9 (signed division). Then send
the 16-bit dividend (B) and 16-bit divisor (C) to the divider using a “
ld.c imm4,%rs
” instruction. The quo-
tient (A) and the remainder (D) will be stored in the low-order 16 bits and the high-order 16 bits of the opera-
tion result register, respectively. The quotient and remainder can be loaded to a CPU register using a “
ld.c
%rd,imm4
” instruction.
Example:
do.c 0x8
;
Sets the operation mode (unsigned division mode).
ld.c 0x0,%r0 ;
Sends the dividend set in %r0.
ld.c 0x1,%r1 ;
Sends the divisor set in %r1. The divider performs “%r0
÷
%r1.”
ld.c %r0,0x0 ;
Loads the result to %r0. (%r0[31:16] = remainder, %r0[15:0] = quotient)
;
0x0 (
imm4
) is a dummy parameter (any value can be specified).
Notes: • Uncertain quotient and remainder will result if the divisor is set to 0.
• Since the DIV module does not support the C, V, Z, and N flags, the “
ld.cf
” instruction can-
not be used. Uncertain values may be set to the C, V, Z, and N flags in PSR of the C33 PE
Core if used.
• A -32,768 quotient and a 0 remainder will result when the dividend is set to -32,768 and the
divisor is set -1.