From f71a3d61a9fa724f881829cd418f74fb966bee98 Mon Sep 17 00:00:00 2001 From: Yuecheng-CAM Date: Sun, 20 Oct 2024 23:17:01 +0100 Subject: [PATCH] implement C_GET_HIGH --- src_Core/ISA/ISA_Decls_CHERI.bsv | 4 +++- src_Core/RISCY_OOO/procs/lib/Decode.bsv | 7 +++++++ src_Core/RISCY_OOO/procs/lib/Exec.bsv | 2 ++ src_Core/RISCY_OOO/procs/lib/ProcTypes.bsv | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src_Core/ISA/ISA_Decls_CHERI.bsv b/src_Core/ISA/ISA_Decls_CHERI.bsv index 3dbd9dd..4e02d05 100755 --- a/src_Core/ISA/ISA_Decls_CHERI.bsv +++ b/src_Core/ISA/ISA_Decls_CHERI.bsv @@ -186,7 +186,9 @@ Bit #(5) f5rs2_cap_CSealEntry = 5'h11; Bit #(5) f5rs2_cap_CLoadTags = 5'h12; // 5'h13 unused Bit #(5) f5rs2_cap_JALR_PCC = 5'h14; -// 5'h15-5'h1f unused (5'h1f reserved for 1-reg instructions) +// 5'h15-5'h16 unused +Bit #(5) f5rs2_cap_CGetHigh = 5'h17; +// 5'h18-5'h1f unused (5'h1f reserved for 1-reg instructions) // ================================================================ // f7_cap_{Load, Store} opcode subdivision diff --git a/src_Core/RISCY_OOO/procs/lib/Decode.bsv b/src_Core/RISCY_OOO/procs/lib/Decode.bsv index c79ea97..a0cd47e 100644 --- a/src_Core/RISCY_OOO/procs/lib/Decode.bsv +++ b/src_Core/RISCY_OOO/procs/lib/Decode.bsv @@ -1327,6 +1327,13 @@ function DecodeResult decode(Instruction inst, Bool cap_mode); regs.src1 = Valid(tagged Gpr rs1); dInst.capFunc = CapInspect (GetType); end + f5rs2_cap_CGetHigh: begin + legalInst = True; + dInst.iType = Cap; + regs.dst = Valid(tagged Gpr rd); + regs.src1 = Valid(tagged Gpr rs1); + dInst.capFunc = CapInspect (GetHigh); + end f5rs2_cap_CLoadTags: begin legalInst = True; dInst.iType = Ld; diff --git a/src_Core/RISCY_OOO/procs/lib/Exec.bsv b/src_Core/RISCY_OOO/procs/lib/Exec.bsv index c408936..a322162 100644 --- a/src_Core/RISCY_OOO/procs/lib/Exec.bsv +++ b/src_Core/RISCY_OOO/procs/lib/Exec.bsv @@ -308,6 +308,8 @@ function Data capInspect(CapPipe a, CapPipe b, CapInspectFunc func); zeroExtend(getFlags(a)); tagged GetPerm : zeroExtend(getPerms(a)); + tagged GetHigh : + zeroExtend(tpl_2(toMem(a))[127:64]); tagged GetType : tpl_1(extractType(a)); tagged ToPtr : diff --git a/src_Core/RISCY_OOO/procs/lib/ProcTypes.bsv b/src_Core/RISCY_OOO/procs/lib/ProcTypes.bsv index 208a2e6..fdb4da5 100644 --- a/src_Core/RISCY_OOO/procs/lib/ProcTypes.bsv +++ b/src_Core/RISCY_OOO/procs/lib/ProcTypes.bsv @@ -363,6 +363,7 @@ typedef union tagged { void GetFlags; void GetPerm; void GetType; + void GetHigh; void ToPtr; } CapInspectFunc deriving(Bits, Eq, FShow);