Datasheet

Table Of Contents
43.3.4.9.7 Important Considerations for Modular Reduction of a Fmult Computation Result
Note: 
Additional options are available through the use of a modular reduction to be executed at the end of this
operation. Some important considerations have to be taken into account concerning the length of
resulting operands to get a mathematically correct result.
The output of this operation is not always compatible with the modular reduction as it may be either
smaller or bigger. In the case (most of the time) the result (pointed by nu1RBase) is smaller in size than
“twice the modulus plus one word” by one word, a padding word must be added to zero. Otherwise, the
reduced value will be taken considering the high order words (potentially uninitialized) as part of the
number, thus resulting in getting a mathematically correct but unexpected result.
In the case that the result is bigger than twice the modulus plus one word, the modular reduction feature
has to be executed as a separate operation, using an Euclidean division.
43.3.4.9.8 Constraints
The following conditions must be avoided to ensure that the service works correctly:
nu1XBase, nu1YBase, nu1RBase or nu1ZBase are not aligned on 32-bit boundaries
{nu1XBase, u2XLength}, {nu1YLength, u2YLength}, {nu1ZBase, u2XLength+u2YLength}
or{nu1RBase, u2XLength+u2YLength} are not in Crypto RAM
u2XLength, u2YLength is either: < 4, > 0xffc or not a 32-bit length
{nu1RBase, u2XLength+u2YLength} overlaps {nu1YBase, u2YLength} or{nu1RBase, u2XLength
+u2YLength} overlaps {nu1XBase, u2XLength}
{nu1RBase, u2XLength+u2YLength} overlaps {nu1ZBase, u2XLength+u2YLength} and nu1RBase>
nu1ZBase
If a modular reduction is specified, the relevant parameters must be defined according to the chosen
reduction and follow the description in 43.3.5.1 Modular Reduction. Additional constraints to be
respected and error codes are described in this section and in Table 43-49.
Multiplication with Accumulation or Subtraction
In the case where the options bits specify that either an Accumulation or a subtraction should be
performed, this service performs the following operation:
R = (Z ± (X × Y + CarryOperand))mod B
XLength + YLength
Table 43-27. Fmult Service (with Accumulate/Subtract From) Carry Settings
Option AND CARRYOPTIONS CarryOperand Resulting Operation
SET_CARRYOPTION(ADD_CARRY) CarryIn R = Z ± (X*Y + CarryIn)
SET_CARRYOPTION(SUB_CARRY) - CarryIn R = Z ± (X*Y - CarryIn)
SET_CARRYOPTION(ADD_1_PLUS_CARRY) 1 + CarryIn R = Z ± (X*Y + 1 + CarryIn)
SET_CARRYOPTION(ADD_1_MINUS_CARRY) 1 - CarryIn R = Z ± (X*Y + 1 - CarryIn)
SET_CARRYOPTION(CARRY_NONE) 0 R = Z ± (X*Y)
SET_CARRYOPTION(ADD_1) 1 R = Z ± (X*Y + 1)
SET_CARRYOPTION(SUB_1) - 1 R = Z ± (X*Y - 1)
SET_CARRYOPTION(ADD_2) 2 R = Z ± (X*Y + 2)
SAM D5x/E5x Family Data Sheet
Public Key Cryptography Controller (PUKCC)
© 2019 Microchip Technology Inc.
Datasheet
DS60001507E-page 1468