Make Cap FShow more concise

This commit is contained in:
Peter Rugg
2019-12-10 16:33:33 +00:00
parent da397428b6
commit c2200f47cc

View File

@@ -847,7 +847,7 @@ typedef CapFat CapReg;
typedef struct {
CapFat capFat;
TempFields tempFields;
} CapPipe deriving (Bits, FShow);
} CapPipe deriving (Bits);
instance CHERICap #(CapMem, OTypeW, FlagsW, CapAddressW, CapW, TSub#(MW, 3));
function isValidCap (x);
@@ -887,6 +887,19 @@ instance CHERICap #(CapMem, OTypeW, FlagsW, CapAddressW, CapW, TSub#(MW, 3));
function getBaseAlignment = error("feature not implemented for this cap type");
endinstance
instance FShow #(CapPipe);
function fshow(cap) = $format(
"v: ", fshow(isValidCap(cap)),
" a: ", fshow(getAddr(cap)),
" o: ", fshow(getOffset(cap)),
" b: ", fshow(getBase(cap)),
" t: ", fshow(getTop(cap)),
" sp: ", fshow(pack(getSoftPerms(cap))),
" hp: ", fshow(pack(getHardPerms(cap))),
" ot: ", fshow(getType(cap)),
" f: ", fshow(getFlags(cap)));
endinstance
instance CHERICap #(CapReg, OTypeW, FlagsW, CapAddressW, CapW, TSub#(MW, 3));
function isValidCap (x) = x.isCapability;