diff options
author | Scott Johnson <scott.johnson@arilinc.com> | 2022-09-15 10:29:28 -0700 |
---|---|---|
committer | Scott Johnson <scott.johnson@arilinc.com> | 2022-09-15 10:29:28 -0700 |
commit | 95f36bc28eb79bb9d7a8681dcb2a83b364842b62 (patch) | |
tree | da1892c9c15ede830c85c7ce2091e01e76bc350c /riscv | |
parent | a0972c82d022f6f7c337b06b27c89a60af52202a (diff) | |
download | spike-95f36bc28eb79bb9d7a8681dcb2a83b364842b62.zip spike-95f36bc28eb79bb9d7a8681dcb2a83b364842b62.tar.gz spike-95f36bc28eb79bb9d7a8681dcb2a83b364842b62.tar.bz2 |
Initialize triggers using default member initializers
Instead of constructor member initializer lists, which require
repeating the list of members, and cause ugly merge conflicts when the
list of members changes.
Diffstat (limited to 'riscv')
-rw-r--r-- | riscv/triggers.cc | 7 | ||||
-rw-r--r-- | riscv/triggers.h | 31 |
2 files changed, 14 insertions, 24 deletions
diff --git a/riscv/triggers.cc b/riscv/triggers.cc index c9d6161..4b73715 100644 --- a/riscv/triggers.cc +++ b/riscv/triggers.cc @@ -4,13 +4,6 @@ namespace triggers { -mcontrol_t::mcontrol_t() : - select(false), timing(false), chain_bit(false), - match(MATCH_EQUAL), m(false), s(false), u(false), - execute_bit(false), store_bit(false), load_bit(false) -{ -} - reg_t mcontrol_t::tdata1_read(const processor_t * const proc) const noexcept { reg_t v = 0; auto xlen = proc->get_xlen(); diff --git a/riscv/triggers.h b/riscv/triggers.h index 19fa437..8f1b81d 100644 --- a/riscv/triggers.h +++ b/riscv/triggers.h @@ -55,15 +55,14 @@ public: virtual bool store() const { return false; } virtual bool load() const { return false; } -public: - bool dmode; - action_t action; - bool hit; + bool dmode = false; + action_t action = ACTION_DEBUG_EXCEPTION; + bool hit = false; virtual ~trigger_t() {}; protected: - trigger_t() : dmode(false), action(ACTION_DEBUG_EXCEPTION), hit(false) {}; + trigger_t() {} }; class mcontrol_t : public trigger_t { @@ -78,8 +77,6 @@ public: MATCH_MASK_HIGH = MCONTROL_MATCH_MASK_HIGH } match_t; - mcontrol_t(); - virtual reg_t tdata1_read(const processor_t * const proc) const noexcept override; virtual bool tdata1_write(processor_t * const proc, const reg_t val) noexcept override; virtual reg_t tdata2_read(const processor_t * const proc) const noexcept override; @@ -97,16 +94,16 @@ private: bool simple_match(unsigned xlen, reg_t value) const; public: - bool select; - bool timing; - bool chain_bit; - match_t match; - bool m; - bool s; - bool u; - bool execute_bit; - bool store_bit; - bool load_bit; + bool select = false; + bool timing = false; + bool chain_bit = false; + match_t match = MATCH_EQUAL; + bool m = false; + bool s = false; + bool u = false; + bool execute_bit = false; + bool store_bit = false; + bool load_bit = false; reg_t tdata2; }; |