System Debug Reference Manual (32650-90888)
Chapter 10 363
System Debug Standard Functions
func bitd
Syntax
bitd (
value position length target
)
Formal Declaration
bitd:any (
value
:any
position
:s16
length
:u16
target
:any)
Parameters
value
The value to deposit into the target. Its type is restricted to the INT and
PTR classes.
position
This parameter specifies the starting bit position (positive value) or the
ending bit position (negative value) of the deposit. Regardless of the size of
the target, bit positions are always numbered from left to right. The
leftmost bit of the target is bit 0.
length
The number of bits to deposit. This value may not exceed 64.
target
The expression in which to deposit the specified bit pattern. Its type is
restricted to the INT and PTR classes.
This function is sensitive to the type of the
target
parameter. As examples, if a S32 or U32
value is passed, the format of the word (start/end positions) is as follows:
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+---------------------------------------------------------------+
| |
+---------------------------------------------------------------+
If a S16 or U16 value is passed, the format of the word (start/end positions) is as follows:
1 1 1 1 1 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+-------------------------------+
| |
+-------------------------------+
Examples
For our example, we use a 32-bit word containing the bit pattern for the hex value
4015381f:
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+---------------------------------------------------------------+
|0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 1 1 0 0 0 0 0 0 1 1 1 1 1|
+---------------------------------------------------------------+
$nmdebug > var xx:u32 4015381f
$nmdebug > wl bitd(0,#30,2,xx)
$4015381c