build/sim/core: fix coverage
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 11 Jan 2019 14:01:58 +0000 (15:01 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 11 Jan 2019 14:01:58 +0000 (15:01 +0100)
litex/build/sim/core/Makefile
litex/build/sim/core/sim.c

index 7693abb72baa727ade2a1a1b1fc10f90fccec664..9adb97630820e0198e5d0f9fc30658c355f4e56e 100644 (file)
@@ -1,7 +1,7 @@
 include variables.mak
 
 CC = gcc
-CFLAGS = -Wall -O3 -ggdb
+CFLAGS = -Wall -O3 -ggdb $(if $(COVERAGE), -DVM_COVERAGE)
 LDFLAGS = -lpthread -ljson-c -lm -lstdc++ -ldl -levent
 
 CC_SRCS ?= "--cc dut.v"
index 6e62c5cfcd811912cbfce7b7c235ecbc39dd24d3..32124ee19b9613c963efe58971777eadad5bea96 100644 (file)
@@ -190,10 +190,12 @@ static void cb(int sock, short which, void *arg)
       if(!s->tickfirst)
        s->module->tick(s->session);
     }
-  }
 
-  if (litex_sim_got_finish())
-    event_base_loopbreak(base);
+    if (litex_sim_got_finish()) {
+        event_base_loopbreak(base);
+        break;
+    }
+  }
 
   if (!evtimer_pending(ev, NULL)) {
     event_del(ev);
@@ -232,7 +234,6 @@ int main()
     goto out;
   }
 
-
   tv.tv_sec = 0;
   tv.tv_usec = 0;
   ev = event_new(base, -1, EV_PERSIST, cb, vdut);