diff options
author | Andrew Waterman <andrew@sifive.com> | 2020-02-15 15:41:45 -0800 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2020-02-15 15:41:45 -0800 |
commit | a8c83b8190f8ac72b04794c03e68cee873a28f3c (patch) | |
tree | 034385e72f29c1b1a36c681d5fce60055d5eaf10 /riscv/clint.cc | |
parent | 9d7c52c6bba57efe895be88fd3ba6a90e66bd3a8 (diff) | |
download | spike-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.cc | 6 |
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; } |