GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LDT / V0-2-0

Constituent: encdec     Tag: rad750


Interface   Data Structures   File List   Data Fields   Globals  

BFP.h File Reference

Bit Field Pack Routines. More...

#include "LDT/BW.h"
#include "LDT/BWP.h"

Include dependency graph for BFP.h:

This graph shows which files directly or indirectly include this file:


Functions

static __inline unsigned int BFP__maskL (int width)
 Produce a left justified mask of the specified width.
static __inline unsigned int BFP__maskR (int width)
 Produce a right justified mask of the specified width.
static __inline unsigned int BFP__wordL (unsigned int *w, unsigned int position, unsigned int field, unsigned int width)
 Packs a left justified bit field into the current position. The width of the bit field must be less than or equal to 32 bits.
static __inline unsigned int BFP__wordR (unsigned int *w, unsigned int position, unsigned int field, unsigned int width)
 Packs a right justified bit field into the current position. The width of the bit field must be less than or equal to 32 bits.
static __inline unsigned int BFP__wordLP (unsigned int *w, unsigned int position, unsigned int field, unsigned int width)
 Packs a left justified bit field into the current position limiting the field to the specified width. The width of the bit field must be less than or equal to 32 bits.
static __inline unsigned int BFP__wordRP (unsigned int *w, unsigned int position, unsigned int field, unsigned int width)
 Packs a right justified bit field into the current position limiting the field to the specified width. The width of the bit field must be less than or equal to 32 bits.
static __inline unsigned int BFP__wordB (unsigned int *w, unsigned int position, unsigned int bit)
 Packs the value of the bit into the current bit position. The value of the bit is either 0 or 1, or said in a negative fashion, it is not the left justified version, i.e. 0x80000000 or 0.
static __inline unsigned int BFP__collapse (unsigned int *w, unsigned int position, unsigned int wrd, unsigned int msk)
 Convenience routine to first collapse wrd, keeping only those bits set in wrd, then pack the collapsed word into w starting at bit position.
static __inline unsigned int BFP__copyW (unsigned int *w, unsigned int position, const unsigned int *wrds, int nwrds)
 Copies the specified array of 32-bit words into the output bit array.
static __inline unsigned int BFP__convert (unsigned int *w, unsigned int position, unsigned int val, unsigned int nval, unsigned int nexp)
 Convenience routine to pack small integers that are embedded in a larger field.
static __inline unsigned int BFP__pack1s (unsigned int *w, unsigned int position, unsigned int cnt)
 Packs cnt consecutive 1's terminated by a 0.

Detailed Description

Bit Field Pack Routines.

Author:
JJRussell - russell@slac.stanford.edu
Inline functions to (left justified) pack bit fields into a 32-bit output vector. These routines assume that any bits ahead of the current bit position index can be overwritten. In this sense these routines are not equivalent to a bit field insert routine which only write the bits in the designated bit field.
The routines come in a 2 x 2 set. One can insert a field of a specified width that is either left or right justified. In addition one can use unprotected or protected routines, the distinction being that the unprotected routines are faster, but demand that the user guarantee that no more than the specified bits are non-zero. Conversely, the protected routines limit the bit field to the specified width.

Function Documentation

static __inline unsigned int BFP__collapse unsigned int *  w,
unsigned int  position,
unsigned int  wrd,
unsigned int  msk
[static]
 

Convenience routine to first collapse wrd, keeping only those bits set in wrd, then pack the collapsed word into w starting at bit position.

Parameters:
w The output word
position The current bit position
wrd The target word
msk The selection mask
Returns:
The updated bit position
Note:
There is no need for a right and left version of these routines.

static __inline unsigned int BFP__convert unsigned int *  w,
unsigned int  position,
unsigned int  val,
unsigned int  nval,
unsigned int  nexp
[static]
 

Convenience routine to pack small integers that are embedded in a larger field.

Parameters:
w The output word
position The current bit position
val The interger value to be encoded
nval The bit field width of val
nexp The number of bits to devote to the exponent encoding
Returns:
The updated bit position
Note:
There is no need for a right and left version of these routines. See BWP_reduceL for a complete description of the packing algorithm

static __inline unsigned int BFP__copyW unsigned int *  w,
unsigned int  position,
const unsigned int *  wrds,
int  nwrds
[static]
 

Copies the specified array of 32-bit words into the output bit array.

Returns:
The updated bit position
Parameters:
w The output word
position The current bit position
wrds The array of 32-bit words to copy
nwrds The number of 32-bit words to copy

static __inline unsigned int BFP__maskL int  width  )  [static]
 

Produce a left justified mask of the specified width.

Returns:
A left justified mask of the specified width
Parameters:
width The width of the mask
The BFP__word packing routines do not protect themselves against stray bits (i.e. bits set outside the specified width) for efficiency reasons. On most occasions this protection occurs naturally as part of composing the field, so this would be a waste of time. However, when it is needed this inline provides a tidy way to produce the necessary mask.

static __inline unsigned int BFP__maskR int  width  )  [static]
 

Produce a right justified mask of the specified width.

Returns:
A right justified mask of the specified width
Parameters:
width The width of the mask, must be between 0 and 31.
The BFP__word packing routines do not protect themselves against stray bits (i.e. bits set outside the specified width) for efficiency reasons. On most occasions this protection occurs naturally as part of composing the field, so this would be a waste of time. However, when it is needed this inline provides a tidy way to produce the necessary mask.

static __inline unsigned int BFP__pack1s unsigned int *  w,
unsigned int  position,
unsigned int  cnt
[static]
 

Packs cnt consecutive 1's terminated by a 0.

__inline unsigned int BFP_pack1s (unsigned int *w, unsigned int position, unsigned int cnt)

Returns:
The next bit position to write, must be pos + cnt + 1
Parameters:
w The output word
position The current bit position
cnt The number of 1s to pack

static __inline unsigned int BFP__wordB unsigned int *  w,
unsigned int  position,
unsigned int  bit
[static]
 

Packs the value of the bit into the current bit position. The value of the bit is either 0 or 1, or said in a negative fashion, it is not the left justified version, i.e. 0x80000000 or 0.

Parameters:
w The output word
position The current bit position
bit The value of the bit to insert (0 or 1)
Returns:
The updated bit position

static __inline unsigned int BFP__wordL unsigned int *  w,
unsigned int  position,
unsigned int  field,
unsigned int  width
[static]
 

Packs a left justified bit field into the current position. The width of the bit field must be less than or equal to 32 bits.

Parameters:
w The output word array to insert the bit field into
position The current bit position in the output bit field
field The left justified field to insert
width The width of the field to insert
Returns:
The new bit position (essentially position + width).

static __inline unsigned int BFP__wordLP unsigned int *  w,
unsigned int  position,
unsigned int  field,
unsigned int  width
[static]
 

Packs a left justified bit field into the current position limiting the field to the specified width. The width of the bit field must be less than or equal to 32 bits.

Parameters:
w The output word array to insert the bit field into
position The current bit position in the output bit field
field The left justified field to insert
width The width of the field to insert
Returns:
The new bit position (essentially position + width).

static __inline unsigned int BFP__wordR unsigned int *  w,
unsigned int  position,
unsigned int  field,
unsigned int  width
[static]
 

Packs a right justified bit field into the current position. The width of the bit field must be less than or equal to 32 bits.

Parameters:
w The output word array to insert the bit field into
position The current bit position in the output bit field
field The left justified field to insert
width The width of the field to insert
Returns:
The new bit position (essentially position + width).

static __inline unsigned int BFP__wordRP unsigned int *  w,
unsigned int  position,
unsigned int  field,
unsigned int  width
[static]
 

Packs a right justified bit field into the current position limiting the field to the specified width. The width of the bit field must be less than or equal to 32 bits.

Parameters:
w The output word array to insert the bit field into
position The current bit position in the output bit field
field The right justified field to insert
width The width of the field to insert
Returns:
The new bit position (essentially position + width).


Generated on Thu Sep 14 09:16:51 2006 by  doxygen 1.4.4