when TRIGGER_COUNTDOWN not enabled, make it on all the time
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 23 Jan 2022 13:52:49 +0000 (13:52 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 23 Jan 2022 13:52:49 +0000 (13:52 +0000)
verilator/microwatt-verilator.cpp

index 9e3905500a5b0394c7494ca1bdfabb784d87a8ad..8fe2973ca4421cc7d5dc437831d2821615f45af1 100644 (file)
@@ -126,9 +126,11 @@ static void mem_write(unsigned char *mem,
 }
 
 #define BRAM_DEBUG
+
+// sigh yes, all these should be runtime commandline options
 #define TRIGGER_ENABLE
 #define TRIGGER_OCCURENCES 1
-#define TRIGGER_COUNTDOWN 10000
+//#define TRIGGER_COUNTDOWN 10000
 //#define TERMINATE_AT_COUNTDOWN
 //#define TRIGGER_NIA 0xa580
 //#define TRIGGER_INSN 0xe8628008
@@ -255,11 +257,14 @@ int main(int argc, char **argv)
 
     // trace conditions
     bool traceme = true;
-    int trigger_countdown = TRIGGER_COUNTDOWN;
     int trigger_occurrences = TRIGGER_OCCURENCES;
+#ifdef TRIGGER_COUNTDOWN
+    int trigger_countdown = TRIGGER_COUNTDOWN;
+#else
 #ifdef TRIGGER_ENABLE
     traceme = false;
 #endif
+#endif // TRIGGER_COUNTDOWN
 
        while(!Verilated::gotFinish()) {
 
@@ -305,6 +310,7 @@ int main(int argc, char **argv)
                     --trigger_occurrences;
                 }
             }
+#ifdef TRIGGER_COUNTDOWN
             // tracing active for only TRIGGER_COUNTDOWN cycles
             if (traceme) {
                 --trigger_countdown;
@@ -315,16 +321,19 @@ int main(int argc, char **argv)
 #endif
                 }
             }
-#endif
+#endif // TRIGGER_COUNTDOWN
+#endif // TRIGGER_ENABLE
             fprintf(dump, "pc %16lx insn %8x msr %16lx",
                                 top->nia, top->insn, top->msr_o);
         }
+#ifdef LDST_DUMP
         if (top->ldst_req) {
             if (!top->nia_req) {
                 fprintf(dump, "pc %-16s insn %-8s msr %-16s", "", "", "");
             }
             fprintf(dump, "    ldst %16lx", top->ldst_addr);
         }
+#endif
         if (top->ldst_req || top->nia_req) {
             fprintf(dump, "\n");
         }