STDA045 November   2026 MSPM0G1505 , MSPM0G1506 , MSPM0G1507 , MSPM0G1518 , MSPM0G1519 , MSPM0G3505 , MSPM0G3506 , MSPM0G3507 , MSPM0G3518 , MSPM0G3519

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
  5. 2ED25519PH Algorithm Introduction
  6. 3MSPM0G Math Accelerator (MATHACL)
    1. 3.1 MATHACL Module
    2. 3.2 Multiply-Accumulate (MAC) Operation
  7. 4Accelerate the ED25519PH Algorithm by Using MATHACL
    1. 4.1 Loop Unrolled Implementation
      1. 4.1.1 Non-MATHACL Optimization
      2. 4.1.2 MATHACL Optimization
    2. 4.2 Loop Rolled Implementation
      1. 4.2.1 Non-MATHACL Optimization
      2. 4.2.2 MATHACL Optimization
    3. 4.3 Benchmark
  8. 5Summary
  9. 6References

MATHACL Optimization

When using MATHACL, the code implementation to get the multiplication output (h[10]) is shown as follows:

for (j=0; j<10; j++){
MATHACL->RES2 = 0;
MATHACL->RES1 = 0;
for (i=0; i<j+1; i++){
MATHACL->OP2 = g_combined[0][j-i];
MATHACL->OP1 = f_combined[(j+1)%2][i];
}
for (i=0; i<10-j-1; i++){
MATHACL->OP2 = g_combined[1][9-(i)];
MATHACL->OP1 = f_combined[(j+1)%2][j+1+i];
}
hvect[j] = ((uint64)(MATHACL->RES2)<<32) + MATHACL->RES1;
}

After accumulation, carries propagate in a similar manner as the loop unrolled scenario. The program execution time can be optimized by using MATHACL. Compared to a loop-unrolled implementation, the loop-rolled + MATHACL implementation requires several instructions between loading the input operation data for loop, so the implementation has a longer execution time but smaller code size.