1 /* program emits a NxN comba multiplier for 1x1 to 16x16 */
4 int main(int argc, char **argv)
8 /* print out preamble */
10 "#define TFM_DEFINES\n"
11 "#include \"fp_mul_comba.c\"\n"
13 "#if defined(TFM_SMALL_SET)\n"
14 "void fp_mul_comba_small(fp_int *A, fp_int *B, fp_int *C)\n"
16 " fp_digit c0, c1, c2, at[32];\n"
17 " switch (MAX(A->used, B->used)) { \n"
20 for (N = 1; N <= 16; N++) {
25 " memcpy(at, A->dp, %d * sizeof(fp_digit));\n"
26 " memcpy(at+%d, B->dp, %d * sizeof(fp_digit));\n"
29 " COMBA_CLEAR;\n", N, N, N, N);
32 for (x = 0; x < (N+N-1); x++) {
39 for (y = 0; y < N; y++) {
40 for (z = 0; z < N; z++) {
42 printf(" MULADD(at[%d], at[%d]); ", y, z+N);
48 " COMBA_STORE(C->dp[%d]);\n", x);
51 " COMBA_STORE2(C->dp[%d]);\n"
53 " C->sign = A->sign ^ B->sign;\n"
56 " break;\n", N+N-1, N+N);
58 printf(" }\n}\n\n#endif\n\n\n"