SIB1中的参数locationAndBandwidth指示RIV(Resource Indicator Value),用于指示初始BWP的RB起始位置和RB数。通过公式可以计算得到BWP的起始位置和RB数,起始位置的参考点为Point A。
参考3GPP协议38.214
其中,BWP最大的size为275。
locationAndBandwidth解码实现
void decodeLocationAndBandwidth(int riv, int &rbStart, int &rbLens)
{
int bwpSize = 275;
int tmpRbLens = riv/bwpSize;
int tmp = riv/bwpSize + riv%bwpSize;
if(tmp < bwpSize)
{
rbLens = tmpRbLens + 1;
rbStart = riv % bwpSize;
}
else
{
rbLens = bwpSize - tmpRbLens + 1;
rbStart = bwpSize - 1 - (riv%bwpSize);
}
}
locationAndBandwidth编码实现
unsigned int encodeLocationAndBandwidth(unsigned short rbStart, unsigned short rbLens)
{
unsigned int riv = 0;
unsigned short bwpSize = 275;
if ((rbLens - 1) <= (bwpSize / 2))
{
riv = bwpSize * (rbLens - 1) + rbStart;
}
else
{
riv = bwpSize * (bwpSize - rbLens + 1) + (bwpSize - 1 - rbStart);
}
return riv;
}