aboutsummaryrefslogtreecommitdiff
path: root/riscv/insns/srx.h
diff options
context:
space:
mode:
Diffstat (limited to 'riscv/insns/srx.h')
-rw-r--r--riscv/insns/srx.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/riscv/insns/srx.h b/riscv/insns/srx.h
new file mode 100644
index 00000000..19460c74
--- /dev/null
+++ b/riscv/insns/srx.h
@@ -0,0 +1,16 @@
+require_extension('P');
+if(xlen == 64){
+ int shamt = RS2 & 63;
+ if(shamt == 0){
+ WRITE_RD((uint64_t)RD);
+ }else{
+ WRITE_RD(((uint64_t)RS1 << (64 - shamt)) | ((uint64_t)RD >> shamt));
+ }
+}else{
+ int shamt = (uint32_t)RS2 & 31;
+ if (shamt == 0) {
+ WRITE_RD(sext_xlen((uint32_t)RD));
+ } else {
+ WRITE_RD(sext_xlen(((uint32_t)RS1 << (32 - shamt)) | ((uint32_t)RD >> shamt)));
+ }
+}