<field> Element Reference

The <field> element identifies an integer unit of information specific to the message being represented.

It must have a name and length attribute. The length is specified in bits, and may be any nonnegative integer value. It does not have to be byte aligned within the underlying message.

The optional bias attribute is added to the value by a fixed amount when displayed in the IDM. See the bias example in the description below.

Attributes
NameFormatDescription
biasintField values are offset by this integer amount when it is accessed or used in an expression.
length (required)ExpressionThe length in bits of the field.
name (required)stringThe name of the field.
typeTypeA reference to the field's <type>
Children<comment>?

? = 0 or 1 occurence, * = 0 or more occurences

Detail

This is a simple example that defines a field named "foo" and is 4 bits long. The name and length are required attributes, and typically they are the only ones used. Here is an example describing a simple message consisting of one 4 bit field.

    <xddl>
     <structure>
      <field name="sequence" length="4"/>
     </structure>
    </xddl>

    simple_field.xddl

Parsing the four bit message "@1111" results in:

    # idm simple_field.xddl @1111

    Name                           Length Value    Hex        Description 
    sequence                       4      15       0F         

This example references a locally defined <type>. See the <type> documentation for more information.

    <xddl>
     <type id="HelloType">
      <enum>
        <item key="0" value="Goodbye World!"/>
        <item key="1" value="Hello World!"/>
      </enum>
     </type>
     <structure>
      <field name="Bit" length="1" type="#HelloType"/>
     </structure>
    </xddl>

    hello.xddl

bias

The optional bias attribute is used to offset the value of field by a fixed amount. Here's an example:

    <xddl>
     <structure>
      <field name="a" length="1" bias="-10"/>
      <field name="b" length="1" bias="-9"/>
      <field name="c" length="1" bias="-8"/>
      <field name="d" length="1" bias="-7"/>
      <field name="e" length="1" bias="1"/>
      <field name="f" length="1" bias="2"/>
      <field name="g" length="1" bias="3"/>
      <field name="h" length="1" bias="4"/>
     </structure>
    </xddl>

    bias.xddl

Each field is just 1 bit long, but we are biasing them by varying amounts. The bias is applied after the fields are parsed. If we parse a message of all zeroes, here is what we get:

    # idm bias.xddl @00000000

    Name                           Length Value    Hex        Description 
    a                              1      -10      00         
    b                              1      -9       00         
    c                              1      -8       00         
    d                              1      -7       00         
    e                              1      1        00         
    f                              1      2        00         
    g                              1      3        00         
    h                              1      4        00         

As you can see, the Value column is offset by the bias. The Hex column still reflects the original bit pattern.

type

The optional type attribute references a <type> element's id. See the <type> element reference for examples.