hack for fromMem function to pass compile time checks
This commit is contained in:
Submodule libs/cheri-cap-lib updated: bd95a8b5b1...f7884bb932
@@ -228,4 +228,4 @@ Bit #(3) f3_AMO_CAP = w_SIZE_CAP;
|
||||
Bit #(XLEN) otype_unsealed_ext = -1;
|
||||
Bit #(XLEN) otype_sentry_ext = -2;
|
||||
Bit #(XLEN) otype_res0_ext = -3;
|
||||
Bit #(XLEN) otype_res1_ext = -4;
|
||||
Bit #(XLEN) otype_res1_ext = -4;
|
||||
@@ -285,7 +285,7 @@ function CapPipe capModify(CapPipe a, CapPipe b, CapModifyFunc func);
|
||||
tagged FromPtr :
|
||||
(getAddr(a) == 0 ? nullCap : setAddr(b_mut, getAddr(a)).value);
|
||||
tagged SetHigh:
|
||||
// fromMem(tuple2(False, {getAddr(b), getAddr(a)} :: Bit#(CapW)));
|
||||
// fromMemTest(tuple2(False, {getAddr(b), getAddr(a)}));
|
||||
capFromAddrs(a,b);
|
||||
// getTruncatedTuple(getAddr(b))
|
||||
tagged BuildCap :
|
||||
@@ -299,14 +299,37 @@ function CapPipe capModify(CapPipe a, CapPipe b, CapModifyFunc func);
|
||||
return res;
|
||||
endfunction
|
||||
|
||||
function CapPipe capFromAddrs (capT a, capT b);
|
||||
// function CapPipe capFromAddrs (CapPipe a, CapPipe b)
|
||||
// provisos (
|
||||
// CHERICap#(CapPipe, o, f, addrW, CapW, m, d)
|
||||
// );
|
||||
|
||||
// // Get full serialized capability of 'a'
|
||||
// match {.tag, .rawA} = toMem(a); // rawA : Bit#(inMemW)
|
||||
|
||||
// // Replace low addrW bits with address from b
|
||||
// Bit#(addrW) newAddr = getAddr(b);
|
||||
|
||||
// Bit#(inMemW) newRaw =
|
||||
// { rawA[CapW-1 : addrW] // keep upper metadata
|
||||
// , newAddr // replace address field
|
||||
// };
|
||||
|
||||
// return fromMem(tuple2(tag, newRaw));
|
||||
|
||||
// endfunction
|
||||
function CapPipe capFromAddrs(capT a, capT b)
|
||||
provisos (CHERICap#(capT, a, b, 64, d, e, f)); // exact instance
|
||||
// Extract addresses
|
||||
Bit#(0) addrA = getAddr(a);
|
||||
Bit#(116) addrB = getAddr(b);
|
||||
// Concatenate into a 180-bit raw capability
|
||||
Bit#(116) rawCap = {addrB, addrA};
|
||||
// Convert to CapPipe using fromMem
|
||||
return fromMem(tuple2(False, rawCap));
|
||||
Bit#(64) addrA = getAddr(a);
|
||||
Bit#(64) addrB = getAddr(b);
|
||||
// Extra bits to reach inMemW = 180
|
||||
Bit#(52) extra = 0; // can be zeros or delta bits if needed
|
||||
|
||||
// Concatenate explicitly typed
|
||||
Bit#(180) rawBits = {addrB, addrA, extra};
|
||||
|
||||
return fromMem(tuple2(False, rawBits));
|
||||
endfunction
|
||||
|
||||
(* noinline *)
|
||||
|
||||
Reference in New Issue
Block a user