aboutsummaryrefslogtreecommitdiffstats
path: root/src/grt/ghwlib.c
diff options
context:
space:
mode:
authortgingold <tgingold@users.noreply.github.com>2017-04-16 08:11:12 +0200
committerGitHub <noreply@github.com>2017-04-16 08:11:12 +0200
commit2f29858cd3a29921b28a5e699b848f0ec16fb7cc (patch)
tree2a90bde86c49e31c53b712fcb063d5e3d46cf7dd /src/grt/ghwlib.c
parent7eb4e6f322074102bc1b038fdf8c5bea1beb88ff (diff)
parent5f15887ceb8460aa5b5120b1fc4f90b6ebfd06cb (diff)
downloadghdl-2f29858cd3a29921b28a5e699b848f0ec16fb7cc.tar.gz
ghdl-2f29858cd3a29921b28a5e699b848f0ec16fb7cc.tar.bz2
ghdl-2f29858cd3a29921b28a5e699b848f0ec16fb7cc.zip
Merge pull request #334 from emogenet/master
Add mechanism to restrict signals dumped by ghwdump
Diffstat (limited to 'src/grt/ghwlib.c')
-rw-r--r--src/grt/ghwlib.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/grt/ghwlib.c b/src/grt/ghwlib.c
index 996057ff6..4ac721ee0 100644
--- a/src/grt/ghwlib.c
+++ b/src/grt/ghwlib.c
@@ -1345,6 +1345,31 @@ ghw_get_value (char *buf, int len, union ghw_val *val, union ghw_type *type)
}
}
+static int
+is_skip_signal (int *signals_to_keep, int nb_signals_to_keep, int signal)
+{
+ int i;
+
+ for (i = 0; i < nb_signals_to_keep; ++i)
+ {
+ if (signal==signals_to_keep[i])
+ return 0;
+ }
+ return 1;
+}
+
+void
+ghw_filter_values (struct ghw_handler *h, int *signals_to_keep, int nb_signals_to_keep)
+{
+ int i;
+
+ for (i = 0; i < h->nbr_sigs; ++i)
+ {
+ struct ghw_sig *s = &(h->sigs[i]);
+ s->skip = is_skip_signal (signals_to_keep, nb_signals_to_keep, i);
+ }
+}
+
void
ghw_disp_values (struct ghw_handler *h)
{
@@ -1353,7 +1378,7 @@ ghw_disp_values (struct ghw_handler *h)
for (i = 0; i < h->nbr_sigs; i++)
{
struct ghw_sig *s = &h->sigs[i];
- if (s->type != NULL)
+ if (s->type != NULL && !(s->skip))
{
printf ("#%d: ", i);
ghw_disp_value (s->val, s->type);