Partial Word Expression

A partial word expression isolates the value of a field of one or more bits of a specified word.

<partial word expression>

──┬─<arithmetic operand>─┬─<partial word part>─────────────────────────┤
  └─<Boolean operand>────┘

<partial word part>

── . ── [ ──<left bit>── : ──<number of bits>── ] ─────────────────────┤

<left bit>

──<arithmetic expression>──────────────────────────────────────────────┤

The <partial word part> construct describes the location in the operand of the field to be isolated. The isolated field is copied to the low order (rightmost) field of a word of all zeros.

The <left bit> element defines the leftmost bit location of the field in the source word. The value of the left bit must lie within the range 0 through 47, where bit 0 is the rightmost, or least significant, bit in the word.

The <number of bits> element specifies the length of the field. The value of the number of bits must lie within the range 1 through 48. If the value of the number of bits exceeds the number of bits to the right of the left bit in the source word, the field wraps around and is continued at bit 47, the leftmost bit, of the same word.

If, through the use of variables, these ranges are exceeded, the program is discontinued with a fault. If 0 is used for the number of bits, no bits are copied.

Examples of Partial Word Expressions

Assume that real variables X, Y, and Z have the following values:

X = 32767 = 4"000000007FFF"
Y =  1024 = 4"000000000400"
Z =     2 = 4"000000000002"

Given these values, the following are examples of arithmetic partial word expressions and their values:

Expression

Value

X.[5:6]

4"00000000003F"

Y.[11:4]

4"000000000004"

Z.[19:48]

4"000020000000"

X.[23:24]

4"000000007FFF"

X.[23:20]

4"0000000007FF"

Using the INFO array example from Concatenation Expression, the following assignments could be used to extract information from INFO.

N := INFO[I].REC_NUMF;
L := INFO[I].LENGTHF;