aboutsummaryrefslogtreecommitdiff
path: root/riscv/triggers.h
diff options
context:
space:
mode:
authorYenHaoChen <howard25336284@gmail.com>2023-02-21 13:39:45 +0800
committerYenHaoChen <howard25336284@gmail.com>2024-05-22 09:04:23 +0800
commit2855c71b850f53d735edf00ccd3221115f597d16 (patch)
tree29a7c47327ee60c1b4046680d359e16fb1a8f77b /riscv/triggers.h
parent2f12bb8c58286c45b19ded54a242a03ec24131f7 (diff)
downloadriscv-isa-sim-2855c71b850f53d735edf00ccd3221115f597d16.zip
riscv-isa-sim-2855c71b850f53d735edf00ccd3221115f597d16.tar.gz
riscv-isa-sim-2855c71b850f53d735edf00ccd3221115f597d16.tar.bz2
triggers: refactor: add typedef enum { ... } hit_t for mcontrol6
Avoid using private headers, e.g., debug_defines.h, in triggers.h
Diffstat (limited to 'riscv/triggers.h')
-rw-r--r--riscv/triggers.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/riscv/triggers.h b/riscv/triggers.h
index 7a4a942..b144ade 100644
--- a/riscv/triggers.h
+++ b/riscv/triggers.h
@@ -51,6 +51,13 @@ struct match_result_t {
action_t action;
};
+typedef enum {
+ HIT_FALSE = 0,
+ HIT_BEFORE = 1,
+ HIT_AFTER = 2,
+ HIT_IMMEDIATELY_AFTER = 3
+} hit_t;
+
class matched_t
{
public:
@@ -205,7 +212,7 @@ public:
virtual bool get_store() const override { return store; }
virtual bool get_load() const override { return load; }
virtual action_t get_action() const override { return action; }
- virtual void set_hit(bool val) = 0;
+ virtual void set_hit(hit_t val) = 0;
virtual std::optional<match_result_t> detect_memory_access_match(processor_t * const proc,
operation_t operation, reg_t address, std::optional<reg_t> data) noexcept override;
@@ -232,7 +239,7 @@ public:
virtual reg_t tdata1_read(const processor_t * const proc) const noexcept override;
virtual void tdata1_write(processor_t * const proc, const reg_t val, const bool allow_chain) noexcept override;
- virtual void set_hit(bool val) override { hit = val; }
+ virtual void set_hit(hit_t val) override { hit = val != HIT_FALSE; }
private:
bool hit = false;
@@ -243,10 +250,10 @@ public:
virtual reg_t tdata1_read(const processor_t * const proc) const noexcept override;
virtual void tdata1_write(processor_t * const proc, const reg_t val, const bool allow_chain) noexcept override;
- virtual void set_hit(bool val) override { hit = val; }
+ virtual void set_hit(hit_t UNUSED val) override { hit = HIT_BEFORE; }
private:
- bool hit = false;
+ hit_t hit = HIT_FALSE;
};
class icount_t : public trigger_t {