From 1bb2f354151d8d9c5497632656256e7543fdb782 Mon Sep 17 00:00:00 2001 From: Emmanuel Mogenet Date: Fri, 28 Apr 2017 23:08:46 +0200 Subject: Add -H to ghwdump to dump full pathnames of signals --- src/grt/ghwlib.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) (limited to 'src/grt/ghwlib.c') diff --git a/src/grt/ghwlib.c b/src/grt/ghwlib.c index bee84687c..1b3c4e683 100644 --- a/src/grt/ghwlib.c +++ b/src/grt/ghwlib.c @@ -840,6 +840,7 @@ ghw_read_hie (struct ghw_handler *h) h->nbr_sigs++; h->skip_sigs = NULL; + h->flag_full_names = 0; h->sigs = (struct ghw_sig *) malloc (h->nbr_sigs * sizeof (struct ghw_sig)); memset (h->sigs, 0, h->nbr_sigs * sizeof (struct ghw_sig)); @@ -1004,6 +1005,48 @@ ghw_get_hie_name (struct ghw_hie *h) void ghw_disp_value (union ghw_val *val, union ghw_type *type); +static void +print_name (struct ghw_hie *hie, int full_names) +{ + int i; + int depth; + struct ghw_hie *p; + struct ghw_hie **buf; + struct ghw_hie **end; + + if (0 == full_names) + { + printf (" %s: ", hie->name); + return; + } + + p = hie; + depth = 0; + while (p && p->name) + { + p = p->parent; + ++depth; + } + buf = (struct ghw_hie **) malloc (depth * sizeof (struct ghw_hie *)); + + p = hie; + end = depth + buf; + while (p && p->name) + { + *(--end) = p; + p = p->parent; + } + + putchar (' '); + for (i = 0; i < depth; ++i) + { + printf ("%s%s", i ? "." : "", buf[i]->name); + } + putchar (':'); + putchar (' '); + free (buf); +} + void ghw_disp_hie (struct ghw_handler *h, struct ghw_hie *top) { @@ -1018,7 +1061,7 @@ ghw_disp_hie (struct ghw_handler *h, struct ghw_hie *top) while (1) { for (i = 0; i < indent; i++) - fputc (' ', stdout); + fputc (' ', stdout); printf ("%s", ghw_get_hie_name (hie)); switch (hie->kind) @@ -1031,7 +1074,7 @@ ghw_disp_hie (struct ghw_handler *h, struct ghw_hie *top) case ghw_hie_process: case ghw_hie_package: if (hie->name) - printf (" %s", hie->name); + print_name (hie, h->flag_full_names); if (hie->kind == ghw_hie_generate_for) { printf ("("); @@ -1057,7 +1100,7 @@ ghw_disp_hie (struct ghw_handler *h, struct ghw_hie *top) unsigned int *sigs = hie->u.sig.sigs; unsigned int k, num; - printf (" %s: ", hie->name); + print_name (hie, h->flag_full_names); ghw_disp_subtype_indication (h, hie->u.sig.type); printf (":"); k = 0; -- cgit v1.2.3 From 5cc4c64175b0d092f4eb4ba3e556a1ddf55b440e Mon Sep 17 00:00:00 2001 From: Emmanuel Mogenet Date: Sun, 30 Apr 2017 07:05:09 +0200 Subject: Actually match the ghdl format this time --- src/grt/ghwlib.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/grt/ghwlib.c') diff --git a/src/grt/ghwlib.c b/src/grt/ghwlib.c index 1b3c4e683..0f7e50224 100644 --- a/src/grt/ghwlib.c +++ b/src/grt/ghwlib.c @@ -1038,9 +1038,10 @@ print_name (struct ghw_hie *hie, int full_names) } putchar (' '); + putchar ('/'); for (i = 0; i < depth; ++i) { - printf ("%s%s", i ? "." : "", buf[i]->name); + printf ("%s%s", i ? "/" : "", buf[i]->name); } putchar (':'); putchar (' '); @@ -1060,8 +1061,9 @@ ghw_disp_hie (struct ghw_handler *h, struct ghw_hie *top) while (1) { - for (i = 0; i < indent; i++) - fputc (' ', stdout); + if (0 == h->flag_full_names) + for (i = 0; i < indent; i++) + fputc (' ', stdout); printf ("%s", ghw_get_hie_name (hie)); switch (hie->kind) @@ -1145,7 +1147,6 @@ ghw_read_eoh (struct ghw_handler *h) return 0; } - int ghw_read_base (struct ghw_handler *h) { -- cgit v1.2.3 From 9d0c671751748ddafca1994e643bb1944c69f863 Mon Sep 17 00:00:00 2001 From: Emmanuel Mogenet Date: Wed, 3 May 2017 21:33:56 +0200 Subject: Add support for signals in generate sections --- src/grt/ghwlib.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/grt/ghwlib.c') diff --git a/src/grt/ghwlib.c b/src/grt/ghwlib.c index 0f7e50224..7c5b80bd0 100644 --- a/src/grt/ghwlib.c +++ b/src/grt/ghwlib.c @@ -1042,6 +1042,12 @@ print_name (struct ghw_hie *hie, int full_names) for (i = 0; i < depth; ++i) { printf ("%s%s", i ? "/" : "", buf[i]->name); + if (ghw_hie_generate_for == buf[i]->kind) + { + putchar ('('); + ghw_disp_value (buf[i]->u.blk.iter_value, buf[i]->u.blk.iter_type); + putchar (')'); + } } putchar (':'); putchar (' '); -- cgit v1.2.3