From a3587f48eaaf22c7391069603f5492cd94e042c7 Mon Sep 17 00:00:00 2001 From: Yinan Xu Date: Thu, 21 Sep 2023 12:16:03 +0800 Subject: [PATCH] dut: move trap values to common/dut They are used by both Verilator and VCS. --- src/test/csrc/common/dut.h | 12 ++++++++++++ src/test/csrc/difftest/difftest.cpp | 1 + src/test/csrc/verilator/emu.h | 12 ------------ 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/test/csrc/common/dut.h b/src/test/csrc/common/dut.h index 70f026a40..c518067c7 100644 --- a/src/test/csrc/common/dut.h +++ b/src/test/csrc/common/dut.h @@ -33,6 +33,18 @@ class DUT { #define simstats_display(s, ...) \ eprintf(ANSI_COLOR_GREEN s ANSI_COLOR_RESET, ##__VA_ARGS__) +enum { + STATE_GOODTRAP = 0, + STATE_BADTRAP = 1, + STATE_ABORT = 2, + STATE_LIMIT_EXCEEDED = 3, + STATE_SIG = 4, + STATE_AMBIGUOUS = 5, + STATE_SIM_EXIT = 6, + STATE_FUZZ_COND = 7, + STATE_RUNNING = -1 +}; + enum class SimExitCode { good_trap, exceed_limit, diff --git a/src/test/csrc/difftest/difftest.cpp b/src/test/csrc/difftest/difftest.cpp index ebd825647..866d8dd96 100644 --- a/src/test/csrc/difftest/difftest.cpp +++ b/src/test/csrc/difftest/difftest.cpp @@ -16,6 +16,7 @@ #include "difftest.h" #include "difftrace.h" +#include "dut.h" #include "goldenmem.h" #include "ram.h" #include "flash.h" diff --git a/src/test/csrc/verilator/emu.h b/src/test/csrc/verilator/emu.h index a28912a98..f6e05a033 100644 --- a/src/test/csrc/verilator/emu.h +++ b/src/test/csrc/verilator/emu.h @@ -79,18 +79,6 @@ struct EmuArgs { bool image_as_footprints = false; }; -enum { - STATE_GOODTRAP = 0, - STATE_BADTRAP = 1, - STATE_ABORT = 2, - STATE_LIMIT_EXCEEDED = 3, - STATE_SIG = 4, - STATE_AMBIGUOUS = 5, - STATE_SIM_EXIT = 6, - STATE_FUZZ_COND = 7, - STATE_RUNNING = -1 -}; - class Emulator final : public DUT { private: VSimTop *dut_ptr;