Rework Kind reporting to match specified behaviour of CGetSealed and CGetType

This commit is contained in:
Peter Rugg
2019-05-26 16:27:53 +01:00
parent a425686321
commit 1c3acdc58d

View File

@@ -109,10 +109,9 @@ typeclass CHERICap#(type t, numeric type ot, numeric type flg, numeric type n, n
// Get the kind of the capability, i.e. whether it is sealed, sentry, unsealed, ... // Get the kind of the capability, i.e. whether it is sealed, sentry, unsealed, ...
function Kind getKind (t cap); function Kind getKind (t cap);
// Helper methods for identifying specific kinds // Helper methods for identifying specific kinds
function Bool isUnsealed (t cap) = getKind(cap) == UNSEALED;
function Bool isSentry (t cap) = getKind(cap) == SENTRY; function Bool isSentry (t cap) = getKind(cap) == SENTRY;
function Bool isSealedWithType (t cap) = getKind(cap) == SEALED_WITH_TYPE; function Bool isSealedWithType (t cap) = getKind(cap) == SEALED_WITH_TYPE;
function Bool isSealed (t cap) = getKind(cap) == SEALED_WITH_TYPE || getKind(cap) == SENTRY; function Bool isSealed (t cap) = getKind(cap) != UNSEALED;
// Get the type field, including implicitly whether the cap is sealed/sentry // Get the type field, including implicitly whether the cap is sealed/sentry
function Bit#(ot) getType (t cap); function Bit#(ot) getType (t cap);