Module Bitfield

Module definition of BitField decorators.

BitField type decorators define bitfields data-structure.

Bitfields are classes where properties have a fixed size in bits.

In a bitfield class definition the topmost @Bitfield decorated property match the most significant bit being encoded/decoded.

class StatusRegister {
@Bitfield(1)
carry_flag: number

@Bitfield(1)
zero_flag: number

@Bitfield(1)
interrupt_disable_flag: number

@Bitfield(1)
decimal_flag: number

@Bitfield(1)
break_flag: number

@Bitfield(1)
_: number

@Bitfield(1)
overflow_flag: number
}

class Header {
@Relation(StatusRegister)
bitfield: StatusRegister
}

BitField type decorator can't be used inside class definition that also contains Primitive definition. To create a BitField object create a class solely made for the bitfield definition as in the example.

Index

Advanced Use

Decorators

Other