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

Constituent: encdec     Tag: rad750


Interface   Data Structures   File List   Data Fields   Globals  

BWP.h File Reference

Bit Word interface definitions, packing specific routines. More...

#include "LDT/BW.h"

Include dependency graph for BWP.h:

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


Functions

BW_vector BWP_collapseL (unsigned int val, unsigned int msk)
 Collapses the bit pattern in val considering only those bits that are set in msk. The bit pattern is left justified.
BW_vector BWP_collapseR (unsigned int val, unsigned int msk)
 Collapses the bit pattern in val considering only those bits that are set in msk. The bit pattern is right justified.
BW_vector BWP_convertL (unsigned int val, unsigned int nsig, unsigned int nexp)
 Encodes small integer values that are embedded in a large field.
BW_vector BWP_convertR (unsigned int val, unsigned int nsig, unsigned int nexp)
 Encodes small integer values that are embedded in a large field.

Detailed Description

Bit Word interface definitions, packing specific routines.

Author:
JJRussell - russell@slac.stanford.edu
   CVS $Id: BWP.h,v 1.1 2006/09/13 17:09:08 russell Exp $

Function Documentation

BW_vector BWP_collapseL unsigned int  val,
unsigned int  msk
 

Collapses the bit pattern in val considering only those bits that are set in msk. The bit pattern is left justified.

Returns:
The bit pattern and the number of significant bits
Parameters:
val The word to extract the bits from
msk The mask of bits to consider
Note:
There should be a PPC specific version of this. The rotate left and insert under mask is perfect for this routine.

BW_vector BWP_collapseR unsigned int  val,
unsigned int  msk
 

Collapses the bit pattern in val considering only those bits that are set in msk. The bit pattern is right justified.

Returns:
The bit pattern and the number of significant bits
Parameters:
val The word to extract the bits from
msk The mask of bits to consider

BW_vector BWP_convertL unsigned int  val,
unsigned int  nval,
unsigned int  nexp
 

Encodes small integer values that are embedded in a large field.

Returns:
The left justified bit pattern and the number of significant bits.
Parameters:
val The value to be encoded
nval The bit field width of val
nexp The number of bits to devote to the exponent encoding
See BWP_convertR for a complete description. (This routine just produces a right justified version of the bit pattern.)

__inline BW_vector BWP_convertR unsigned int  val,
unsigned int  nval,
unsigned int  nexp
 

Encodes small integer values that are embedded in a large field.

Returns:
The right justified bit pattern and the number of significant bits.
Parameters:
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
This encoding is most effective on small integer values that are embedded in a larger field. The val is broken into two pieces. The first piece a field consisting of the number of leading zeros, while the second piece is all the rest, sans the first bit, which, in all but one case must be a 1, so therefore need not be encoded. That special case is when the number of leading zeroes is greater than or equal to (1 << nexp) - 1. Since only that many zeroes can be encoded, one cannot make any assumptions about the value of the next bit.

Example
Consider the number 0x1fff embedded in a 25-bit field using nexp = 4. The call would be
   bwv = BWP__convertR (0x1fff, 25, 4);

One can encode up to 15 leading zeroes. In this case there are only 8. This gets encoded as EXP = 7 (this is the usual n-1), MANTISSA = 0xfff or 0x7fff, NBITS = 16.

Warning:
As currently written, this routine can safely accomodate
  • nexp = 5 27-bit integer
  • nexp = 4 28-bit integer
  • nexp = 3 29-bit integer
  • nexp = 2 30-bit integer
  • nexp = 1 31-bit integer

Of course, some of these are silly combinations in the sense that the would produce no compression and would more than likely result in an expansion.


Generated on Thu Sep 14 09:17:19 2006 by  doxygen 1.4.4