diff --git a/src/test/csrc/verilator/emu.cpp b/src/test/csrc/verilator/emu.cpp index 138822614..1ec4edc1c 100644 --- a/src/test/csrc/verilator/emu.cpp +++ b/src/test/csrc/verilator/emu.cpp @@ -734,7 +734,9 @@ void Emulator::snapshot_load(const char *filename) { void Emulator::fork_child_init() { #if EMU_THREAD > 1 -#ifdef VERILATOR_4_210 +#if VERILATOR_VERSION_INTEGER >= 4228000 + dut_ptr->vlSymsp->__Vm_threadPoolp = new VlThreadPool(dut_ptr->contextp(), EMU_THREAD - 1); +#elif VERILATOR_VERSION_INTEGER >= 4210000 dut_ptr->vlSymsp->__Vm_threadPoolp = new VlThreadPool(dut_ptr->contextp(), EMU_THREAD - 1, 0); #else dut_ptr->__Vm_threadPoolp = new VlThreadPool(dut_ptr->contextp(), EMU_THREAD - 1, 0); diff --git a/verilator.mk b/verilator.mk index 91b9424bf..cd3ee795c 100644 --- a/verilator.mk +++ b/verilator.mk @@ -42,9 +42,10 @@ endif # Verilator version check VERILATOR_VER_CMD = verilator --version | cut -f2 -d' ' | tr -d '.' +VERILATOR_VERSION = $(shell `$(VERILATOR_VER_CMD)`) + VERILATOR_4_210 := $(shell expr `$(VERILATOR_VER_CMD)` \>= 4210) ifeq ($(VERILATOR_4_210),1) -EMU_CXXFLAGS += -DVERILATOR_4_210 VEXTRA_FLAGS += --instr-count-dpi 1 endif VERILATOR_5_000 := $(shell expr `$(VERILATOR_VER_CMD)` \>= 5000)