From 02027ca74cb904ee691b7b7d9b03c46f3c1f49ac Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Thu, 29 Sep 2016 11:24:04 -0700 Subject: [PATCH] Update trigger behavior. (#70) M-mode writes to tdata1 with dmode set are ignored instead of raising an exception. Add the same behavior for tdata2. --- riscv/processor.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/riscv/processor.cc b/riscv/processor.cc index 1a41f60..47a3a66 100644 --- a/riscv/processor.cc +++ b/riscv/processor.cc @@ -419,7 +419,7 @@ void processor_t::set_csr(int which, reg_t val) { mcontrol_t *mc = &state.mcontrol[state.tselect]; if (mc->dmode && !state.dcsr.cause) { - throw trap_illegal_instruction(); + break; } mc->dmode = get_field(val, MCONTROL_DMODE(xlen)); mc->select = get_field(val, MCONTROL_SELECT); @@ -443,6 +443,9 @@ void processor_t::set_csr(int which, reg_t val) } break; case CSR_TDATA2: + if (state.mcontrol[state.tselect].dmode && !state.dcsr.cause) { + break; + } if (state.tselect < state.num_triggers) { state.tdata2[state.tselect] = val; } -- 2.30.2