use unsigned long shift on sv csr setting
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 18 Oct 2018 22:11:08 +0000 (23:11 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 18 Oct 2018 22:11:08 +0000 (23:11 +0100)
riscv/processor.cc

index 4431dcdc05979479303775560f85d7af3c062dbd..3586dc02126c907291bdb4e312e55d8209501f61 100644 (file)
@@ -378,8 +378,8 @@ void processor_t::set_csr(int which, reg_t val)
       int clroffset = 2;
       if (xlen == 64)
       {
-          state.sv_csrs[tbidx+2].u = get_field(val, 0xffff<<32);
-          state.sv_csrs[tbidx+3].u = get_field(val, 0xffff<<48);
+          state.sv_csrs[tbidx+2].u = get_field(val, 0xffffUL<<32);
+          state.sv_csrs[tbidx+3].u = get_field(val, 0xffffUL<<48);
         clroffset = 4;
       }
       // clear out all CSRs above the one(s) being set: this ensures that
@@ -439,8 +439,8 @@ void processor_t::set_csr(int which, reg_t val)
       int clroffset = 2;
       if (xlen == 64)
       {
-          state.sv_pred_csrs[tbidx+2].u = get_field(val, 0xffff<<32);
-          state.sv_pred_csrs[tbidx+3].u = get_field(val, 0xffff<<48);
+          state.sv_pred_csrs[tbidx+2].u = get_field(val, 0xffffUL<<32);
+          state.sv_pred_csrs[tbidx+3].u = get_field(val, 0xffffUL<<48);
           clroffset = 4;
       }
       for (int i = tbidx+clroffset; i < 16; i++)