OpenASIP  2.0
Static Public Member Functions | List of all members
BEMTools Class Reference

#include <BEMTools.hh>

Collaboration diagram for BEMTools:
Collaboration graph

Static Public Member Functions

static unsigned encodingWidth (unsigned encoding, unsigned extrabits)
 
static unsigned extrabits (unsigned encoding, unsigned width)
 

Detailed Description

Definition at line 40 of file BEMTools.hh.

Member Function Documentation

◆ encodingWidth()

unsigned BEMTools::encodingWidth ( unsigned  encoding,
unsigned  extrabits 
)
static

Returns bit width required by the encoding and extrabits combination.

Note
encoding value of zero translates to width of zero.

Definition at line 46 of file BEMTools.cc.

46  {
47  return MathTools::bitLength(encoding) + extrabits;
48 }

References MathTools::bitLength(), and extrabits().

Referenced by BEMTester::canAddComponentPriorityEncoding().

Here is the call graph for this function:

◆ extrabits()

unsigned BEMTools::extrabits ( unsigned  encoding,
unsigned  width 
)
static

Calculates the extra bits (zeroes) of the given encoding.

For example:

*  (encoding, width) = (3, 5) ->  |00011| -> return 3.
* 
Parameters
encodingThe encoding value.
widthThe number of bits the encoding occupies. Must be at least or more than required bits needed for the value. Must greater than 0.

Definition at line 64 of file BEMTools.cc.

64  {
65  assert(width >= MathTools::bitLength(encoding));
66  assert(width > 0);
67  return width - MathTools::bitLength(encoding);
68 }

References assert, and MathTools::bitLength().

Referenced by encodingWidth().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
BEMTools::extrabits
static unsigned extrabits(unsigned encoding, unsigned width)
Definition: BEMTools.cc:64
assert
#define assert(condition)
Definition: Application.hh:86
MathTools::bitLength
static unsigned int bitLength(long unsigned int number)