aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--riscv/csrs.cc6
-rw-r--r--riscv/processor.h43
-rw-r--r--riscv/triggers.h29
3 files changed, 39 insertions, 39 deletions
diff --git a/riscv/csrs.cc b/riscv/csrs.cc
index 2ca9689..cbf65da 100644
--- a/riscv/csrs.cc
+++ b/riscv/csrs.cc
@@ -993,7 +993,7 @@ tdata1_csr_t::tdata1_csr_t(processor_t* const proc, const reg_t addr):
reg_t tdata1_csr_t::read() const noexcept {
reg_t v = 0;
auto xlen = proc->get_xlen();
- mcontrol_t *mc = &state->mcontrol[state->tselect->read()];
+ triggers::mcontrol_t *mc = &state->mcontrol[state->tselect->read()];
v = set_field(v, MCONTROL_TYPE(xlen), mc->type);
v = set_field(v, MCONTROL_DMODE(xlen), mc->dmode);
v = set_field(v, MCONTROL_MASKMAX(xlen), mc->maskmax);
@@ -1013,7 +1013,7 @@ reg_t tdata1_csr_t::read() const noexcept {
}
bool tdata1_csr_t::unlogged_write(const reg_t val) noexcept {
- mcontrol_t *mc = &state->mcontrol[state->tselect->read()];
+ triggers::mcontrol_t *mc = &state->mcontrol[state->tselect->read()];
if (mc->dmode && !state->debug_mode) {
return false;
}
@@ -1023,7 +1023,7 @@ bool tdata1_csr_t::unlogged_write(const reg_t val) noexcept {
mc->timing = get_field(val, MCONTROL_TIMING);
mc->action = (triggers::action_t) get_field(val, MCONTROL_ACTION);
mc->chain = get_field(val, MCONTROL_CHAIN);
- mc->match = (mcontrol_match_t) get_field(val, MCONTROL_MATCH);
+ mc->match = (triggers::mcontrol_match_t) get_field(val, MCONTROL_MATCH);
mc->m = get_field(val, MCONTROL_M);
mc->h = get_field(val, MCONTROL_H);
mc->s = get_field(val, MCONTROL_S);
diff --git a/riscv/processor.h b/riscv/processor.h
index 3e06d5b..d12ca93 100644
--- a/riscv/processor.h
+++ b/riscv/processor.h
@@ -56,35 +56,6 @@ typedef std::unordered_map<reg_t, freg_t> commit_log_reg_t;
// addr, value, size
typedef std::vector<std::tuple<reg_t, uint64_t, uint8_t>> commit_log_mem_t;
-typedef enum
-{
- MATCH_EQUAL = MCONTROL_MATCH_EQUAL,
- MATCH_NAPOT = MCONTROL_MATCH_NAPOT,
- MATCH_GE = MCONTROL_MATCH_GE,
- MATCH_LT = MCONTROL_MATCH_LT,
- MATCH_MASK_LOW = MCONTROL_MATCH_MASK_LOW,
- MATCH_MASK_HIGH = MCONTROL_MATCH_MASK_HIGH
-} mcontrol_match_t;
-
-typedef struct
-{
- uint8_t type;
- bool dmode;
- uint8_t maskmax;
- bool select;
- bool timing;
- triggers::action_t action;
- bool chain;
- mcontrol_match_t match;
- bool m;
- bool h;
- bool s;
- bool u;
- bool execute;
- bool store;
- bool load;
-} mcontrol_t;
-
enum VRM{
RNU = 0,
RNE,
@@ -203,7 +174,7 @@ struct state_t
csr_t_p dpc;
dcsr_csr_t_p dcsr;
csr_t_p tselect;
- mcontrol_t mcontrol[num_triggers];
+ triggers::mcontrol_t mcontrol[num_triggers];
tdata2_csr_t_p tdata2;
bool debug_mode;
@@ -384,33 +355,33 @@ public:
auto tdata2 = state.tdata2->read(i);
switch (state.mcontrol[i].match) {
- case MATCH_EQUAL:
+ case triggers::MATCH_EQUAL:
if (value != tdata2)
continue;
break;
- case MATCH_NAPOT:
+ case triggers::MATCH_NAPOT:
{
reg_t mask = ~((1 << (cto(tdata2)+1)) - 1);
if ((value & mask) != (tdata2 & mask))
continue;
}
break;
- case MATCH_GE:
+ case triggers::MATCH_GE:
if (value < tdata2)
continue;
break;
- case MATCH_LT:
+ case triggers::MATCH_LT:
if (value >= tdata2)
continue;
break;
- case MATCH_MASK_LOW:
+ case triggers::MATCH_MASK_LOW:
{
reg_t mask = tdata2 >> (xlen/2);
if ((value & mask) != (tdata2 & mask))
continue;
}
break;
- case MATCH_MASK_HIGH:
+ case triggers::MATCH_MASK_HIGH:
{
reg_t mask = tdata2 >> (xlen/2);
if (((value >> (xlen/2)) & mask) != (tdata2 & mask))
diff --git a/riscv/triggers.h b/riscv/triggers.h
index 068acb9..3755807 100644
--- a/riscv/triggers.h
+++ b/riscv/triggers.h
@@ -20,6 +20,35 @@ typedef enum
ACTION_TRACE_EMIT = MCONTROL_ACTION_TRACE_EMIT
} action_t;
+typedef enum
+{
+ MATCH_EQUAL = MCONTROL_MATCH_EQUAL,
+ MATCH_NAPOT = MCONTROL_MATCH_NAPOT,
+ MATCH_GE = MCONTROL_MATCH_GE,
+ MATCH_LT = MCONTROL_MATCH_LT,
+ MATCH_MASK_LOW = MCONTROL_MATCH_MASK_LOW,
+ MATCH_MASK_HIGH = MCONTROL_MATCH_MASK_HIGH
+} mcontrol_match_t;
+
+typedef struct
+{
+ uint8_t type;
+ bool dmode;
+ uint8_t maskmax;
+ bool select;
+ bool timing;
+ triggers::action_t action;
+ bool chain;
+ mcontrol_match_t match;
+ bool m;
+ bool h;
+ bool s;
+ bool u;
+ bool execute;
+ bool store;
+ bool load;
+} mcontrol_t;
+
};
#endif