From 8e6cf2916b9cb809744ac8dbcc04d2a2b108c5b5 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Fri, 22 Apr 2022 10:28:35 -0700 Subject: Whitespace fix. --- riscv/triggers.h | 1 - 1 file changed, 1 deletion(-) (limited to 'riscv/triggers.h') diff --git a/riscv/triggers.h b/riscv/triggers.h index ad294c8..3a9c34b 100644 --- a/riscv/triggers.h +++ b/riscv/triggers.h @@ -110,7 +110,6 @@ public: bool store_bit; bool load_bit; reg_t tdata2; - }; class module_t { -- cgit v1.1 From d9131e3b1dc571a657f9615903d1b7220c7c7d7f Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Fri, 22 Apr 2022 10:40:01 -0700 Subject: Remove mcontrol_t.type. It's not writable anyway. --- riscv/triggers.h | 1 - 1 file changed, 1 deletion(-) (limited to 'riscv/triggers.h') diff --git a/riscv/triggers.h b/riscv/triggers.h index 3a9c34b..c21b638 100644 --- a/riscv/triggers.h +++ b/riscv/triggers.h @@ -96,7 +96,6 @@ private: bool simple_match(unsigned xlen, reg_t value) const; public: - uint8_t type; uint8_t maskmax; bool select; bool timing; -- cgit v1.1 From 16413646bb44d8752c25f0f36745b6b74a2a1025 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Fri, 22 Apr 2022 10:48:00 -0700 Subject: Remove maskmax as a variable. --- riscv/triggers.h | 1 - 1 file changed, 1 deletion(-) (limited to 'riscv/triggers.h') diff --git a/riscv/triggers.h b/riscv/triggers.h index c21b638..1e74c91 100644 --- a/riscv/triggers.h +++ b/riscv/triggers.h @@ -96,7 +96,6 @@ private: bool simple_match(unsigned xlen, reg_t value) const; public: - uint8_t maskmax; bool select; bool timing; bool chain_bit; -- cgit v1.1 From f2f6037fea9313f43f7e94872304ab18ead0181d Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Fri, 22 Apr 2022 10:57:31 -0700 Subject: Remove mcontrol_t.h It was removed from the spec a long time ago. --- riscv/triggers.h | 1 - 1 file changed, 1 deletion(-) (limited to 'riscv/triggers.h') diff --git a/riscv/triggers.h b/riscv/triggers.h index 1e74c91..75ee405 100644 --- a/riscv/triggers.h +++ b/riscv/triggers.h @@ -101,7 +101,6 @@ public: bool chain_bit; match_t match; bool m; - bool h; bool s; bool u; bool execute_bit; -- cgit v1.1 From 85fbd75d44c369ccb358d70bb4adc3a82a23c495 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Thu, 28 Apr 2022 10:27:42 -0700 Subject: Implement mcontrol trigger hit bit. --- riscv/triggers.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'riscv/triggers.h') diff --git a/riscv/triggers.h b/riscv/triggers.h index 75ee405..19fa437 100644 --- a/riscv/triggers.h +++ b/riscv/triggers.h @@ -58,11 +58,12 @@ public: public: bool dmode; action_t action; + bool hit; virtual ~trigger_t() {}; protected: - trigger_t() : dmode(false), action(ACTION_DEBUG_EXCEPTION) {}; + trigger_t() : dmode(false), action(ACTION_DEBUG_EXCEPTION), hit(false) {}; }; class mcontrol_t : public trigger_t { -- cgit v1.1 From 95f36bc28eb79bb9d7a8681dcb2a83b364842b62 Mon Sep 17 00:00:00 2001 From: Scott Johnson Date: Thu, 15 Sep 2022 10:29:28 -0700 Subject: 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. --- riscv/triggers.h | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'riscv/triggers.h') 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; }; -- cgit v1.1 From b724db52f9d7be3e3068e5bf01ac939ece8d032b Mon Sep 17 00:00:00 2001 From: YenHaoChen Date: Fri, 30 Sep 2022 11:48:44 +0800 Subject: Add has_data argument to trigger checking functions The mcontrol trigger can select either address or data for checking. The The selection decides the priority of the trigger. For instance, the address trigger has a higher priority over the page fault, and the page fault has a higher priority over the data trigger. The previous implementation only has the checking functions for data trigger, which results in incorrect priority of address trigger. This commit adds a has_data argument to indicate address trigger and the priority of the trigger. --- riscv/triggers.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'riscv/triggers.h') diff --git a/riscv/triggers.h b/riscv/triggers.h index 8f1b81d..b7512ef 100644 --- a/riscv/triggers.h +++ b/riscv/triggers.h @@ -43,7 +43,7 @@ class matched_t class trigger_t { public: virtual match_result_t memory_access_match(processor_t * const proc, - operation_t operation, reg_t address, reg_t data) = 0; + operation_t operation, reg_t address, bool has_data, reg_t data=0) = 0; virtual reg_t tdata1_read(const processor_t * const proc) const noexcept = 0; virtual bool tdata1_write(processor_t * const proc, const reg_t val) noexcept = 0; @@ -88,7 +88,7 @@ public: virtual bool load() const override { return load_bit; } virtual match_result_t memory_access_match(processor_t * const proc, - operation_t operation, reg_t address, reg_t data) override; + operation_t operation, reg_t address, bool has_data, reg_t data=0) override; private: bool simple_match(unsigned xlen, reg_t value) const; @@ -115,7 +115,7 @@ public: unsigned count() const { return triggers.size(); } match_result_t memory_access_match(action_t * const action, - operation_t operation, reg_t address, reg_t data); + operation_t operation, reg_t address, bool has_data, reg_t data=0); reg_t tdata1_read(const processor_t * const proc, unsigned index) const noexcept; bool tdata1_write(processor_t * const proc, unsigned index, const reg_t val) noexcept; -- cgit v1.1 From 37c8985013b1a15a8043f002e94f38e09cb55ef4 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Thu, 13 Oct 2022 13:51:06 -0700 Subject: Remove unused field matched_t::data --- riscv/triggers.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'riscv/triggers.h') diff --git a/riscv/triggers.h b/riscv/triggers.h index b7512ef..05ce75e 100644 --- a/riscv/triggers.h +++ b/riscv/triggers.h @@ -31,12 +31,11 @@ typedef enum { class matched_t { public: - matched_t(triggers::operation_t operation, reg_t address, reg_t data, action_t action) : - operation(operation), address(address), data(data), action(action) {} + matched_t(triggers::operation_t operation, reg_t address, action_t action) : + operation(operation), address(address), action(action) {} triggers::operation_t operation; reg_t address; - reg_t data; action_t action; }; -- cgit v1.1 From 062ef8868033605b56269b185e3584ef2370ac12 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Thu, 13 Oct 2022 13:57:08 -0700 Subject: In triggers, use optional instead of {has_data, data} --- riscv/triggers.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'riscv/triggers.h') diff --git a/riscv/triggers.h b/riscv/triggers.h index 05ce75e..7b40b8f 100644 --- a/riscv/triggers.h +++ b/riscv/triggers.h @@ -2,6 +2,7 @@ #define _RISCV_TRIGGERS_H #include +#include #include "decode.h" @@ -42,7 +43,7 @@ class matched_t class trigger_t { public: virtual match_result_t memory_access_match(processor_t * const proc, - operation_t operation, reg_t address, bool has_data, reg_t data=0) = 0; + operation_t operation, reg_t address, std::optional data) = 0; virtual reg_t tdata1_read(const processor_t * const proc) const noexcept = 0; virtual bool tdata1_write(processor_t * const proc, const reg_t val) noexcept = 0; @@ -87,7 +88,7 @@ public: virtual bool load() const override { return load_bit; } virtual match_result_t memory_access_match(processor_t * const proc, - operation_t operation, reg_t address, bool has_data, reg_t data=0) override; + operation_t operation, reg_t address, std::optional data) override; private: bool simple_match(unsigned xlen, reg_t value) const; @@ -114,7 +115,7 @@ public: unsigned count() const { return triggers.size(); } match_result_t memory_access_match(action_t * const action, - operation_t operation, reg_t address, bool has_data, reg_t data=0); + operation_t operation, reg_t address, std::optional data); reg_t tdata1_read(const processor_t * const proc, unsigned index) const noexcept; bool tdata1_write(processor_t * const proc, unsigned index, const reg_t val) noexcept; -- cgit v1.1