fixed removing areas where delta values were used
Some checks failed
check properties / tests (push) Has been cancelled

This commit is contained in:
2026-02-23 12:26:03 +00:00
parent 8f4feb2f1b
commit 6263041aa1
2 changed files with 26 additions and 29 deletions

View File

@@ -145,7 +145,7 @@ typedef SizeOf#(Perms) PermsW;
typedef TSub#(CapW, TAdd#( CapAddrW
, TAdd#( OTypeW
, TAdd#( CBoundsW
, TAdd#(PermsW, FlagsW)))))) ResW;
, TAdd#(PermsW, FlagsW))))) ResW;
// The full capability structure, including the "tag" bit.
typedef struct {
Bool isCapability;
@@ -1548,31 +1548,29 @@ typedef struct {
Bit#(VA_Width) address;
Bool validAddress;
} CapTrim deriving(Bits, Eq, FShow);
// function CapTrim trimCap(CapMem cm);
// CapabilityInMemory cap = unpack(cm);
// Bit#(TSub#(CapAddrW,VA_Width)) addr_upper = truncateLSB(cap.address);
// return CapTrim{perms: cap.perms,
// flags: cap.flags,
// delta: cap.delta,
// bounds: cap.bounds,
// address: truncate(cap.address),
// validAddress: (addr_upper==signExtend(cap.address[valueOf(VA_Width)-1]))
// };
// endfunction
// function CapMem untrimCap(CapTrim ct);
// // Encode an invalid address as the bit above the last valid bit being different.
// Bit#(1) addressMsb = ct.address[valueOf(VA_Width)-1];
// if (!ct.validAddress) addressMsb = ^addressMsb;
// return pack(CapabilityInMemory{
// isCapability: True,
// perms: ct.perms,
// reserved: 0,
// flags: ct.flags,
// otype: otype_unsealed,
// delta: ct.delta,
// bounds: ct.bounds,
// address: signExtend({addressMsb,ct.address})
// });
// endfunction
function CapTrim trimCap(CapMem cm);
CapabilityInMemory cap = unpack(cm);
Bit#(TSub#(CapAddrW,VA_Width)) addr_upper = truncateLSB(cap.address);
return CapTrim{perms: cap.perms,
flags: cap.flags,
bounds: cap.bounds,
address: truncate(cap.address),
validAddress: (addr_upper==signExtend(cap.address[valueOf(VA_Width)-1]))
};
endfunction
function CapMem untrimCap(CapTrim ct);
// Encode an invalid address as the bit above the last valid bit being different.
Bit#(1) addressMsb = ct.address[valueOf(VA_Width)-1];
if (!ct.validAddress) addressMsb = ^addressMsb;
return pack(CapabilityInMemory{
isCapability: True,
perms: ct.perms,
reserved: 0,
flags: ct.flags,
otype: otype_unsealed,
bounds: ct.bounds,
address: signExtend({addressMsb,ct.address})
});
endfunction
endpackage

View File

@@ -119,7 +119,7 @@ endfunction
// XXX TODO augment with all architectural bounds/ repbounds ?
function Fmt showCHERICap (capT cap)
provisos (CHERICap #(capT , otypeW, flgW, addrW, inMemW, maskableW, delta));
provisos (CHERICap #(capT , otypeW, flgW, addrW, inMemW, maskableW));
return $format( "Valid: 0x%0x", isValidCap(cap)) +
$format(" Perms: 0x%0x", getPerms(cap)) +
$format(" Kind: ", fshow(getKind(cap))) +
@@ -153,7 +153,6 @@ typeclass CHERICap #( type capT // type of the CHERICap capability
, numeric type addrW // width of the address
, numeric type inMemW // width of the capability in mem
, numeric type maskableW // width of maskable bits
, numeric type delta // size of delta (tlb bypass)
)
dependencies (capT determines (otypeW, flgW, addrW, inMemW, maskableW));