New function for adding to the address unsafely.

Would used an increment size based on mantissa width, but this is not
available in the type class, so just use 1 byte.
This function is currently used for adding small increments to the PC,
so does not need support for larger offsets.
This commit is contained in:
jon
2020-08-21 15:31:31 +01:00
parent abfcb20d03
commit 356c7891ee
2 changed files with 7 additions and 0 deletions

View File

@@ -124,6 +124,8 @@ typeclass CHERICap#(type t, numeric type ot, numeric type flg, numeric type n, n
function Exact#(t) setAddr (t cap, Bit#(n) addr);
// Set the address of the capability. Result assumed to be representable
function t setAddrUnsafe (t cap, Bit#(n) addr);
// Add to the address of the capability. Result assumed to be representable
function t addAddrUnsafe (t cap, Bit#(8) inc);
// Get the offset of the capability
function Bit#(n) getOffset (t cap) = getAddr(cap) - getBase(cap);