STDA045 November 2026 MSPM0G1505 , MSPM0G1506 , MSPM0G1507 , MSPM0G1518 , MSPM0G1519 , MSPM0G3505 , MSPM0G3506 , MSPM0G3507 , MSPM0G3518 , MSPM0G3519
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.