From: Luke Kenneth Casson Leighton Date: Tue, 11 Jan 2022 07:43:07 +0000 (+0000) Subject: add trace-activation for a #defined number of cycles X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fa837f972022bdd745ce025f2cb5b0758cdde2d7;p=microwatt.git add trace-activation for a #defined number of cycles --- diff --git a/verilator/microwatt-verilator.cpp b/verilator/microwatt-verilator.cpp index 836540c..f714d4d 100644 --- a/verilator/microwatt-verilator.cpp +++ b/verilator/microwatt-verilator.cpp @@ -81,6 +81,7 @@ static void mem_write(unsigned char *mem, #define TRIGGER_ENABLE #define TRIGGER_NIA 0xa580 #define TRIGGER_INSN 0xe8628008 +#define TRIGGER_COUNTDOWN 200000 //#define TRIGGER_NIA 0x335c //#define TRIGGER_INSN 0x3c400001 @@ -184,6 +185,7 @@ int main(int argc, char **argv) // trace conditions bool traceme = true; + int trigger_countdown = TRIGGER_COUNTDOWN; #ifdef TRIGGER_ENABLE traceme = false; #endif @@ -213,6 +215,13 @@ int main(int argc, char **argv) traceme = true; fprintf(dump, "trace trigger enabled\n"); } + // tracing active for only TRIGGER_COUNTDOWN cycles + if (traceme) { + trigger_countdown--; + if (trigger_countdown == 0) { + traceme = false; + } + } #endif fprintf(dump, "pc %8x insn %8x msr %16lx", top->nia, top->insn, top->msr_o);