VerilatedVcdC *tfp;
#endif
-void tick(Vmicrowatt *top)
+void tick(Vmicrowatt *top, bool dump)
{
top->ext_clk = 1;
top->eval();
#if VM_TRACE
- if (tfp)
+ if (tfp && dump)
tfp->dump((double) main_time);
#endif
main_time++;
top->ext_clk = 0;
top->eval();
#if VM_TRACE
- if (tfp)
+ if (tfp && dump)
tfp->dump((double) main_time);
#endif
main_time++;
}
#define BRAM_DEBUG
+#define TRIGGER_ENABLE
+#define TRIGGER_NIA 0xa580
+#define TRIGGER_INSN 0xe8628008
+//#define TRIGGER_NIA 0x335c
+//#define TRIGGER_INSN 0x3c400001
int main(int argc, char **argv)
{
// Reset
top->ext_rst = 0;
for (unsigned long i = 0; i < 5; i++)
- tick(top);
+ tick(top, true);
top->ext_rst = 1;
unsigned long long bram_do = 0;
+ // trace conditions
+ bool traceme = true;
+#ifdef TRIGGER_ENABLE
+ traceme = false;
+#endif
+
while(!Verilated::gotFinish()) {
- tick(top);
+ tick(top, traceme);
// read/write the memory to/from the mmap'd file (if given)
if (mem != NULL) {
#ifdef BRAM_DEBUG
if (top->nia_req) {
+#ifdef TRIGGER_ENABLE
+ if ((top->nia == TRIGGER_NIA) && (top->insn == TRIGGER_INSN)) {
+ traceme = true;
+ fprintf(dump, "trace trigger enabled\n");
+ }
+#endif
fprintf(dump, "pc %8x insn %8x msr %16lx",
top->nia, top->insn, top->msr_o);
}