Update trigger behavior. (#70)
authorTim Newsome <tim@sifive.com>
Thu, 29 Sep 2016 18:24:04 +0000 (11:24 -0700)
committerAndrew Waterman <waterman@eecs.berkeley.edu>
Thu, 29 Sep 2016 18:24:03 +0000 (11:24 -0700)
M-mode writes to tdata1 with dmode set are ignored instead of raising an
exception.
Add the same behavior for tdata2.

riscv/processor.cc

index 1a41f604e9681e2f03d09c93314adafa72f9d7bd..47a3a668fafe80a2bcebfaa4a60ecb1b59058781 100644 (file)
@@ -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;
       }