GD32W51x User Manual
976
Modular addition
The modular addition operation is selected by configuring MODSEL[5:0] in PKCAU_CTL
register as "001110". The operation declaration is shown in
Figure 29-10. Modular addition
The operation result is
“
result = A+B mod n
”
.
Figure 29-10. Modular addition
Modulus length M
Operand A
PKCAU RAM
0x404
Operand B
0x408
...
0x400
...
0x8B4
0xA44
0xD5C
Modulus n
...
0xBD0
...
A
+
B mod n
Offset address
input
output
Offset address
0xBD0
0≤A<n, 0≤B<n, 0≤result<n, 0<n<2
M
, 0<M≤3136.
Modular subtraction
The modular subtraction operation is selected by configuring MODSEL[5:0] in PKCAU_CTL
register as "001111". The operation declaration is shown in
If A
≥
B, the operation result is
“
result = A-B mod n
”
;
If A
<
B, the operation result is
“
result = A-B+n mod n
”
.