From b34c3fb76e00296caf60c651ee37ac025a5bc092 Mon Sep 17 00:00:00 2001 From: Robert Norton Date: Tue, 13 Mar 2018 17:56:54 +0000 Subject: minor cleanup of load -- we no longer need to separate out by access size because the type checker is more clever. --- cheri/cheri_insts.sail | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/cheri/cheri_insts.sail b/cheri/cheri_insts.sail index ebdc474e..fa6ae0fd 100644 --- a/cheri/cheri_insts.sail +++ b/cheri/cheri_insts.sail @@ -1167,10 +1167,10 @@ function clause execute (CLoad(rd, cb, rt, offset, signext, width, linked)) = raise_c2_exception(CapEx_PermitLoadViolation, cb) else { - size = wordWidthBytes(width); - cursor = getCapCursor(cb_val); - vAddr = cursor + unsigned(rGPR(rt)) + (size*signed(offset)); - vAddr64= to_bits(64, vAddr); + let 'size = wordWidthBytes(width); + let cursor = getCapCursor(cb_val); + let vAddr = cursor + unsigned(rGPR(rt)) + (size*signed(offset)); + let vAddr64 = to_bits(64, vAddr); if ((vAddr + size) > getCapTop(cb_val)) then raise_c2_exception(CapEx_LengthViolation, cb) else if (vAddr < getCapBase(cb_val)) then @@ -1180,23 +1180,14 @@ function clause execute (CLoad(rd, cb, rt, offset, signext, width, linked)) = else { pAddr = (TLBTranslate(vAddr64, LoadData)); - widthBytes = wordWidthBytes(width); memResult : bits(64) = if (linked) then { CP0LLBit = 0b1; CP0LLAddr = pAddr; - if widthBytes == 1 then extendLoad(MEMr_reserve_wrapper(pAddr, 1), signext) - else if widthBytes == 2 then extendLoad(MEMr_reserve_wrapper(pAddr, 2), signext) - else if widthBytes == 4 then extendLoad(MEMr_reserve_wrapper(pAddr, 4), signext) - else extendLoad(MEMr_reserve_wrapper(pAddr, 8), signext) + extendLoad(MEMr_reserve_wrapper(pAddr, size), signext) } else - { - if widthBytes == 1 then extendLoad(MEMr_wrapper(pAddr, 1), signext) - else if widthBytes == 2 then extendLoad(MEMr_wrapper(pAddr, 2), signext) - else if widthBytes == 4 then extendLoad(MEMr_wrapper(pAddr, 4), signext) - else extendLoad(MEMr_wrapper(pAddr, 8), signext) - }; + extendLoad(MEMr_wrapper(pAddr, size), signext); wGPR(rd) = memResult; } } -- cgit v1.2.3