[PATCH 08/23] sim/erc32: added -v and -vv command line switches for verbose output

Jiri Gaisler
2015-02-17T07:45:37Z

* help.c (usage) update usage help print-out

* sis.c (run_sim) increase debug level with -v and -vv. Also print
simulation time in long long format.
---
sim/erc32/help.c | 2 +-
sim/erc32/sis.c | 10 +++++++---
2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/sim/erc32/help.c b/sim/erc32/help.c
index 21c2a77..6d74e79 100644
--- a/sim/erc32/help.c
+++ b/sim/erc32/help.c
@@ -7,8 +7,8 @@ usage()
{

printf("usage: sis [-uart1 uart_device1] [-uart2 uart_device2]\n");
+ printf("[-sparclite] [-dumbio] [-v] [-vv]\n");
printf("[-nfp] [-freq frequency] [-c batch_file] [files]\n");
- printf("[-sparclite] [-dumbio]\n");
}

void
diff --git a/sim/erc32/sis.c b/sim/erc32/sis.c
index 39050d7..97f1b31 100644
--- a/sim/erc32/sis.c
+++ b/sim/erc32/sis.c
@@ -122,7 +122,7 @@ run_sim(sregs, icount, dis)
sregs->histind = 0;
}
if (dis) {
- printf(" %8u ", ebase.simtime);
+ printf(" %8llu ", ebase.simtime);
dis_mem(sregs->pc, 1, &dinfo);
}
}
@@ -214,6 +214,10 @@ main(argc, argv)
#endif
} else if (strcmp(argv[stat], "-dumbio") == 0) {
dumbio = 1;
+ } else if (strcmp(argv[stat], "-v") == 0) {
+ sis_verbose = 1;
+ } else if (strcmp(argv[stat], "-vv") == 0) {
+ sis_verbose = 2;
} else {
printf("unknown option %s\n", argv[stat]);
usage();
@@ -279,7 +283,7 @@ main(argc, argv)
case CTRL_C:
printf("\b\bInterrupt!\n");
case TIME_OUT:
- printf(" Stopped at time %d (%.3f ms)\n", ebase.simtime,
+ printf(" Stopped at time %llu (%.3f ms)\n", ebase.simtime,
((double) ebase.simtime / (double) sregs.freq) / 1000.0);
break;
case BPT_HIT:
@@ -289,7 +293,7 @@ main(argc, argv)
case ERROR:
printf("IU in error mode (%d)\n", sregs.trap);
stat = 0;
- printf(" %8d ", ebase.simtime);
+ printf(" %8llu ", ebase.simtime);
dis_mem(sregs.pc, 1, &dinfo);
break;
default:
--
2.1.0