提交 f060958b 编写于 作者: A Allen

emu: output coverage to coverage.dat.

上级 d70a2272
......@@ -69,7 +69,7 @@ EMU_CXXFLAGS += -std=c++11 -static -Wall -I$(EMU_CSRC_DIR)
EMU_CXXFLAGS += -DVERILATOR -Wno-maybe-uninitialized
EMU_LDFLAGS += -lpthread -lSDL2 -ldl -lz
VEXTRA_FLAGS = -I$(abspath $(BUILD_DIR)) --x-assign unique -O3 -CFLAGS "$(EMU_CXXFLAGS)" -LDFLAGS "$(EMU_LDFLAGS)"
VEXTRA_FLAGS = -I$(abspath $(BUILD_DIR)) --x-assign unique -O3 -CFLAGS "$(EMU_CXXFLAGS)" -LDFLAGS "$(EMU_LDFLAGS)" --coverage-line
# Verilator trace support
EMU_TRACE ?=
......
......@@ -329,6 +329,7 @@ uint64_t Emulator::execute(uint64_t max_cycle, uint64_t max_instr) {
#if VM_TRACE == 1
if (enable_waveform) tfp->close();
#endif
save_coverage();
display_trapinfo();
return cycles;
}
......@@ -358,6 +359,19 @@ inline char* Emulator::waveform_filename(time_t t) {
return buf;
}
inline void Emulator::save_coverage(void) {
char *noop_home = getenv("NOOP_HOME");
assert(noop_home != NULL);
char buf[1024];
snprintf(buf, 1024, "%s/build/logs", noop_home);
Verilated::mkdir(buf);
snprintf(buf, 1024, "%s/build/logs/coverage.dat", noop_home);
VerilatedCov::write(buf);
}
void Emulator::display_trapinfo() {
uint64_t pc = dut_ptr->io_trap_pc;
uint64_t instrCnt = dut_ptr->io_trap_instrCnt;
......
......@@ -59,6 +59,7 @@ class Emulator {
void snapshot_save(const char *filename);
void snapshot_load(const char *filename);
inline char* waveform_filename(time_t t);
inline void save_coverage(void);
public:
Emulator(int argc, const char *argv[]);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册