GD32W51x User Manual
973
MODSEL[5:0]
Operation m odes
000001
calculate Montgomery parameter only
000010
modular exponentiation (the Montgomery parameter must be preloaded)
000111
RSA CRT exponentiation
001000
Modular inversion
001001
Arithmetic addition
001010
Arithmetic subtraction
001011
Arithmetic multiplication
001100
Arithmetic comparison
001101
Modular reduction
001110
Modular addition
001111
Modular subtraction
010000
Montgomery multiplication
Arithmetic addition
The arithmetic addition operation is selected by configuring MODSEL[5:0] in PKCAU_CTL
register as "001001". The operation declaration is shown in
Figure 29-5. Arithmetic addition
The operation result is
“
result = A+B
”
.
Figure 29-5. Arithmetic addition
Operand length L
Operand A
PKCAU RAM
0x404
Operand B
offset address
0x408
...
0x400
...
0x8B4
0xA44
...
0xBD0
...
input
output
A+B
offset address
0xBD0
0≤A<2
L
, 0≤B<2
L
, 0≤result<2
L+1
, 0<L≤3136.
Arithmetic subtraction
The arithmetic subtraction operation is selected by configuring MODSEL[5:0] in PKCAU_CTL
register as "001010". The operation declaration is shown in
If A≥B
,
the operation result is
“
result = A-B
”
;
If A<B
,
the operation result is
“
result = A-B+2
L+ceil(L%32)
”