diff --git a/target/common/test/verilator_lib.cc b/target/common/test/verilator_lib.cc index 2fefe225d4..681d65f67e 100644 --- a/target/common/test/verilator_lib.cc +++ b/target/common/test/verilator_lib.cc @@ -17,7 +17,7 @@ const int HTIFTimeInterval = 200; void sim_thread_main(void *arg) { ((Sim *)arg)->main(); } // Sim time. -int TIME = 0; +vluint64_t TIME = 0; Sim::Sim(int argc, char **argv) : htif_t(argc, argv), ipc(argc, argv) { // Search arguments for `--vcd` flag and enable waves if requested @@ -78,7 +78,15 @@ void Sim::main() { } // namespace sim // Verilator callback to get the current time. +<<<<<<< Updated upstream double sc_time_stamp() { return sim::TIME; } +======= +double sc_time_stamp() { + // We want to return timestamp in picosecond accuracy, assuming that one cycle takes 1ns + // Since 1 cycle takes 2 time increments, scale by 500 to get time = cycle * 1000 + + return sim::TIME * 500; +} +>>>>>>> Stashed changes // DPI calls. void tb_memory_read(long long addr, int len, const svOpenArrayHandle data) {