aboutsummaryrefslogtreecommitdiff
path: root/riscv/clint.cc
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2020-02-15 15:41:45 -0800
committerAndrew Waterman <andrew@sifive.com>2020-02-15 15:41:45 -0800
commita8c83b8190f8ac72b04794c03e68cee873a28f3c (patch)
tree034385e72f29c1b1a36c681d5fce60055d5eaf10 /riscv/clint.cc
parent9d7c52c6bba57efe895be88fd3ba6a90e66bd3a8 (diff)
downloadspike-a8c83b8190f8ac72b04794c03e68cee873a28f3c.zip
spike-a8c83b8190f8ac72b04794c03e68cee873a28f3c.tar.gz
spike-a8c83b8190f8ac72b04794c03e68cee873a28f3c.tar.bz2
Make CLINT API use Hz instead of MHz
Diffstat (limited to 'riscv/clint.cc')
-rw-r--r--riscv/clint.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/riscv/clint.cc b/riscv/clint.cc
index d68f4cc..aee995b 100644
--- a/riscv/clint.cc
+++ b/riscv/clint.cc
@@ -2,8 +2,8 @@
#include "devices.h"
#include "processor.h"
-clint_t::clint_t(std::vector<processor_t*>& procs, uint64_t freq_mhz, bool real_time)
- : procs(procs), freq_mhz(freq_mhz), real_time(real_time), mtime(0), mtimecmp(procs.size())
+clint_t::clint_t(std::vector<processor_t*>& procs, uint64_t freq_hz, bool real_time)
+ : procs(procs), freq_hz(freq_hz), real_time(real_time), mtime(0), mtimecmp(procs.size())
{
struct timeval base;
@@ -77,7 +77,7 @@ void clint_t::increment(reg_t inc)
gettimeofday(&now, NULL);
diff_usecs = ((now.tv_sec - real_time_ref_secs) * 1000000) + (now.tv_usec - real_time_ref_usecs);
- mtime = diff_usecs * freq_mhz;
+ mtime = diff_usecs * freq_hz / 1000000;
} else {
mtime += inc;
}