!Define

The !Define tag is used to override specific parameters of a register within a known register group. They are particularly useful where the same register description is reused in multiple places but some parameter (e.g. the blockaccess attribute) needs to be different in one implementation than another.

For any attributes that do not have !Define overrides, they maintain the same value that they took in the base register description.

Descriptions of !Reg and !Field attributes can be found in their schema descriptions.

Note

The !Define tag is likely to be refactored into an !Override tag that can be used more widely than just for register descriptions, and may form the basis of parameterisable components within BLADE.

Below is a more detailed example than normal to try and explain how this tag is used, and why it exists.

Example

base_registers.yaml:

- !Group
  name: group_a
  regs:
  - !Reg
    name     : device_id
    busaccess: RO
    reset    : 0x12345678
    ...
  ...

- !Group
  name: group_b
  regs:
  - !Reg
    name : data_words
    width: 16
    array: 4
    ...
  ...

first_mod.yaml: Here we alter the device ID and make it active-read, so that a strobe signal is fired every time the register is read.

#include "base_registers.yaml"

- !Config
  order:
  - !Register [group_a]
  - !Register [group_b]

- !Define { group: group_a, reg: device_id, reset: 0x11223344, busaccess: AR }

second_mod.yaml: Here we change the device ID, then widen the data words whilst keeping the same overall number of bits by decreasing the array size.

#include "base_registers.yaml

- !Config
  order:
  - !Register [group_b]
  - !Register [group_a]

- !Define { group: group_a, reg: device_id, reset: 0x99887766 }
- !Define { group: group_b, reg: data_words, width: 32, array: 2 }

Usage

- !Define
  group: my_reg_group
  name : my_reg
  field: my_field
  reset: 4
  width: 6
  enum :
  - !Enum [first, 0]
  ...

- !Define
  group      : my_reg_group
  name       : my_reg
  busaccess  : RO
  blockaccess: ARW
  ...
class blade.schema.ph_define.Define(name='', group='', reg='', field='', enum='', array='', align='', width='', reset='', blockaccess='', busaccess='', instaccess='')

Overrides specific parameters of a defined register

__init__(name='', group='', reg='', field='', enum='', array='', align='', width='', reset='', blockaccess='', busaccess='', instaccess='')

Initialisation for the !Define tag.

Parameters
  • name – Name of the override

  • group – Group of the register to override

  • reg – Name of the register to override

  • field – Which field is being modified (only required for changing attributes of a field, omit if modifying the register)

  • enum – New enumeration values to replace those in the base description of the !Field

  • array – Modify the number of instances of a specific register

  • align – Modify the alignment parameter for the register

  • width – Modify the width of the register

  • reset – Modify the reset value of the register

  • blockaccess – Modify the block access privileges

  • busaccess – Modify the bus access privileges

  • instaccess – Modify the instruction access privileges

validate()

Check that this tag agrees with our YAML schema