Register map

EnumValue

class corsair.EnumValue(name='enum', value=0, description='Enumerated value', **args)[source]

Enumerated value.

Parameters:
  • name (str) – Enum name

  • value (int) – Enum value

  • description (str) – Enum description

as_dict()[source]

Create a dictionary with the key attributes of the bit field.

as_str(indent='')[source]

Create an indented string with the enum information.

property description

Description of the enum.

property name

Name of the enum.

validate()[source]

Validate parameters of the enum.

property value

Value of the enum.

BitField

class corsair.BitField(name='val', description='Value of the register', reset=0, width=1, lsb=0, access='rw', hardware='n', **args)[source]

Bit field.

Parameters:
  • name (str) – Bit field name

  • description (str) – Bit field description

  • reset (int) – Bit field reset vaue

  • width (int) – Bit field width vaue

  • lsb (int) – Bit field LSB vaue

  • access (str) – Bit field access mode

  • hardware (str) – Bit field hardware options

property access

Access mode for the bitfield.

add_enums(new_enums)[source]

Add enum or list of enums.

Enums are automatically sorted and stored in the ascending order of value attributes.

as_dict()[source]

Create a dictionary with the key attributes of the bit field.

as_str(indent='')[source]

Create an indented string with the bit field information.

property bits

Create list with all positions of the bits represented by the bit field.

property byte_strobes

Dictionary with LSB and MSB values for the every byte in the write data bus.

property description

Description of the bitfield.

property enum_names

List with all enum names.

property enums

List with enum objects.

property hardware

Hardware mode for the bitfield.

is_vector()[source]

Check if the width of the bit field > 1.

property lsb

LSB value of the bitfield.

property mask

Bit mask for the field.

property msb

Position of most significant bit (MSB) of the field.

property name

Name of the bit field.

property reset

Inital value of the bitfield.

validate()[source]

Validate parameters of the bit field.

property width

Width value of the bitfield.

Register

class corsair.Register(name='csr0', description='Control and status register 0', address=None, **args)[source]

Control and status register.

Parameters:
  • name (str) – Bit field name

  • description (str) – Bit field description

  • address (int, None) – Register address

property access

Register access mode, based on bitfields.

add_bitfields(new_bitfields)[source]

Add bit field or list of bit feilds.

Bit fields are automatically sorted and stored in the ascending order of msb attributes.

property address

Address of the register.

as_dict()[source]

Create a dictionary with the key attributes of the register.

as_str(indent='')[source]

Create an indented string with the information about the register.

property bitfield_names

List with all bit field names.

property bitfields

List with bit field objects.

property description

Description of the register.

property name

Name of the register.

property reset

Reset value of the refister after reset.

validate()[source]

Validate parameters of the register.

RegisterMap

class corsair.RegisterMap[source]

CSR map

add_registers(new_regs)[source]

Add list of registers.

Register are automatically sorted and stored in the ascending order of addresses.

as_dict()[source]

Return register map as a dictionary.

as_str(indent='')[source]

Create indented string with the information about register map.

read_file(path)[source]

Read register map from file (based on extension).

read_json(path)[source]

Read register map from JSON file.

read_txt(path)[source]

Read register map from text file.

read_yaml(path)[source]

Read register map from YAML file.

property reg_names

List with all register names.

property regs

List with register objects.

validate()[source]

Validate the register map.