randomization.cpp
来自「在vc上做的802.16d ofdm phy的仿真」· C++ 代码 · 共 58 行
CPP
58 行
#include "typedef.h"
#include "randomization.h"
#include "global_var.h"
//initializtion RandVector
void dlRandInit(Uint16 burstIndex, //0=FCH, indication that the burst is FCH.
//1= indication that this is theburst #1after FCH.
Uint8 bsid,
Uint8 diuc,
Uint8 frameIndex,
Uint16 *pRandVector)
{
if(burstIndex < 2)
{
*pRandVector = 0x4a80;
}
else
{
*pRandVector = (Uint16)(frameIndex & 0x0f);
*pRandVector |= ((diuc & 0x0f) << 5);
*pRandVector |= 0x0610;
*pRandVector |= ((bsid & 0x0f)<< 11);
}
}
//randomization
void randomization (Uint8 mode,
DlTxBurstParam *pDlTxBurstParam,
Uint16 burstIndex,
Uint8 *pRandomizationIn,
Uint16 randomizationInLength,
Uint16 *pRandVector,
Uint8 *pRandomizationOut)
{
Int16 i, j;
Int8 feedBack;
if((*pDlTxBurstParam).burstSymIndex == 0)
{
dlRandInit(burstIndex,(*pDlTxBurstParam).bsid,
(*pDlTxBurstParam).diuc,(*pDlTxBurstParam).frameIndex,pRandVector);
}
for (i = 0; i < randomizationInLength; i++)
{
pRandomizationOut[i] = pRandomizationIn[i];
for (j = 0; j < 8; j++)
{
feedBack = (*pRandVector & 1);
*pRandVector >>= 1;
feedBack ^= (*pRandVector & 1);
pRandomizationOut[i] ^= feedBack << (7 - j);//"<<" before "^" ;
*pRandVector ^= (feedBack << 14);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?