Skip to content

Fix kslraw.u instruction in P extension, version 0.9.11

Eclipse Webmaster requested to merge github/fork/xiaoweish/kslraw_u into master

Created by: xiaoweish

Credit goes to my colleague Han for his contributions.

Per P ext 0.9.11, fix kslraw.u behavior.

if (Rs2[5:0] s< 0) {
  sa = -Rs2[5:0];
  sa = (sa == 32)? 31 : sa;
  res[31:-1] = SE33(Rs1[31:(sa-1)]) + 1;
  rst[31:0] = res[31:0];
} else {
  sa = Rs2[5:0];
  tmp[(31+sa):0] = Rs1.W[0] u<< sa;
  if (tmp s> (2^31)-1) {
    rst[31:0] = (2^31)-1;
    OV = 1;
  } else if (tmp s< -2^31) {
    rst[31:0] = -2^31;
    OV = 1
  } else {
    rst[31:0] = tmp[31:0];
  }
}
Rd = rst[31:0]; // RV32
Rd = SE64(rst[31:0]); // RV64

Merge request reports

Loading