Skip to main content

Fields

Fields define the bit-packing layout within a register.

Field Object Structure

FieldRequiredTypeDescription
symbolYesStringThe programmatic name for the field (e.g., EN).
bitsYesList[Integer]The bit range as [high, low] (e.g., [7, 7] or [15, 12]).
nameRecommendedStringFull name of the field.
descriptionRecommendedStringDocumentation for the field.
accessNoList[AccessCode]Overrides the default register access.
enumNoStringThe symbol of a global Enum to link to this field.
resetRecommendedString or IntThe reset value for this specific field. Can be a number or an Enum Value name.
formatNoFormatObjDefines data representation (signed/unsigned) and units.

Access Codes

CodeMeaningExplanation
naNo accessGenerally should not be used, registers that have no access should not be included
rReadable
rclrRead to Clear
rsetRead to Set
wWritable
wosetWrite 1 to Set (Self resetting)Denotes self resetting as typically writing a 1 performs a set
woclrWrite 1 to Clear
wotogWrite 1 to Toggle
wzsetWrite 0 to Set
wzclrWrite 0 to Clear (Self resetting)Denotes self resetting as typically writing a 0 performs a clear
wztogWrite 0 to Toggle
wclrWrite to ClearDenotes writing any value causes a clear
wsetWrite to SetDenotes writing any value causes a set

Format Object Structure

The format block is used to describe the raw data representation and provide documentation units. It does not generate scaling logic.

FieldRequiredTypeDescription
representationYesStringCan be one of the following options:
1. us: Unsigned e.g. uint8_t or uint32_t
2. tc: Two's Compliment e.g. int8_t or int32_t, sign extended
3. sm: Sign Magnitude e.g. MSB is the sign bit
4. bd: Binary Coded Decimal e.g. Each 4 bits represent a digit from 0-9.
unitNoStringThe real-world unit of measurement (e.g., "Celsius", "Volts").
scaleNoFloatThe magnitude scalar applied to the units. For example, 0.001 would be used in conjunction with unit: "Celsius" to denote millicelsius.

Example (Field with Format):

- symbol: TEMP
bits: [ 15, 4 ]
access: [ r ]
description: "Temperature result."
format:
representation: tc
unit: "Celsius"
scale: 1.0