fun_ofdm  1.0
802.11a Physical Layer for USRP
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
fun::BitInterleave Struct Reference

The BitInterleave struct. More...

#include <interleaver.h>

Public Member Functions

 BitInterleave (int ncarriers, int nbits)
 
unsigned int index (unsigned int k)
 
void fill (std::vector< unsigned int > &v, bool inverse)
 

Public Attributes

unsigned int d_bpsc
 
unsigned int d_cbps
 

Static Public Attributes

static const int d_num_chunks = 16
 

Detailed Description

The BitInterleave struct.

This struct sets up the interleaving map based on the the number of coded bits per symbol

Definition at line 56 of file interleaver.h.

Constructor & Destructor Documentation

fun::BitInterleave::BitInterleave ( int  ncarriers,
int  nbits 
)
inline

Definition at line 61 of file interleaver.h.

61  :
62  d_bpsc(nbits),
63  d_cbps(nbits * ncarriers)
64  {}

Member Function Documentation

void fun::BitInterleave::fill ( std::vector< unsigned int > &  v,
bool  inverse 
)
inline

Definition at line 77 of file interleaver.h.

References d_cbps, and index().

Referenced by fun::interleaver::deinterleave(), and fun::interleaver::interleave().

78  {
79  v.resize(d_cbps);
80  if (!inverse)
81  {
82  for (unsigned int i = 0; i < d_cbps; ++i)
83  {
84  v[i] = index(i);
85  }
86  }
87  else
88  {
89  for (unsigned int i = 0; i < d_cbps; ++i)
90  {
91  v[index(i)] = i;
92  }
93  }
94  }
unsigned int fun::BitInterleave::index ( unsigned int  k)
inline

Definition at line 66 of file interleaver.h.

References d_bpsc, d_cbps, and d_num_chunks.

Referenced by fill().

67  {
68  // see 17.3.5.6 in 802.11a-1999, floor is implicit
69  assert (k < d_cbps);
70  unsigned int s = std::max(d_bpsc / 2, (unsigned int)1);
71  unsigned int i = (d_cbps / d_num_chunks) * (k % d_num_chunks) + (k / d_num_chunks);
72  unsigned int j = s * (i / s) + (i + d_cbps - (d_num_chunks * i / d_cbps)) % s;
73  assert (j < d_cbps);
74  return j;
75  }

Member Data Documentation

unsigned int fun::BitInterleave::d_bpsc

Definition at line 57 of file interleaver.h.

Referenced by index().

unsigned int fun::BitInterleave::d_cbps

Definition at line 58 of file interleaver.h.

Referenced by fill(), and index().

const int fun::BitInterleave::d_num_chunks = 16
static

Definition at line 59 of file interleaver.h.

Referenced by index().


The documentation for this struct was generated from the following file: