SWCU194 March 2023 CC1314R10 , CC1354P10 , CC1354R10 , CC2674P10 , CC2674R10
Table 13-1 lists the arguments and results for each PKCP operation.
Function | Mathematical Operation | Vector A | Vector B | Vector C | Vector D |
---|---|---|---|---|---|
Multiply | A × B → C | Multiplicand | Multiplier | Product | N/A |
Add | A + B → C | Addend | Addend | Sum | N/A |
Subtract | A - B → C | Minuend | Subtrahend | Difference | N/A |
AddSub | A + C - B → D | Addend | Subtrahend | Addend | Result |
Right Shift | A >> Shift → C | Input | N/A | Result | N/A |
Left Shift | A << Shift → C | Input | N/A | Result | N/A |
Divide | A mod B → C, A div B → D | Dividend | Divisor | Remainder | Quotient |
Modulo | A mod B → C | Dividend | Divisor | Remainder | N/A |
Compare | A = B, A < B, A > B | Input1 | Input2 | NA | N/A |
Copy | A → C | Input | N/A | Result | N/A |
To obtain correct results, the input vector must meet the requirements presented in Table 13-2.
Operational Restrictions | |
---|---|
Function | Requirements |
Multiply | 0 < A_Len B_Len ≤ Max_Len |
Add | 0 < A_Len B_Len ≤ Max_Len |
Subtract | 0 < A_Len B_Len ≤ Max_Len Result must be positive (A ≥ B) |
AddSub | 0 < A_Len ≤ Max_Len (B and C operands have A_Len as length, B_Len is ignored) Result must be positive [(A + C) ≥ B] |
Right shift | 0 < A_Len ≤ Max_Len |
Left shift | 0 < A_Len ≤ Max_Len |
Divide, modulo | 1 < B_Len ≤ A_Len ≤ Max_Len Most significant 32-bit word of B operand cannot be 0 |
Compare | 0 < A_Len ≤ Max_Len (B operand has A_Len as length, B_Len is ignored) |
Copy | 0 < A_Len ≤ Max_Len |
The host is responsible for allocating a block of contiguous memory in PKA RAM for the result vector. Table 13-3 indicates how much memory should be allocated for the result vectors.
Function | Result Vector | Result Vector Length (in 32-Bit Words) |
---|---|---|
Multiply | C | A_Len + B_Len + 6 (the six scratchpad words should be discarded) |
Add | C | Max(A_Len, B_Len) + 1 |
Subtract | C | Max(A_Len, B_Len) |
AddSub | D | A_Len + 1 |
Right shift | C | A_Len |
Left shift | C | A_Len + 1 (when shift value is nonzero) |
A_Len (when shift value is zero) | ||
Divide | C | Remainder → B_Len + 1 (one scratchpad word should be discarded) |
D | Quotient → A_Len – B_Len + 1 | |
Modulo | C | Remainder → B_Len + 1 (one scratchpad word should be discarded) |
Compare | None | Updates the PKA_COMPARE register |
Copy | C | A_Len |
Input vectors for an operation are always allowed to overlap in memory (partially or completely).
Table 13-4 lists restrictions for the overlap of output and input vectors of the operations.
Function | Result Vector | Restriction |
---|---|---|
Multiply | C | No overlap with A or B vectors allowed. |
Add, subtract | C | May overlap with A and (or) B vectors if the start address of the C vector does not lie above the start address of the vector or vectors that it overlaps. |
AddSub | D | May overlap with A, B, and (or) C vectors if the start address of the D vector does not lie above the start address of the vector or vectors that it overlaps. |
Right shift, left shift | C | May overlap with A vector if the start address of the C vector does not lie above the start address of the A vector. |
Divide | C | No overlap with A, B, or D vectors allowed. |
D | No overlap with A, B, or C vectors allowed. | |
Modulo | C | No overlap with A or B vectors allowed. |
Compare | None | Compare does not write a result vector. |
Copy | C | Restrictions for Copy are the same as right and left shift restrictions; copy of a vector to a lower address is always allowed, even if a source and destination overlap(1). |