aboutsummaryrefslogtreecommitdiff
path: root/riscv/csrs.h
diff options
context:
space:
mode:
authorWeiwei Li <liweiwei@iscas.ac.cn>2022-07-08 20:30:02 +0800
committerWeiwei Li <liweiwei@iscas.ac.cn>2022-07-21 08:50:26 +0800
commit3ff1b5f1c6c6e13777be1c677abc2340f3dabd1a (patch)
treeb5c4481531b8da56e2aa4ef5473c148ef0b9f177 /riscv/csrs.h
parent28ee0c4d6a1ed221f1a05ba48f54023ac7d455cc (diff)
downloadspike-3ff1b5f1c6c6e13777be1c677abc2340f3dabd1a.zip
spike-3ff1b5f1c6c6e13777be1c677abc2340f3dabd1a.tar.gz
spike-3ff1b5f1c6c6e13777be1c677abc2340f3dabd1a.tar.bz2
add support for time/timeh/htimedelta/htimedeltah csrs
Diffstat (limited to 'riscv/csrs.h')
-rw-r--r--riscv/csrs.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/riscv/csrs.h b/riscv/csrs.h
index 8108d1e..34bc9d0 100644
--- a/riscv/csrs.h
+++ b/riscv/csrs.h
@@ -509,6 +509,21 @@ class wide_counter_csr_t: public csr_t {
typedef std::shared_ptr<wide_counter_csr_t> wide_counter_csr_t_p;
+class time_counter_csr_t: public csr_t {
+ public:
+ time_counter_csr_t(processor_t* const proc, const reg_t addr);
+ virtual reg_t read() const noexcept override;
+
+ void sync(const reg_t val) noexcept;
+
+ protected:
+ virtual bool unlogged_write(const reg_t val) noexcept override { return false; };
+ private:
+ reg_t shadow_val;
+};
+
+typedef std::shared_ptr<time_counter_csr_t> time_counter_csr_t_p;
+
// For a CSR that is an alias of another
class proxy_csr_t: public csr_t {
public: