summaryrefslogtreecommitdiff
path: root/tools/gf_methods.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gf_methods.c')
-rw-r--r--tools/gf_methods.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/tools/gf_methods.c b/tools/gf_methods.c
index c7d3d58..b016c33 100644
--- a/tools/gf_methods.c
+++ b/tools/gf_methods.c
@@ -39,7 +39,7 @@ static char *divides[NDIVS] = { "MATRIX", "EUCLID" };
void usage(char *s)
{
- fprintf(stderr, "usage: gf_methods w -BADC -LUMDRB\n");
+ fprintf(stderr, "usage: gf_methods w -BADC -LXUMDRB\n");
fprintf(stderr, "\n");
fprintf(stderr, " w can be 1-32, 64, 128\n");
fprintf(stderr, "\n");
@@ -50,6 +50,7 @@ void usage(char *s)
fprintf(stderr, " Combinations are fine.\n");
fprintf(stderr, "\n");
fprintf(stderr, " -L Simply lists methods\n");
+ fprintf(stderr, " -X List methods and functions selected (compile with DEBUG_FUNCTIONS)\n");
fprintf(stderr, " -U Produces calls to gf_unit\n");
fprintf(stderr, " -M Produces calls to time_tool.sh for single multiplications\n");
fprintf(stderr, " -D Produces calls to time_tool.sh for single divisions\n");
@@ -63,6 +64,19 @@ void usage(char *s)
exit(1);
}
+void print_methods(gf_t *gf)
+{
+#ifdef DEBUG_FUNCTIONS
+ gf_internal_t *h = (gf_internal_t*) gf->scratch;
+
+ printf("multiply = %s\n", h->multiply);
+ printf("divide = %s\n", h->divide);
+ printf("inverse = %s\n", h->inverse);
+ printf("multiply_region = %s\n", h->multiply_region);
+ printf("extract_word = %s\n", h->extract_word);
+#endif
+}
+
int main(int argc, char *argv[])
{
int m, r, d, w, i, sa, j, k, reset, ok;
@@ -99,12 +113,12 @@ int main(int argc, char *argv[])
}
}
- if (strchr("LUMDRB", argv[3][1]) == NULL) { usage("Bad -LUMDRB"); }
+ if (strchr("LXUMDRB", argv[3][1]) == NULL) { usage("Bad -LXUMDRB"); }
listing = argv[3][1];
if (listing == 'U') {
w_str = "../test/gf_unit %d A -1";
- } else if (listing == 'L') {
+ } else if (listing == 'L' || listing == 'X') {
w_str = "w=%d:";
} else {
w_str = strdup("sh time_tool.sh X %d");
@@ -192,6 +206,8 @@ int main(int argc, char *argv[])
printf(w_str, w);
for (j = 0; j < sa; j++) printf(" %s", gf_argv[j]);
printf("\n");
+ if (listing == 'X')
+ print_methods(&gf);
gf_free(&gf, 1);
} else if (_gf_errno == GF_E_DEFAULT) {
fprintf(stderr, "Unlabeled failed method: w=%d:", w);
@@ -212,6 +228,8 @@ int main(int argc, char *argv[])
printf(w_str, w);
for (j = 0; j < sa; j++) printf(" %s", gf_argv[j]);
printf("\n");
+ if (listing == 'X')
+ print_methods(&gf);
gf_free(&gf, 1);
} else if (_gf_errno == GF_E_DEFAULT) {
fprintf(stderr, "Unlabeled failed method: w=%d:", w);