Skip to content

Use bitfield for EncCapability #87

Open
@Timmmm

Description

@Timmmm

Currently there's this code:

struct EncCapability = {
  perms      : bits(cap_uperms_width + cap_hperms_width),
  otype      : bits(cap_otype_width),
  reserved   : bits(cap_reserved_width),
  flags      : bits(cap_flags_width),
  internal_E : bit,
  T          : bits(cap_mantissa_width - 2),
  B          : bits(cap_mantissa_width),
  address    : bits(cap_addr_width)
}

function capBitsToEncCapability(c) : CapBits -> EncCapability = struct {
  perms      = c[127..112],
  reserved   = c[111..110],
  flags      = c[109..109],
  otype      = c[108..91],
  internal_E = c[90],
  T          = c[89..78],
  B          = c[77..64],
  address    = c[63..0]
}

I think Sail has a bitfield feature which is designed for this sort of thing.

bitfield EncCapability : bits(128) = {
  perms      : 127 .. 112,
  otype      : 111 .. 110, 
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions