Bitfield

Bitfields are the representation of how the values (like registers) are specified on the machine code of the ISA. The syntax to declare a bitfield is:

bitfield <name>[<size>]

OR

bitfield <name>[<size>] {
    <field-list>
}

Examples

bitfield Reg[4]

It’s a bitfield named Reg with 4 bits size.

bitfield Opcode[8] {
    imm[1]
    op[7]
}

It’s a bitfield named Opcode with 8 bits size and 2 fields:

  1. imm (1 bit size) is the first bit of the bitfield Opcode.
  2. op (7 bits size) are the next 7 bits of the bitfield Opcode.

  1. The sum of all field sizes should be equal to bitfield’s size.↩︎