diff --git a/src/test/csrc/common/ram.cpp b/src/test/csrc/common/ram.cpp index 00eb6ed14..b551a501e 100644 --- a/src/test/csrc/common/ram.cpp +++ b/src/test/csrc/common/ram.cpp @@ -226,6 +226,7 @@ InputReader *SimMemory::createInputReader(const char *image) { } void SimMemory::display_stats() { +#ifdef FUZZING uint64_t req_in_range = 0; auto const img_indices = get_img_size() / sizeof(uint64_t); for (auto index : accessed_indices) { @@ -235,6 +236,7 @@ void SimMemory::display_stats() { } auto req_all = accessed_indices.size(); printf("SimMemory: img_size %lu, req_all %lu, req_in_range %lu\n", img_indices, req_all, req_in_range); +#endif // FUZZING } MmapMemory::MmapMemory(const char *image, uint64_t n_bytes) : SimMemory(n_bytes) { diff --git a/src/test/csrc/common/ram.h b/src/test/csrc/common/ram.h index ed2e33ca1..9c1a66aad 100644 --- a/src/test/csrc/common/ram.h +++ b/src/test/csrc/common/ram.h @@ -85,11 +85,15 @@ class SimMemory { protected: uint64_t memory_size; // in bytes +#ifdef FUZZING std::set accessed_indices; +#endif InputReader *createInputReader(const char *image); virtual uint64_t get_img_size() = 0; void inline on_access(uint64_t index) { +#ifdef FUZZING accessed_indices.insert(index); +#endif } public: diff --git a/src/test/csrc/verilator/emu.cpp b/src/test/csrc/verilator/emu.cpp index 6328d2421..9de757974 100644 --- a/src/test/csrc/verilator/emu.cpp +++ b/src/test/csrc/verilator/emu.cpp @@ -480,9 +480,7 @@ Emulator::~Emulator() { stats.update(&(difftest[0]->dut)); #endif // CONFIG_NO_DIFFTEST -#ifdef FUZZING simMemory->display_stats(); -#endif delete simMemory; simMemory = nullptr;