From: Andrey Miroshnikov Date: Mon, 8 May 2023 18:57:07 +0000 (+0000) Subject: microwatt-verilator.cpp: Added -h and -d flags. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=066a2da5a68d11fb3d40086b2dcc98fd08a5bd92;p=microwatt.git microwatt-verilator.cpp: Added -h and -d flags. Help string is crude, but at least shows all options. Dump flag for enabling trace dumping. TRIGGER_ENABLE define was preventing dumping. Trace dumps generate large VCD files, so may be worth using fst instead. --- diff --git a/verilator/microwatt-verilator.cpp b/verilator/microwatt-verilator.cpp index a226393..5c7a82e 100644 --- a/verilator/microwatt-verilator.cpp +++ b/verilator/microwatt-verilator.cpp @@ -128,7 +128,7 @@ static void mem_write(unsigned char *mem, #define BRAM_DEBUG // sigh yes, all these should be runtime commandline options -#define TRIGGER_ENABLE +//#define TRIGGER_ENABLE #define TRIGGER_OCCURENCES 1 #define TRIGGER_COUNTDOWN 20000 //#define TERMINATE_AT_COUNTDOWN @@ -179,6 +179,7 @@ int main(int argc, char **argv) memset(_mem, sz, 0); vluint64_t restore_time = 0; + bool traceme = false; // true: dump to trace file, false: don't // identify bram files to load (if not starting "+[verilator]") // here we can specify any number of files, but at present only // (realistically) two are supported: the bootloader (at address 0x0) @@ -187,7 +188,20 @@ int main(int argc, char **argv) // of hassle for (int i = 1; i < argc; i++) { char *bram_file = NULL; - if (strcmp("-s", argv[i]) == 0) { + if (strcmp("-h", argv[i]) == 0) { + printf("---Microwatt-verilator binary.---\n"); + printf("Line args:\n"); + printf("-h <- shows this help string\n"); + printf("-s [NUMBER] <- start sim from snapshot\n"); + printf("first arg <- binary file to load into bram\n"); + printf("second arg <- linux binary to load to 0x600000 (a hack)\n"); + exit(1); + } + else if (strcmp("-d", argv[i]) == 0) { + printf("Trace dump enabled. NOTE: Generates *LARGE* files!\n"); + traceme = true; + } + else if (strcmp("-s", argv[i]) == 0) { bram_file = (char*)malloc(128); // okok not freed, i know restore_time = atol(argv[i+1]); // yees, we knoow, check argc restore_model(restore_time, top); @@ -267,7 +281,6 @@ int main(int argc, char **argv) unsigned long long bram_do = 0; // trace conditions - bool traceme = true; int trigger_occurrences = TRIGGER_OCCURENCES; #ifdef TRIGGER_COUNTDOWN int trigger_countdown = TRIGGER_COUNTDOWN;