summaryrefslogtreecommitdiff
path: root/cheri
diff options
context:
space:
mode:
authorRobert Norton2016-04-18 18:04:21 +0100
committerRobert Norton2016-04-18 18:16:19 +0100
commit2bf8f99f6982a78e6f8e2f9fc18384b1a8ccbccc (patch)
tree782616a25922efc21bb0f661bc04ef6af2920fad /cheri
parentc557c893609b7b378bd4fd5d3f5873433f44323d (diff)
cheri: use signed() rather than casting to int as advised by kathy. This has the advantage of actually doing what I want.
Diffstat (limited to 'cheri')
-rw-r--r--cheri/cheri_insts.sail12
1 files changed, 6 insertions, 6 deletions
diff --git a/cheri/cheri_insts.sail b/cheri/cheri_insts.sail
index c340ef32..c8ca156d 100644
--- a/cheri/cheri_insts.sail
+++ b/cheri/cheri_insts.sail
@@ -487,7 +487,7 @@ function clause decode (0b010010 : 0b10000 : (regno) rd : (regno) cb : 0b0000000
function clause decode (0b010010 : 0b10000 : (regno) rd : (regno) cb : 0b00000001 : 0b1 : 0b10) = Some(CLoad(rd, cb, 0b00000, 0b00000000, true, W, true)) (* CLLW *)
function clause decode (0b010010 : 0b10000 : (regno) rd : (regno) cb : 0b00000001 : 0b0 : 0b11) = Some(CLoad(rd, cb, 0b00000, 0b00000000, false, D, true)) (* CLLD *)
-function clause execute (CLoad(rd, cb, rt, offset, signed, width, linked)) =
+function clause execute (CLoad(rd, cb, rt, offset, signext, width, linked)) =
{
cb_val := readCapReg(cb);
if (register_inaccessible(cb)) then
@@ -502,7 +502,7 @@ function clause execute (CLoad(rd, cb, rt, offset, signed, width, linked)) =
{
size := wordWidthBytes(width);
cursor := getCapCursor(cb_val);
- vAddr := cursor + (int) (rGPR(rt)) + (int) offset;
+ vAddr := cursor + signed(rGPR(rt)) + signed(offset);
vAddr64:= (bit[64]) vAddr;
if ((vAddr + size) > ((nat) (cb_val.base) + ((nat) (cb_val.length)))) then
exit (raise_c2_exception(CapEx_LengthViolation, cb))
@@ -522,7 +522,7 @@ function clause execute (CLoad(rd, cb, rt, offset, signed, width, linked)) =
}
else
MEMr(pAddr, widthBytes);
- if (signed) then
+ if (signext) then
wGPR(rd) := EXTS(memResult)
else
wGPR(rd) := EXTZ(memResult)
@@ -556,7 +556,7 @@ function clause execute (CStore(rs, cb, rt, rd, offset, width, conditional)) =
{
size := wordWidthBytes(width);
cursor := getCapCursor(cb_val);
- vAddr := cursor + (int) (rGPR(rt)) + (int) offset;
+ vAddr := cursor + signed(rGPR(rt)) + signed(offset);
vAddr64:= (bit[64]) vAddr;
if ((vAddr + size) > ((nat) (cb_val.base) + ((nat) (cb_val.length)))) then
exit (raise_c2_exception(CapEx_LengthViolation, cb))
@@ -616,7 +616,7 @@ function clause execute (CSC(cs, cb, rt, rd, offset, conditional)) =
else
{
cursor := getCapCursor(cb_val);
- vAddr := cursor + (int) (rGPR(rt)) + (int) offset;
+ vAddr := cursor + signed(rGPR(rt)) + signed(offset);
vAddr64:= (bit[64]) vAddr;
if ((vAddr + cap_size) > ((nat) (cb_val.base) + ((nat) (cb_val.length)))) then
exit (raise_c2_exception(CapEx_LengthViolation, cb))
@@ -660,7 +660,7 @@ function clause execute (CLC(cd, cb, rt, offset, linked)) =
else
{
cursor := getCapCursor(cb_val);
- vAddr := cursor + (int) (rGPR(rt)) + (int) offset;
+ vAddr := cursor + signed(rGPR(rt)) + signed(offset);
vAddr64:= (bit[64]) vAddr;
if ((vAddr + cap_size) > ((nat) (cb_val.base) + ((nat) (cb_val.length)))) then
exit (raise_c2_exception(CapEx_LengthViolation, cb))