summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Norton2017-05-26 09:25:33 +0100
committerRobert Norton2017-05-26 09:27:23 +0100
commit63969f86a41d6547ba12716d246c7020528a6ae1 (patch)
treeb887a5803f202f0b043cd771c82b813dcb2c302e
parent2d761dec9fd4ba26793ff44fb27fad0c17c30db8 (diff)
add cmovz and cmovn conditional capability move instructions new in ISAv6.
-rw-r--r--cheri/cheri_insts.sail16
1 files changed, 16 insertions, 0 deletions
diff --git a/cheri/cheri_insts.sail b/cheri/cheri_insts.sail
index 08a58516..2353a737 100644
--- a/cheri/cheri_insts.sail
+++ b/cheri/cheri_insts.sail
@@ -463,6 +463,22 @@ function clause execute (CClearTag(cd, cb)) =
(* END_CClearTag *)
}
+union ast member (regno,regno,regno,bool) CMOVX
+function clause decode (0b010010 : 0b00000 : (regno) cd : (regno) cb : (regno) rt : 0b011100) = Some(CMOVX(cd, cb, rt, false)) (* CMOVN *)
+function clause decode (0b010010 : 0b00000 : (regno) cd : (regno) cb : (regno) rt : 0b011011) = Some(CMOVX(cd, cb, rt, true)) (* CMOVZ *)
+function clause execute (CMOVX(cd, cb, rt, ismovz)) =
+{
+ (* START_CMOVX *)
+ checkCP2usable();
+ if (register_inaccessible(cd)) then
+ raise_c2_exception(CapEx_AccessSystemRegsViolation, cd)
+ else if (register_inaccessible(cb)) then
+ raise_c2_exception(CapEx_AccessSystemRegsViolation, cb)
+ else if ((rGPR(rt) == 0) ^ ismovz) then
+ writeCapReg(cd) := readCapReg(cb);
+ (* END_CMOVX *)
+}
+
union ast member (ClearRegSet, bit[16]) ClearRegs
function clause decode (0b010010 : 0b01111 : 0b00000 : (bit[16]) imm) = Some(ClearRegs(GPLo, imm)) (* ClearLo *)
function clause decode (0b010010 : 0b01111 : 0b00001 : (bit[16]) imm) = Some(ClearRegs(GPHi, imm)) (* ClearHi *)