Merge branch 'develop-nr' into nr_pdcch
This commit is contained in:
@@ -30,7 +30,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
#include "extern_3GPPinterleaver.h"
|
||||
|
||||
//#define DEBUG_TURBO_ENCODER 1
|
||||
|
||||
@@ -110,9 +109,7 @@ uint32_t bit_byte_lut[2048];
|
||||
void threegpplte_turbo_encoder(uint8_t *input,
|
||||
uint16_t input_length_bytes,
|
||||
uint8_t *output,
|
||||
uint8_t F,
|
||||
uint16_t interleaver_f1,
|
||||
uint16_t interleaver_f2)
|
||||
uint8_t F)
|
||||
{
|
||||
|
||||
int i,k=0;
|
||||
@@ -256,6 +253,217 @@ inline short threegpp_interleaver_parameters(uint16_t bytes_per_codeword)
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
|
||||
const interleaver_TS_36_212_t f1f2[188] = {
|
||||
{ 40, 3, 10 },
|
||||
{ 48, 7, 12 },
|
||||
{ 56, 19, 42 },
|
||||
{ 64, 7, 16 },
|
||||
{ 72, 7, 18 },
|
||||
{ 80, 11, 20 },
|
||||
{ 88, 5, 22 },
|
||||
{ 96, 11, 24 },
|
||||
{ 104, 7, 26 },
|
||||
{ 112, 41, 84 },
|
||||
{ 120, 103, 90 },
|
||||
{ 128, 15, 32 },
|
||||
{ 136, 9, 34 },
|
||||
{ 144, 17, 108 },
|
||||
{ 152, 9, 38 },
|
||||
{ 160, 21, 120 },
|
||||
{ 168, 101, 84 },
|
||||
{ 176, 21, 44 },
|
||||
{ 184, 57, 46 },
|
||||
{ 192, 23, 48 },
|
||||
{ 200, 13, 50 },
|
||||
{ 208, 27, 52 },
|
||||
{ 216, 11, 36 },
|
||||
{ 224, 27, 56 },
|
||||
{ 232, 85, 58 },
|
||||
{ 240, 29, 60 },
|
||||
{ 248, 33, 62 },
|
||||
{ 256, 15, 32 },
|
||||
{ 264, 17, 198 },
|
||||
{ 272, 33, 68 },
|
||||
{ 280, 103, 210 },
|
||||
{ 288, 19, 36 },
|
||||
{ 296, 19, 74 },
|
||||
{ 304, 37, 76 },
|
||||
{ 312, 19, 78 },
|
||||
{ 320, 21, 120 },
|
||||
{ 328, 21, 82 },
|
||||
{ 336, 115, 84 },
|
||||
{ 344, 193, 86 },
|
||||
{ 352, 21, 44 },
|
||||
{ 360, 133, 90 },
|
||||
{ 368, 81, 46 },
|
||||
{ 376, 45, 94 },
|
||||
{ 384, 23, 48 },
|
||||
{ 392, 243, 98 },
|
||||
{ 400, 151, 40 },
|
||||
{ 408, 155, 102 },
|
||||
{ 416, 25, 52 },
|
||||
{ 424, 51, 106 },
|
||||
{ 432, 47, 72 },
|
||||
{ 440, 91, 110 },
|
||||
{ 448, 29, 168 },
|
||||
{ 456, 29, 114 },
|
||||
{ 464, 247, 58 },
|
||||
{ 472, 29, 118 },
|
||||
{ 480, 89, 180 },
|
||||
{ 488, 91, 122 },
|
||||
{ 496, 157, 62 },
|
||||
{ 504, 55, 84 },
|
||||
{ 512, 31, 64 },
|
||||
{ 528, 17, 66 },
|
||||
{ 544, 35, 68 },
|
||||
{ 560, 227, 420 },
|
||||
{ 576, 65, 96 },
|
||||
{ 592, 19, 74 },
|
||||
{ 608, 37, 76 },
|
||||
{ 624, 41, 234 },
|
||||
{ 640, 39, 80 },
|
||||
{ 656, 185, 82 },
|
||||
{ 672, 43, 252 },
|
||||
{ 688, 21, 86 },
|
||||
{ 704, 155, 44 },
|
||||
{ 720, 79, 120 },
|
||||
{ 736, 139, 92 },
|
||||
{ 752, 23, 94 },
|
||||
{ 768, 217, 48 },
|
||||
{ 784, 25, 98 },
|
||||
{ 800, 17, 80 },
|
||||
{ 816, 127, 102 },
|
||||
{ 832, 25, 52 },
|
||||
{ 848, 239, 106 },
|
||||
{ 864, 17, 48 },
|
||||
{ 880, 137, 110 },
|
||||
{ 896, 215, 112 },
|
||||
{ 912, 29, 114 },
|
||||
{ 928, 15, 58 },
|
||||
{ 944, 147, 118 },
|
||||
{ 960, 29, 60 },
|
||||
{ 976, 59, 122 },
|
||||
{ 992, 65, 124 },
|
||||
{ 1008, 55, 84 },
|
||||
{ 1024, 31, 64 },
|
||||
{ 1056, 17, 66 },
|
||||
{ 1088, 171, 204 },
|
||||
{ 1120, 67, 140 },
|
||||
{ 1152, 35, 72 },
|
||||
{ 1184, 19, 74 },
|
||||
{ 1216, 39, 76 },
|
||||
{ 1248, 19, 78 },
|
||||
{ 1280, 199, 240 },
|
||||
{ 1312, 21, 82 },
|
||||
{ 1344, 211, 252 },
|
||||
{ 1376, 21, 86 },
|
||||
{ 1408, 43, 88 },
|
||||
{ 1440, 149, 60 },
|
||||
{ 1472, 45, 92 },
|
||||
{ 1504, 49, 846 },
|
||||
{ 1536, 71, 48 },
|
||||
{ 1568, 13, 28 },
|
||||
{ 1600, 17, 80 },
|
||||
{ 1632, 25, 102 },
|
||||
{ 1664, 183, 104 },
|
||||
{ 1696, 55, 954 },
|
||||
{ 1728, 127, 96 },
|
||||
{ 1760, 27, 110 },
|
||||
{ 1792, 29, 112 },
|
||||
{ 1824, 29, 114 },
|
||||
{ 1856, 57, 116 },
|
||||
{ 1888, 45, 354 },
|
||||
{ 1920, 31, 120 },
|
||||
{ 1952, 59, 610 },
|
||||
{ 1984, 185, 124 },
|
||||
{ 2016, 113, 420 },
|
||||
{ 2048, 31, 64 },
|
||||
{ 2112, 17, 66 },
|
||||
{ 2176, 171, 136 },
|
||||
{ 2240, 209, 420 },
|
||||
{ 2304, 253, 216 },
|
||||
{ 2368, 367, 444 },
|
||||
{ 2432, 265, 456 },
|
||||
{ 2496, 181, 468 },
|
||||
{ 2560, 39, 80 },
|
||||
{ 2624, 27, 164 },
|
||||
{ 2688, 127, 504 },
|
||||
{ 2752, 143, 172 },
|
||||
{ 2816, 43, 88 },
|
||||
{ 2880, 29, 300 },
|
||||
{ 2944, 45, 92 },
|
||||
{ 3008, 157, 188 },
|
||||
{ 3072, 47, 96 },
|
||||
{ 3136, 13, 28 },
|
||||
{ 3200, 111, 240 },
|
||||
{ 3264, 443, 204 },
|
||||
{ 3328, 51, 104 },
|
||||
{ 3392, 51, 212 },
|
||||
{ 3456, 451, 192 },
|
||||
{ 3520, 257, 220 },
|
||||
{ 3584, 57, 336 },
|
||||
{ 3648, 313, 228 },
|
||||
{ 3712, 271, 232 },
|
||||
{ 3776, 179, 236 },
|
||||
{ 3840, 331, 120 },
|
||||
{ 3904, 363, 244 },
|
||||
{ 3968, 375, 248 },
|
||||
{ 4032, 127, 168 },
|
||||
{ 4096, 31, 64 },
|
||||
{ 4160, 33, 130 },
|
||||
{ 4224, 43, 264 },
|
||||
{ 4288, 33, 134 },
|
||||
{ 4352, 477, 408 },
|
||||
{ 4416, 35, 138 },
|
||||
{ 4480, 233, 280 },
|
||||
{ 4544, 357, 142 },
|
||||
{ 4608, 337, 480 },
|
||||
{ 4672, 37, 146 },
|
||||
{ 4736, 71, 444 },
|
||||
{ 4800, 71, 120 },
|
||||
{ 4864, 37, 152 },
|
||||
{ 4928, 39, 462 },
|
||||
{ 4992, 127, 234 },
|
||||
{ 5056, 39, 158 },
|
||||
{ 5120, 39, 80 },
|
||||
{ 5184, 31, 96 },
|
||||
{ 5248, 113, 902 },
|
||||
{ 5312, 41, 166 },
|
||||
{ 5376, 251, 336 },
|
||||
{ 5440, 43, 170 },
|
||||
{ 5504, 21, 86 },
|
||||
{ 5568, 43, 174 },
|
||||
{ 5632, 45, 176 },
|
||||
{ 5696, 45, 178 },
|
||||
{ 5760, 161, 120 },
|
||||
{ 5824, 89, 182 },
|
||||
{ 5888, 323, 184 },
|
||||
{ 5952, 47, 186 },
|
||||
{ 6016, 23, 94 },
|
||||
{ 6080, 47, 190 },
|
||||
{ 6144, 263, 480 },
|
||||
};
|
||||
|
||||
|
||||
t_interleaver_codebook *f1f2mat;
|
||||
short *il_tb;
|
||||
__attribute__((constructor)) static void init_interleaver(void) {
|
||||
int totSize=0;
|
||||
f1f2mat=(t_interleaver_codebook*) malloc(sizeof(*f1f2mat) * sizeof(f1f2) / sizeof(*f1f2));
|
||||
for (int i=0; i < sizeof(f1f2)/sizeof(*f1f2) ; i++) {
|
||||
f1f2mat[i].nb_bits=f1f2[i].nb_bits;
|
||||
f1f2mat[i].f1=f1f2[i].f1;
|
||||
f1f2mat[i].f2=f1f2[i].f2;
|
||||
f1f2mat[i].beg_index=totSize;
|
||||
totSize+=f1f2mat[i].nb_bits;
|
||||
}
|
||||
il_tb=(short*)malloc(sizeof(*il_tb)*totSize);
|
||||
int idx=0;
|
||||
for (int i=0; i < sizeof(f1f2)/sizeof(*f1f2) ; i++)
|
||||
for (uint64_t j=0; j<f1f2[i].nb_bits; j++)
|
||||
il_tb[idx++]=(j*f1f2[i].f1+j*j*f1f2[i].f2)%f1f2[i].nb_bits;
|
||||
}
|
||||
|
||||
|
||||
#ifdef MAIN
|
||||
@@ -296,9 +504,7 @@ int main(int argc,char **argv)
|
||||
|
||||
threegpplte_turbo_encoder(&input[0],
|
||||
5,
|
||||
&output[0],
|
||||
F1,
|
||||
F2);
|
||||
&output[0]);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +27,7 @@
|
||||
*/
|
||||
#ifndef TC_MAIN
|
||||
#include "coding_defs.h"
|
||||
#include "extern_3GPPinterleaver.h"
|
||||
#else
|
||||
#include "coding_vars.h"
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
@@ -539,9 +537,7 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
|
||||
void threegpplte_turbo_encoder_sse(unsigned char *input,
|
||||
unsigned short input_length_bytes,
|
||||
unsigned char *output,
|
||||
unsigned char F,
|
||||
unsigned short interleaver_f1,
|
||||
unsigned short interleaver_f2)
|
||||
unsigned char F)
|
||||
{
|
||||
|
||||
int i;
|
||||
@@ -699,9 +695,7 @@ int main(int argc,char **argv)
|
||||
threegpplte_turbo_encoder_sse(&input[0],
|
||||
INPUT_LENGTH,
|
||||
&output[0],
|
||||
0,
|
||||
F1,
|
||||
F2);
|
||||
0);
|
||||
|
||||
|
||||
for (i=0;i<12+(INPUT_LENGTH*24);i++)
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
#include "PHY/defs_common.h"
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "extern_3GPPinterleaver.h"
|
||||
#else
|
||||
|
||||
#include "defs.h"
|
||||
@@ -893,8 +892,6 @@ unsigned char phy_threegpplte_turbo_decoder16avx2(int16_t *y,
|
||||
uint8_t *decoded_bytes,
|
||||
uint8_t *decoded_bytes2,
|
||||
uint16_t n,
|
||||
uint16_t f1,
|
||||
uint16_t f2,
|
||||
uint8_t max_iterations,
|
||||
uint8_t crc_type,
|
||||
uint8_t F,
|
||||
@@ -989,134 +986,6 @@ unsigned char phy_threegpplte_turbo_decoder16avx2(int16_t *y,
|
||||
yp1 = yparity1;
|
||||
yp2 = yparity2;
|
||||
|
||||
|
||||
#if 0
|
||||
__m128i *yp128,*yp128_cw2;
|
||||
__m128i tmpe,tmpe_cw2;
|
||||
yp128 = (__m128i*)y;
|
||||
yp128_cw2 = (__m128i*)y2;
|
||||
|
||||
|
||||
|
||||
for (i=0; i<n; i+=8) {
|
||||
pi2_p = &pi2tab16avx2[iind][i];
|
||||
|
||||
j=pi2_p[0];
|
||||
|
||||
|
||||
tmpe = _mm_load_si128(yp128);
|
||||
tmpe_cw2 = _mm_load_si128(yp128_cw2);
|
||||
// fprintf(fdavx2,"yp128 %p\n",yp128);
|
||||
// print_shorts("tmpe",(int16_t*)&tmpe);
|
||||
|
||||
s[j] = _mm_extract_epi16(tmpe,0);
|
||||
yp1[j] = _mm_extract_epi16(tmpe,1);
|
||||
yp2[j] = _mm_extract_epi16(tmpe,2);
|
||||
s[j+8] = _mm_extract_epi16(tmpe_cw2,0);
|
||||
yp1[j+8] = _mm_extract_epi16(tmpe_cw2,1);
|
||||
yp2[j+8] = _mm_extract_epi16(tmpe_cw2,2);
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdavx2,"init0: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j],yp1[j],yp2[j]);
|
||||
fprintf(fdavx2b,"init0: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j+8],yp1[j+8],yp2[j+8]);
|
||||
#endif
|
||||
|
||||
j=pi2_p[1];
|
||||
|
||||
s[j] = _mm_extract_epi16(tmpe,3);
|
||||
yp1[j] = _mm_extract_epi16(tmpe,4);
|
||||
yp2[j] = _mm_extract_epi16(tmpe,5);
|
||||
s[j+8] = _mm_extract_epi16(tmpe_cw2,3);
|
||||
yp1[j+8] = _mm_extract_epi16(tmpe_cw2,4);
|
||||
yp2[j+8] = _mm_extract_epi16(tmpe_cw2,5);
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdavx2,"init1: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j],yp1[j],yp2[j]);
|
||||
fprintf(fdavx2b,"init1: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j+8],yp1[j+8],yp2[j+8]);
|
||||
#endif
|
||||
j=pi2_p[2];
|
||||
|
||||
s[j] = _mm_extract_epi16(tmpe,6);
|
||||
yp1[j] = _mm_extract_epi16(tmpe,7);
|
||||
tmpe = _mm_load_si128(&yp128[1]);
|
||||
yp2[j] = _mm_extract_epi16(tmpe,0);
|
||||
s[j+8] = _mm_extract_epi16(tmpe_cw2,6);
|
||||
yp1[j+8] = _mm_extract_epi16(tmpe_cw2,7);
|
||||
tmpe_cw2 = _mm_load_si128(&yp128_cw2[1]);
|
||||
yp2[j+8] = _mm_extract_epi16(tmpe_cw2,0);
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdavx2,"init2: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j],yp1[j],yp2[j]);
|
||||
fprintf(fdavx2b,"init2: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j+8],yp1[j+8],yp2[j+8]);
|
||||
#endif
|
||||
j=pi2_p[3];
|
||||
|
||||
s[j] = _mm_extract_epi16(tmpe,1);
|
||||
yp1[j] = _mm_extract_epi16(tmpe,2);
|
||||
yp2[j] = _mm_extract_epi16(tmpe,3);
|
||||
s[j+8] = _mm_extract_epi16(tmpe_cw2,1);
|
||||
yp1[j+8] = _mm_extract_epi16(tmpe_cw2,2);
|
||||
yp2[j+8] = _mm_extract_epi16(tmpe_cw2,3);
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdavx2,"init3: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j],yp1[j],yp2[j]);
|
||||
fprintf(fdavx2b,"init3: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j+8],yp1[j+8],yp2[j+8]);
|
||||
#endif
|
||||
j=pi2_p[4];
|
||||
|
||||
s[j] = _mm_extract_epi16(tmpe,4);
|
||||
yp1[j] = _mm_extract_epi16(tmpe,5);
|
||||
yp2[j] = _mm_extract_epi16(tmpe,6);
|
||||
s[j+8] = _mm_extract_epi16(tmpe_cw2,4);
|
||||
yp1[j+8] = _mm_extract_epi16(tmpe_cw2,5);
|
||||
yp2[j+8] = _mm_extract_epi16(tmpe_cw2,6);
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdavx2,"init4: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j],yp1[j],yp2[j]);
|
||||
fprintf(fdavx2b,"init4: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j+8],yp1[j+8],yp2[j+8]);
|
||||
#endif
|
||||
j=pi2_p[5];
|
||||
|
||||
s[j] = _mm_extract_epi16(tmpe,7);
|
||||
tmpe = _mm_load_si128(&yp128[2]);
|
||||
yp1[j] = _mm_extract_epi16(tmpe,0);
|
||||
yp2[j] = _mm_extract_epi16(tmpe,1);
|
||||
s[j+8] = _mm_extract_epi16(tmpe_cw2,7);
|
||||
tmpe_cw2 = _mm_load_si128(&yp128_cw2[2]);
|
||||
yp1[j+8] = _mm_extract_epi16(tmpe_cw2,0);
|
||||
yp2[j+8] = _mm_extract_epi16(tmpe_cw2,1);
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdavx2,"init5: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j],yp1[j],yp2[j]);
|
||||
fprintf(fdavx2b,"init5: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j+8],yp1[j+8],yp2[j+8]);
|
||||
#endif
|
||||
j=pi2_p[6];
|
||||
|
||||
s[j] = _mm_extract_epi16(tmpe,2);
|
||||
yp1[j] = _mm_extract_epi16(tmpe,3);
|
||||
yp2[j] = _mm_extract_epi16(tmpe,4);
|
||||
s[j+8] = _mm_extract_epi16(tmpe_cw2,2);
|
||||
yp1[j+8] = _mm_extract_epi16(tmpe_cw2,3);
|
||||
yp2[j+8] = _mm_extract_epi16(tmpe_cw2,4);
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdavx2,"init6: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j],yp1[j],yp2[j]);
|
||||
fprintf(fdavx2b,"init6: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j+8],yp1[j+8],yp2[j+8]);
|
||||
#endif
|
||||
j=pi2_p[7];
|
||||
|
||||
s[j] = _mm_extract_epi16(tmpe,5);
|
||||
yp1[j] = _mm_extract_epi16(tmpe,6);
|
||||
yp2[j] = _mm_extract_epi16(tmpe,7);
|
||||
s[j+8] = _mm_extract_epi16(tmpe_cw2,5);
|
||||
yp1[j+8] = _mm_extract_epi16(tmpe_cw2,6);
|
||||
yp2[j+8] = _mm_extract_epi16(tmpe_cw2,7);
|
||||
#ifdef DEBUG_LOGMAP
|
||||
fprintf(fdavx2,"init7: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j],yp1[j],yp2[j]);
|
||||
fprintf(fdavx2b,"init7: j %d, s[j] %d yp1[j] %d yp2[j] %d\n",((j>>4)<<3)+(j&7),s[j+8],yp1[j+8],yp2[j+8]);
|
||||
#endif
|
||||
yp128+=3;
|
||||
yp128_cw2+=3;
|
||||
|
||||
}
|
||||
yp=(llr_t*)yp128;
|
||||
yp_cw2=(llr_t*)yp128_cw2;
|
||||
#else
|
||||
|
||||
pi2_p = &pi2tab16avx2[iind][0];
|
||||
for (i=0,j=0; i<n; i++) {
|
||||
s[*pi2_p] = y[j];
|
||||
@@ -1128,8 +997,6 @@ unsigned char phy_threegpplte_turbo_decoder16avx2(int16_t *y,
|
||||
}
|
||||
yp=(llr_t*)&y[j];
|
||||
yp_cw2=(llr_t*)&y2[j];
|
||||
#endif
|
||||
|
||||
|
||||
// Termination
|
||||
for (i=0; i<3; i++) {
|
||||
@@ -1417,8 +1284,6 @@ unsigned char phy_threegpplte_turbo_decoder16avx2(int16_t *y,
|
||||
uint8_t *decoded_bytes,
|
||||
uint8_t *decoded_bytes2,
|
||||
uint16_t n,
|
||||
uint16_t f1,
|
||||
uint16_t f2,
|
||||
uint8_t max_iterations,
|
||||
uint8_t crc_type,
|
||||
uint8_t F,
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/CODING/defs.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "extern_3GPPinterleaver.h"
|
||||
#else
|
||||
|
||||
#include "defs.h"
|
||||
@@ -1983,8 +1982,6 @@ void init_td()
|
||||
unsigned char phy_threegpplte_turbo_decoder(short *y,
|
||||
unsigned char *decoded_bytes,
|
||||
unsigned short n,
|
||||
unsigned short f1,
|
||||
unsigned short f2,
|
||||
unsigned char max_iterations,
|
||||
unsigned char crc_type,
|
||||
unsigned char F,
|
||||
@@ -2620,8 +2617,6 @@ int test_logmap8()
|
||||
test[3] = 0x92;
|
||||
test[4] = 0xfe;
|
||||
|
||||
crcTableInit();
|
||||
|
||||
crc = crc24a(test,
|
||||
40)>>8;
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
#include "PHY/defs_common.h"
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "extern_3GPPinterleaver.h"
|
||||
#else
|
||||
|
||||
#include "defs.h"
|
||||
@@ -233,9 +232,6 @@ void compute_alpha16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,unsigned s
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
alpha128 = (__m128i *)alpha;
|
||||
//#ifdef __AVX2__
|
||||
#if 0
|
||||
alpha256 = (__m256i *)alpha;
|
||||
#endif
|
||||
#elif defined(__arm__)
|
||||
alpha128 = (int16x8_t *)alpha;
|
||||
#endif
|
||||
@@ -317,10 +313,6 @@ void compute_alpha16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,unsigned s
|
||||
|
||||
alpha_ptr = &alpha128[0];
|
||||
//#ifdef __AVX2__
|
||||
#if 0
|
||||
alpha_ptr256 = &alpha256[0];
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
m11p = (__m128i*)m_11;
|
||||
m10p = (__m128i*)m_10;
|
||||
@@ -450,9 +442,6 @@ void compute_alpha16(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,unsigned s
|
||||
|
||||
alpha_ptr+=8;
|
||||
//#ifdef __AVX2__
|
||||
#if 0
|
||||
alpha_ptr256+=4;
|
||||
#endif
|
||||
m11p++;
|
||||
m10p++;
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
@@ -1172,24 +1161,21 @@ void init_td16(void)
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char phy_threegpplte_turbo_decoder16(short *y,
|
||||
short *y2,
|
||||
unsigned char *decoded_bytes,
|
||||
unsigned char *decoded_bytes2,
|
||||
unsigned short n,
|
||||
unsigned short f1,
|
||||
unsigned short f2,
|
||||
unsigned char max_iterations,
|
||||
unsigned char crc_type,
|
||||
unsigned char F,
|
||||
time_stats_t *init_stats,
|
||||
time_stats_t *alpha_stats,
|
||||
time_stats_t *beta_stats,
|
||||
time_stats_t *gamma_stats,
|
||||
time_stats_t *ext_stats,
|
||||
time_stats_t *intl1_stats,
|
||||
time_stats_t *intl2_stats)
|
||||
{
|
||||
uint8_t phy_threegpplte_turbo_decoder16(int16_t *y,
|
||||
int16_t *y2,
|
||||
uint8_t *decoded_bytes,
|
||||
uint8_t *decoded_bytes2,
|
||||
uint16_t n,
|
||||
uint8_t max_iterations,
|
||||
uint8_t crc_type,
|
||||
uint8_t F,
|
||||
time_stats_t *init_stats,
|
||||
time_stats_t *alpha_stats,
|
||||
time_stats_t *beta_stats,
|
||||
time_stats_t *gamma_stats,
|
||||
time_stats_t *ext_stats,
|
||||
time_stats_t *intl1_stats,
|
||||
time_stats_t *intl2_stats) {
|
||||
|
||||
/* y is a pointer to the input
|
||||
decoded_bytes is a pointer to the decoded output
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
#include "PHY/defs_common.h"
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "extern_3GPPinterleaver.h"
|
||||
#else
|
||||
|
||||
#include "defs.h"
|
||||
@@ -427,67 +426,6 @@ void compute_beta8(llr_t* alpha,llr_t* beta,llr_t *m_11,llr_t* m_10,unsigned sho
|
||||
|
||||
llr_t beta2,beta3,beta4,beta5,beta6,beta7;
|
||||
|
||||
|
||||
#if 0
|
||||
int16_t m11,m10;
|
||||
int16_t beta0_16,beta1_16,beta2_16,beta3_16,beta4_16,beta5_16,beta6_16,beta7_16,beta0_2,beta1_2,beta2_2,beta3_2,beta_m;
|
||||
__m128i beta_16;
|
||||
// termination for beta initialization
|
||||
|
||||
m11=(int16_t)m_11[2+frame_length];
|
||||
m10=(int16_t)m_10[2+frame_length];
|
||||
|
||||
beta0 = -m11;//M0T_TERM;
|
||||
beta1 = m11;//M1T_TERM;
|
||||
m11=(int16_t)m_11[1+frame_length];
|
||||
m10=(int16_t)m_10[1+frame_length];
|
||||
|
||||
beta0_2 = beta0-m11;//+M0T_TERM;
|
||||
beta1_2 = beta0+m11;//+M1T_TERM;
|
||||
beta2_2 = beta1+m10;//M2T_TERM;
|
||||
beta3_2 = beta1-m10;//+M3T_TERM;
|
||||
m11=(int16_t)m_11[frame_length];
|
||||
m10=(int16_t)m_10[frame_length];
|
||||
|
||||
beta0_16 = beta0_2-m11;//+M0T_TERM;
|
||||
beta1_16 = beta0_2+m11;//+M1T_TERM;
|
||||
beta2_16 = beta1_2+m10;//+M2T_TERM;
|
||||
beta3_16 = beta1_2-m10;//+M3T_TERM;
|
||||
beta4_16 = beta2_2-m10;//+M4T_TERM;
|
||||
beta5_16 = beta2_2+m10;//+M5T_TERM;
|
||||
beta6_16 = beta3_2+m11;//+M6T_TERM;
|
||||
beta7_16 = beta3_2-m11;//+M7T_TERM;
|
||||
|
||||
beta_m = (beta0_16>beta1_16) ? beta0_16 : beta1_16;
|
||||
beta_m = (beta_m>beta2_16) ? beta_m : beta2_16;
|
||||
beta_m = (beta_m>beta3_16) ? beta_m : beta3_16;
|
||||
beta_m = (beta_m>beta4_16) ? beta_m : beta4_16;
|
||||
beta_m = (beta_m>beta5_16) ? beta_m : beta5_16;
|
||||
beta_m = (beta_m>beta6_16) ? beta_m : beta6_16;
|
||||
beta_m = (beta_m>beta7_16) ? beta_m : beta7_16;
|
||||
|
||||
beta0_16=beta0_16-beta_m;
|
||||
beta1_16=beta1_16-beta_m;
|
||||
beta2_16=beta2_16-beta_m;
|
||||
beta3_16=beta3_16-beta_m;
|
||||
beta4_16=beta4_16-beta_m;
|
||||
beta5_16=beta5_16-beta_m;
|
||||
beta6_16=beta6_16-beta_m;
|
||||
beta7_16=beta7_16-beta_m;
|
||||
|
||||
beta_16 = _mm_set_epi16(beta7_16,beta6_16,beta5_16,beta4_16,beta3_16,beta2_16,beta1_16,beta0_16);
|
||||
beta_16 = _mm_packs_epi16(beta_16,beta_16);
|
||||
beta0 = _mm_extract_epi8(beta_16,0);
|
||||
beta1 = _mm_extract_epi8(beta_16,1);
|
||||
beta2 = _mm_extract_epi8(beta_16,2);
|
||||
beta3 = _mm_extract_epi8(beta_16,3);
|
||||
beta4 = _mm_extract_epi8(beta_16,4);
|
||||
beta5 = _mm_extract_epi8(beta_16,5);
|
||||
beta6 = _mm_extract_epi8(beta_16,6);
|
||||
beta7 = _mm_extract_epi8(beta_16,7);
|
||||
|
||||
#endif
|
||||
|
||||
if (frame_length > 6144) {
|
||||
LOG_E(PHY,"compute_beta: frame_length %d\n",frame_length);
|
||||
return;
|
||||
@@ -897,25 +835,21 @@ void init_td8(void)
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char phy_threegpplte_turbo_decoder8(short *y,
|
||||
short y2,
|
||||
unsigned char *decoded_bytes,
|
||||
unsigned char *decoded_bytes2,
|
||||
unsigned short n,
|
||||
unsigned short f1,
|
||||
unsigned short f2,
|
||||
unsigned char max_iterations,
|
||||
unsigned char crc_type,
|
||||
unsigned char F,
|
||||
time_stats_t *init_stats,
|
||||
time_stats_t *alpha_stats,
|
||||
time_stats_t *beta_stats,
|
||||
time_stats_t *gamma_stats,
|
||||
time_stats_t *ext_stats,
|
||||
time_stats_t *intl1_stats,
|
||||
time_stats_t *intl2_stats)
|
||||
{
|
||||
|
||||
uint8_t phy_threegpplte_turbo_decoder8(int16_t *y,
|
||||
int16_t *y2,
|
||||
uint8_t *decoded_bytes,
|
||||
uint8_t *decoded_bytes2,
|
||||
uint16_t n,
|
||||
uint8_t max_iterations,
|
||||
uint8_t crc_type,
|
||||
uint8_t F,
|
||||
time_stats_t *init_stats,
|
||||
time_stats_t *alpha_stats,
|
||||
time_stats_t *beta_stats,
|
||||
time_stats_t *gamma_stats,
|
||||
time_stats_t *ext_stats,
|
||||
time_stats_t *intl1_stats,
|
||||
time_stats_t *intl2_stats) {
|
||||
/* y is a pointer to the input
|
||||
decoded_bytes is a pointer to the decoded output
|
||||
n is the size in bits of the coded block, with the tail */
|
||||
@@ -1085,209 +1019,6 @@ unsigned char phy_threegpplte_turbo_decoder8(short *y,
|
||||
yp2[k]=*yp++;
|
||||
}
|
||||
|
||||
#endif
|
||||
#if 0
|
||||
|
||||
for (i=0; i<n2; i+=16) {
|
||||
pi2_p = &pi2tab8[iind][i];
|
||||
|
||||
j=pi2_p[0];
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
s[j] = _mm_extract_epi8(yp128[0],0);
|
||||
yp1[j] = _mm_extract_epi8(yp128[0],1);
|
||||
yp2[j] = _mm_extract_epi8(yp128[0],2);
|
||||
|
||||
|
||||
j=pi2_p[1];
|
||||
s[j] = _mm_extract_epi8(yp128[0],3);
|
||||
yp1[j] = _mm_extract_epi8(yp128[0],4);
|
||||
yp2[j] = _mm_extract_epi8(yp128[0],5);
|
||||
|
||||
|
||||
j=pi2_p[2];
|
||||
s[j] = _mm_extract_epi8(yp128[0],6);
|
||||
yp1[j] = _mm_extract_epi8(yp128[0],7);
|
||||
yp2[j] = _mm_extract_epi8(yp128[0],8);
|
||||
|
||||
|
||||
j=pi2_p[3];
|
||||
s[j] = _mm_extract_epi8(yp128[0],9);
|
||||
yp1[j] = _mm_extract_epi8(yp128[0],10);
|
||||
yp2[j] = _mm_extract_epi8(yp128[0],11);
|
||||
|
||||
|
||||
j=pi2_p[4];
|
||||
s[j] = _mm_extract_epi8(yp128[0],12);
|
||||
yp1[j] = _mm_extract_epi8(yp128[0],13);
|
||||
yp2[j] = _mm_extract_epi8(yp128[0],14);
|
||||
|
||||
|
||||
j=pi2_p[5];
|
||||
s[j] = _mm_extract_epi8(yp128[0],15);
|
||||
yp1[j] = _mm_extract_epi8(yp128[1],0);
|
||||
yp2[j] = _mm_extract_epi8(yp128[1],1);
|
||||
|
||||
|
||||
j=pi2_p[6];
|
||||
s[j] = _mm_extract_epi8(yp128[1],2);
|
||||
yp1[j] = _mm_extract_epi8(yp128[1],3);
|
||||
yp2[j] = _mm_extract_epi8(yp128[1],4);
|
||||
|
||||
|
||||
j=pi2_p[7];
|
||||
s[j] = _mm_extract_epi8(yp128[1],5);
|
||||
yp1[j] = _mm_extract_epi8(yp128[1],6);
|
||||
yp2[j] = _mm_extract_epi8(yp128[1],7);
|
||||
|
||||
|
||||
j=pi2_p[8];
|
||||
s[j] = _mm_extract_epi8(yp128[1],8);
|
||||
yp1[j] = _mm_extract_epi8(yp128[1],9);
|
||||
yp2[j] = _mm_extract_epi8(yp128[1],10);
|
||||
|
||||
|
||||
j=pi2_p[9];
|
||||
s[j] = _mm_extract_epi8(yp128[1],11);
|
||||
yp1[j] = _mm_extract_epi8(yp128[1],12);
|
||||
yp2[j] = _mm_extract_epi8(yp128[1],13);
|
||||
|
||||
|
||||
j=pi2_p[10];
|
||||
s[j] = _mm_extract_epi8(yp128[1],14);
|
||||
yp1[j] = _mm_extract_epi8(yp128[1],15);
|
||||
yp2[j] = _mm_extract_epi8(yp128[2],0);
|
||||
|
||||
|
||||
j=pi2_p[11];
|
||||
s[j] = _mm_extract_epi8(yp128[2],1);
|
||||
yp1[j] = _mm_extract_epi8(yp128[2],2);
|
||||
yp2[j] = _mm_extract_epi8(yp128[2],3);
|
||||
|
||||
|
||||
j=pi2_p[12];
|
||||
s[j] = _mm_extract_epi8(yp128[2],4);
|
||||
yp1[j] = _mm_extract_epi8(yp128[2],5);
|
||||
yp2[j] = _mm_extract_epi8(yp128[2],6);
|
||||
|
||||
|
||||
j=pi2_p[13];
|
||||
s[j] = _mm_extract_epi8(yp128[2],7);
|
||||
yp1[j] = _mm_extract_epi8(yp128[2],8);
|
||||
yp2[j] = _mm_extract_epi8(yp128[2],9);
|
||||
|
||||
|
||||
j=pi2_p[14];
|
||||
s[j] = _mm_extract_epi8(yp128[2],10);
|
||||
yp1[j] = _mm_extract_epi8(yp128[2],11);
|
||||
yp2[j] = _mm_extract_epi8(yp128[2],12);
|
||||
|
||||
|
||||
j=pi2_p[15];
|
||||
s[j] = _mm_extract_epi8(yp128[2],13);
|
||||
yp1[j] = _mm_extract_epi8(yp128[2],14);
|
||||
yp2[j] = _mm_extract_epi8(yp128[2],15);
|
||||
|
||||
|
||||
#elif defined(__arm__)
|
||||
s[j] = vgetq_lane_s8(yp128[0],0);
|
||||
yp1[j] = vgetq_lane_s8(yp128[0],1);
|
||||
yp2[j] = vgetq_lane_s8(yp128[0],2);
|
||||
|
||||
|
||||
j=pi2_p[1];
|
||||
s[j] = vgetq_lane_s8(yp128[0],3);
|
||||
yp1[j] = vgetq_lane_s8(yp128[0],4);
|
||||
yp2[j] = vgetq_lane_s8(yp128[0],5);
|
||||
|
||||
|
||||
j=pi2_p[2];
|
||||
s[j] = vgetq_lane_s8(yp128[0],6);
|
||||
yp1[j] = vgetq_lane_s8(yp128[0],7);
|
||||
yp2[j] = vgetq_lane_s8(yp128[0],8);
|
||||
|
||||
|
||||
j=pi2_p[3];
|
||||
s[j] = vgetq_lane_s8(yp128[0],9);
|
||||
yp1[j] = vgetq_lane_s8(yp128[0],10);
|
||||
yp2[j] = vgetq_lane_s8(yp128[0],11);
|
||||
|
||||
|
||||
j=pi2_p[4];
|
||||
s[j] = vgetq_lane_s8(yp128[0],12);
|
||||
yp1[j] = vgetq_lane_s8(yp128[0],13);
|
||||
yp2[j] = vgetq_lane_s8(yp128[0],14);
|
||||
|
||||
|
||||
j=pi2_p[5];
|
||||
s[j] = vgetq_lane_s8(yp128[0],15);
|
||||
yp1[j] = vgetq_lane_s8(yp128[1],0);
|
||||
yp2[j] = vgetq_lane_s8(yp128[1],1);
|
||||
|
||||
|
||||
j=pi2_p[6];
|
||||
s[j] = vgetq_lane_s8(yp128[1],2);
|
||||
yp1[j] = vgetq_lane_s8(yp128[1],3);
|
||||
yp2[j] = vgetq_lane_s8(yp128[1],4);
|
||||
|
||||
|
||||
j=pi2_p[7];
|
||||
s[j] = vgetq_lane_s8(yp128[1],5);
|
||||
yp1[j] = vgetq_lane_s8(yp128[1],6);
|
||||
yp2[j] = vgetq_lane_s8(yp128[1],7);
|
||||
|
||||
|
||||
j=pi2_p[8];
|
||||
s[j] = vgetq_lane_s8(yp128[1],8);
|
||||
yp1[j] = vgetq_lane_s8(yp128[1],9);
|
||||
yp2[j] = vgetq_lane_s8(yp128[1],10);
|
||||
|
||||
|
||||
j=pi2_p[9];
|
||||
s[j] = vgetq_lane_s8(yp128[1],11);
|
||||
yp1[j] = vgetq_lane_s8(yp128[1],12);
|
||||
yp2[j] = vgetq_lane_s8(yp128[1],13);
|
||||
|
||||
|
||||
j=pi2_p[10];
|
||||
s[j] = vgetq_lane_s8(yp128[1],14);
|
||||
yp1[j] = vgetq_lane_s8(yp128[1],15);
|
||||
yp2[j] = vgetq_lane_s8(yp128[2],0);
|
||||
|
||||
|
||||
j=pi2_p[11];
|
||||
s[j] = vgetq_lane_s8(yp128[2],1);
|
||||
yp1[j] = vgetq_lane_s8(yp128[2],2);
|
||||
yp2[j] = vgetq_lane_s8(yp128[2],3);
|
||||
|
||||
|
||||
j=pi2_p[12];
|
||||
s[j] = vgetq_lane_s8(yp128[2],4);
|
||||
yp1[j] = vgetq_lane_s8(yp128[2],5);
|
||||
yp2[j] = vgetq_lane_s8(yp128[2],6);
|
||||
|
||||
|
||||
j=pi2_p[13];
|
||||
s[j] = vgetq_lane_s8(yp128[2],7);
|
||||
yp1[j] = vgetq_lane_s8(yp128[2],8);
|
||||
yp2[j] = vgetq_lane_s8(yp128[2],9);
|
||||
|
||||
|
||||
j=pi2_p[14];
|
||||
s[j] = vgetq_lane_s8(yp128[2],10);
|
||||
yp1[j] = vgetq_lane_s8(yp128[2],11);
|
||||
yp2[j] = vgetq_lane_s8(yp128[2],12);
|
||||
|
||||
|
||||
j=pi2_p[15];
|
||||
s[j] = vgetq_lane_s8(yp128[2],13);
|
||||
yp1[j] = vgetq_lane_s8(yp128[2],14);
|
||||
yp2[j] = vgetq_lane_s8(yp128[2],15);
|
||||
|
||||
#endif
|
||||
yp128+=3;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
yp=(llr_t*)yp128;
|
||||
@@ -1337,9 +1068,8 @@ unsigned char phy_threegpplte_turbo_decoder8(short *y,
|
||||
if (init_stats) stop_meas(init_stats);
|
||||
|
||||
// do log_map from first parity bit
|
||||
|
||||
|
||||
log_map8(systematic0,yparity1,m11,m10,alpha,beta,ext,n2,0,F,offset8_flag,alpha_stats,beta_stats,gamma_stats,ext_stats);
|
||||
|
||||
while (iteration_cnt++ < max_iterations) {
|
||||
|
||||
#ifdef DEBUG_LOGMAP
|
||||
|
||||
@@ -25,8 +25,18 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "SIMULATION/TOOLS/sim.h"
|
||||
#include "PHY/CODING/nrLDPC_encoder/defs.h"
|
||||
#include "PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.h"
|
||||
|
||||
#define MAX_NUM_DLSCH_SEGMENTS 16
|
||||
|
||||
#ifndef malloc16
|
||||
# ifdef __AVX2__
|
||||
# define malloc16(x) memalign(32,x)
|
||||
# else
|
||||
# define malloc16(x) memalign(16,x)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// 4-bit quantizer
|
||||
char quantize4bit(double D,double x)
|
||||
@@ -62,11 +72,11 @@ char quantize(double D,double x,unsigned char B)
|
||||
#define MAX_BLOCK_LENGTH 8448
|
||||
|
||||
int test_ldpc(short No_iteration,
|
||||
int nom_rate,
|
||||
int denom_rate,
|
||||
//int nom_rate,
|
||||
//int denom_rate,
|
||||
double SNR,
|
||||
unsigned char qbits,
|
||||
short block_length,
|
||||
unsigned short block_length,
|
||||
unsigned int ntrials,
|
||||
unsigned int *errors,
|
||||
unsigned int *crc_misses)
|
||||
@@ -85,12 +95,14 @@ int test_ldpc(short No_iteration,
|
||||
double *modulated_input;
|
||||
char *channel_output_fixed;
|
||||
unsigned int i,j,trial=0;
|
||||
short BG,Zc,Kb,nrows,ncols;
|
||||
int no_punctured_columns,removed_bit;
|
||||
short BG,Zc,Kb;
|
||||
//short nrows,ncols;
|
||||
//int no_punctured_columns,removed_bit;
|
||||
int i1;
|
||||
//Table of possible lifting sizes
|
||||
short lift_size[51]= {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,20,22,24,26,28,30,32,36,40,44,48,52,56,60,64,72,80,88,96,104,112,120,128,144,160,176,192,208,224,240,256,288,320,352,384};
|
||||
int n_segments=8;
|
||||
int N; //length encoded block
|
||||
|
||||
t_nrLDPC_dec_params decParams;
|
||||
int n_iter;
|
||||
@@ -107,7 +119,9 @@ int test_ldpc(short No_iteration,
|
||||
modulated_input = (double *)malloc(sizeof(double) * 68*384);
|
||||
channel_output = (double *)malloc(sizeof(double) * 68*384);
|
||||
channel_output_fixed = (char *)malloc16(sizeof(char) * 68*384);
|
||||
estimated_output = (unsigned char*) malloc16(sizeof(unsigned char) * block_length/8);
|
||||
estimated_output = (unsigned char*) malloc16(sizeof(unsigned char) * block_length);
|
||||
|
||||
memset(channel_output_fixed,0,sizeof(char) * 68*384);
|
||||
|
||||
reset_meas(&time);
|
||||
reset_meas(&time_optim);
|
||||
@@ -124,18 +138,18 @@ int test_ldpc(short No_iteration,
|
||||
}
|
||||
|
||||
//determine number of bits in codeword
|
||||
//if (block_length>3840)
|
||||
if ((block_length>3840) && (block_length <= MAX_BLOCK_LENGTH))
|
||||
{
|
||||
BG=1;
|
||||
Kb = 22;
|
||||
nrows=46; //parity check bits
|
||||
ncols=22; //info bits
|
||||
//nrows=46; //parity check bits
|
||||
//ncols=22; //info bits
|
||||
}
|
||||
/*else if (block_length<=3840)
|
||||
else if (block_length<=3840)
|
||||
{
|
||||
BG=2;
|
||||
nrows=42; //parity check bits
|
||||
ncols=10; // info bits
|
||||
//nrows=42; //parity check bits
|
||||
//ncols=10; // info bits
|
||||
|
||||
if (block_length>640)
|
||||
Kb = 10;
|
||||
@@ -145,11 +159,14 @@ int test_ldpc(short No_iteration,
|
||||
Kb = 8;
|
||||
else
|
||||
Kb = 6;
|
||||
}*/
|
||||
|
||||
}
|
||||
else {
|
||||
printf("block_length %d not supported\n",block_length);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
//find minimum value in all sets of lifting size
|
||||
Zc=0;
|
||||
|
||||
for (i1=0; i1 < 51; i1++)
|
||||
{
|
||||
if (lift_size[i1] >= (double) block_length/Kb)
|
||||
@@ -160,12 +177,17 @@ int test_ldpc(short No_iteration,
|
||||
}
|
||||
}
|
||||
|
||||
printf("ldpc_test: block_length %d, BG %d, Zc %d, Kb %d\n",block_length,BG, Zc, Kb);
|
||||
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*(1/((float)nom_rate/(float)denom_rate)))/Zc;
|
||||
if (BG==1)
|
||||
N=66*Zc;
|
||||
else if (BG==2)
|
||||
N=50*Zc;
|
||||
|
||||
printf("ldpc_test: block_length %d, BG %d, Zc %d, Kb %d, N %d\n",block_length,BG, Zc, Kb, N);
|
||||
//no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*(1/((float)nom_rate/(float)denom_rate)))/Zc;
|
||||
// printf("puncture:%d\n",no_punctured_columns);
|
||||
removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(int)(block_length/((float)nom_rate/(float)denom_rate));
|
||||
//removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(int)(block_length/((float)nom_rate/(float)denom_rate));
|
||||
if (ntrials==0)
|
||||
ldpc_encoder_orig(test_input[0],channel_input[0], block_length, nom_rate, denom_rate, 1);
|
||||
ldpc_encoder_orig(test_input[0],channel_input[0], block_length, BG, 1);
|
||||
|
||||
for (trial=0; trial < ntrials; trial++)
|
||||
{
|
||||
@@ -173,20 +195,20 @@ int test_ldpc(short No_iteration,
|
||||
//// encoder
|
||||
start_meas(&time);
|
||||
for(j=0;j<n_segments;j++) {
|
||||
ldpc_encoder_orig(test_input[j], channel_input[j],block_length,nom_rate,denom_rate,0);
|
||||
ldpc_encoder_orig(test_input[j], channel_input[j],block_length,BG,0);
|
||||
}
|
||||
stop_meas(&time);
|
||||
|
||||
start_meas(&time_optim);
|
||||
ldpc_encoder_optim_8seg(test_input,channel_input_optim,block_length,nom_rate,denom_rate,n_segments,&tinput,&tprep,&tparity,&toutput);
|
||||
ldpc_encoder_optim_8seg(test_input,channel_input_optim,block_length,BG,n_segments,&tinput,&tprep,&tparity,&toutput);
|
||||
/*for(j=0;j<n_segments;j++) {
|
||||
ldpc_encoder_optim(test_input[j],channel_input_optim[j],block_length,nom_rate,denom_rate,&tinput,&tprep,&tparity,&toutput);
|
||||
ldpc_encoder_optim(test_input[j],channel_input_optim[j],block_length,BG,&tinput,&tprep,&tparity,&toutput);
|
||||
}*/
|
||||
stop_meas(&time_optim);
|
||||
|
||||
if (ntrials==1)
|
||||
for (j=0;j<n_segments;j++)
|
||||
for (i = 0; i < block_length+(nrows-no_punctured_columns) * Zc - removed_bit; i++)
|
||||
for (i = 0; i < 3*block_length; i++)
|
||||
if (channel_input[j][i]!=channel_input_optim[j][i]) {
|
||||
printf("differ in seg %d pos %d (%d,%d)\n",j,i,channel_input[j][i],channel_input_optim[j][i]);
|
||||
return (-1);
|
||||
@@ -198,10 +220,7 @@ int test_ldpc(short No_iteration,
|
||||
//printf("channel_input[%d]=%d\n",i,channel_input[i]);
|
||||
//printf("%d ",channel_input[i]);
|
||||
|
||||
//if ((BG==2) && (Zc==128||Zc==256))
|
||||
if (0)
|
||||
{
|
||||
for (i = 2*Zc; i < (Kb+nrows-no_punctured_columns) * Zc-removed_bit; i++)
|
||||
for (i = 2*Zc; i < 3*block_length; i++)
|
||||
{
|
||||
#ifdef DEBUG_CODER
|
||||
if ((i&0xf)==0)
|
||||
@@ -209,25 +228,26 @@ int test_ldpc(short No_iteration,
|
||||
#endif
|
||||
|
||||
if (channel_input[0][i-2*Zc]==0)
|
||||
modulated_input[i]=1/sqrt(2); //QPSK
|
||||
modulated_input[i]=1/sqrt(2); //BPSK
|
||||
else
|
||||
modulated_input[i]=-1/sqrt(2);
|
||||
|
||||
channel_output[i] = modulated_input[i] + gaussdouble(0.0,1.0) * 1/sqrt(2*SNR);
|
||||
channel_output_fixed[i] = (char) ((channel_output[i]*128)<0?(channel_output[i]*128-0.5):(channel_output[i]*128+0.5)); //fixed point 9-7
|
||||
//printf("llr[%d]=%d\n",i,channel_output_fixed[i]);
|
||||
if (channel_output[i]>1.0)
|
||||
channel_output_fixed[i]=127;
|
||||
else if (channel_output[i]<-1.0)
|
||||
channel_output_fixed[i]=-128;
|
||||
else
|
||||
channel_output_fixed[i] = (char) ((channel_output[i]*128)<0?(channel_output[i]*128-0.5):(channel_output[i]*128+0.5)); //fixed point 9-7
|
||||
//printf("llr[%d]=%d (%f)\n",i,channel_output_fixed[i],channel_output[i]);
|
||||
}
|
||||
|
||||
//for (i=(Kb+nrows) * Zc-5;i<(Kb+nrows) * Zc;i++)
|
||||
//{
|
||||
// printf("channel_input[%d]=%d\n",i,channel_input[i]);
|
||||
//printf("%lf %d\n",channel_output[i], channel_output_fixed[i]);
|
||||
//printf("v[%d]=%lf\n",i,modulated_input[i]);}
|
||||
#ifdef DEBUG_CODER
|
||||
printf("\n");
|
||||
exit(-1);
|
||||
#endif
|
||||
|
||||
/*
|
||||
the LDPC decoder supports several rates and the input has to be adapted accordingly (by padding with zeros to the next lower supported rate). Moreover, the first 2*Z LLRs are zero (since they are punctured and not transmitted) then you have the LLRs corresponding to the systematic bits. After that come the filler bits, the encoder uses 0 for the filler bits hence for the decoder you need to put 127 (max LLR for bit 0) at their place. Then come the LLRs corresponding to the punctured bits followed by zeros to pad for the supported decoder rate.
|
||||
*/
|
||||
for (i=0;i<2*Zc;i++)
|
||||
channel_output_fixed[i] = 0;
|
||||
|
||||
decParams.BG=BG;
|
||||
decParams.Z=Zc;
|
||||
decParams.R=13;
|
||||
@@ -236,9 +256,9 @@ int test_ldpc(short No_iteration,
|
||||
|
||||
// decode the sequence
|
||||
// decoder supports BG2, Z=128 & 256
|
||||
//esimated_output=ldpc_decoder(channel_output_fixed, block_length, No_iteration, (double)((float)nom_rate/(float)denom_rate));
|
||||
//estimated_output=ldpc_decoder(channel_output_fixed, block_length, No_iteration, (double)((float)nom_rate/(float)denom_rate));
|
||||
|
||||
nrLDPC_decoder(&decParams, channel_output_fixed, estimated_output, NULL);
|
||||
n_iter = nrLDPC_decoder(&decParams, (int8_t*) channel_output_fixed, (int8_t*) estimated_output, NULL);
|
||||
|
||||
//for (i=(Kb+nrows) * Zc-5;i<(Kb+nrows) * Zc;i++)
|
||||
// printf("esimated_output[%d]=%d\n",i,esimated_output[i]);
|
||||
@@ -248,15 +268,12 @@ int test_ldpc(short No_iteration,
|
||||
{
|
||||
if (estimated_output[i] != test_input[0][i])
|
||||
{
|
||||
//printf("error pos %d (%d, %d)\n",i,estimated_output[i],test_input[i]);
|
||||
printf("error pos %d (%d, %d)\n",i,estimated_output[i],test_input[0][i]);
|
||||
*errors = (*errors) + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/*else if (trial==0)
|
||||
printf("decoder is not supported\n");*/
|
||||
}
|
||||
|
||||
for(j=0;j<MAX_NUM_DLSCH_SEGMENTS;j++) {
|
||||
@@ -284,8 +301,8 @@ int main(int argc, char *argv[])
|
||||
short block_length=576; // decoder supports length: 1201 -> 1280, 2401 -> 2560
|
||||
short No_iteration=25;
|
||||
//double rate=0.333;
|
||||
int nom_rate=1;
|
||||
int denom_rate=3;
|
||||
//int nom_rate=1;
|
||||
//int denom_rate=3;
|
||||
double SNR0=-2.0,SNR,SNR_lin;
|
||||
unsigned char qbits=4;
|
||||
unsigned int decoded_errors[100]; // initiate the size of matrix equivalent to size of SNR
|
||||
@@ -295,21 +312,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
randominit(0);
|
||||
|
||||
while ((c = getopt (argc, argv, "q:r:s:l:n:d:")) != -1)
|
||||
while ((c = getopt (argc, argv, "q:s:l:n:h")) != -1)
|
||||
switch (c)
|
||||
{
|
||||
case 'q':
|
||||
qbits = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
nom_rate = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
denom_rate = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
block_length = atoi(optarg);
|
||||
break;
|
||||
@@ -323,21 +332,25 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
case 'h':
|
||||
printf("usage ldpctest -h -l blocklength -n n_trials -s SNR\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
printf("the decoder supports BG2, Kb=10, Z=128 & 256\n");
|
||||
printf(" range of blocklength: 1201 -> 1280, 2401 -> 2560\n");
|
||||
//printf("the decoder supports BG2, Kb=10, Z=128 & 256\n");
|
||||
//printf(" range of blocklength: 1201 -> 1280, 2401 -> 2560\n");
|
||||
//printf("rate: %d/%d\n",nom_rate,denom_rate);
|
||||
printf("block length %d: \n", block_length);
|
||||
printf("rate: %d/%d\n",nom_rate,denom_rate);
|
||||
printf("n_trials %d: \n", n_trials);
|
||||
printf("SNR0 %f: \n", SNR0);
|
||||
|
||||
//for (block_length=8;block_length<=MAX_BLOCK_LENGTH;block_length+=8)
|
||||
for (SNR=SNR0;SNR<SNR0+1.0;SNR+=1.0)
|
||||
{
|
||||
SNR_lin = pow(10,SNR/10);
|
||||
decoded_errors[i]=test_ldpc(No_iteration,
|
||||
nom_rate,
|
||||
denom_rate,
|
||||
//nom_rate,
|
||||
//denom_rate,
|
||||
SNR_lin, // noise standard deviation
|
||||
qbits,
|
||||
block_length, // block length bytes
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
|
||||
#include "UTIL/LOG/log.h"
|
||||
|
||||
//#include "PHY/CODING/lte_interleaver.h"
|
||||
//#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "ARCH/CBMIMO1/DEVICE_DRIVER/vars.h"
|
||||
#include "MAC_INTERFACE/vars.h"
|
||||
#include "PHY/CODING/defs.h"
|
||||
//#include "PHY/CODING/lte_interleaver.h"
|
||||
//#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
|
||||
|
||||
@@ -52,8 +51,6 @@ void lte_param_init(unsigned char N_tx, unsigned char N_rx)
|
||||
randominit(0);
|
||||
set_taus_seed(0);
|
||||
|
||||
crcTableInit();
|
||||
|
||||
lte_frame_parms = &(PHY_config->lte_frame_parms); //openair1/PHY/impl_defs_lte.h
|
||||
lte_ue_common_vars = &(PHY_vars->lte_ue_common_vars);
|
||||
lte_ue_dlsch_vars = &(PHY_vars->lte_ue_dlsch_vars);
|
||||
@@ -249,7 +246,6 @@ int main(int argc, char *argv[])
|
||||
randominit(0);
|
||||
set_taus_seed(0);
|
||||
|
||||
crcTableInit();
|
||||
ccodelte_init();
|
||||
ccodelte_init_inv();
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
#include "SIMULATION/TOOLS/sim.h"
|
||||
|
||||
#define DEBUG_DCI_POLAR_PARAMS
|
||||
//#define DEBUG_DCI_POLAR_PARAMS
|
||||
//#define DEBUG_POLAR_TIMING
|
||||
//#define DEBUG_CRC
|
||||
|
||||
@@ -18,13 +18,17 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
//Initiate timing. (Results depend on CPU Frequency. Therefore, might change due to performance variances during simulation.)
|
||||
time_stats_t timeEncoder,timeDecoder;
|
||||
time_stats_t polar_decoder_init,polar_rate_matching,decoding,bit_extraction,deinterleaving;
|
||||
time_stats_t path_metric,sorting,update_LLR;
|
||||
opp_enabled=1;
|
||||
int decoder_int16=0;
|
||||
int generate_optim_code=0;
|
||||
cpu_freq_GHz = get_cpu_freq_GHz();
|
||||
reset_meas(&timeEncoder);
|
||||
reset_meas(&timeDecoder);
|
||||
|
||||
randominit(0);
|
||||
crcTableInit();
|
||||
|
||||
//Default simulation values (Aim for iterations = 1000000.)
|
||||
int itr, iterations = 1000, arguments, polarMessageType = 0; //0=PBCH, 1=DCI, -1=UCI
|
||||
double SNRstart = -20.0, SNRstop = 0.0, SNRinc= 0.5; //dB
|
||||
@@ -36,7 +40,7 @@ int main(int argc, char *argv[]) {
|
||||
double timeEncoderCumulative = 0, timeDecoderCumulative = 0;
|
||||
uint8_t aggregation_level = 8, decoderListSize = 8, pathMetricAppr = 0;
|
||||
|
||||
while ((arguments = getopt (argc, argv, "s:d:f:m:i:l:a:")) != -1)
|
||||
while ((arguments = getopt (argc, argv, "s:d:f:m:i:l:a:hqg")) != -1)
|
||||
switch (arguments)
|
||||
{
|
||||
case 's':
|
||||
@@ -67,9 +71,25 @@ int main(int argc, char *argv[]) {
|
||||
pathMetricAppr = (uint8_t) atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
decoder_int16=1;
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
generate_optim_code=1;
|
||||
iterations=1;
|
||||
SNRstart=-6.0;
|
||||
SNRstop =-6.0;
|
||||
decoder_int16=1;
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
printf("./polartest -s SNRstart -d SNRinc -f SNRstop -m [0=PBCH|1=DCI|2=UCI] -i iterations -l decoderListSize -a pathMetricAppr -q (use fixed point decoder)\n");
|
||||
exit(-1);
|
||||
|
||||
default:
|
||||
perror("[polartest.c] Problem at argument parsing with getopt");
|
||||
abort ();
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (polarMessageType == 0) { //PBCH
|
||||
@@ -84,15 +104,19 @@ int main(int argc, char *argv[]) {
|
||||
//testLength = ;
|
||||
//coderLength = ;
|
||||
}
|
||||
|
||||
|
||||
//Logging
|
||||
time_t currentTime;
|
||||
time (¤tTime);
|
||||
char *folderName, fileName[512], currentTimeInfo[25];
|
||||
char fileName[512], currentTimeInfo[25];
|
||||
char folderName[] = ".";
|
||||
|
||||
/*
|
||||
folderName=getenv("HOME");
|
||||
strcat(folderName,"/Desktop/polartestResults");
|
||||
|
||||
*/
|
||||
|
||||
#ifdef DEBUG_POLAR_TIMING
|
||||
sprintf(fileName,"%s/TIMING_ListSize_%d_pmAppr_%d_Payload_%d_Itr_%d",folderName,decoderListSize,pathMetricAppr,testLength,iterations);
|
||||
#else
|
||||
@@ -102,15 +126,17 @@ int main(int argc, char *argv[]) {
|
||||
strcat(fileName,currentTimeInfo);
|
||||
|
||||
//Create "~/Desktop/polartestResults" folder if it doesn't already exist.
|
||||
/*
|
||||
struct stat folder = {0};
|
||||
if (stat(folderName, &folder) == -1) mkdir(folderName, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
|
||||
*/
|
||||
|
||||
FILE* logFile;
|
||||
logFile = fopen(fileName, "w");
|
||||
if (logFile==NULL) {
|
||||
fprintf(stderr,"[polartest.c] Problem creating file %s with fopen\n",fileName);
|
||||
exit(-1);
|
||||
}
|
||||
logFile = fopen(fileName, "w");
|
||||
if (logFile==NULL) {
|
||||
fprintf(stderr,"[polartest.c] Problem creating file %s with fopen\n",fileName);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_POLAR_TIMING
|
||||
fprintf(logFile,",timeEncoderCRCByte[us],timeEncoderCRCBit[us],timeEncoderInterleaver[us],timeEncoderBitInsertion[us],timeEncoder1[us],timeEncoder2[us],timeEncoderRateMatching[us],timeEncoderByte2Bit[us]\n");
|
||||
@@ -131,7 +157,9 @@ int main(int argc, char *argv[]) {
|
||||
uint8_t *encoderOutputByte = malloc(sizeof(uint8_t) * coderLength);
|
||||
double *modulatedInput = malloc (sizeof(double) * coderLength); //channel input
|
||||
double *channelOutput = malloc (sizeof(double) * coderLength); //add noise
|
||||
|
||||
int16_t *channelOutput_int16;
|
||||
if (decoder_int16 == 1) channelOutput_int16 = (int16_t*)malloc (sizeof(int16_t) * coderLength);
|
||||
|
||||
t_nrPolar_paramsPtr nrPolar_params = NULL, currentPtr = NULL;
|
||||
nr_polar_init(&nrPolar_params, polarMessageType, testLength, aggregation_level);
|
||||
currentPtr = nr_polar_params(nrPolar_params, polarMessageType, testLength, aggregation_level);
|
||||
@@ -280,6 +308,7 @@ int main(int argc, char *argv[]) {
|
||||
for (int i=0; i<currentPtr->payloadBits; i++) aPrioriArray[i] = NAN;
|
||||
|
||||
for (SNR = SNRstart; SNR <= SNRstop; SNR += SNRinc) {
|
||||
printf("SNR %f\n",SNR);
|
||||
SNR_lin = pow(10, SNR/10);
|
||||
for (itr = 1; itr <= iterations; itr++) {
|
||||
|
||||
@@ -313,6 +342,15 @@ int main(int argc, char *argv[]) {
|
||||
modulatedInput[i]=(-1)/sqrt(2);
|
||||
|
||||
channelOutput[i] = modulatedInput[i] + (gaussdouble(0.0,1.0) * (1/sqrt(2*SNR_lin)));
|
||||
|
||||
|
||||
if (decoder_int16==1) {
|
||||
if (channelOutput[i] > 15) channelOutput_int16[i] = 127;
|
||||
else if (channelOutput[i] < -16) channelOutput_int16[i] = -128;
|
||||
else channelOutput_int16[i] = (int16_t) (8*channelOutput[i]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
start_meas(&timeDecoder);
|
||||
@@ -322,12 +360,19 @@ int main(int argc, char *argv[]) {
|
||||
NR_POLAR_DECODER_LISTSIZE,
|
||||
aPrioriArray,
|
||||
NR_POLAR_DECODER_PATH_METRIC_APPROXIMATION);*/
|
||||
decoderState = polar_decoder_aPriori(channelOutput,
|
||||
estimatedOutput,
|
||||
currentPtr,
|
||||
NR_POLAR_DECODER_LISTSIZE,
|
||||
NR_POLAR_DECODER_PATH_METRIC_APPROXIMATION,
|
||||
aPrioriArray);
|
||||
if (decoder_int16==0)
|
||||
decoderState = polar_decoder_aPriori(channelOutput,
|
||||
estimatedOutput,
|
||||
currentPtr,
|
||||
NR_POLAR_DECODER_LISTSIZE,
|
||||
NR_POLAR_DECODER_PATH_METRIC_APPROXIMATION,
|
||||
aPrioriArray);
|
||||
else
|
||||
decoderState = polar_decoder_int16(channelOutput_int16,
|
||||
estimatedOutput,
|
||||
currentPtr);
|
||||
|
||||
|
||||
stop_meas(&timeDecoder);
|
||||
/*printf("testInput: [0]->0x%08x\n", testInput[0]);
|
||||
printf("estimatedOutput: [0]->0x%08x\n", estimatedOutput[0]);*/
|
||||
@@ -372,6 +417,9 @@ int main(int argc, char *argv[]) {
|
||||
((double)bitErrorCumulative / (iterations*testLength)),
|
||||
(timeEncoderCumulative/iterations),timeDecoderCumulative/iterations);
|
||||
|
||||
if (blockErrorCumulative==0 && bitErrorCumulative==0)
|
||||
break;
|
||||
|
||||
blockErrorCumulative = 0; bitErrorCumulative = 0;
|
||||
timeEncoderCumulative = 0; timeDecoderCumulative = 0;
|
||||
}
|
||||
|
||||
@@ -218,8 +218,6 @@ int main(int argc, char *argv[])
|
||||
randominit();
|
||||
set_taus_seed();
|
||||
|
||||
crcTableInit();
|
||||
|
||||
printf("EbN0, sigma, BER, FER\n");
|
||||
|
||||
for (SNR=0; SNR<10; SNR++) {
|
||||
|
||||
@@ -28,8 +28,7 @@
|
||||
#define __CODING_DEFS__H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "PHY/defs_common.h"
|
||||
#include <PHY/defs_common.h>
|
||||
|
||||
#define CRC24_A 0
|
||||
#define CRC24_B 1
|
||||
@@ -39,7 +38,24 @@
|
||||
#define MAX_TURBO_ITERATIONS_MBSFN 8
|
||||
#define MAX_TURBO_ITERATIONS max_turbo_iterations
|
||||
|
||||
typedef struct {
|
||||
unsigned short nb_bits;
|
||||
unsigned short f1;
|
||||
unsigned short f2;
|
||||
} interleaver_TS_36_212_t;
|
||||
|
||||
extern const interleaver_TS_36_212_t f1f2[188];
|
||||
|
||||
#define LTE_NULL 2
|
||||
typedef struct interleaver_codebook {
|
||||
unsigned long nb_bits;
|
||||
unsigned short f1;
|
||||
unsigned short f2;
|
||||
unsigned int beg_index;
|
||||
} t_interleaver_codebook;
|
||||
extern t_interleaver_codebook *f1f2mat;
|
||||
extern short *il_tb;
|
||||
|
||||
|
||||
/** @addtogroup _PHY_CODING_BLOCKS_
|
||||
* @{
|
||||
@@ -321,7 +337,7 @@ void ccodedab_init_inv(void);
|
||||
|
||||
/*!\fn void crcTableInit(void)
|
||||
\brief This function initializes the different crc tables.*/
|
||||
void crcTableInit (void);
|
||||
//void crcTableInit (void);
|
||||
|
||||
|
||||
|
||||
@@ -331,7 +347,7 @@ based on 3GPP UMTS/LTE specifications.
|
||||
@param inPtr Pointer to input byte stream
|
||||
@param bitlen length of inputs in bits
|
||||
*/
|
||||
uint32_t crc24a (uint8_t *inPtr, int32_t bitlen);
|
||||
unsigned int crc24a (unsigned char * inptr, int bitlen);
|
||||
|
||||
/*!\fn uint32_t crc24b(uint8_t *inPtr, int32_t bitlen)
|
||||
\brief This computes a 24-bit crc ('b' variant for transport-block segments)
|
||||
@@ -353,20 +369,20 @@ uint32_t crc24c (uint8_t *inPtr, int32_t bitlen);
|
||||
\brief This computes a 16-bit crc based on 3GPP UMTS specifications.
|
||||
@param inPtr Pointer to input byte stream
|
||||
@param bitlen length of inputs in bits*/
|
||||
uint32_t crc16 (uint8_t *inPtr, int32_t bitlen);
|
||||
unsigned int crc16 (unsigned char * inptr, int bitlen);
|
||||
|
||||
/*!\fn uint32_t crc12(uint8_t *inPtr, int32_t bitlen)
|
||||
\brief This computes a 12-bit crc based on 3GPP UMTS specifications.
|
||||
@param inPtr Pointer to input byte stream
|
||||
@param bitlen length of inputs in bits*/
|
||||
uint32_t crc12 (uint8_t *inPtr, int32_t bitlen);
|
||||
unsigned int crc12 (unsigned char * inptr, int bitlen);
|
||||
|
||||
/*!\fn uint32_t crc8(uint8_t *inPtr, int32_t bitlen)
|
||||
\brief This computes a 8-bit crc based on 3GPP UMTS specifications.
|
||||
@param inPtr Pointer to input byte stream
|
||||
@param bitlen length of inputs in bits*/
|
||||
uint32_t crc8 (uint8_t *inPtr, int32_t bitlen);
|
||||
|
||||
unsigned int crc8 (unsigned char * inptr, int bitlen);
|
||||
|
||||
/*!\fn void phy_viterbi_dot11_sse2(int8_t *y, uint8_t *decoded_bytes, uint16_t n,int offset,int traceback)
|
||||
\brief This routine performs a SIMD optmized Viterbi decoder for the 802.11 64-state convolutional code. It can be
|
||||
run in segments with final trace back after last segment.
|
||||
@@ -423,13 +439,15 @@ int32_t rate_matching_lte(uint32_t N_coded,
|
||||
|
||||
|
||||
|
||||
uint32_t crcbit (uint8_t * ,
|
||||
int32_t,
|
||||
uint32_t);
|
||||
unsigned int crcbit (unsigned char * inputptr, int octetlen, unsigned int poly);
|
||||
|
||||
int16_t reverseBits(int32_t ,int32_t);
|
||||
void phy_viterbi_dot11(int8_t *,uint8_t *,uint16_t);
|
||||
|
||||
decoder_if_t phy_threegpplte_turbo_decoder;
|
||||
decoder_if_t phy_threegpplte_turbo_decoder8;
|
||||
decoder_if_t phy_threegpplte_turbo_decoder16;
|
||||
|
||||
int32_t nr_segmentation(unsigned char *input_buffer,
|
||||
unsigned char **output_buffers,
|
||||
unsigned int B,
|
||||
|
||||
@@ -19,10 +19,9 @@
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
extern unsigned short f1f2mat_old[2*188];
|
||||
extern double cpuf;
|
||||
extern decoder_if_t decoder16;
|
||||
extern decoder_if_t decoder8;
|
||||
extern encoder_if_t encoder;
|
||||
extern decoder_if_t *decoder16;
|
||||
extern decoder_if_t *decoder8;
|
||||
extern encoder_if_t *encoder;
|
||||
extern int load_codinglib(void);
|
||||
extern int free_codinglib(void);
|
||||
extern void free_codinglib(void);
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#include "PHY/defs_common.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "PHY/CODING/coding_extern.h"
|
||||
#include "common/utils/load_module_shlib.h"
|
||||
#include "common/utils/telnetsrv/telnetsrv.h"
|
||||
|
||||
@@ -55,28 +56,26 @@ loader_shlibfunc_t shlib_fdesc[DECODE_NUM_FPTR];
|
||||
|
||||
/* encoding decoding functions pointers, filled here and used when encoding/decoding */
|
||||
/*defined as extern in PHY?CODING/extern.h */
|
||||
decoder_if_t decoder16;
|
||||
decoder_if_t decoder8;
|
||||
encoder_if_t encoder;
|
||||
decoder_if_t *decoder16;
|
||||
decoder_if_t *decoder8;
|
||||
encoder_if_t *encoder;
|
||||
|
||||
extern int _may_i_use_cpu_feature(unsigned __int64);
|
||||
uint8_t nodecod(short *y,
|
||||
short *y2,
|
||||
unsigned char *decoded_bytes,
|
||||
unsigned char *decoded_bytes2,
|
||||
unsigned short n,
|
||||
unsigned short f1,
|
||||
unsigned short f2,
|
||||
unsigned char max_iterations,
|
||||
unsigned char crc_type,
|
||||
unsigned char F,
|
||||
time_stats_t *init_stats,
|
||||
time_stats_t *alpha_stats,
|
||||
time_stats_t *beta_stats,
|
||||
time_stats_t *gamma_stats,
|
||||
time_stats_t *ext_stats,
|
||||
time_stats_t *intl1_stats,
|
||||
time_stats_t *intl2_stats)
|
||||
uint8_t nodecod(int16_t *y,
|
||||
int16_t *y2,
|
||||
uint8_t *decoded_bytes,
|
||||
uint8_t *decoded_bytes2,
|
||||
uint16_t n,
|
||||
uint8_t max_iterations,
|
||||
uint8_t crc_type,
|
||||
uint8_t F,
|
||||
time_stats_t *init_stats,
|
||||
time_stats_t *alpha_stats,
|
||||
time_stats_t *beta_stats,
|
||||
time_stats_t *gamma_stats,
|
||||
time_stats_t *ext_stats,
|
||||
time_stats_t *intl1_stats,
|
||||
time_stats_t *intl2_stats)
|
||||
{
|
||||
return max_iterations+1;
|
||||
};
|
||||
@@ -86,24 +85,24 @@ void decoding_setmode (int mode) {
|
||||
case MODE_DECODE_NONE:
|
||||
decoder8=nodecod;
|
||||
decoder16=nodecod;
|
||||
encoder=(encoder_if_t)shlib_fdesc[ENCODE_C_FPTRIDX].fptr;
|
||||
encoder=(encoder_if_t*)shlib_fdesc[ENCODE_C_FPTRIDX].fptr;
|
||||
break;
|
||||
case MODE_DECODE_C:
|
||||
decoder16=(decoder_if_t)shlib_fdesc[DECODE_TD_C_FPTRIDX].fptr;
|
||||
decoder8=(decoder_if_t)shlib_fdesc[DECODE_TD_C_FPTRIDX].fptr;
|
||||
encoder=(encoder_if_t)shlib_fdesc[ENCODE_C_FPTRIDX].fptr;
|
||||
decoder16=(decoder_if_t*)shlib_fdesc[DECODE_TD_C_FPTRIDX].fptr;
|
||||
decoder8=(decoder_if_t*)shlib_fdesc[DECODE_TD_C_FPTRIDX].fptr;
|
||||
encoder=(encoder_if_t*)shlib_fdesc[ENCODE_C_FPTRIDX].fptr;
|
||||
break;
|
||||
case MODE_DECODE_AVX2:
|
||||
decoder16=(decoder_if_t)shlib_fdesc[DECODE_TD16_AVX2_FPTRIDX].fptr;
|
||||
decoder8=(decoder_if_t)shlib_fdesc[DECODE_TD8_SSE_FPTRIDX].fptr;
|
||||
encoder=(encoder_if_t)shlib_fdesc[ENCODE_SSE_FPTRIDX].fptr;
|
||||
decoder16=(decoder_if_t*)shlib_fdesc[DECODE_TD16_AVX2_FPTRIDX].fptr;
|
||||
decoder8=(decoder_if_t*)shlib_fdesc[DECODE_TD8_SSE_FPTRIDX].fptr;
|
||||
encoder=(encoder_if_t*)shlib_fdesc[ENCODE_SSE_FPTRIDX].fptr;
|
||||
break;
|
||||
default:
|
||||
mode=MODE_DECODE_SSE;
|
||||
case MODE_DECODE_SSE:
|
||||
decoder8=(decoder_if_t)shlib_fdesc[DECODE_TD8_SSE_FPTRIDX].fptr;
|
||||
decoder16=(decoder_if_t)shlib_fdesc[DECODE_TD16_SSE_FPTRIDX].fptr;
|
||||
encoder=(encoder_if_t)shlib_fdesc[ENCODE_SSE_FPTRIDX].fptr;
|
||||
decoder8=(decoder_if_t*)shlib_fdesc[DECODE_TD8_SSE_FPTRIDX].fptr;
|
||||
decoder16=(decoder_if_t*)shlib_fdesc[DECODE_TD16_SSE_FPTRIDX].fptr;
|
||||
encoder=(encoder_if_t*)shlib_fdesc[ENCODE_SSE_FPTRIDX].fptr;
|
||||
break;
|
||||
}
|
||||
curmode=mode;
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
|
||||
#include "coding_defs.h"
|
||||
|
||||
|
||||
/*ref 36-212 v8.6.0 , pp 8-9 */
|
||||
/* the highest degree is set by default */
|
||||
unsigned int poly24a = 0x864cfb00; // 1000 0110 0100 1100 1111 1011
|
||||
@@ -45,6 +44,9 @@ unsigned int poly24c = 0xb2b11700; // 1011 0010 1011 0001 0001 011
|
||||
unsigned int poly16 = 0x10210000; // 0001 0000 0010 0001 D^16 + D^12 + D^5 + 1
|
||||
unsigned int poly12 = 0x80F00000; // 1000 0000 1111 D^12 + D^11 + D^3 + D^2 + D + 1
|
||||
unsigned int poly8 = 0x9B000000; // 1001 1011 D^8 + D^7 + D^4 + D^3 + D + 1
|
||||
uint32_t poly6 = 0x84000000; // 10000100000... -> D^6+D^5+1
|
||||
uint32_t poly11 = 0xc4200000; //11000100001000... -> D^11+D^10+D^9+D^5+1
|
||||
|
||||
/*********************************************************
|
||||
|
||||
For initialization && verification purposes,
|
||||
@@ -100,6 +102,18 @@ void crcTableInit (void)
|
||||
crc8Table[c] = (unsigned char) (crcbit (&c, 1, poly8) >> 24);
|
||||
} while (++c);
|
||||
}
|
||||
|
||||
//Generic version
|
||||
void crcTable256Init (uint32_t poly, uint32_t* crc256Table)
|
||||
{
|
||||
unsigned char c = 0;
|
||||
|
||||
do {
|
||||
crc256Table[c] = crcbit(&c, 1, poly);
|
||||
} while (++c);
|
||||
|
||||
}
|
||||
|
||||
/*********************************************************
|
||||
|
||||
Byte by byte implementations,
|
||||
@@ -221,6 +235,28 @@ crc8 (unsigned char * inptr, int bitlen)
|
||||
return crc;
|
||||
}
|
||||
|
||||
//Generic version
|
||||
unsigned int crcPayload(unsigned char * inptr, int bitlen, uint32_t* crc256Table)
|
||||
{
|
||||
int octetlen, resbit;
|
||||
unsigned int crc = 0;
|
||||
octetlen = bitlen/8; // Change in bytes
|
||||
resbit = (bitlen % 8);
|
||||
|
||||
while (octetlen-- > 0)
|
||||
{
|
||||
crc = (crc << 8) ^ crc256Table[(*inptr++) ^ (crc >> 24)];
|
||||
}
|
||||
|
||||
if (resbit > 0)
|
||||
{
|
||||
crc = (crc << resbit) ^ crc256Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))];
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef DEBUG_CRC
|
||||
/*******************************************************************/
|
||||
/**
|
||||
@@ -240,3 +276,4 @@ main()
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,210 +0,0 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
unsigned short f1f2mat_old[2*188] = {3, 10,
|
||||
7, 12,
|
||||
19, 42,
|
||||
7, 16,
|
||||
7, 18,
|
||||
11, 20,
|
||||
5, 22,
|
||||
11, 24,
|
||||
7, 26,
|
||||
41, 84,
|
||||
103, 90,
|
||||
15, 32,
|
||||
9, 34,
|
||||
17, 108,
|
||||
9, 38,
|
||||
21, 120,
|
||||
101, 84,
|
||||
21, 44,
|
||||
57, 46,
|
||||
23, 48,
|
||||
13, 50,
|
||||
27, 52,
|
||||
11, 36,
|
||||
27, 56,
|
||||
85, 58,
|
||||
29, 60,
|
||||
33, 62,
|
||||
15, 32,
|
||||
17, 198,
|
||||
33, 68,
|
||||
103, 210,
|
||||
19, 36,
|
||||
19, 74,
|
||||
37, 76,
|
||||
19, 78,
|
||||
21, 120,
|
||||
21, 82,
|
||||
115, 84,
|
||||
193, 86,
|
||||
21, 44,
|
||||
133, 90,
|
||||
81, 46,
|
||||
45, 94,
|
||||
23, 48,
|
||||
243, 98,
|
||||
151, 40,
|
||||
155, 102,
|
||||
25, 52,
|
||||
51, 106,
|
||||
47, 72,
|
||||
91, 110,
|
||||
29, 168,
|
||||
29, 114,
|
||||
247, 58,
|
||||
29, 118,
|
||||
89, 180,
|
||||
91, 122,
|
||||
157, 62,
|
||||
55, 84,
|
||||
31, 64,
|
||||
17, 66,
|
||||
35, 68,
|
||||
227, 420,
|
||||
65, 96,
|
||||
19, 74,
|
||||
37, 76,
|
||||
41, 234,
|
||||
39, 80,
|
||||
185, 82,
|
||||
43, 252,
|
||||
21, 86,
|
||||
155, 44,
|
||||
79, 120,
|
||||
139, 92,
|
||||
23, 94,
|
||||
217, 48,
|
||||
25, 98,
|
||||
17, 80,
|
||||
127, 102,
|
||||
25, 52,
|
||||
239, 106,
|
||||
17, 48,
|
||||
137, 110,
|
||||
215, 112,
|
||||
29, 114,
|
||||
15, 58,
|
||||
147, 118,
|
||||
29, 60,
|
||||
59, 122,
|
||||
65, 124,
|
||||
55, 84,
|
||||
31, 64,
|
||||
17, 66,
|
||||
171, 204,
|
||||
67, 140,
|
||||
35, 72,
|
||||
19, 74,
|
||||
39, 76,
|
||||
19, 78,
|
||||
199, 240,
|
||||
21, 82,
|
||||
211, 252,
|
||||
21, 86,
|
||||
43, 88,
|
||||
149, 60,
|
||||
45, 92,
|
||||
49, 846,
|
||||
71, 48,
|
||||
13, 28,
|
||||
17, 80,
|
||||
25, 102,
|
||||
183, 104,
|
||||
55, 954,
|
||||
127, 96,
|
||||
27, 110,
|
||||
29, 112,
|
||||
29, 114,
|
||||
57, 116,
|
||||
45, 354,
|
||||
31, 120,
|
||||
59, 610,
|
||||
185, 124,
|
||||
113, 420,
|
||||
31, 64,
|
||||
17, 66,
|
||||
171, 136,
|
||||
209, 420,
|
||||
253, 216,
|
||||
367, 444,
|
||||
265, 456,
|
||||
181, 468,
|
||||
39, 80,
|
||||
27, 164,
|
||||
127, 504,
|
||||
143, 172,
|
||||
43, 88,
|
||||
29, 300,
|
||||
45, 92,
|
||||
157, 188,
|
||||
47, 96,
|
||||
13, 28,
|
||||
111, 240,
|
||||
443, 204,
|
||||
51, 104,
|
||||
51, 212,
|
||||
451, 192,
|
||||
257, 220,
|
||||
57, 336,
|
||||
313, 228,
|
||||
271, 232,
|
||||
179, 236,
|
||||
331, 120,
|
||||
363, 244,
|
||||
375, 248,
|
||||
127, 168,
|
||||
31, 64,
|
||||
33, 130,
|
||||
43, 264,
|
||||
33, 134,
|
||||
477, 408,
|
||||
35, 138,
|
||||
233, 280,
|
||||
357, 142,
|
||||
337, 480,
|
||||
37, 146,
|
||||
71, 444,
|
||||
71, 120,
|
||||
37, 152,
|
||||
39, 462,
|
||||
127, 234,
|
||||
39, 158,
|
||||
39, 80,
|
||||
31, 96,
|
||||
113, 902,
|
||||
41, 166,
|
||||
251, 336,
|
||||
43, 170,
|
||||
21, 86,
|
||||
43, 174,
|
||||
45, 176,
|
||||
45, 178,
|
||||
161, 120,
|
||||
89, 182,
|
||||
323, 184,
|
||||
47, 186,
|
||||
23, 94,
|
||||
47, 190,
|
||||
263, 480
|
||||
};
|
||||
@@ -31,6 +31,18 @@
|
||||
|
||||
#include "PHY/TOOLS/time_meas.h"
|
||||
|
||||
/*ldpc_encoder.c*/
|
||||
int encode_parity_check_part_orig(unsigned char *c,unsigned char *d, short BG,short Zc,short Kb,short block_length);
|
||||
|
||||
/*ldpc_encoder2.c*/
|
||||
void encode_parity_check_part_optim(uint8_t *c,uint8_t *d, short BG,short Zc,short Kb);
|
||||
int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,short block_length,short BG,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput);
|
||||
int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_input,short block_length,short BG,int n_segments,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput);
|
||||
|
||||
/*ldpc_generate_coefficient.c*/
|
||||
int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,short block_length,short BG,unsigned char gen_code);
|
||||
|
||||
/*
|
||||
int encode_parity_check_part(unsigned char *c,unsigned char *d, short BG,short Zc,short Kb);
|
||||
int encode_parity_check_part_orig(unsigned char *c,unsigned char *d, short BG,short Zc,short Kb,short block_length);
|
||||
int ldpc_encoder(unsigned char *test_input,unsigned char *channel_input,short block_length, double rate);
|
||||
@@ -38,4 +50,4 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
|
||||
int ldpc_encoder_multi_segment(unsigned char **test_input,unsigned char **channel_input,short block_length,double rate,uint8_t n_segments);
|
||||
int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,short block_length,int nom_rate,int denom_rate,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput);
|
||||
int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_input,short block_length,int nom_rate,int denom_rate,int n_segments,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput);
|
||||
|
||||
*/
|
||||
|
||||
@@ -50,14 +50,14 @@ int encode_parity_check_part_orig(unsigned char *c,unsigned char *d, short BG,sh
|
||||
int i1,i2,i3,i4,i5,temp_prime;
|
||||
unsigned char channel_temp,temp;
|
||||
|
||||
//if (BG==1)
|
||||
if (BG==1)
|
||||
{
|
||||
no_shift_values=(short *) no_shift_values_BG1;
|
||||
pointer_shift_values=(short *) pointer_shift_values_BG1;
|
||||
nrows=46; //parity check bits
|
||||
ncols=22; //info bits
|
||||
}
|
||||
/*else if (BG==2)
|
||||
else if (BG==2)
|
||||
{
|
||||
no_shift_values=(short *) no_shift_values_BG2;
|
||||
pointer_shift_values=(short *) pointer_shift_values_BG2;
|
||||
@@ -68,7 +68,7 @@ int encode_parity_check_part_orig(unsigned char *c,unsigned char *d, short BG,sh
|
||||
printf("problem with BG\n");
|
||||
return(-1);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*3)/Zc;
|
||||
|
||||
|
||||
@@ -198,10 +198,10 @@ void encode_parity_check_part_optim(uint8_t *c,uint8_t *d, short BG,short Zc,sho
|
||||
}
|
||||
|
||||
|
||||
int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,short block_length,int nom_rate,int denom_rate,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput)
|
||||
int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,short block_length,short BG,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput)
|
||||
{
|
||||
|
||||
short BG,Zc,Kb,nrows,ncols;
|
||||
short Kb,Zc,nrows,ncols;
|
||||
int i,i1;
|
||||
int no_punctured_columns,removed_bit;
|
||||
|
||||
@@ -211,16 +211,14 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
|
||||
int simd_size;
|
||||
|
||||
//determine number of bits in codeword
|
||||
//if (block_length>3840)
|
||||
if (BG==1)
|
||||
{
|
||||
BG=1;
|
||||
Kb = 22;
|
||||
nrows=46; //parity check bits
|
||||
ncols=22; //info bits
|
||||
}
|
||||
/*else if (block_length<=3840)
|
||||
else if (BG==2)
|
||||
{
|
||||
BG=2;
|
||||
nrows=42; //parity check bits
|
||||
ncols=10; // info bits
|
||||
|
||||
@@ -232,7 +230,7 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
|
||||
Kb = 8;
|
||||
else
|
||||
Kb = 6;
|
||||
}*/
|
||||
}
|
||||
|
||||
//find minimum value in all sets of lifting size
|
||||
Zc=0;
|
||||
@@ -315,10 +313,10 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_input,short block_length,int nom_rate,int denom_rate,int n_segments,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput)
|
||||
int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_input,short block_length,short BG,int n_segments,time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput)
|
||||
{
|
||||
|
||||
short BG,Zc,Kb,nrows,ncols;
|
||||
short Kb,Zc,nrows,ncols;
|
||||
int i,i1,j;
|
||||
int no_punctured_columns,removed_bit;
|
||||
//Table of possible lifting sizes
|
||||
@@ -345,16 +343,14 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i
|
||||
AssertFatal(n_segments>0&&n_segments<=8,"0 < n_segments %d <= 8\n",n_segments);
|
||||
|
||||
//determine number of bits in codeword
|
||||
//if (block_length>3840)
|
||||
if (BG==1)
|
||||
{
|
||||
BG=1;
|
||||
Kb = 22;
|
||||
nrows=46; //parity check bits
|
||||
ncols=22; //info bits
|
||||
}
|
||||
/*else if (block_length<=3840)
|
||||
else if (BG==2)
|
||||
{
|
||||
BG=2;
|
||||
nrows=42; //parity check bits
|
||||
ncols=10; // info bits
|
||||
|
||||
@@ -366,7 +362,7 @@ int ldpc_encoder_optim_8seg(unsigned char **test_input,unsigned char **channel_i
|
||||
Kb = 8;
|
||||
else
|
||||
Kb = 6;
|
||||
}*/
|
||||
}
|
||||
|
||||
//find minimum value in all sets of lifting size
|
||||
Zc=0;
|
||||
|
||||
@@ -361,13 +361,13 @@ short *choose_generator_matrix(short BG,short Zc)
|
||||
return Gen_shift_values;
|
||||
}
|
||||
|
||||
int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,short block_length,int nom_rate,int denom_rate,unsigned char gen_code)
|
||||
int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,short block_length,short BG,unsigned char gen_code)
|
||||
{
|
||||
unsigned char c[22*384]; //padded input, unpacked, max size
|
||||
unsigned char d[68*384]; //coded output, unpacked, max size
|
||||
unsigned char channel_temp,temp;
|
||||
short *Gen_shift_values, *no_shift_values, *pointer_shift_values;
|
||||
short BG,Zc,Kb,nrows,ncols;
|
||||
short Zc,Kb,nrows,ncols;
|
||||
int i,i1,i2,i3,i4,i5,temp_prime,var;
|
||||
int no_punctured_columns,removed_bit;
|
||||
//Table of possible lifting sizes
|
||||
@@ -378,16 +378,14 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
|
||||
int indlist2[1000];
|
||||
|
||||
//determine number of bits in codeword
|
||||
//if (block_length>3840)
|
||||
if (BG==1)
|
||||
{
|
||||
BG=1;
|
||||
Kb = 22;
|
||||
nrows=46; //parity check bits
|
||||
ncols=22; //info bits
|
||||
}
|
||||
/*else if (block_length<=3840)
|
||||
else if (BG==2)
|
||||
{
|
||||
BG=2;
|
||||
nrows=42; //parity check bits
|
||||
ncols=10; // info bits
|
||||
|
||||
@@ -399,7 +397,7 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
|
||||
Kb = 8;
|
||||
else
|
||||
Kb = 6;
|
||||
}*/
|
||||
}
|
||||
|
||||
//find minimum value in all sets of lifting size
|
||||
Zc=0;
|
||||
@@ -417,6 +415,8 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
|
||||
return(-1);
|
||||
}
|
||||
|
||||
int K = ncols*Zc;
|
||||
|
||||
Gen_shift_values=choose_generator_matrix(BG,Zc);
|
||||
if (Gen_shift_values==NULL) {
|
||||
printf("ldpc_encoder_orig: could not find generator matrix\n");
|
||||
@@ -438,9 +438,15 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
|
||||
}
|
||||
|
||||
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*3)/Zc;
|
||||
//nrows - no_punctured_columns = 2 +2*block_length/Zc
|
||||
removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(block_length*3);
|
||||
// ((nrows-no_punctured_columns) * Zc-removed_bit) =
|
||||
// 2Zc + 2*block_length
|
||||
//printf("%d\n",no_punctured_columns);
|
||||
//printf("%d\n",removed_bit);
|
||||
//printf("%d\n",nrows-no_punctured_columns);
|
||||
//printf("%d\n",((nrows-no_punctured_columns) * Zc-removed_bit));
|
||||
|
||||
// unpack input
|
||||
memset(c,0,sizeof(unsigned char) * ncols * Zc);
|
||||
memset(d,0,sizeof(unsigned char) * nrows * Zc);
|
||||
@@ -608,8 +614,8 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,sho
|
||||
}
|
||||
|
||||
// information part and puncture columns
|
||||
memcpy(&channel_input[0], &c[2*Zc], (block_length-2*Zc)*sizeof(unsigned char));
|
||||
memcpy(&channel_input[block_length-2*Zc], &d[0], ((nrows-no_punctured_columns) * Zc-removed_bit)*sizeof(unsigned char));
|
||||
memcpy(&channel_input[0], &c[2*Zc], (block_length-2*Zc)*sizeof(unsigned char)); //systematic bits
|
||||
memcpy(&channel_input[block_length-2*Zc], &d[0], ((nrows-no_punctured_columns) * Zc-removed_bit)*sizeof(unsigned char)); //systematic bits 2Zc + 2*block_length
|
||||
//memcpy(channel_input,c,Kb*Zc*sizeof(unsigned char));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include "nrPolar_tools/nr_polar_defs.h"
|
||||
#include "nrPolar_tools/nr_polar_pbch_defs.h"
|
||||
#include "nrPolar_tools/nr_polar_uci_defs.h"
|
||||
|
||||
void nr_polar_init(t_nrPolar_params* polarParams, int messageType) {
|
||||
|
||||
uint32_t poly6 = 0x84000000; // 1000100000... -> D^6+D^5+1
|
||||
uint32_t poly11 = 0x63200000; //11000100001000... -> D^11+D^10+D^9+D^5+1
|
||||
//uint32_t poly16 = 0x81080000; //100000010000100... - > D^16+D^12+D^5+1
|
||||
//uint32_t poly24a = 0x864cfb00; //100001100100110011111011 -> D^24+D^23+D^18+D^17+D^14+D^11+D^10+D^7+D^6+D^5+D^4+D^3+D+1
|
||||
//uint32_t poly24b = 0x80006300; //100000000000000001100011 -> D^24+D^23+D^6+D^5+D+1
|
||||
uint32_t poly24c = 0xB2B11700; //101100101011000100010111 -> D^24...
|
||||
|
||||
if (messageType == 0) { //DCI
|
||||
|
||||
} else if (messageType == 1) { //PBCH
|
||||
polarParams->n_max = NR_POLAR_PBCH_N_MAX;
|
||||
polarParams->i_il = NR_POLAR_PBCH_I_IL;
|
||||
polarParams->i_seg = NR_POLAR_PBCH_I_SEG;
|
||||
polarParams->n_pc = NR_POLAR_PBCH_N_PC;
|
||||
polarParams->n_pc_wm = NR_POLAR_PBCH_N_PC_WM;
|
||||
polarParams->i_bil = NR_POLAR_PBCH_I_BIL;
|
||||
polarParams->payloadBits = NR_POLAR_PBCH_PAYLOAD_BITS;
|
||||
polarParams->encoderLength = NR_POLAR_PBCH_E;
|
||||
polarParams->crcParityBits = NR_POLAR_PBCH_CRC_PARITY_BITS;
|
||||
|
||||
polarParams->K = polarParams->payloadBits + polarParams->crcParityBits; // Number of bits to encode.
|
||||
polarParams->N = nr_polar_output_length(polarParams->K, polarParams->encoderLength, polarParams->n_max);
|
||||
polarParams->n = log2(polarParams->N);
|
||||
|
||||
polarParams->crc_generator_matrix=crc24c_generator_matrix(polarParams->payloadBits);
|
||||
polarParams->crc_polynomial = poly24c;
|
||||
polarParams->G_N = nr_polar_kronecker_power_matrices(polarParams->n);
|
||||
|
||||
//polar_encoder vectors:
|
||||
polarParams->nr_polar_crc = malloc(sizeof(uint8_t) * polarParams->crcParityBits);
|
||||
polarParams->nr_polar_cPrime = malloc(sizeof(uint8_t) * polarParams->K);
|
||||
polarParams->nr_polar_d = malloc(sizeof(uint8_t) * polarParams->N);
|
||||
|
||||
//Polar Coding vectors
|
||||
polarParams->nr_polar_u = malloc(sizeof(uint8_t) * polarParams->N); //Decoder: nr_polar_uHat
|
||||
polarParams->nr_polar_cPrime = malloc(sizeof(uint8_t) * polarParams->K); //Decoder: nr_polar_cHat
|
||||
polarParams->nr_polar_b = malloc(sizeof(uint8_t) * polarParams->K); //Decoder: nr_polar_bHat
|
||||
|
||||
polarParams->decoder_kernel = NULL;//polar_decoder_K56_N512_E864;
|
||||
|
||||
|
||||
|
||||
} else if (messageType == 2) { //UCI
|
||||
polarParams->payloadBits = NR_POLAR_PUCCH_PAYLOAD_BITS; //A depends on what they carry...
|
||||
polarParams->encoderLength = NR_POLAR_PUCCH_E ; //E depends on other standards 6.3.1.4
|
||||
|
||||
if (polarParams->payloadBits <= 11) //Ref. 38-212, Section 6.3.1.2.2
|
||||
polarParams->crcParityBits = 0; //K=A
|
||||
else //Ref. 38-212, Section 6.3.1.2.1
|
||||
{
|
||||
if (polarParams->payloadBits < 20)
|
||||
polarParams->crcParityBits = NR_POLAR_PUCCH_CRC_PARITY_BITS_SHORT;
|
||||
else
|
||||
polarParams->crcParityBits = NR_POLAR_PUCCH_CRC_PARITY_BITS_LONG;
|
||||
|
||||
if (polarParams->payloadBits >= 360 && polarParams->encoderLength >= 1088)
|
||||
polarParams->i_seg = NR_POLAR_PUCCH_I_SEG_LONG; // -> C=2
|
||||
else
|
||||
polarParams->i_seg = NR_POLAR_PUCCH_I_SEG_SHORT; // -> C=1
|
||||
}
|
||||
|
||||
polarParams->K = polarParams->payloadBits + polarParams->crcParityBits; // Number of bits to encode.
|
||||
|
||||
//K_r = K/C ; C = I_seg+1
|
||||
if((polarParams->K)/(polarParams->i_seg+1)>=18 && (polarParams->K)/(polarParams->i_seg+1)<=25) //Ref. 38-212, Section 6.3.1.3.1
|
||||
{
|
||||
polarParams->n_max = NR_POLAR_PUCCH_N_MAX;
|
||||
polarParams->i_il =NR_POLAR_PUCCH_I_IL;
|
||||
polarParams->n_pc = NR_POLAR_PUCCH_N_PC_SHORT;
|
||||
|
||||
if( (polarParams->encoderLength - polarParams->K)/(polarParams->i_seg + 1) + 3 > 192 )
|
||||
polarParams->n_pc_wm = NR_POLAR_PUCCH_N_PC_WM_LONG;
|
||||
else
|
||||
polarParams->n_pc_wm = NR_POLAR_PUCCH_N_PC_WM_SHORT;
|
||||
}
|
||||
|
||||
if( (polarParams->K)/(polarParams->i_seg + 1) > 30 ) //Ref. 38-212, Section 6.3.1.3.1
|
||||
{
|
||||
polarParams->n_max = NR_POLAR_PUCCH_N_MAX;
|
||||
polarParams->i_il =NR_POLAR_PUCCH_I_IL;
|
||||
polarParams->n_pc = NR_POLAR_PUCCH_N_PC_LONG;
|
||||
polarParams->n_pc_wm = NR_POLAR_PUCCH_N_PC_WM_LONG;
|
||||
}
|
||||
|
||||
polarParams->i_bil = NR_POLAR_PUCCH_I_BIL; //Ref. 38-212, Section 6.3.1.4.1
|
||||
|
||||
polarParams->N = nr_polar_output_length(polarParams->K, polarParams->encoderLength, polarParams->n_max);
|
||||
polarParams->n = log2(polarParams->N);
|
||||
|
||||
if((polarParams->payloadBits) <= 19)
|
||||
{
|
||||
polarParams->crc_generator_matrix=crc6_generator_matrix(polarParams->payloadBits);
|
||||
polarParams->crc_polynomial = poly6;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
polarParams->crc_generator_matrix=crc11_generator_matrix(polarParams->payloadBits);
|
||||
polarParams->crc_polynomial = poly11;
|
||||
}
|
||||
polarParams->G_N = nr_polar_kronecker_power_matrices(polarParams->n);
|
||||
|
||||
//polar_encoder vectors:
|
||||
polarParams->nr_polar_crc = malloc(sizeof(uint8_t) * polarParams->crcParityBits);
|
||||
polarParams->nr_polar_cPrime = malloc(sizeof(uint8_t) * polarParams->K);
|
||||
polarParams->nr_polar_d = malloc(sizeof(uint8_t) * polarParams->N);
|
||||
|
||||
//Polar Coding vectors
|
||||
polarParams->nr_polar_u = malloc(sizeof(uint8_t) * polarParams->N); //Decoder: nr_polar_uHat
|
||||
polarParams->nr_polar_cPrime = malloc(sizeof(uint8_t) * polarParams->K); //Decoder: nr_polar_cHat
|
||||
polarParams->nr_polar_b = malloc(sizeof(uint8_t) * polarParams->K); //Decoder: nr_polar_bHat
|
||||
|
||||
}
|
||||
|
||||
polarParams->crcCorrectionBits = NR_POLAR_CRC_ERROR_CORRECTION_BITS;
|
||||
|
||||
polarParams->crc256Table = malloc(sizeof(uint32_t)*256);
|
||||
crcTable256Init(polarParams->crc_polynomial, polarParams->crc256Table);
|
||||
polarParams->Q_0_Nminus1 = nr_polar_sequence_pattern(polarParams->n);
|
||||
|
||||
polarParams->interleaving_pattern = malloc(sizeof(uint16_t) * polarParams->K);
|
||||
nr_polar_interleaving_pattern(polarParams->K, polarParams->i_il, polarParams->interleaving_pattern);
|
||||
|
||||
polarParams->rate_matching_pattern = malloc(sizeof(uint16_t) * polarParams->encoderLength);
|
||||
uint16_t *J = malloc(sizeof(uint16_t) * polarParams->N);
|
||||
nr_polar_rate_matching_pattern(polarParams->rate_matching_pattern, J,
|
||||
nr_polar_subblock_interleaver_pattern, polarParams->K, polarParams->N, polarParams->encoderLength);
|
||||
|
||||
|
||||
polarParams->information_bit_pattern = malloc(sizeof(uint8_t) * polarParams->N);
|
||||
polarParams->Q_I_N = malloc(sizeof(int16_t) * (polarParams->K + polarParams->n_pc));
|
||||
polarParams->Q_F_N = malloc(sizeof(int16_t) * (polarParams->N+1)); // Last element shows the final array index assigned a value.
|
||||
polarParams->Q_PC_N = malloc(sizeof(int16_t) * (polarParams->n_pc));
|
||||
for (int i=0; i<=polarParams->N; i++) polarParams->Q_F_N[i] = -1; // Empty array.
|
||||
nr_polar_info_bit_pattern(polarParams->information_bit_pattern,
|
||||
polarParams->Q_I_N, polarParams->Q_F_N, J, polarParams->Q_0_Nminus1,
|
||||
polarParams->K, polarParams->N, polarParams->encoderLength, polarParams->n_pc);
|
||||
|
||||
polarParams->channel_interleaver_pattern = malloc(sizeof(uint16_t) * polarParams->encoderLength);
|
||||
nr_polar_channel_interleaver_pattern(polarParams->channel_interleaver_pattern,
|
||||
polarParams->i_bil, polarParams->encoderLength);
|
||||
|
||||
polarParams->extended_crc_generator_matrix = malloc(polarParams->K * sizeof(uint8_t *)); //G_P3
|
||||
uint8_t tempECGM[polarParams->K][polarParams->crcParityBits];
|
||||
for (int i = 0; i < polarParams->K; i++){
|
||||
polarParams->extended_crc_generator_matrix[i] = malloc(polarParams->crcParityBits * sizeof(uint8_t));
|
||||
}
|
||||
|
||||
for (int i=0; i<polarParams->payloadBits; i++) {
|
||||
for (int j=0; j<polarParams->crcParityBits; j++) {
|
||||
tempECGM[i][j]=polarParams->crc_generator_matrix[i][j];
|
||||
}
|
||||
}
|
||||
for (int i=polarParams->payloadBits; i<polarParams->K; i++) {
|
||||
for (int j=0; j<polarParams->crcParityBits; j++) {
|
||||
if( (i-polarParams->payloadBits) == j ){
|
||||
tempECGM[i][j]=1;
|
||||
} else {
|
||||
tempECGM[i][j]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<polarParams->K; i++) {
|
||||
for (int j=0; j<polarParams->crcParityBits; j++) {
|
||||
polarParams->extended_crc_generator_matrix[i][j]=tempECGM[polarParams->interleaving_pattern[i]][j];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
build_decoder_tree(polarParams);
|
||||
printf("decoder tree nodes %d\n",polarParams->tree.num_nodes);
|
||||
|
||||
|
||||
|
||||
free(J);
|
||||
}
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
|
||||
|
||||
|
||||
// ----- Old implementation ----
|
||||
uint8_t **crc24c_generator_matrix(uint16_t payloadSizeBits){
|
||||
|
||||
uint8_t crcPolynomialPattern[25] = {1,1,0,1,1,0,0,1,0,1,0,1,1,0,0,0,1,0,0,0,1,0,1,1,1};
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
|
||||
|
||||
|
||||
int8_t polar_decoder(
|
||||
double *input,
|
||||
uint8_t *out,
|
||||
@@ -285,7 +286,6 @@ int8_t polar_decoder_aPriori(double *input,
|
||||
uint8_t pathMetricAppr,
|
||||
double *aPrioriPayload)
|
||||
{
|
||||
|
||||
uint8_t ***bit = nr_alloc_uint8_t_3D_array(polarParams->N, (polarParams->n+1), 2*listSize);
|
||||
uint8_t **bitUpdated = nr_alloc_uint8_t_2D_array(polarParams->N, (polarParams->n+1)); //0=False, 1=True
|
||||
uint8_t **llrUpdated = nr_alloc_uint8_t_2D_array(polarParams->N, (polarParams->n+1)); //0=False, 1=True
|
||||
@@ -355,6 +355,7 @@ int8_t polar_decoder_aPriori(double *input,
|
||||
uint8_t listIndex[2*listSize], copyIndex;
|
||||
|
||||
for (uint16_t currentBit=0; currentBit<polarParams->N; currentBit++){
|
||||
|
||||
updateLLR(llr, llrUpdated, bit, bitUpdated, currentListSize, currentBit, 0, polarParams->N, (polarParams->n+1), pathMetricAppr);
|
||||
if (polarParams->information_bit_pattern[currentBit]==0) { //Frozen bit.
|
||||
updatePathMetric(pathMetric, llr, currentListSize, 0, currentBit, pathMetricAppr); //approximation=0 --> 11b, approximation=1 --> 12
|
||||
@@ -528,6 +529,7 @@ int8_t polar_decoder_aPriori(double *input,
|
||||
*/
|
||||
nr_byte2bit_uint8_32_t(polarParams->nr_polar_A, polarParams->payloadBits, out);
|
||||
return(0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1034,3 +1036,42 @@ int8_t polar_decoder_dci(double *input,
|
||||
nr_byte2bit_uint8_32_t(polarParams->nr_polar_A, polarParams->payloadBits, out);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int8_t polar_decoder_int16(int16_t *input,
|
||||
uint8_t *out,
|
||||
t_nrPolar_params *polarParams)
|
||||
{
|
||||
|
||||
|
||||
|
||||
int16_t d_tilde[polarParams->N];// = malloc(sizeof(double) * polarParams->N);
|
||||
nr_polar_rate_matching_int16(input, d_tilde, polarParams->rate_matching_pattern, polarParams->K, polarParams->N, polarParams->encoderLength);
|
||||
for (int i=0;i<polarParams->N;i++) {
|
||||
if (d_tilde[i]<-128) d_tilde[i]=-128;
|
||||
else if (d_tilde[i]>127) d_tilde[i]=128;
|
||||
}
|
||||
memcpy((void*)&polarParams->tree.root->alpha[0],(void*)&d_tilde[0],sizeof(int16_t)*polarParams->N);
|
||||
|
||||
/*
|
||||
* SCL polar decoder.
|
||||
*/
|
||||
|
||||
|
||||
generic_polar_decoder(polarParams,polarParams->tree.root);
|
||||
|
||||
|
||||
//Extract the information bits (û to ĉ)
|
||||
nr_polar_info_bit_extraction(polarParams->nr_polar_U, polarParams->nr_polar_CPrime, polarParams->information_bit_pattern, polarParams->N);
|
||||
|
||||
//Deinterleaving (ĉ to b)
|
||||
|
||||
nr_polar_deinterleaver(polarParams->nr_polar_CPrime, polarParams->nr_polar_B, polarParams->interleaving_pattern, polarParams->K);
|
||||
|
||||
//Remove the CRC (â)
|
||||
for (int j = 0; j < polarParams->payloadBits; j++) polarParams->nr_polar_A[j]=polarParams->nr_polar_B[j];
|
||||
|
||||
nr_byte2bit_uint8_32_t(polarParams->nr_polar_A, polarParams->payloadBits, out);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,10 @@
|
||||
*/
|
||||
|
||||
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
|
||||
#include "PHY/sse_intrin.h"
|
||||
#include "PHY/impl_defs_top.h"
|
||||
|
||||
//#define DEBUG_NEW_IMPL
|
||||
|
||||
void updateLLR(double ***llr,
|
||||
uint8_t **llrU,
|
||||
@@ -56,8 +60,9 @@ void updateLLR(double ***llr,
|
||||
computeLLR(llr, row, col, i, offset, approximation);
|
||||
}
|
||||
}
|
||||
|
||||
llrU[row][col]=1;
|
||||
|
||||
// printf("LLR (a %f, b %f): llr[%d][%d] %f\n",32*a,32*b,col,row,32*llr[col][row]);
|
||||
}
|
||||
|
||||
void updateBit(uint8_t ***bit,
|
||||
@@ -68,6 +73,7 @@ void updateBit(uint8_t ***bit,
|
||||
uint16_t xlen,
|
||||
uint8_t ylen)
|
||||
{
|
||||
|
||||
uint16_t offset = ( xlen/(pow(2,(ylen-col))) );
|
||||
|
||||
for (uint8_t i=0; i<listSize; i++) {
|
||||
@@ -101,6 +107,7 @@ void updatePathMetric(double *pathMetric,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void updatePathMetric2(double *pathMetric,
|
||||
double ***llr,
|
||||
uint8_t listSize,
|
||||
@@ -110,6 +117,7 @@ void updatePathMetric2(double *pathMetric,
|
||||
double *tempPM = malloc(sizeof(double) * listSize);
|
||||
for (int i=0; i < listSize; i++) tempPM[i]=pathMetric[i];
|
||||
|
||||
|
||||
uint8_t bitValue = 0;
|
||||
if (appr) { //eq. (12)
|
||||
for (uint8_t i = 0; i < listSize; i++) {
|
||||
@@ -132,7 +140,9 @@ void updatePathMetric2(double *pathMetric,
|
||||
|
||||
free(tempPM);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void computeLLR(double ***llr,
|
||||
uint16_t row,
|
||||
@@ -152,6 +162,7 @@ void computeLLR(double ***llr,
|
||||
llr[row][col][i] = log((exp(a + b) + 1) / (exp(a) + exp(b)));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void updateCrcChecksum(uint8_t **crcChecksum,
|
||||
@@ -179,3 +190,347 @@ void updateCrcChecksum2(uint8_t **crcChecksum,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
decoder_node_t *new_decoder_node(int first_leaf_index,int level) {
|
||||
|
||||
decoder_node_t *node=(decoder_node_t *)malloc(sizeof(decoder_node_t));
|
||||
|
||||
node->first_leaf_index=first_leaf_index;
|
||||
node->level=level;
|
||||
node->Nv = 1<<level;
|
||||
node->leaf = 0;
|
||||
node->left=(decoder_node_t *)NULL;
|
||||
node->right=(decoder_node_t *)NULL;
|
||||
node->all_frozen=0;
|
||||
node->alpha = (int16_t*)malloc16(node->Nv*sizeof(int16_t));
|
||||
node->beta = (int16_t*)malloc16(node->Nv*sizeof(int16_t));
|
||||
memset((void*)node->beta,-1,node->Nv*sizeof(int16_t));
|
||||
|
||||
|
||||
return(node);
|
||||
}
|
||||
|
||||
decoder_node_t *add_nodes(int level,int first_leaf_index,t_nrPolar_params *pp) {
|
||||
|
||||
int all_frozen_below=1;
|
||||
int Nv = 1<<level;
|
||||
decoder_node_t *new_node = new_decoder_node(first_leaf_index,level);
|
||||
#ifdef DEBUG_NEW_IMPL
|
||||
printf("New node %d order %d, level %d\n",pp->tree.num_nodes,Nv,level);
|
||||
pp->tree.num_nodes++;
|
||||
#endif
|
||||
if (level==0) {
|
||||
#ifdef DEBUG_NEW_IMPL
|
||||
printf("leaf %d (%s)\n",first_leaf_index,pp->information_bit_pattern[first_leaf_index]==1 ? "information or crc" : "frozen");
|
||||
#endif
|
||||
new_node->leaf=1;
|
||||
new_node->all_frozen = pp->information_bit_pattern[first_leaf_index]==0 ? 1 : 0;
|
||||
return new_node; // this is a leaf node
|
||||
}
|
||||
|
||||
for (int i=0;i<Nv;i++) {
|
||||
if (pp->information_bit_pattern[i+first_leaf_index]>0) all_frozen_below=0;
|
||||
}
|
||||
if (all_frozen_below==0) new_node->left=add_nodes(level-1,first_leaf_index,pp);
|
||||
else {
|
||||
#ifdef DEBUG_NEW_IMPL
|
||||
printf("aggregating frozen bits %d ... %d at level %d (%s)\n",first_leaf_index,first_leaf_index+Nv-1,level,((first_leaf_index/Nv)&1)==0?"left":"right");
|
||||
#endif
|
||||
new_node->leaf=1;
|
||||
new_node->all_frozen=1;
|
||||
}
|
||||
if (all_frozen_below==0) new_node->right=add_nodes(level-1,first_leaf_index+(Nv/2),pp);
|
||||
|
||||
return(new_node);
|
||||
}
|
||||
|
||||
|
||||
void build_decoder_tree(t_nrPolar_params *pp) {
|
||||
|
||||
pp->tree.num_nodes=0;
|
||||
pp->tree.root = add_nodes(pp->n,0,pp);
|
||||
|
||||
}
|
||||
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
// translate 1-1 SIMD functions from SSE to NEON
|
||||
#define __m128i int16x8_t
|
||||
#define __m64 int8x8_t
|
||||
#define _mm_abs_epi16(a) vabsq_s16(a)
|
||||
#define _mm_min_epi16(a,b) vminq_s16(a,b)
|
||||
#define _mm_subs_epi16(a,b) vsubq_s16(a,b)
|
||||
#define _mm_abs_pi16(a) vabs_s16(a)
|
||||
#define _mm_min_pi16(a,b) vmin_s16(a,b)
|
||||
#define _mm_subs_pi16(a,b) vsub_s16(a,b)
|
||||
#endif
|
||||
|
||||
void applyFtoleft(t_nrPolar_params *pp,decoder_node_t *node) {
|
||||
int16_t *alpha_v=node->alpha;
|
||||
int16_t *alpha_l=node->left->alpha;
|
||||
int16_t *betal = node->left->beta;
|
||||
int16_t a,b,absa,absb,maska,maskb,minabs;
|
||||
|
||||
#ifdef DEBUG_NEW_IMPL
|
||||
printf("applyFtoleft %d, Nv %d (level %d,node->left (leaf %d, AF %d))\n",node->first_leaf_index,node->Nv,node->level,node->left->leaf,node->left->all_frozen);
|
||||
|
||||
|
||||
for (int i=0;i<node->Nv;i++) printf("i%d (frozen %d): alpha_v[i] = %d\n",i,1-pp->information_bit_pattern[node->first_leaf_index+i],alpha_v[i]);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
if (node->left->all_frozen == 0) {
|
||||
#if defined(__AVX2__)
|
||||
int avx2mod = (node->Nv/2)&15;
|
||||
if (avx2mod == 0) {
|
||||
__m256i a256,b256,absa256,absb256,minabs256;
|
||||
int avx2len = node->Nv/2/16;
|
||||
|
||||
// printf("avx2len %d\n",avx2len);
|
||||
for (int i=0;i<avx2len;i++) {
|
||||
a256 =((__m256i*)alpha_v)[i];
|
||||
b256 =((__m256i*)alpha_v)[i+avx2len];
|
||||
absa256 =_mm256_abs_epi16(a256);
|
||||
absb256 =_mm256_abs_epi16(b256);
|
||||
minabs256 =_mm256_min_epi16(absa256,absb256);
|
||||
((__m256i*)alpha_l)[i] =_mm256_sign_epi16(minabs256,_mm256_sign_epi16(a256,b256));
|
||||
}
|
||||
}
|
||||
else if (avx2mod == 8) {
|
||||
__m128i a128,b128,absa128,absb128,minabs128;
|
||||
a128 =*((__m128i*)alpha_v);
|
||||
b128 =((__m128i*)alpha_v)[1];
|
||||
absa128 =_mm_abs_epi16(a128);
|
||||
absb128 =_mm_abs_epi16(b128);
|
||||
minabs128 =_mm_min_epi16(absa128,absb128);
|
||||
*((__m128i*)alpha_l) =_mm_sign_epi16(minabs128,_mm_sign_epi16(a128,b128));
|
||||
}
|
||||
else if (avx2mod == 4) {
|
||||
__m64 a64,b64,absa64,absb64,minabs64;
|
||||
a64 =*((__m64*)alpha_v);
|
||||
b64 =((__m64*)alpha_v)[1];
|
||||
absa64 =_mm_abs_pi16(a64);
|
||||
absb64 =_mm_abs_pi16(b64);
|
||||
minabs64 =_mm_min_pi16(absa64,absb64);
|
||||
*((__m64*)alpha_l) =_mm_sign_pi16(minabs64,_mm_sign_pi16(a64,b64));
|
||||
}
|
||||
else
|
||||
#else
|
||||
int sse4mod = (node->Nv/2)&7;
|
||||
int sse4len = node->Nv/2/8;
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
int16x8_t signatimesb,comp1,comp2,negminabs128;
|
||||
int16x8_t zero=vdupq_n_s16(0);
|
||||
#endif
|
||||
|
||||
if (sse4mod == 0) {
|
||||
for (int i=0;i<sse4len;i++) {
|
||||
__m128i a128,b128,absa128,absb128,minabs128;
|
||||
int sse4len = node->Nv/2/8;
|
||||
|
||||
a128 =*((__m128i*)alpha_v);
|
||||
b128 =((__m128i*)alpha_v)[1];
|
||||
absa128 =_mm_abs_epi16(a128);
|
||||
absb128 =_mm_abs_epi16(b128);
|
||||
minabs128 =_mm_min_epi16(absa128,absb128);
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
// unfortunately no direct equivalent to _mm_sign_epi16
|
||||
signatimesb=vxorrq_s16(a128,b128);
|
||||
comp1=vcltq_s16(signatimesb,zero);
|
||||
comp2=vcgeq_s16(signatimesb,zero);
|
||||
negminabs128=vnegq_s16(minabs128);
|
||||
*((__m128i*)alpha_l) =vorrq_s16(vandq_s16(minabs128,comp0),vandq_s16(negminabs128,comp1));
|
||||
#else
|
||||
*((__m128i*)alpha_l) =_mm_sign_epi16(minabs128,_mm_sign_epi16(a128,b128));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (sse4mod == 4) {
|
||||
__m64 a64,b64,absa64,absb64,minabs64;
|
||||
a64 =*((__m64*)alpha_v);
|
||||
b64 =((__m64*)alpha_v)[1];
|
||||
absa64 =_mm_abs_pi16(a64);
|
||||
absb64 =_mm_abs_pi16(b64);
|
||||
minabs64 =_mm_min_pi16(absa64,absb64);
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
AssertFatal(1==0,"Need to do this still for ARM\n");
|
||||
#else
|
||||
*((__m64*)alpha_l) =_mm_sign_pi16(minabs64,_mm_sign_epi16(a64,b64));
|
||||
#endif
|
||||
}
|
||||
|
||||
else
|
||||
#endif
|
||||
{ // equvalent scalar code to above, activated only on non x86/ARM architectures
|
||||
for (int i=0;i<node->Nv/2;i++) {
|
||||
a=alpha_v[i];
|
||||
b=alpha_v[i+(node->Nv/2)];
|
||||
maska=a>>15;
|
||||
maskb=b>>15;
|
||||
absa=(a+maska)^maska;
|
||||
absb=(b+maskb)^maskb;
|
||||
minabs = absa<absb ? absa : absb;
|
||||
alpha_l[i] = (maska^maskb)==0 ? minabs : -minabs;
|
||||
// printf("alphal[%d] %d (%d,%d)\n",i,alpha_l[i],a,b);
|
||||
}
|
||||
}
|
||||
if (node->Nv == 2) { // apply hard decision on left node
|
||||
betal[0] = (alpha_l[0]>0) ? -1 : 1;
|
||||
#ifdef DEBUG_NEW_IMPL
|
||||
printf("betal[0] %d (%p)\n",betal[0],&betal[0]);
|
||||
#endif
|
||||
pp->nr_polar_U[node->first_leaf_index] = (1+betal[0])>>1;
|
||||
#ifdef DEBUG_NEW_IMPL
|
||||
printf("Setting bit %d to %d (LLR %d)\n",node->first_leaf_index,(betal[0]+1)>>1,alpha_l[0]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void applyGtoright(t_nrPolar_params *pp,decoder_node_t *node) {
|
||||
|
||||
int16_t *alpha_v=node->alpha;
|
||||
int16_t *alpha_r=node->right->alpha;
|
||||
int16_t *betal = node->left->beta;
|
||||
int16_t *betar = node->right->beta;
|
||||
|
||||
#ifdef DEBUG_NEW_IMPL
|
||||
printf("applyGtoright %d, Nv %d (level %d), (leaf %d, AF %d)\n",node->first_leaf_index,node->Nv,node->level,node->right->leaf,node->right->all_frozen);
|
||||
#endif
|
||||
|
||||
if (node->right->all_frozen == 0) {
|
||||
#if defined(__AVX2__)
|
||||
int avx2mod = (node->Nv/2)&15;
|
||||
if (avx2mod == 0) {
|
||||
int avx2len = node->Nv/2/16;
|
||||
|
||||
for (int i=0;i<avx2len;i++) {
|
||||
((__m256i *)alpha_r)[i] =
|
||||
_mm256_subs_epi16(((__m256i *)alpha_v)[i+avx2len],
|
||||
_mm256_sign_epi16(((__m256i *)alpha_v)[i],
|
||||
((__m256i *)betal)[i]));
|
||||
}
|
||||
}
|
||||
else if (avx2mod == 8) {
|
||||
((__m128i *)alpha_r)[0] = _mm_subs_epi16(((__m128i *)alpha_v)[1],_mm_sign_epi16(((__m128i *)alpha_v)[0],((__m128i *)betal)[0]));
|
||||
}
|
||||
else if (avx2mod == 4) {
|
||||
((__m64 *)alpha_r)[0] = _mm_subs_pi16(((__m64 *)alpha_v)[1],_mm_sign_pi16(((__m64 *)alpha_v)[0],((__m64 *)betal)[0]));
|
||||
}
|
||||
else
|
||||
#else
|
||||
int sse4mod = (node->Nv/2)&7;
|
||||
|
||||
if (sse4mod == 0) {
|
||||
int sse4len = node->Nv/2/8;
|
||||
|
||||
for (int i=0;i<sse4len;i++) {
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
((int16x8_t *)alpha_r)[0] = vsubq_s16(((int16x8_t *)alpha_v)[1],vmulq_epi16(((int16x8_t *)alpha_v)[0],((int16x8_t *)betal)[0]));
|
||||
#else
|
||||
((__m128i *)alpha_r)[0] = _mm_subs_epi16(((__m128i *)alpha_v)[1],_mm_sign_epi16(((__m128i *)alpha_v)[0],((__m128i *)betal)[0]));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (sse4mod == 4) {
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
((int16x4_t *)alpha_r)[0] = vsub_s16(((int16x4_t *)alpha_v)[1],vmul_epi16(((int16x4_t *)alpha_v)[0],((int16x4_t *)betal)[0]));
|
||||
#else
|
||||
((__m64 *)alpha_r)[0] = _mm_subs_pi16(((__m64 *)alpha_v)[1],_mm_sign_pi16(((__64 *)alpha_v)[0],((__m64 *)betal)[0]));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{// equvalent scalar code to above, activated only on non x86/ARM architectures
|
||||
for (int i=0;i<node->Nv/2;i++) {
|
||||
alpha_r[i] = alpha_v[i+(node->Nv/2)] - (betal[i]*alpha_v[i]);
|
||||
}
|
||||
}
|
||||
if (node->Nv == 2) { // apply hard decision on right node
|
||||
betar[0] = (alpha_r[0]>0) ? -1 : 1;
|
||||
pp->nr_polar_U[node->first_leaf_index+1] = (1+betar[0])>>1;
|
||||
#ifdef DEBUG_NEW_IMPL
|
||||
printf("Setting bit %d to %d (LLR %d)\n",node->first_leaf_index+1,(betar[0]+1)>>1,alpha_r[0]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int16_t all1[16] = {1,1,1,1,
|
||||
1,1,1,1,
|
||||
1,1,1,1,
|
||||
1,1,1,1};
|
||||
|
||||
void computeBeta(t_nrPolar_params *pp,decoder_node_t *node) {
|
||||
|
||||
int16_t *betav = node->beta;
|
||||
int16_t *betal = node->left->beta;
|
||||
int16_t *betar = node->right->beta;
|
||||
#ifdef DEBUG_NEW_IMPL
|
||||
printf("Computing beta @ level %d first_leaf_index %d (all_frozen %d)\n",node->level,node->first_leaf_index,node->left->all_frozen);
|
||||
#endif
|
||||
if (node->left->all_frozen==0) { // if left node is not aggregation of frozen bits
|
||||
#if defined(__AVX2__)
|
||||
int avx2mod = (node->Nv/2)&15;
|
||||
register __m256i allones=*((__m256i*)all1);
|
||||
if (avx2mod == 0) {
|
||||
int avx2len = node->Nv/2/16;
|
||||
for (int i=0;i<avx2len;i++) {
|
||||
((__m256i*)betav)[i] = _mm256_or_si256(_mm256_cmpeq_epi16(((__m256i*)betar)[i],
|
||||
((__m256i*)betal)[i]),allones);
|
||||
}
|
||||
}
|
||||
else if (avx2mod == 8) {
|
||||
((__m128i*)betav)[0] = _mm_or_si128(_mm_cmpeq_epi16(((__m128i*)betar)[0],
|
||||
((__m128i*)betal)[0]),*((__m128i*)all1));
|
||||
}
|
||||
else if (avx2mod == 4) {
|
||||
((__m64*)betav)[0] = _mm_or_si64(_mm_cmpeq_pi16(((__m64*)betar)[0],
|
||||
((__m64*)betal)[0]),*((__m64*)all1));
|
||||
}
|
||||
else
|
||||
#else
|
||||
int avx2mod = (node->Nv/2)&15;
|
||||
|
||||
if (ssr4mod == 0) {
|
||||
int ssr4len = node->Nv/2/8;
|
||||
register __m128i allones=*((__m128i*)all1);
|
||||
for (int i=0;i<sse4len;i++) {
|
||||
((__m256i*)betav)[i] = _mm_or_si128(_mm_cmpeq_epi16(((__m128i*)betar)[i],
|
||||
((__m128i*)betal)[i]),allones));
|
||||
}
|
||||
}
|
||||
else if (sse4mod == 4) {
|
||||
((__m64*)betav)[0] = _mm_or_si64(_mm_cmpeq_pi16(((__m64*)betar)[0],
|
||||
((__m64*)betal)[0]),*((__m64*)all1));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
for (int i=0;i<node->Nv/2;i++) {
|
||||
betav[i] = (betal[i] != betar[i]) ? 1 : -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else memcpy((void*)&betav[0],betar,(node->Nv/2)*sizeof(int16_t));
|
||||
memcpy((void*)&betav[node->Nv/2],betar,(node->Nv/2)*sizeof(int16_t));
|
||||
|
||||
}
|
||||
|
||||
void generic_polar_decoder(t_nrPolar_params *pp,decoder_node_t *node) {
|
||||
|
||||
|
||||
// Apply F to left
|
||||
applyFtoleft(pp,node);
|
||||
// if left is not a leaf recurse down to the left
|
||||
if (node->left->leaf==0) generic_polar_decoder(pp,node->left);
|
||||
|
||||
applyGtoright(pp,node);
|
||||
if (node->right->leaf==0) generic_polar_decoder(pp,node->right);
|
||||
|
||||
computeBeta(pp,node);
|
||||
|
||||
}
|
||||
|
||||
@@ -56,6 +56,27 @@
|
||||
|
||||
static const uint8_t nr_polar_subblock_interleaver_pattern[32] = { 0, 1, 2, 4, 3, 5, 6, 7, 8, 16, 9, 17, 10, 18, 11, 19, 12, 20, 13, 21, 14, 22, 15, 23, 24, 25, 26, 28, 27, 29, 30, 31 };
|
||||
|
||||
|
||||
#define Nmax 1024
|
||||
#define nmax 10
|
||||
|
||||
typedef struct decoder_node_t_s {
|
||||
struct decoder_node_t_s *left;
|
||||
struct decoder_node_t_s *right;
|
||||
int level;
|
||||
int leaf;
|
||||
int Nv;
|
||||
int first_leaf_index;
|
||||
int all_frozen;
|
||||
int16_t *alpha;
|
||||
int16_t *beta;
|
||||
} decoder_node_t;
|
||||
|
||||
typedef struct decoder_tree_t_s {
|
||||
decoder_node_t *root;
|
||||
int num_nodes;
|
||||
} decoder_tree_t;
|
||||
|
||||
struct nrPolar_params {
|
||||
//messageType: 0=PBCH, 1=DCI, -1=UCI
|
||||
int idx; //idx = (messageType * messageLength * aggregation_prime);
|
||||
@@ -84,10 +105,12 @@ struct nrPolar_params {
|
||||
int16_t *Q_PC_N;
|
||||
uint8_t *information_bit_pattern;
|
||||
uint16_t *channel_interleaver_pattern;
|
||||
uint32_t crc_polynomial;
|
||||
|
||||
uint8_t **crc_generator_matrix; //G_P
|
||||
uint8_t **G_N;
|
||||
|
||||
uint32_t* crc256Table;
|
||||
uint8_t **extended_crc_generator_matrix;
|
||||
//lowercase: bits, Uppercase: Bits stored in bytes
|
||||
//polar_encoder vectors
|
||||
uint8_t *nr_polar_crc;
|
||||
@@ -101,6 +124,8 @@ struct nrPolar_params {
|
||||
uint8_t *nr_polar_CPrime;
|
||||
uint8_t *nr_polar_B;
|
||||
uint8_t *nr_polar_U;
|
||||
|
||||
decoder_tree_t tree;
|
||||
} __attribute__ ((__packed__));
|
||||
typedef struct nrPolar_params t_nrPolar_params;
|
||||
typedef t_nrPolar_params *t_nrPolar_paramsPtr;
|
||||
@@ -149,6 +174,8 @@ int8_t polar_decoder_dci(double *input,
|
||||
uint8_t pathMetricAppr,
|
||||
uint16_t n_RNTI);
|
||||
|
||||
void generic_polar_decoder(t_nrPolar_params *,decoder_node_t *);
|
||||
|
||||
void nr_polar_init(t_nrPolar_paramsPtr *polarParams,
|
||||
int8_t messageType,
|
||||
uint16_t messageLength,
|
||||
@@ -194,6 +221,8 @@ void nr_polar_rate_matching(double *input,
|
||||
uint16_t N,
|
||||
uint16_t E);
|
||||
|
||||
void nr_polar_rate_matching_int16(int16_t *input, int16_t *output, uint16_t *rmp, uint16_t K, uint16_t N, uint16_t E);
|
||||
|
||||
void nr_polar_interleaving_pattern(uint16_t K,
|
||||
uint8_t I_IL,
|
||||
uint16_t *PI_k_);
|
||||
|
||||
@@ -3,21 +3,73 @@
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
void nr_polar_kernel_operation(uint8_t *u, uint8_t *d, uint16_t N)
|
||||
#include <immintrin.h>
|
||||
|
||||
void nr_polar_kernal_operation(uint8_t *u, uint8_t *d, uint16_t N)
|
||||
{
|
||||
// Martino's algorithm to avoid multiplication for the generating matrix
|
||||
// Martino's algorithm to avoid multiplication for the generating matrix of polar codes
|
||||
|
||||
uint32_t i,j;
|
||||
|
||||
int i,j;
|
||||
printf("\nd = ");
|
||||
for(i=0; i<N; i++)
|
||||
{
|
||||
d[i]=0;
|
||||
for(j=0; j<N; j++)
|
||||
#ifdef __AVX2__
|
||||
|
||||
__m256i A,B,C,D,E,U,zerosOnly, OUT;
|
||||
__m256i inc;
|
||||
uint32_t dTest[8];
|
||||
uint32_t uArray[8];
|
||||
uint32_t k;
|
||||
uint32_t incArray[8];
|
||||
|
||||
//initialisation
|
||||
for(k=0; k<8; k++)
|
||||
incArray[k]=k;
|
||||
inc=_mm256_loadu_si256((__m256i const*)incArray); // 0, 1, ..., 7 to increase
|
||||
|
||||
zerosOnly=_mm256_setzero_si256(); // for comparison
|
||||
|
||||
for(i=0; i<N; i+=8)
|
||||
{
|
||||
d[i]=d[i]+(( (j-i)& i )==0)*u[j];
|
||||
B=_mm256_set1_epi32((int)i); // i, ..., i
|
||||
B=_mm256_add_epi32(B, inc); // i, i+1, ..., i+7
|
||||
|
||||
OUT=_mm256_setzero_si256(); // it will contain the result of all the XORs for the d(i)s
|
||||
|
||||
for(j=0; j<N; j++)
|
||||
{
|
||||
A=_mm256_set1_epi32((int)(j)); //j, j, ..., j
|
||||
A=_mm256_sub_epi32(A, B); //(j-i), (j-(i+1)), ... (j-(i+7))
|
||||
|
||||
U=_mm256_set1_epi32((int)u[j]);
|
||||
_mm256_storeu_si256((__m256i*)uArray, U); //u(j) ... u(j) for the maskload
|
||||
|
||||
C=_mm256_and_si256(A, B); //(j-i)&i -> If zero, then XOR with the u(j)
|
||||
D=_mm256_cmpeq_epi32(C, zerosOnly); // compare with zero and use the result as mask
|
||||
|
||||
E=_mm256_maskload_epi32((int const*)uArray, D); // load only some u(j)s for the XOR
|
||||
OUT=_mm256_xor_si256(OUT, E); //32 bit x 8
|
||||
|
||||
}
|
||||
_mm256_storeu_si256((__m256i*)dTest, OUT);
|
||||
|
||||
for(k=0; k<8; k++) // Conversion from 32 bits to 8 bits
|
||||
{
|
||||
d[i+k]=(uint8_t)dTest[k]; // With AVX512 there is an intrinsic to do it
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
for(i=0; i<N; i++) // Create the elements of d=u*G_N ...
|
||||
{
|
||||
d[i]=0;
|
||||
for(j=0; j<N; j++) // ... looking at all the elements of u
|
||||
{
|
||||
d[i]=d[i] ^ (!( (j-i)& i ))*u[j];
|
||||
// it's like ((j-i)&i)==0
|
||||
}
|
||||
}
|
||||
d[i]=d[i]%2;
|
||||
|
||||
#endif
|
||||
|
||||
printf("%i", d[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,6 +111,32 @@ double ***nr_alloc_double_3D_array(uint16_t xlen, uint16_t ylen, uint16_t zlen)
|
||||
return output;
|
||||
}
|
||||
|
||||
double **nr_alloc_double_2D_array(uint16_t xlen, uint16_t ylen) {
|
||||
double **output;
|
||||
int i, j;
|
||||
|
||||
if ((output = malloc(xlen * sizeof(*output))) == NULL) {
|
||||
perror("[nr_alloc_double_3D_array] Problem at 1D allocation");
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i < xlen; i++)
|
||||
output[i] = NULL;
|
||||
|
||||
|
||||
for (i = 0; i < xlen; i++)
|
||||
if ((output[i] = malloc(ylen * sizeof *output[i])) == NULL) {
|
||||
perror("[nr_alloc_double_2D_array] Problem at 2D allocation");
|
||||
nr_free_double_2D_array(output, xlen);
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i < xlen; i++)
|
||||
for (j = 0; j < ylen; j++)
|
||||
output[i][j] = 0;
|
||||
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
uint8_t **nr_alloc_uint8_t_2D_array(uint16_t xlen, uint16_t ylen) {
|
||||
uint8_t **output;
|
||||
int i, j;
|
||||
@@ -136,6 +162,18 @@ uint8_t **nr_alloc_uint8_t_2D_array(uint16_t xlen, uint16_t ylen) {
|
||||
return output;
|
||||
}
|
||||
|
||||
void nr_free_double_3D_array(double ***input, uint16_t xlen, uint16_t ylen) {
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < xlen; i++) {
|
||||
for (j = 0; j < ylen; j++) {
|
||||
free(input[i][j]);
|
||||
}
|
||||
free(input[i]);
|
||||
}
|
||||
free(input);
|
||||
}
|
||||
|
||||
void nr_free_uint8_t_3D_array(uint8_t ***input, uint16_t xlen, uint16_t ylen) {
|
||||
int i, j;
|
||||
|
||||
@@ -149,31 +187,28 @@ void nr_free_uint8_t_3D_array(uint8_t ***input, uint16_t xlen, uint16_t ylen) {
|
||||
}
|
||||
|
||||
void nr_free_uint8_t_2D_array(uint8_t **input, uint16_t xlen) {
|
||||
for (int i = 0; i < xlen; i++) free(input[i]);
|
||||
free(input);
|
||||
for (int i = 0; i < xlen; i++) free(input[i]);
|
||||
free(input);
|
||||
}
|
||||
|
||||
void nr_free_double_3D_array(double ***input, uint16_t xlen, uint16_t ylen) {
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < xlen; i++) {
|
||||
for (j = 0; j < ylen; j++) {
|
||||
free(input[i][j]);
|
||||
}
|
||||
free(input[i]);
|
||||
}
|
||||
free(input);
|
||||
void nr_free_double_2D_array(double **input, uint16_t xlen) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < xlen; i++) {
|
||||
free(input[i]);
|
||||
}
|
||||
free(input);
|
||||
}
|
||||
|
||||
// Modified Bubble Sort.
|
||||
void nr_sort_asc_double_1D_array_ind(double *matrix, uint8_t *ind, uint8_t len) {
|
||||
uint8_t swaps;
|
||||
int swaps;
|
||||
double temp;
|
||||
uint8_t tempInd;
|
||||
int tempInd;
|
||||
|
||||
for (uint8_t i = 0; i < len; i++) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
swaps = 0;
|
||||
for (uint8_t j = 0; j < (len - i) - 1; j++) {
|
||||
for (int j = 0; j < (len - i) - 1; j++) {
|
||||
if (matrix[j] > matrix[j + 1]) {
|
||||
temp = matrix[j];
|
||||
matrix[j] = matrix[j + 1];
|
||||
@@ -190,3 +225,28 @@ void nr_sort_asc_double_1D_array_ind(double *matrix, uint8_t *ind, uint8_t len)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void nr_sort_asc_int16_1D_array_ind(int32_t *matrix, int *ind, int len) {
|
||||
int swaps;
|
||||
int16_t temp;
|
||||
int tempInd;
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
swaps = 0;
|
||||
for (int j = 0; j < (len - i) - 1; j++) {
|
||||
if (matrix[j] > matrix[j + 1]) {
|
||||
temp = matrix[j];
|
||||
matrix[j] = matrix[j + 1];
|
||||
matrix[j + 1] = temp;
|
||||
|
||||
tempInd = ind[j];
|
||||
ind[j] = ind[j + 1];
|
||||
ind[j + 1] = tempInd;
|
||||
|
||||
swaps++;
|
||||
}
|
||||
}
|
||||
if (swaps == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,3 +313,25 @@ void nr_polar_rate_matching(double *input, double *output, uint16_t *rmp, uint16
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void nr_polar_rate_matching_int16(int16_t *input, int16_t *output, uint16_t *rmp, uint16_t K, uint16_t N, uint16_t E){
|
||||
|
||||
if (E>=N) { //repetition
|
||||
for (int i=0; i<=N-1; i++) output[i]=0;
|
||||
for (int i=0; i<=E-1; i++){
|
||||
output[rmp[i]]+=input[i];
|
||||
}
|
||||
} else {
|
||||
if ( (K/(double)E) <= (7.0/16) ) { //puncturing
|
||||
for (int i=0; i<=N-1; i++) output[i]=0;
|
||||
} else { //shortening
|
||||
for (int i=0; i<=N-1; i++) output[i]=INFINITY;
|
||||
}
|
||||
|
||||
for (int i=0; i<=E-1; i++){
|
||||
output[rmp[i]]=input[i];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
|
||||
|
||||
void nr_polar_rate_matching_pattern(uint16_t *rmp, uint16_t *J, const uint8_t *P_i_, uint16_t K, uint16_t N, uint16_t E){
|
||||
|
||||
uint8_t i;
|
||||
uint16_t *d, *y, ind;
|
||||
d = (uint16_t *)malloc(sizeof(uint16_t) * N);
|
||||
y = (uint16_t *)malloc(sizeof(uint16_t) * N);
|
||||
|
||||
for (int m=0; m<=N-1; m++) d[m]=m;
|
||||
|
||||
for (int m=0; m<=N-1; m++){
|
||||
i=floor((32*m)/N);
|
||||
J[m] = (P_i_[i]*(N/32)) + (m%(N/32));
|
||||
y[m] = d[J[m]];
|
||||
}
|
||||
|
||||
if (E>=N) { //repetition
|
||||
for (int k=0; k<=E-1; k++) {
|
||||
ind = (k%N);
|
||||
rmp[k]=y[ind];
|
||||
}
|
||||
} else {
|
||||
if ( (K/(double)E) <= (7.0/16) ) { //puncturing
|
||||
for (int k=0; k<=E-1; k++) {
|
||||
rmp[k]=y[k+N-E];
|
||||
}
|
||||
} else { //shortening
|
||||
for (int k=0; k<=E-1; k++) {
|
||||
rmp[k]=y[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free(d);
|
||||
free(y);
|
||||
}
|
||||
|
||||
|
||||
void nr_polar_rate_matching(double *input, double *output, uint16_t *rmp, uint16_t K, uint16_t N, uint16_t E){
|
||||
|
||||
if (E>=N) { //repetition
|
||||
for (int i=0; i<=N-1; i++) output[i]=0;
|
||||
for (int i=0; i<=E-1; i++){
|
||||
output[rmp[i]]+=input[i];
|
||||
}
|
||||
} else {
|
||||
if ( (K/(double)E) <= (7.0/16) ) { //puncturing
|
||||
for (int i=0; i<=N-1; i++) output[i]=0;
|
||||
} else { //shortening
|
||||
for (int i=0; i<=N-1; i++) output[i]=INFINITY;
|
||||
}
|
||||
|
||||
for (int i=0; i<=E-1; i++){
|
||||
output[rmp[i]]=input[i];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void nr_polar_rate_matching_int8(int16_t *input, int16_t *output, uint16_t *rmp, uint16_t K, uint16_t N, uint16_t E){
|
||||
|
||||
if (E>=N) { //repetition
|
||||
for (int i=0; i<=N-1; i++) output[i]=0;
|
||||
for (int i=0; i<=E-1; i++){
|
||||
output[rmp[i]]+=input[i];
|
||||
}
|
||||
} else {
|
||||
if ( (K/(double)E) <= (7.0/16) ) { //puncturing
|
||||
for (int i=0; i<=N-1; i++) output[i]=0;
|
||||
} else { //shortening
|
||||
for (int i=0; i<=N-1; i++) output[i]=INFINITY;
|
||||
}
|
||||
|
||||
for (int i=0; i<=E-1; i++){
|
||||
output[rmp[i]]=input[i];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -147,6 +147,9 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams,
|
||||
|
||||
free(J);
|
||||
|
||||
build_decoder_tree(newPolarInitNode);
|
||||
printf("decoder tree nodes %d\n",newPolarInitNode->tree.num_nodes);
|
||||
|
||||
} else {
|
||||
AssertFatal(1 == 0, "[nr_polar_init] New t_nrPolar_paramsPtr could not be created");
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
//#include "TDD-Config.h"
|
||||
//#include "MBSFN-SubframeConfigList.h"
|
||||
//#include "MobilityControlInfo.h"
|
||||
//#if defined(Rel10) || defined(Rel14)
|
||||
//#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
//#include "SCellToAddMod-r10.h"
|
||||
//#endif
|
||||
|
||||
|
||||
@@ -67,17 +67,13 @@ void generate_qpsk_table(void)
|
||||
void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms)
|
||||
{
|
||||
|
||||
crcTableInit();
|
||||
|
||||
ccodedot11_init();
|
||||
ccodedot11_init_inv();
|
||||
|
||||
ccodelte_init();
|
||||
ccodelte_init_inv();
|
||||
|
||||
init_dfts();
|
||||
|
||||
crcTableInit();
|
||||
|
||||
phy_generate_viterbi_tables();
|
||||
phy_generate_viterbi_tables_lte();
|
||||
|
||||
load_codinglib();
|
||||
@@ -88,6 +84,7 @@ void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms)
|
||||
|
||||
generate_64qam_table();
|
||||
generate_16qam_table();
|
||||
generate_qpsk_table();
|
||||
generate_RIV_tables();
|
||||
|
||||
init_unscrambling_lut();
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "RadioResourceConfigDedicated.h"
|
||||
#include "TDD-Config.h"
|
||||
#include "MBSFN-SubframeConfigList.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "assertions.h"
|
||||
#include <math.h>
|
||||
|
||||
@@ -182,7 +182,7 @@ void phy_config_request(PHY_Config_t *phy_config) {
|
||||
fp->frame_type,
|
||||
RC.eNB[Mod_id][CC_id]->X_u);
|
||||
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
fp->prach_emtc_config_common.prach_Config_enabled=1;
|
||||
|
||||
fp->prach_emtc_config_common.rootSequenceIndex = cfg->emtc_config.prach_catm_root_sequence_index.value;
|
||||
@@ -255,12 +255,7 @@ void phy_config_request(PHY_Config_t *phy_config) {
|
||||
"prach_starting_subframe_periodicity[0] %d < prach_numPetitionPerPreambleAttempt[0] %d\n",
|
||||
fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[0],
|
||||
fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0]);
|
||||
#if 0
|
||||
AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0] > 0,
|
||||
"prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0]==0\n");
|
||||
#else
|
||||
LOG_E(PHY,"***DJP*** removed assert on preamble fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0]:%d expecting >0 %s:%d\n\n\n", fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0], __FILE__, __LINE__);
|
||||
#endif
|
||||
|
||||
fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[0] = cfg->emtc_config.prach_ce_level_0_configuration_index.value;
|
||||
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[0] = cfg->emtc_config.prach_ce_level_0_frequency_offset.value;
|
||||
fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_enable[0] = cfg->emtc_config.prach_ce_level_0_hopping_enable.value;
|
||||
@@ -471,7 +466,7 @@ void phy_config_sib2_eNB(uint8_t Mod_id,
|
||||
}
|
||||
*/
|
||||
|
||||
void phy_config_sib13_eNB(uint8_t Mod_id,int CC_id,int mbsfn_Area_idx,
|
||||
void phy_config_sib13_eNB(module_id_t Mod_id,int CC_id,int mbsfn_Area_idx,
|
||||
long mbsfn_AreaId_r9)
|
||||
{
|
||||
|
||||
@@ -482,7 +477,7 @@ void phy_config_sib13_eNB(uint8_t Mod_id,int CC_id,int mbsfn_Area_idx,
|
||||
|
||||
if (mbsfn_Area_idx == 0) {
|
||||
fp->Nid_cell_mbsfn = (uint16_t)mbsfn_AreaId_r9;
|
||||
LOG_N(PHY,"Fix me: only called when mbsfn_Area_idx == 0)\n");
|
||||
LOG_I(PHY,"Fix me: only called when mbsfn_Area_idx == 0)\n");
|
||||
}
|
||||
|
||||
lte_gold_mbsfn(fp,RC.eNB[Mod_id][CC_id]->lte_gold_mbsfn_table,fp->Nid_cell_mbsfn);
|
||||
@@ -491,8 +486,7 @@ void phy_config_sib13_eNB(uint8_t Mod_id,int CC_id,int mbsfn_Area_idx,
|
||||
|
||||
void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *eNB)
|
||||
{
|
||||
|
||||
uint8_t UE_id;
|
||||
uint16_t UE_id;
|
||||
struct PhysicalConfigDedicated *physicalConfigDedicated;
|
||||
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
|
||||
|
||||
@@ -735,7 +729,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
|
||||
LTE_eNB_PUSCH** const pusch_vars = eNB->pusch_vars;
|
||||
LTE_eNB_SRS* const srs_vars = eNB->srs_vars;
|
||||
LTE_eNB_PRACH* const prach_vars = &eNB->prach_vars;
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
LTE_eNB_PRACH* const prach_vars_br = &eNB->prach_vars_br;
|
||||
#endif
|
||||
int i, UE_id;
|
||||
@@ -831,7 +825,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
|
||||
|
||||
prach_vars->rxsigF[0] = (int16_t**)malloc16_clear(64*sizeof(int16_t*));
|
||||
// PRACH BR
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
prach_vars_br->prachF = (int16_t*)malloc16_clear( 1024*2*sizeof(int32_t) );
|
||||
|
||||
// assume maximum of 64 RX antennas for PRACH receiver
|
||||
@@ -899,7 +893,7 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB)
|
||||
LTE_eNB_PUSCH** const pusch_vars = eNB->pusch_vars;
|
||||
LTE_eNB_SRS* const srs_vars = eNB->srs_vars;
|
||||
LTE_eNB_PRACH* const prach_vars = &eNB->prach_vars;
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
LTE_eNB_PRACH* const prach_vars_br = &eNB->prach_vars_br;
|
||||
#endif
|
||||
int i, UE_id;
|
||||
@@ -932,7 +926,7 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB)
|
||||
for (i = 0; i < 64; i++) free_and_zero(prach_vars->prach_ifft[0][i]);
|
||||
free_and_zero(prach_vars->prach_ifft[0]);
|
||||
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
for (int ce_level = 0; ce_level < 4; ce_level++) {
|
||||
for (i = 0; i < 64; i++) free_and_zero(prach_vars_br->prach_ifft[ce_level][i]);
|
||||
free_and_zero(prach_vars_br->prach_ifft[ce_level]);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "RadioResourceConfigDedicated.h"
|
||||
#include "TDD-Config.h"
|
||||
#include "MBSFN-SubframeConfigList.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "assertions.h"
|
||||
#include <math.h>
|
||||
|
||||
@@ -98,7 +98,7 @@ int phy_init_RU(RU_t *ru) {
|
||||
for (i=0; i<ru->nb_rx; i++) {
|
||||
ru->prach_rxsigF[i] = (int16_t*)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) );
|
||||
LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,ru->prach_rxsigF[i]);
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
for (j=0;j<4;j++) {
|
||||
ru->prach_rxsigF_br[j][i] = (int16_t*)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) );
|
||||
LOG_D(PHY,"[INIT] prach_vars_br->rxsigF[%d] = %p\n",i,ru->prach_rxsigF_br[j][i]);
|
||||
@@ -109,7 +109,7 @@ int phy_init_RU(RU_t *ru) {
|
||||
AssertFatal(RC.nb_L1_inst <= NUMBER_OF_eNB_MAX,"eNB instances %d > %d\n",
|
||||
RC.nb_L1_inst,NUMBER_OF_eNB_MAX);
|
||||
|
||||
LOG_E(PHY,"[INIT] %s() RC.nb_L1_inst:%d \n", __FUNCTION__, RC.nb_L1_inst);
|
||||
LOG_D(PHY,"[INIT] %s() RC.nb_L1_inst:%d \n", __FUNCTION__, RC.nb_L1_inst);
|
||||
|
||||
for (i=0; i<RC.nb_L1_inst; i++) {
|
||||
for (p=0;p<15;p++) {
|
||||
@@ -178,7 +178,7 @@ void phy_free_RU(RU_t *ru)
|
||||
|
||||
for (i = 0; i < ru->nb_rx; i++) {
|
||||
free_and_zero(ru->prach_rxsigF[i]);
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
for (j = 0; j < 4; j++) free_and_zero(ru->prach_rxsigF_br[j][i]);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "RadioResourceConfigDedicated.h"
|
||||
#include "TDD-Config.h"
|
||||
#include "MBSFN-SubframeConfigList.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "assertions.h"
|
||||
#include <math.h>
|
||||
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
|
||||
@@ -35,8 +35,9 @@
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
|
||||
uint8_t dmrs1_tab_ue[8] = {0,2,3,4,6,8,9,10};
|
||||
extern uint8_t nfapi_mode;
|
||||
|
||||
void phy_config_sib1_ue(uint8_t Mod_id,int CC_id,
|
||||
void phy_config_sib1_ue(module_id_t Mod_id,int CC_id,
|
||||
uint8_t eNB_id,
|
||||
TDD_Config_t *tdd_Config,
|
||||
uint8_t SIwindowsize,
|
||||
@@ -54,7 +55,7 @@ void phy_config_sib1_ue(uint8_t Mod_id,int CC_id,
|
||||
fp->SIPeriod = SIperiod;
|
||||
}
|
||||
|
||||
void phy_config_sib2_ue(uint8_t Mod_id,int CC_id,
|
||||
void phy_config_sib2_ue(module_id_t Mod_id,int CC_id,
|
||||
uint8_t eNB_id,
|
||||
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
|
||||
ARFCN_ValueEUTRA_t *ul_CarrierFreq,
|
||||
@@ -178,7 +179,7 @@ void phy_config_sib2_ue(uint8_t Mod_id,int CC_id,
|
||||
|
||||
}
|
||||
|
||||
void phy_config_sib13_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,int mbsfn_Area_idx,
|
||||
void phy_config_sib13_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,int mbsfn_Area_idx,
|
||||
long mbsfn_AreaId_r9)
|
||||
{
|
||||
|
||||
@@ -189,7 +190,7 @@ void phy_config_sib13_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,int mbsfn_Area_
|
||||
|
||||
if (mbsfn_Area_idx == 0) {
|
||||
fp->Nid_cell_mbsfn = (uint16_t)mbsfn_AreaId_r9;
|
||||
LOG_N(PHY,"Fix me: only called when mbsfn_Area_idx == 0)\n");
|
||||
LOG_I(PHY,"Fix me: only called when mbsfn_Area_idx == 0)\n");
|
||||
}
|
||||
|
||||
lte_gold_mbsfn(fp,PHY_vars_UE_g[Mod_id][CC_id]->lte_gold_mbsfn_table,fp->Nid_cell_mbsfn);
|
||||
@@ -200,7 +201,7 @@ void phy_config_sib13_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,int mbsfn_Area_
|
||||
/*
|
||||
* Configures UE MAC and PHY with radioResourceCommon received in mobilityControlInfo IE during Handover
|
||||
*/
|
||||
void phy_config_afterHO_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_id, MobilityControlInfo_t *mobilityControlInfo, uint8_t ho_failed)
|
||||
void phy_config_afterHO_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_id, MobilityControlInfo_t *mobilityControlInfo, uint8_t ho_failed)
|
||||
{
|
||||
|
||||
if(mobilityControlInfo!=NULL) {
|
||||
@@ -323,7 +324,7 @@ void phy_config_afterHO_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_id, Mobility
|
||||
}
|
||||
}
|
||||
|
||||
void phy_config_meas_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8_t n_adj_cells,unsigned int *adj_cell_id)
|
||||
void phy_config_meas_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8_t n_adj_cells,unsigned int *adj_cell_id)
|
||||
{
|
||||
|
||||
PHY_MEASUREMENTS *phy_meas = &PHY_vars_UE_g[Mod_id][CC_id]->measurements;
|
||||
@@ -341,7 +342,7 @@ void phy_config_meas_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8_t n
|
||||
|
||||
}
|
||||
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
void phy_config_dedicated_scell_ue(uint8_t Mod_id,
|
||||
uint8_t eNB_index,
|
||||
SCellToAddMod_r10_t *sCellToAddMod_r10,
|
||||
@@ -352,7 +353,7 @@ void phy_config_dedicated_scell_ue(uint8_t Mod_id,
|
||||
#endif
|
||||
|
||||
|
||||
void phy_config_harq_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
void phy_config_harq_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
uint16_t max_harq_tx )
|
||||
{
|
||||
|
||||
@@ -362,7 +363,7 @@ void phy_config_harq_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
|
||||
extern uint16_t beta_cqi[16];
|
||||
|
||||
void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
struct PhysicalConfigDedicated *physicalConfigDedicated )
|
||||
{
|
||||
|
||||
@@ -564,14 +565,17 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
phy_vars_ue->decode_SIB = 0;
|
||||
phy_vars_ue->decode_MIB = 0;
|
||||
}
|
||||
//phy_vars_ue->pdcch_vars[1][eNB_id]->crnti = phy_vars_ue->pdcch_vars[0][eNB_id]->crnti;
|
||||
if(phy_vars_ue->pdcch_vars[0][eNB_id]->crnti == 0x1234)
|
||||
phy_vars_ue->pdcch_vars[0][eNB_id]->crnti = phy_vars_ue->pdcch_vars[1][eNB_id]->crnti;
|
||||
else
|
||||
phy_vars_ue->pdcch_vars[1][eNB_id]->crnti = phy_vars_ue->pdcch_vars[0][eNB_id]->crnti;
|
||||
|
||||
LOG_I(PHY,"C-RNTI %x %x \n", phy_vars_ue->pdcch_vars[0][eNB_id]->crnti,
|
||||
phy_vars_ue->pdcch_vars[1][eNB_id]->crnti);
|
||||
if(nfapi_mode!=3){
|
||||
//phy_vars_ue->pdcch_vars[1][eNB_id]->crnti = phy_vars_ue->pdcch_vars[0][eNB_id]->crnti;
|
||||
if(phy_vars_ue->pdcch_vars[0][eNB_id]->crnti == 0x1234)
|
||||
phy_vars_ue->pdcch_vars[0][eNB_id]->crnti = phy_vars_ue->pdcch_vars[1][eNB_id]->crnti;
|
||||
else
|
||||
phy_vars_ue->pdcch_vars[1][eNB_id]->crnti = phy_vars_ue->pdcch_vars[0][eNB_id]->crnti;
|
||||
|
||||
LOG_I(PHY,"C-RNTI %x %x \n", phy_vars_ue->pdcch_vars[0][eNB_id]->crnti,
|
||||
phy_vars_ue->pdcch_vars[1][eNB_id]->crnti);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -705,6 +709,7 @@ int init_lte_ue_signal(PHY_VARS_UE *ue,
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++) {
|
||||
common_vars->rxdata[i] = (int32_t*) malloc16_clear( (fp->samples_per_tti*10+2048)*sizeof(int32_t) );
|
||||
LOG_I(PHY,"common_vars->rxdata[%d] %p\n",i,common_vars->rxdata[i]);
|
||||
common_vars->common_vars_rx_data_per_thread[0].rxdataF[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->ofdm_symbol_size*14) );
|
||||
common_vars->common_vars_rx_data_per_thread[1].rxdataF[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->ofdm_symbol_size*14) );
|
||||
}
|
||||
@@ -854,6 +859,9 @@ int init_lte_ue_signal(PHY_VARS_UE *ue,
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rho = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rxdataF_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->dl_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->dciFormat = 0;
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->agregationLevel = 0xFF;
|
||||
}
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++) {
|
||||
|
||||
@@ -100,6 +100,7 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
|
||||
frame_parms->first_carrier_offset = 1536-600;
|
||||
frame_parms->nb_prefix_samples=(frame_parms->nb_prefix_samples*3)>>2;
|
||||
frame_parms->nb_prefix_samples0=(frame_parms->nb_prefix_samples0*3)>>2;
|
||||
|
||||
}
|
||||
else {
|
||||
frame_parms->ofdm_symbol_size = 2048;
|
||||
@@ -148,7 +149,6 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
|
||||
frame_parms->N_RBGS = 2;
|
||||
frame_parms->N_RBG = 13;
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 15:
|
||||
@@ -159,6 +159,7 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
|
||||
frame_parms->nb_prefix_samples0>>=(3-log2_osf);
|
||||
frame_parms->N_RBGS = 2;
|
||||
frame_parms->N_RBG = 8;
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
@@ -169,6 +170,7 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
|
||||
frame_parms->nb_prefix_samples0>>=(4-log2_osf);
|
||||
frame_parms->N_RBGS = 1;
|
||||
frame_parms->N_RBG = 6;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
+18
-15
@@ -29,7 +29,6 @@
|
||||
#include "TDD-Config.h"
|
||||
#include "LAYER2/MAC/mac_extern.h"
|
||||
#include "MBSFN-SubframeConfigList.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "assertions.h"
|
||||
#include <math.h>
|
||||
|
||||
@@ -116,6 +115,10 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
||||
);*/
|
||||
LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_gNB][MOD %02"PRIu8"][]\n", gNB->Mod_id);
|
||||
|
||||
crcTableInit();
|
||||
|
||||
init_dfts();
|
||||
|
||||
// PBCH DMRS gold sequences generation
|
||||
nr_init_pbch_dmrs(gNB);
|
||||
// Polar encoder init for PBCH
|
||||
@@ -221,13 +224,13 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
||||
for (i=0; i<2; i++) {
|
||||
// RK 2 times because of output format of FFT!
|
||||
// FIXME We should get rid of this
|
||||
pusch_vars[UE_id]->rxdataF_ext[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_channel_bandwidth.value*12*fp->symbols_per_slot );
|
||||
pusch_vars[UE_id]->rxdataF_ext2[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_channel_bandwidth.value*12*fp->symbols_per_slot );
|
||||
pusch_vars[UE_id]->drs_ch_estimates[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_channel_bandwidth.value*12*fp->symbols_per_slot );
|
||||
pusch_vars[UE_id]->rxdataF_ext[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12*fp->symbols_per_slot );
|
||||
pusch_vars[UE_id]->rxdataF_ext2[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12*fp->symbols_per_slot );
|
||||
pusch_vars[UE_id]->drs_ch_estimates[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12*fp->symbols_per_slot );
|
||||
pusch_vars[UE_id]->drs_ch_estimates_time[i] = (int32_t*)malloc16_clear( 2*sizeof(int32_t)*fp->ofdm_symbol_size );
|
||||
pusch_vars[UE_id]->rxdataF_comp[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_channel_bandwidth.value*12*fp->symbols_per_slot );
|
||||
pusch_vars[UE_id]->ul_ch_mag[i] = (int32_t*)malloc16_clear( fp->symbols_per_slot*sizeof(int32_t)*cfg->rf_config.ul_channel_bandwidth.value*12 );
|
||||
pusch_vars[UE_id]->ul_ch_magb[i] = (int32_t*)malloc16_clear( fp->symbols_per_slot*sizeof(int32_t)*cfg->rf_config.ul_channel_bandwidth.value*12 );
|
||||
pusch_vars[UE_id]->rxdataF_comp[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12*fp->symbols_per_slot );
|
||||
pusch_vars[UE_id]->ul_ch_mag[i] = (int32_t*)malloc16_clear( fp->symbols_per_slot*sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12 );
|
||||
pusch_vars[UE_id]->ul_ch_magb[i] = (int32_t*)malloc16_clear( fp->symbols_per_slot*sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12 );
|
||||
}
|
||||
|
||||
pusch_vars[UE_id]->llr = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
|
||||
@@ -253,8 +256,8 @@ void phy_config_request(PHY_Config_t *phy_config) {
|
||||
NR_DL_FRAME_PARMS *fp;
|
||||
PHICH_RESOURCE_t phich_resource_table[4]={oneSixth,half,one,two};
|
||||
int eutra_band = cfg->nfapi_config.rf_bands.rf_band[0];
|
||||
int dl_Bandwidth = cfg->rf_config.dl_channel_bandwidth.value;
|
||||
int ul_Bandwidth = cfg->rf_config.ul_channel_bandwidth.value;
|
||||
int dl_Bandwidth = cfg->rf_config.dl_carrier_bandwidth.value;
|
||||
int ul_Bandwidth = cfg->rf_config.ul_carrier_bandwidth.value;
|
||||
int Nid_cell = cfg->sch_config.physical_cell_id.value;
|
||||
int Ncp = cfg->subframe_config.dl_cyclic_prefix_type.value;
|
||||
int p_eNB = cfg->rf_config.tx_antenna_ports.value;
|
||||
@@ -375,8 +378,8 @@ void install_schedule_handlers(IF_Module_t *if_inst)
|
||||
gNB_config->subframe_config.numerology_index_mu.value = 1;
|
||||
gNB_config->subframe_config.duplex_mode.value = FDD;
|
||||
gNB_config->rf_config.tx_antenna_ports.value = 1;
|
||||
gNB_config->rf_config.dl_channel_bandwidth.value = 106;
|
||||
gNB_config->rf_config.ul_channel_bandwidth.value = 106;
|
||||
gNB_config->rf_config.dl_carrier_bandwidth.value = 106;
|
||||
gNB_config->rf_config.ul_carrier_bandwidth.value = 106;
|
||||
gNB_config->sch_config.half_frame_index.value = 0;
|
||||
gNB_config->sch_config.ssb_subcarrier_offset.value = 0;
|
||||
gNB_config->sch_config.n_ssb_crb.value = 86;
|
||||
@@ -410,8 +413,8 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config)
|
||||
gNB_config->nfapi_config.earfcn.value = phy_config->cfg->nfapi_config.earfcn.value; //6600
|
||||
gNB_config->subframe_config.numerology_index_mu.value = phy_config->cfg->subframe_config.numerology_index_mu.value;//1
|
||||
gNB_config->rf_config.tx_antenna_ports.value = phy_config->cfg->rf_config.tx_antenna_ports.value; //1
|
||||
gNB_config->rf_config.dl_channel_bandwidth.value = phy_config->cfg->rf_config.dl_channel_bandwidth.value;//106;
|
||||
gNB_config->rf_config.ul_channel_bandwidth.value = phy_config->cfg->rf_config.ul_channel_bandwidth.value;//106;
|
||||
gNB_config->rf_config.dl_carrier_bandwidth.value = phy_config->cfg->rf_config.dl_carrier_bandwidth.value;//106;
|
||||
gNB_config->rf_config.ul_carrier_bandwidth.value = phy_config->cfg->rf_config.ul_carrier_bandwidth.value;//106;
|
||||
gNB_config->sch_config.half_frame_index.value = 0;
|
||||
gNB_config->sch_config.ssb_subcarrier_offset.value = phy_config->cfg->sch_config.ssb_subcarrier_offset.value;//0;
|
||||
gNB_config->sch_config.n_ssb_crb.value = 86;
|
||||
@@ -434,8 +437,8 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config)
|
||||
Mod_id,
|
||||
CC_id,
|
||||
gNB_config->nfapi_config.rf_bands.rf_band[0],
|
||||
gNB_config->rf_config.dl_channel_bandwidth.value,
|
||||
gNB_config->rf_config.ul_channel_bandwidth.value,
|
||||
gNB_config->rf_config.dl_carrier_bandwidth.value,
|
||||
gNB_config->rf_config.ul_carrier_bandwidth.value,
|
||||
gNB_config->sch_config.physical_cell_id.value,
|
||||
gNB_config->rf_config.tx_antenna_ports.value,
|
||||
fp->dl_CarrierFreq );
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "RadioResourceConfigDedicated.h"
|
||||
#include "TDD-Config.h"
|
||||
#include "MBSFN-SubframeConfigList.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "assertions.h"
|
||||
#include <math.h>
|
||||
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
#include "phy_init.h"
|
||||
#include "SCHED_UE/sched_UE.h"
|
||||
#include "PHY/phy_extern_nr_ue.h"
|
||||
#include "SIMULATION/TOOLS/sim.h"
|
||||
//#include "SIMULATION/TOOLS/sim.h"
|
||||
#include "RadioResourceConfigCommonSIB.h"
|
||||
#include "RadioResourceConfigDedicated.h"
|
||||
#include "TDD-Config.h"
|
||||
#include "MBSFN-SubframeConfigList.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "assertions.h"
|
||||
#include <math.h>
|
||||
#include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h"
|
||||
@@ -357,7 +357,7 @@ void phy_config_dedicated_scell_ue(uint8_t Mod_id,
|
||||
}
|
||||
#endif
|
||||
|
||||
void phy_config_harq_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
void phy_config_harq_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
uint16_t max_harq_tx )
|
||||
{
|
||||
|
||||
@@ -947,6 +947,8 @@ void phy_init_nr_top(PHY_VARS_NR_UE *ue)
|
||||
|
||||
crcTableInit();
|
||||
|
||||
init_dfts();
|
||||
|
||||
ccodedot11_init();
|
||||
ccodedot11_init_inv();
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_t* config,
|
||||
NR_DL_FRAME_PARMS *frame_parms)
|
||||
{
|
||||
|
||||
int N_RB = config->rf_config.dl_channel_bandwidth.value;
|
||||
int N_RB = config->rf_config.dl_carrier_bandwidth.value;
|
||||
int Ncp = config->subframe_config.dl_cyclic_prefix_type.value;
|
||||
int mu = config->subframe_config.numerology_index_mu.value;
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "PHICH-Config.h"
|
||||
#include "MBSFN-SubframeConfigList.h"
|
||||
#include "MobilityControlInfo.h"
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
#include "SCellToAddMod-r10.h"
|
||||
#endif
|
||||
/** @addtogroup _PHY_STRUCTURES_
|
||||
@@ -353,7 +353,7 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
|
||||
uint32_t perfect_ce);
|
||||
|
||||
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
void phy_config_dedicated_scell_ue(uint8_t Mod_id,
|
||||
uint8_t eNB_index,
|
||||
SCellToAddMod_r10_t *sCellToAddMod_r10,
|
||||
@@ -385,6 +385,8 @@ void nr_phy_config_request(NR_PHY_Config_t *gNB);
|
||||
void phy_free_nr_gNB(PHY_VARS_gNB *gNB);
|
||||
int l1_north_init_gNB(void);
|
||||
|
||||
void init_dfts(void);
|
||||
|
||||
/** @} */
|
||||
#endif
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "PHY/phy_extern_ue.h"
|
||||
#include "lte_estimation.h"
|
||||
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "openair2/LAYER2/MAC/mac_proto.h"
|
||||
|
||||
#define DEBUG_PHY
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
PHY_VARS_UE *ue,
|
||||
unsigned char eNB_id,
|
||||
module_id_t eNB_id,
|
||||
uint8_t subframe,
|
||||
unsigned char clear,
|
||||
short coef)
|
||||
@@ -86,6 +86,11 @@ void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
{
|
||||
diff = max_pos_fil - (frame_parms->nb_prefix_samples>>3);
|
||||
|
||||
#if BASIC_SIMULATOR
|
||||
/* a hack without which the UE does not connect (to be fixed somehow) */
|
||||
diff = 0;
|
||||
#endif
|
||||
|
||||
if ( abs(diff) < SYNCH_HYST )
|
||||
ue->rx_offset = 0;
|
||||
else
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
|
||||
#define DEBUG_PHY
|
||||
|
||||
@@ -79,7 +79,7 @@ int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
#ifdef DEBUG_PHY
|
||||
sprintf(fname,"srs_ch_estimates_time_%d%d.m",ind,aa);
|
||||
sprintf(vname,"srs_time_%d%d",ind,aa);
|
||||
write_output(fname,vname,lte_eNB_srs->srs_ch_estimates_time[aa],frame_parms->ofdm_symbol_size*2,2,1);
|
||||
LOG_M(fname,vname,lte_eNB_srs->srs_ch_estimates_time[aa],frame_parms->ofdm_symbol_size*2,2,1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
}
|
||||
|
||||
|
||||
int lte_est_timing_advance_pusch(PHY_VARS_eNB* eNB,uint8_t UE_id)
|
||||
int lte_est_timing_advance_pusch(PHY_VARS_eNB* eNB,module_id_t UE_id)
|
||||
{
|
||||
int temp, i, aa, max_pos=0, max_val=0;
|
||||
short Re,Im;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "PHY/impl_defs_top.h"
|
||||
#include "openair2/LAYER2/MAC/mac_proto.h"
|
||||
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
|
||||
#define DEBUG_PHY
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
PHY_VARS_UE *ue,
|
||||
unsigned char eNB_id,
|
||||
module_id_t eNB_id,
|
||||
uint8_t subframe,
|
||||
unsigned char clear,
|
||||
short coef)
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
//#define DEBUG_BF_CH
|
||||
|
||||
int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
|
||||
uint8_t eNB_id,
|
||||
module_id_t eNB_id,
|
||||
uint8_t eNB_offset,
|
||||
unsigned char Ns,
|
||||
unsigned char p,
|
||||
@@ -81,7 +81,7 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue,
|
||||
//generate ue specific pilots
|
||||
lprime = symbol/3-1;
|
||||
lte_dl_ue_spec_rx(phy_vars_ue,uespec_pilot,Ns,5,lprime,0,dlsch0_harq->nb_rb);
|
||||
//write_output("uespec_pilot_rx.m","uespec_pilot",uespec_pilot,300,1,1);
|
||||
//LOG_M("uespec_pilot_rx.m","uespec_pilot",uespec_pilot,300,1,1);
|
||||
|
||||
if (frame_parms->Ncp==0){
|
||||
if (symbol==3 || symbol==6 || symbol==9 || symbol==12)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "SCHED_UE/sched_UE.h"
|
||||
|
||||
int lte_dl_channel_estimation(PHY_VARS_UE *ue,
|
||||
uint8_t eNB_id,
|
||||
module_id_t eNB_id,
|
||||
uint8_t eNB_offset,
|
||||
unsigned char Ns,
|
||||
unsigned char p,
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
//#define DEBUG_CH
|
||||
int lte_dl_mbsfn_channel_estimation(PHY_VARS_UE *ue,
|
||||
uint8_t eNB_id,
|
||||
module_id_t eNB_id,
|
||||
uint8_t eNB_offset,
|
||||
int subframe,
|
||||
unsigned char l)
|
||||
|
||||
@@ -34,7 +34,7 @@ int32_t rx_power_avg_eNB[3];
|
||||
|
||||
void lte_eNB_I0_measurements(PHY_VARS_eNB *eNB,
|
||||
int subframe,
|
||||
unsigned char eNB_id,
|
||||
module_id_t eNB_id,
|
||||
unsigned char clear)
|
||||
{
|
||||
|
||||
@@ -115,8 +115,8 @@ void lte_eNB_I0_measurements(PHY_VARS_eNB *eNB,
|
||||
}
|
||||
|
||||
void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
|
||||
unsigned char eNB_id,
|
||||
unsigned char UE_id,
|
||||
module_id_t eNB_id,
|
||||
module_id_t UE_id,
|
||||
unsigned char init_averaging)
|
||||
{
|
||||
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
|
||||
|
||||
@@ -274,11 +274,11 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *com
|
||||
|
||||
|
||||
|
||||
#ifdef DEBUG_PHY
|
||||
write_output("primary_sync0.m","psync0",primary_synch0_time,frame_parms->ofdm_symbol_size,1,1);
|
||||
write_output("primary_sync1.m","psync1",primary_synch1_time,frame_parms->ofdm_symbol_size,1,1);
|
||||
write_output("primary_sync2.m","psync2",primary_synch2_time,frame_parms->ofdm_symbol_size,1,1);
|
||||
#endif
|
||||
LOG_M_BEGIN(DEBUG_LTEESTIM);
|
||||
LOG_M("primary_sync0.m","psync0",primary_synch0_time,frame_parms->ofdm_symbol_size,1,1);
|
||||
LOG_M("primary_sync1.m","psync1",primary_synch1_time,frame_parms->ofdm_symbol_size,1,1);
|
||||
LOG_M("primary_sync2.m","psync2",primary_synch2_time,frame_parms->ofdm_symbol_size,1,1);
|
||||
LOG_M_END
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -330,10 +330,6 @@ static inline int abs32(int x)
|
||||
return (((int)((short*)&x)[0])*((int)((short*)&x)[0]) + ((int)((short*)&x)[1])*((int)((short*)&x)[1]));
|
||||
}
|
||||
|
||||
#ifdef DEBUG_PHY
|
||||
int debug_cnt=0;
|
||||
#endif
|
||||
|
||||
#define SHIFT 17
|
||||
|
||||
int lte_sync_time(int **rxdata, ///rx data in time domain
|
||||
@@ -464,19 +460,18 @@ int lte_sync_time(int **rxdata, ///rx data in time domain
|
||||
LOG_I(PHY,"[UE] lte_sync_time: Sync source = %d, Peak found at pos %d, val = %d (%d dB)\n",sync_source,peak_pos,peak_val,dB_fixed(peak_val)/2);
|
||||
|
||||
|
||||
#ifdef DEBUG_PHY
|
||||
LOG_M_BEGIN(DEBUG_LTEESTIM)
|
||||
static int debug_cnt;
|
||||
if (debug_cnt == 0) {
|
||||
write_output("sync_corr0_ue.m","synccorr0",sync_corr_ue0,2*length,1,2);
|
||||
write_output("sync_corr1_ue.m","synccorr1",sync_corr_ue1,2*length,1,2);
|
||||
write_output("sync_corr2_ue.m","synccorr2",sync_corr_ue2,2*length,1,2);
|
||||
write_output("rxdata0.m","rxd0",rxdata[0],length<<1,1,1);
|
||||
LOG_M("sync_corr0_ue.m","synccorr0",sync_corr_ue0,2*length,1,2);
|
||||
LOG_M("sync_corr1_ue.m","synccorr1",sync_corr_ue1,2*length,1,2);
|
||||
LOG_M("sync_corr2_ue.m","synccorr2",sync_corr_ue2,2*length,1,2);
|
||||
LOG_M("rxdata0.m","rxd0",rxdata[0],length<<1,1,1);
|
||||
// exit(-1);
|
||||
} else {
|
||||
debug_cnt++;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
LOG_M_END
|
||||
|
||||
|
||||
return(peak_pos);
|
||||
|
||||
@@ -67,7 +67,7 @@ void lte_sync_timefreq(PHY_VARS_UE *ue,int band,unsigned int DL_freq)
|
||||
|
||||
|
||||
for (i=0; i<38400*4; i+=3072) { // steps of 200 us with 100 us overlap, 0 to 5s
|
||||
// write_output("rxsig0.m","rxs0",ue->lte_ue_common_vars.rxdata[0],30720,1,1);
|
||||
// LOG_M("rxsig0.m","rxs0",ue->lte_ue_common_vars.rxdata[0],30720,1,1);
|
||||
|
||||
//for (i = 15360-3072*2; i<15360+3072+1; i+=3072) {
|
||||
|
||||
@@ -81,16 +81,15 @@ void lte_sync_timefreq(PHY_VARS_UE *ue,int band,unsigned int DL_freq)
|
||||
|
||||
//compute frequency-domain representation of 6144-sample chunk
|
||||
dft6144((int16_t *)rxp,
|
||||
sp,
|
||||
1);
|
||||
sp,1);
|
||||
|
||||
|
||||
/*
|
||||
printf("i %d: sp %p\n",i,sp);
|
||||
if (i==12288) {
|
||||
write_output("scan6144F.m","s6144F",sp,6144,1,1);
|
||||
write_output("scan6144.m","s6144",rxp,6144,1,1);
|
||||
write_output("pss0_6144.m","pss0",pss6144_0_0,256,1,1);
|
||||
LOG_M("scan6144F.m","s6144F",sp,6144,1,1);
|
||||
LOG_M("scan6144.m","s6144",rxp,6144,1,1);
|
||||
LOG_M("pss0_6144.m","pss0",pss6144_0_0,256,1,1);
|
||||
}*/
|
||||
|
||||
for (f = -2000; f<2000; f++) { // this is -10MHz to 10 MHz in 5 kHz steps
|
||||
@@ -273,10 +272,10 @@ void lte_sync_timefreq(PHY_VARS_UE *ue,int band,unsigned int DL_freq)
|
||||
if (i==12288) {
|
||||
sprintf(fname,"corr256F_%d.m",abs(f));
|
||||
sprintf(vname,"c256F_%d",abs(f));
|
||||
write_output(fname,vname,autocorr0,256,1,1);
|
||||
LOG_M(fname,vname,autocorr0,256,1,1);
|
||||
sprintf(fname,"corr256_%d.m",abs(f));
|
||||
sprintf(vname,"c256_%d",abs(f));
|
||||
write_output(fname,vname,tmp_t,256,1,1);
|
||||
LOG_M(fname,vname,tmp_t,256,1,1);
|
||||
}*/
|
||||
|
||||
memset((void*)autocorr0_t,0,256*4);
|
||||
|
||||
@@ -55,7 +55,7 @@ void print_ints(char *s,int *x)
|
||||
|
||||
}
|
||||
|
||||
int16_t get_PL(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
|
||||
int16_t get_PL(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
|
||||
{
|
||||
|
||||
PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
@@ -81,7 +81,7 @@ int16_t get_PL(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
|
||||
}
|
||||
|
||||
|
||||
uint8_t get_n_adj_cells (uint8_t Mod_id,uint8_t CC_id)
|
||||
uint8_t get_n_adj_cells (module_id_t Mod_id,uint8_t CC_id)
|
||||
{
|
||||
|
||||
PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
@@ -92,7 +92,7 @@ uint8_t get_n_adj_cells (uint8_t Mod_id,uint8_t CC_id)
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t get_rx_total_gain_dB (uint8_t Mod_id,uint8_t CC_id)
|
||||
uint32_t get_rx_total_gain_dB (module_id_t Mod_id,uint8_t CC_id)
|
||||
{
|
||||
|
||||
PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
@@ -102,7 +102,7 @@ uint32_t get_rx_total_gain_dB (uint8_t Mod_id,uint8_t CC_id)
|
||||
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
uint32_t get_RSSI (uint8_t Mod_id,uint8_t CC_id)
|
||||
uint32_t get_RSSI (module_id_t Mod_id,uint8_t CC_id)
|
||||
{
|
||||
|
||||
PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
@@ -112,7 +112,7 @@ uint32_t get_RSSI (uint8_t Mod_id,uint8_t CC_id)
|
||||
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
double get_RSRP(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
|
||||
double get_RSRP(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
|
||||
{
|
||||
|
||||
AssertFatal(PHY_vars_UE_g!=NULL,"PHY_vars_UE_g is null\n");
|
||||
@@ -128,7 +128,7 @@ double get_RSRP(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
|
||||
return -140.0;
|
||||
}
|
||||
|
||||
uint32_t get_RSRQ(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
|
||||
uint32_t get_RSRQ(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
|
||||
{
|
||||
|
||||
PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
@@ -139,7 +139,7 @@ uint32_t get_RSRQ(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
int8_t set_RSRP_filtered(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp)
|
||||
int8_t set_RSRP_filtered(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp)
|
||||
{
|
||||
|
||||
PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
@@ -153,7 +153,7 @@ int8_t set_RSRP_filtered(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rs
|
||||
return -1;
|
||||
}
|
||||
|
||||
int8_t set_RSRQ_filtered(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrq)
|
||||
int8_t set_RSRQ_filtered(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrq)
|
||||
{
|
||||
|
||||
PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
|
||||
@@ -23,9 +23,8 @@
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "PHY/sse_intrin.h"
|
||||
//#define DEBUG_CH
|
||||
#include "UTIL/LOG/log.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
|
||||
#include "T.h"
|
||||
#include "lte_estimation.h"
|
||||
|
||||
// round(exp(sqrt(-1)*(pi/2)*[0:1:N-1]/N)*pow2(15))
|
||||
@@ -37,7 +36,7 @@ static int16_t ru_90c[2*128] = {32767, 0,32766, -402,32758, -804,32746, -1206,32
|
||||
|
||||
int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB,
|
||||
eNB_rxtx_proc_t *proc,
|
||||
uint8_t UE_id,
|
||||
module_id_t UE_id,
|
||||
unsigned char l,
|
||||
unsigned char Ns) {
|
||||
|
||||
@@ -105,9 +104,9 @@ int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32)));
|
||||
#ifdef DEBUG_CH
|
||||
|
||||
if (Ns==0)
|
||||
write_output("drs_seq0.m","drsseq0",ul_ref_sigs_rx[u][v][Msc_RS_idx],2*Msc_RS,2,1);
|
||||
LOG_M("drs_seq0.m","drsseq0",ul_ref_sigs_rx[u][v][Msc_RS_idx],2*Msc_RS,2,1);
|
||||
else
|
||||
write_output("drs_seq1.m","drsseq1",ul_ref_sigs_rx[u][v][Msc_RS_idx],2*Msc_RS,2,1);
|
||||
LOG_M("drs_seq1.m","drsseq1",ul_ref_sigs_rx[u][v][Msc_RS_idx],2*Msc_RS,2,1);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -228,7 +227,7 @@ int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32)));
|
||||
if((cyclic_shift != 0)) {
|
||||
// Compensating for the phase shift introduced at the transmitte
|
||||
#ifdef DEBUG_CH
|
||||
write_output("drs_est_pre.m","drsest_pre",ul_ch_estimates[0],300*12,1,1);
|
||||
LOG_M("drs_est_pre.m","drsest_pre",ul_ch_estimates[0],300*12,1,1);
|
||||
#endif
|
||||
|
||||
for(i=symbol_offset; i<symbol_offset+Msc_RS; i++) {
|
||||
@@ -251,7 +250,7 @@ int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32)));
|
||||
}
|
||||
|
||||
#ifdef DEBUG_CH
|
||||
write_output("drs_est_post.m","drsest_post",ul_ch_estimates[0],300*12,1,1);
|
||||
LOG_M("drs_est_post.m","drsest_post",ul_ch_estimates[0],300*12,1,1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -294,11 +293,11 @@ int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32)));
|
||||
|
||||
if (aa==1) {
|
||||
if (Ns == 0) {
|
||||
write_output("rxdataF_ext.m","rxF_ext",&rxdataF_ext[aa][symbol_offset],512*2,2,1);
|
||||
write_output("tmpin_ifft.m","drs_in",temp_in_ifft_0,512,1,1);
|
||||
write_output("drs_est0.m","drs0",ul_ch_estimates_time[aa],512,1,1);
|
||||
LOG_M("rxdataF_ext.m","rxF_ext",&rxdataF_ext[aa][symbol_offset],512*2,2,1);
|
||||
LOG_M("tmpin_ifft.m","drs_in",temp_in_ifft_0,512,1,1);
|
||||
LOG_M("drs_est0.m","drs0",ul_ch_estimates_time[aa],512,1,1);
|
||||
} else
|
||||
write_output("drs_est1.m","drs1",ul_ch_estimates_time[aa],512,1,1);
|
||||
LOG_M("drs_est1.m","drs1",ul_ch_estimates_time[aa],512,1,1);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -454,7 +453,7 @@ int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
&srs_vars->srs[eNB_id],
|
||||
0x7FFF,
|
||||
subframe)==-1) {
|
||||
LOG_E(PHY,"lte_srs_channel_estimation: Error in generate_srs_rx\n");
|
||||
LOG_E(PHY,"lte_srs_channel_estimation: Error in generate_srs\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
@@ -466,8 +465,8 @@ int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
srs_vars->srs_ch_estimates[aa]);
|
||||
#endif
|
||||
|
||||
//write_output("eNB_rxF.m","rxF",&common_vars->rxdataF[0][aa][2*frame_parms->ofdm_symbol_size*symbol],2*(frame_parms->ofdm_symbol_size),2,1);
|
||||
//write_output("eNB_srs.m","srs_eNB",common_vars->srs,(frame_parms->ofdm_symbol_size),1,1);
|
||||
//LOG_M("eNB_rxF.m","rxF",&common_vars->rxdataF[0][aa][2*frame_parms->ofdm_symbol_size*symbol],2*(frame_parms->ofdm_symbol_size),2,1);
|
||||
//LOG_M("eNB_srs.m","srs_eNB",common_vars->srs,(frame_parms->ofdm_symbol_size),1,1);
|
||||
|
||||
|
||||
mult_cpx_conj_vector((int16_t*) &common_vars->rxdataF[aa][2*frame_parms->ofdm_symbol_size*symbol],
|
||||
@@ -480,7 +479,7 @@ int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
#ifdef DEBUG_SRS
|
||||
sprintf(fname,"srs_ch_est%d.m",aa);
|
||||
sprintf(vname,"srs_est%d",aa);
|
||||
write_output(fname,vname,srs_vars->srs_ch_estimates[aa],frame_parms->ofdm_symbol_size,1,1);
|
||||
LOG_M(fname,vname,srs_vars->srs_ch_estimates[aa],frame_parms->ofdm_symbol_size,1,1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -256,9 +256,9 @@ int lte_dl_cell_spec_rx(PHY_VARS_UE *ue,
|
||||
|
||||
|
||||
|
||||
//extern int write_output(const char *,const char *,void *,int,int,char);
|
||||
//extern int LOG_M(const char *,const char *,void *,int,int,char);
|
||||
// flag change eren
|
||||
extern int write_output(const char *,const char *,void *,int,int,char);
|
||||
extern int LOG_M(const char *,const char *,void *,int,int,char);
|
||||
main()
|
||||
{
|
||||
|
||||
@@ -317,10 +317,10 @@ main()
|
||||
0);
|
||||
|
||||
|
||||
write_output("dl_cell_spec00.m","dl_cs00",output00,1024,1,1);
|
||||
write_output("dl_cell_spec01.m","dl_cs01",output01,1024,1,1);
|
||||
write_output("dl_cell_spec10.m","dl_cs10",output10,1024,1,1);
|
||||
write_output("dl_cell_spec11.m","dl_cs11",output11,1024,1,1);
|
||||
LOG_M("dl_cell_spec00.m","dl_cs00",output00,1024,1,1);
|
||||
LOG_M("dl_cell_spec01.m","dl_cs01",output01,1024,1,1);
|
||||
LOG_M("dl_cell_spec10.m","dl_cs10",output10,1024,1,1);
|
||||
LOG_M("dl_cell_spec11.m","dl_cs11",output11,1024,1,1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -317,9 +317,9 @@ int lte_dl_ue_spec_rx(PHY_VARS_UE *ue,
|
||||
|
||||
|
||||
|
||||
//extern int write_output(const char *,const char *,void *,int,int,char);
|
||||
//extern int LOG_M(const char *,const char *,void *,int,int,char);
|
||||
// flag change eren
|
||||
extern int write_output(const char *,const char *,void *,int,int,char);
|
||||
extern int LOG_M(const char *,const char *,void *,int,int,char);
|
||||
main()
|
||||
{
|
||||
|
||||
@@ -378,10 +378,10 @@ main()
|
||||
0);
|
||||
|
||||
|
||||
write_output("dl_ue_spec00.m","dl_cs00",output00,1024,1,1);
|
||||
write_output("dl_ue_spec01.m","dl_cs01",output01,1024,1,1);
|
||||
write_output("dl_ue_spec10.m","dl_cs10",output10,1024,1,1);
|
||||
write_output("dl_ue_spec11.m","dl_cs11",output11,1024,1,1);
|
||||
LOG_M("dl_ue_spec00.m","dl_cs00",output00,1024,1,1);
|
||||
LOG_M("dl_ue_spec01.m","dl_cs01",output01,1024,1,1);
|
||||
LOG_M("dl_ue_spec10.m","dl_cs10",output10,1024,1,1);
|
||||
LOG_M("dl_ue_spec11.m","dl_cs11",output11,1024,1,1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ N_{ID}^{cell = 0..503
|
||||
|
||||
void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14],uint16_t Nid_cell)
|
||||
{
|
||||
|
||||
unsigned char ns,l,Ncp=1-frame_parms->Ncp;
|
||||
unsigned int n,x1,x2;//,x1tmp,x2tmp;
|
||||
|
||||
@@ -54,7 +53,7 @@ void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14]
|
||||
|
||||
x2 = Ncp +
|
||||
(Nid_cell<<1) +
|
||||
(((1+(Nid_cell<<1))*(1 + (((frame_parms->Ncp==0)?4:3)*l) + (7*(1+ns))))<<10); //cinit
|
||||
(((1+(Nid_cell<<1))*(1 + (((frame_parms->Ncp==0)?4:3)*l) + (7*(1+ns))))<<10); //cinit
|
||||
//x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit
|
||||
//n = 0
|
||||
x1 = 1+ (1<<31);
|
||||
@@ -81,7 +80,7 @@ void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14]
|
||||
}
|
||||
}
|
||||
|
||||
void lte_gold_ue_spec(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_uespec_table[2][20][2][21],uint16_t Nid_cell, uint16_t *n_idDMRS)
|
||||
void lte_gold_ue_spec(uint32_t lte_gold_uespec_table[2][20][2][21],uint16_t Nid_cell, uint16_t *n_idDMRS)
|
||||
{
|
||||
|
||||
unsigned char ns,l;
|
||||
@@ -169,41 +168,6 @@ void lte_gold_ue_spec_port5(uint32_t lte_gold_uespec_port5_table[20][38],uint16_
|
||||
}
|
||||
}
|
||||
|
||||
/*! \brief gold sequenquence generator
|
||||
\param x1
|
||||
\param x2 this should be set to c_init if reset=1
|
||||
\param reset resets the generator
|
||||
\return 32 bits of the gold sequence
|
||||
*/
|
||||
unsigned int lte_gold_generic(unsigned int *x1, unsigned int *x2, unsigned char reset)
|
||||
{
|
||||
int n;
|
||||
|
||||
if (reset) {
|
||||
*x1 = 1+ (1<<31);
|
||||
*x2=*x2 ^ ((*x2 ^ (*x2>>1) ^ (*x2>>2) ^ (*x2>>3))<<31);
|
||||
|
||||
// skip first 50 double words (1600 bits)
|
||||
// printf("n=0 : x1 %x, x2 %x\n",x1,x2);
|
||||
for (n=1; n<50; n++) {
|
||||
*x1 = (*x1>>1) ^ (*x1>>4);
|
||||
*x1 = *x1 ^ (*x1<<31) ^ (*x1<<28);
|
||||
*x2 = (*x2>>1) ^ (*x2>>2) ^ (*x2>>3) ^ (*x2>>4);
|
||||
*x2 = *x2 ^ (*x2<<31) ^ (*x2<<30) ^ (*x2<<29) ^ (*x2<<28);
|
||||
}
|
||||
}
|
||||
|
||||
*x1 = (*x1>>1) ^ (*x1>>4);
|
||||
*x1 = *x1 ^ (*x1<<31) ^ (*x1<<28);
|
||||
*x2 = (*x2>>1) ^ (*x2>>2) ^ (*x2>>3) ^ (*x2>>4);
|
||||
*x2 = *x2 ^ (*x2<<31) ^ (*x2<<30) ^ (*x2<<29) ^ (*x2<<28);
|
||||
return(*x1^*x2);
|
||||
// printf("n=%d : c %x\n",n,x1^x2);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef LTE_GOLD_MAIN
|
||||
main()
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
\param reset resets the generator
|
||||
\return 32 bits of the gold sequence
|
||||
*/
|
||||
unsigned int lte_gold_generic(unsigned int *x1, unsigned int *x2, unsigned char reset);
|
||||
uint32_t lte_gold_generic(uint32_t *x1, uint32_t *x2, uint8_t reset);
|
||||
|
||||
|
||||
/*!\brief This function generates the LTE Gold sequence (36-211, Sec 7.2), specifically for DL reference signals.
|
||||
@@ -45,8 +45,7 @@ unsigned int lte_gold_generic(unsigned int *x1, unsigned int *x2, unsigned char
|
||||
@param Nid_cell Cell Id (to compute sequences for local and adjacent cells) */
|
||||
|
||||
void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14],uint16_t Nid_cell);
|
||||
|
||||
void lte_gold_ue_spec(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_uespec_table[2][20][2][21],uint16_t Nid_cell, uint16_t *n_idDMRS);
|
||||
void lte_gold_ue_spec(uint32_t lte_gold_uespec_table[2][20][2][21],uint16_t Nid_cell, uint16_t *n_idDMRS);
|
||||
|
||||
void lte_gold_ue_spec_port5(uint32_t lte_gold_uespec_port5_table[20][38],uint16_t Nid_cell, uint16_t n_rnti);
|
||||
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
#include "transport_common_proto.h"
|
||||
#include "assertions.h"
|
||||
#include "T.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_extern.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
|
||||
@@ -57,8 +57,8 @@
|
||||
|
||||
|
||||
|
||||
static uint8_t d[3*(MAX_DCI_SIZE_BITS + 16) + 96];
|
||||
static uint8_t w[3*3*(MAX_DCI_SIZE_BITS+16)];
|
||||
//static uint8_t d[3*(MAX_DCI_SIZE_BITS + 16) + 96];
|
||||
//static uint8_t w[3*3*(MAX_DCI_SIZE_BITS+16)];
|
||||
|
||||
void dci_encoding(uint8_t *a,
|
||||
uint8_t A,
|
||||
@@ -70,6 +70,8 @@ void dci_encoding(uint8_t *a,
|
||||
|
||||
uint8_t D = (A + 16);
|
||||
uint32_t RCC;
|
||||
uint8_t d[3*(MAX_DCI_SIZE_BITS + 16) + 96];
|
||||
uint8_t w[3*3*(MAX_DCI_SIZE_BITS+16)];
|
||||
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
int32_t i;
|
||||
@@ -119,7 +121,7 @@ uint8_t *generate_dci0(uint8_t *dci,
|
||||
(aggregation_level==2) ||
|
||||
(aggregation_level==4) ||
|
||||
(aggregation_level==8)
|
||||
#ifdef Rel14 // Added for EPDCCH/MPDCCH
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) // Added for EPDCCH/MPDCCH
|
||||
||
|
||||
(aggregation_level==16) ||
|
||||
(aggregation_level==24) ||
|
||||
@@ -169,7 +171,7 @@ uint8_t *generate_dci0(uint8_t *dci,
|
||||
return(e+coded_bits);
|
||||
}
|
||||
|
||||
uint32_t Y;
|
||||
//uint32_t Y;
|
||||
|
||||
|
||||
|
||||
@@ -368,16 +370,12 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
||||
|
||||
if (dci_alloc[i].L == (uint8_t)L) {
|
||||
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
if (dci_alloc[i].rnti==0x1234)
|
||||
LOG_D(PHY,"Generating DCI %d/%d (nCCE %d) of length %d, aggregation %d (%x), rnti %x\n",i,num_dci,dci_alloc[i].firstCCE,dci_alloc[i].dci_length,dci_alloc[i].L,
|
||||
LOG_D(PHY,"Generating DCI %d/%d (nCCE %d) of length %d, aggregation %d (%x), rnti %x\n",
|
||||
i,num_dci,dci_alloc[i].firstCCE,dci_alloc[i].dci_length,dci_alloc[i].L,
|
||||
*(unsigned int*)dci_alloc[i].dci_pdu,
|
||||
dci_alloc[i].rnti);
|
||||
dump_dci(frame_parms,&dci_alloc[i]);
|
||||
#endif
|
||||
|
||||
if (dci_alloc[i].firstCCE>=0) {
|
||||
//printf("generate DCI .%d rnti %d length %d\n", subframe, dci_alloc[i].rnti, dci_alloc[i].dci_length);
|
||||
e_ptr = generate_dci0(dci_alloc[i].dci_pdu,
|
||||
e+(72*dci_alloc[i].firstCCE),
|
||||
dci_alloc[i].dci_length,
|
||||
|
||||
@@ -48,10 +48,10 @@
|
||||
#include "dci_tools_common_extern.h"
|
||||
#include "transport_proto.h"
|
||||
|
||||
int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
|
||||
int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
|
||||
{
|
||||
uint8_t i;
|
||||
int8_t first_free_index=-1;
|
||||
uint16_t i;
|
||||
int16_t first_free_index=-1;
|
||||
|
||||
AssertFatal(eNB!=NULL,"eNB is null\n");
|
||||
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
|
||||
@@ -68,10 +68,10 @@ int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
|
||||
return first_free_index;
|
||||
}
|
||||
|
||||
int8_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
|
||||
int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
|
||||
{
|
||||
uint8_t i;
|
||||
int8_t first_free_index=-1;
|
||||
uint16_t i;
|
||||
int16_t first_free_index=-1;
|
||||
|
||||
AssertFatal(eNB!=NULL,"eNB is null\n");
|
||||
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
|
||||
@@ -270,8 +270,12 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
|
||||
if ((rel8->rnti_type == 2 ) && (rel8->rnti != SI_RNTI) && (rel8->rnti != P_RNTI)) dci_alloc->ra_flag = 1;
|
||||
|
||||
UE_id = find_dlsch(rel8->rnti,eNB,SEARCH_EXIST_OR_FREE);
|
||||
AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n");
|
||||
AssertFatal(UE_id<NUMBER_OF_UE_MAX,"returned UE_id %d >= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX);
|
||||
if( (UE_id<0) || (UE_id>=NUMBER_OF_UE_MAX) ){
|
||||
LOG_E(PHY,"illegal UE_id found!!! rnti %04x UE_id %d\n",rel8->rnti,UE_id);
|
||||
return;
|
||||
}
|
||||
//AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n");
|
||||
//AssertFatal(UE_id<NUMBER_OF_UE_MAX,"returned UE_id %d >= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX);
|
||||
dlsch0 = eNB->dlsch[UE_id][0];
|
||||
dlsch1 = eNB->dlsch[UE_id][1];
|
||||
|
||||
@@ -303,7 +307,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
|
||||
}
|
||||
dlsch0_harq->ndi = rel8->new_data_indicator_1;
|
||||
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
#endif
|
||||
if (rel8->rnti_type == 2)
|
||||
dlsch0_harq->round = 0;
|
||||
|
||||
@@ -480,10 +488,14 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
|
||||
dlsch0_harq->mcs = rel8->mcs_1;
|
||||
dlsch0_harq->Qm = 2;
|
||||
dlsch0_harq->TBS = TBStable[I_mcs][NPRB-1];
|
||||
dlsch0->harq_ids[subframe] = rel8->harq_process;
|
||||
dlsch0->harq_ids[frame%2][subframe] = rel8->harq_process;
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
#endif
|
||||
dlsch0->rnti = rel8->rnti;
|
||||
dlsch0->harq_ids[subframe] = rel8->harq_process;
|
||||
//dlsch0->harq_ids[subframe] = rel8->harq_process;
|
||||
if (dlsch0_harq->round == 0)
|
||||
dlsch0_harq->status = ACTIVE;
|
||||
|
||||
@@ -495,7 +507,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
|
||||
case NFAPI_DL_DCI_FORMAT_1:
|
||||
|
||||
dci_alloc->format = format1;
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
#endif
|
||||
|
||||
LOG_D(PHY,"SFN/SF:%04d%d proc:TX:SFN/SF:%04d%d: Programming DLSCH for Format 1 DCI, harq_pid %d\n",frame,subframe,proc->frame_tx,subframe,rel8->harq_process);
|
||||
|
||||
@@ -640,7 +656,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
|
||||
|
||||
dlsch0_harq->dl_power_off = 1;
|
||||
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -656,7 +676,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
|
||||
}
|
||||
|
||||
LOG_D(PHY,"DCI: Set harq_ids[%d] to %d (%p)\n",subframe,rel8->harq_process,dlsch0);
|
||||
dlsch0->harq_ids[subframe] = rel8->harq_process;
|
||||
dlsch0->harq_ids[frame%2][subframe] = rel8->harq_process;
|
||||
|
||||
dlsch0->harq_mask |= (1<<rel8->harq_process);
|
||||
|
||||
@@ -823,8 +843,8 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
|
||||
|
||||
dlsch0->subframe_tx[subframe] = 1;
|
||||
|
||||
dlsch0->harq_ids[subframe] = rel8->harq_process;
|
||||
dlsch1->harq_ids[subframe] = rel8->harq_process;
|
||||
dlsch0->harq_ids[frame%2][subframe] = rel8->harq_process;
|
||||
dlsch1->harq_ids[frame%2][subframe] = rel8->harq_process;
|
||||
// printf("Setting DLSCH harq id %d to subframe %d\n",harq_pid,subframe);
|
||||
|
||||
|
||||
@@ -851,19 +871,32 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
|
||||
// assume both TBs are active
|
||||
dlsch0_harq->Nl = 1;
|
||||
dlsch1_harq->Nl = 1;
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
dlsch1->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
dlsch1->active = 1;
|
||||
#endif
|
||||
dlsch0->harq_mask |= (1<<rel8->harq_process);
|
||||
dlsch1->harq_mask |= (1<<rel8->harq_process);
|
||||
|
||||
// check if either TB is disabled (see 36-213 V11.3 Section )
|
||||
if ((dlsch0_harq->rvidx == 1) && (dlsch0_harq->mcs == 0)) {
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 0;
|
||||
#else
|
||||
dlsch0->active = 0;
|
||||
#endif
|
||||
dlsch0->harq_mask &= ~(1<<rel8->harq_process);
|
||||
}
|
||||
|
||||
if ((dlsch1_harq->rvidx == 1) && (dlsch1_harq->mcs == 0)) {
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch1->active[subframe]= 0;
|
||||
#else
|
||||
dlsch1->active = 0;
|
||||
#endif
|
||||
dlsch1->harq_mask &= ~(1<<rel8->harq_process);
|
||||
}
|
||||
|
||||
@@ -875,8 +908,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
|
||||
dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][dlsch0_harq->nb_rb-1];
|
||||
dlsch1_harq->TBS = TBStable[get_I_TBS(dlsch1_harq->mcs)][dlsch0_harq->nb_rb-1];
|
||||
|
||||
#ifdef PHY_TX_THREAD
|
||||
if ((dlsch0->active[subframe]==1) && (dlsch1->active[subframe]==1)) {
|
||||
#else
|
||||
if ((dlsch0->active==1) && (dlsch1->active==1)) {
|
||||
|
||||
#endif
|
||||
dlsch0_harq->mimo_mode = LARGE_CDD;
|
||||
dlsch1_harq->mimo_mode = LARGE_CDD;
|
||||
dlsch0_harq->dl_power_off = 1;
|
||||
@@ -886,7 +922,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
|
||||
dlsch1_harq->mimo_mode = ALAMOUTI;
|
||||
}
|
||||
} else if (fp->nb_antenna_ports_eNB == 4) { // 4 antenna case
|
||||
#ifdef PHY_TX_THREAD
|
||||
if ((dlsch0->active[subframe]==1) && (dlsch1->active[subframe]==1)) {
|
||||
#else
|
||||
if ((dlsch0->active==1) && (dlsch1->active==1)) {
|
||||
#endif
|
||||
switch (rel8->precoding_information) {
|
||||
case 0: // one layer per transport block
|
||||
dlsch0_harq->mimo_mode = LARGE_CDD;
|
||||
@@ -926,7 +966,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
|
||||
LOG_E(PHY,"Illegal value (3) for TPMI in Format 2A DCI\n");
|
||||
break;
|
||||
}
|
||||
#ifdef PHY_TX_THREAD
|
||||
} else if (dlsch0->active[subframe] == 1) {
|
||||
#else
|
||||
} else if (dlsch0->active == 1) {
|
||||
#endif
|
||||
switch (rel8->precoding_information) {
|
||||
case 0: // one layer per transport block
|
||||
dlsch0_harq->mimo_mode = ALAMOUTI;
|
||||
@@ -946,7 +990,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
|
||||
LOG_E(PHY,"Illegal value %d for TPMI in Format 2A DCI with one transport block enabled\n",rel8->precoding_information);
|
||||
break;
|
||||
}
|
||||
#ifdef PHY_TX_THREAD
|
||||
} else if (dlsch1->active[subframe] == 1) {
|
||||
#else
|
||||
} else if (dlsch1->active == 1) {
|
||||
#endif
|
||||
switch (rel8->precoding_information) {
|
||||
case 0: // one layer per transport block
|
||||
dlsch0_harq->mimo_mode = ALAMOUTI;
|
||||
@@ -972,10 +1020,18 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
|
||||
}
|
||||
|
||||
// reset HARQ process if this is the first transmission
|
||||
#ifdef PHY_TX_THREAD
|
||||
if ((dlsch0->active[subframe]==1) && (dlsch0_harq->round == 0))
|
||||
#else
|
||||
if ((dlsch0->active==1) && (dlsch0_harq->round == 0))
|
||||
#endif
|
||||
dlsch0_harq->status = ACTIVE;
|
||||
|
||||
#ifdef PHY_TX_THREAD
|
||||
if ((dlsch1->active[subframe]==1) && (dlsch1_harq->round == 0))
|
||||
#else
|
||||
if ((dlsch1->active==1) && (dlsch1_harq->round == 0))
|
||||
#endif
|
||||
dlsch1_harq->status = ACTIVE;
|
||||
|
||||
dlsch0->rnti = rel8->rnti;
|
||||
@@ -1149,8 +1205,13 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
|
||||
printf("RV0 = %d, RV1 = %d. MCS0 = %d, MCS1=%d\n", rel8->redundancy_version_1, rel8->redundancy_version_2, rel8->mcs_1, rel8->mcs_2);
|
||||
#endif
|
||||
if (TB0_active && TB1_active && rel8->transport_block_to_codeword_swap_flag==0) {
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
dlsch1->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
dlsch1->active = 1;
|
||||
#endif
|
||||
dlsch0->harq_mask |= (1<<rel8->harq_process);
|
||||
dlsch1->harq_mask |= (1<<rel8->harq_process);
|
||||
dlsch0_harq = dlsch0->harq_processes[rel8->harq_process];
|
||||
@@ -1172,8 +1233,13 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
|
||||
else if (TB0_active && TB1_active && rel8->transport_block_to_codeword_swap_flag==1) {
|
||||
dlsch0 = eNB->dlsch[UE_id][1];
|
||||
dlsch1 = eNB->dlsch[UE_id][0];
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
dlsch1->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
dlsch1->active = 1;
|
||||
#endif
|
||||
|
||||
dlsch0->harq_mask |= (1<<rel8->harq_process);
|
||||
dlsch1->harq_mask |= (1<<rel8->harq_process);
|
||||
@@ -1191,7 +1257,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
|
||||
dlsch1_harq->codeword=0;
|
||||
}
|
||||
else if (TB0_active && (TB1_active==0)) {
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
#endif
|
||||
dlsch0->harq_mask |= (1<<rel8->harq_process);
|
||||
dlsch0_harq = dlsch0->harq_processes[rel8->harq_process];
|
||||
dlsch0_harq->mcs = rel8->mcs_1;
|
||||
@@ -1206,7 +1276,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
|
||||
#endif
|
||||
}
|
||||
else if ((TB0_active==0) && TB1_active) {
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch1->active[subframe] = 1;
|
||||
#else
|
||||
dlsch1->active = 1;
|
||||
#endif
|
||||
dlsch1->harq_mask |= (1<<rel8->harq_process);
|
||||
dlsch1_harq = dlsch1->harq_processes[rel8->harq_process];
|
||||
dlsch1_harq->mcs = rel8->mcs_2;
|
||||
@@ -1224,11 +1298,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
|
||||
if (dlsch0 != NULL){
|
||||
dlsch0->subframe_tx[subframe] = 1;
|
||||
|
||||
dlsch0->harq_ids[subframe] = rel8->harq_process;
|
||||
dlsch0->harq_ids[frame%2][subframe] = rel8->harq_process;
|
||||
}
|
||||
|
||||
if (dlsch1_harq != NULL){
|
||||
dlsch1->harq_ids[subframe] = rel8->harq_process;
|
||||
dlsch1->harq_ids[frame%2][subframe] = rel8->harq_process;
|
||||
}
|
||||
|
||||
|
||||
@@ -1439,6 +1513,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
|
||||
LTE_DL_eNB_HARQ_t *dlsch0_harq=NULL;
|
||||
int UE_id;
|
||||
int subframe = proc->subframe_tx;
|
||||
int frame = proc->frame_tx;
|
||||
|
||||
dci_alloc->firstCCE = rel13->ecce_index;
|
||||
dci_alloc->L = rel13->aggregation_level;
|
||||
@@ -1457,8 +1532,12 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
|
||||
if (rel13->rnti_type == 2 ) dci_alloc->ra_flag = 1;
|
||||
|
||||
UE_id = find_dlsch(rel13->rnti,eNB,SEARCH_EXIST_OR_FREE);
|
||||
AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n");
|
||||
AssertFatal(UE_id<NUMBER_OF_UE_MAX,"returned UE_id %d >= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX);
|
||||
if( (UE_id<0) || (UE_id>=NUMBER_OF_UE_MAX) ){
|
||||
LOG_E(PHY,"illegal UE_id found!!! rnti %04x UE_id %d\n",rel13->rnti,UE_id);
|
||||
return;
|
||||
}
|
||||
//AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n");
|
||||
//AssertFatal(UE_id<NUMBER_OF_UE_MAX,"returned UE_id %d >= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX);
|
||||
dlsch0 = eNB->dlsch[UE_id][0];
|
||||
dlsch0_harq = dlsch0->harq_processes[rel13->harq_process];
|
||||
|
||||
@@ -1470,7 +1549,11 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
|
||||
|
||||
case 10: // Format 6-1A
|
||||
dci_alloc->format = format6_1A;
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
#endif
|
||||
switch (fp->N_RB_DL) {
|
||||
|
||||
case 25:
|
||||
@@ -1526,7 +1609,11 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
|
||||
break;
|
||||
case 11: // Format 6-1B
|
||||
dci_alloc->format = format6_1B;
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
#endif
|
||||
switch (fp->N_RB_DL) {
|
||||
|
||||
case 25:
|
||||
@@ -1569,7 +1656,11 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
|
||||
}
|
||||
case 12: // Format 6-2
|
||||
dci_alloc->format = format6_2;
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
#endif
|
||||
switch (fp->N_RB_DL) {
|
||||
case 25:
|
||||
dci_alloc->dci_length = sizeof_DCI6_2_5MHz_t;
|
||||
@@ -1652,8 +1743,12 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
|
||||
//LOG_E(PHY,"Invalid beamforming mode %dL\n", beamforming_mode);
|
||||
|
||||
dlsch0_harq->dl_power_off = 1;
|
||||
|
||||
|
||||
#ifdef PHY_TX_THREAD
|
||||
dlsch0->active[subframe] = 1;
|
||||
#else
|
||||
dlsch0->active = 1;
|
||||
#endif
|
||||
dlsch0->harq_mask |= (1<<rel13->harq_process);
|
||||
|
||||
|
||||
@@ -1666,7 +1761,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
|
||||
|
||||
}
|
||||
|
||||
dlsch0->harq_ids[subframe] = rel13->harq_process;
|
||||
dlsch0->harq_ids[frame%2][subframe] = rel13->harq_process;
|
||||
|
||||
|
||||
|
||||
@@ -1697,6 +1792,8 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc,
|
||||
|
||||
uint32_t ndi = pdu->dci_pdu_rel8.new_data_indication_1;
|
||||
|
||||
uint16_t UE_id = -1;
|
||||
|
||||
#ifdef T_TRACER
|
||||
T(T_ENB_PHY_ULSCH_UE_DCI, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe),
|
||||
T_INT(pdu->dci_pdu_rel8.rnti), T_INT(((frame*10+subframe+4) % 8) /* TODO: correct harq pid */),
|
||||
@@ -1842,16 +1939,23 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc,
|
||||
DevParam (frame_parms->N_RB_DL, 0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
if(frame_parms->frame_type == TDD){
|
||||
UE_id = find_ulsch(pdu->dci_pdu_rel8.rnti, eNB,SEARCH_EXIST_OR_FREE);
|
||||
if(UE_id != -1){
|
||||
eNB->ulsch[UE_id]->harq_processes[pdu->dci_pdu_rel8.harq_pid]->V_UL_DAI = dai +1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame,int subframe)
|
||||
void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame,int subframe)
|
||||
{
|
||||
uint8_t harq_pid;
|
||||
uint8_t UE_id;
|
||||
//uint8_t UE_id;
|
||||
boolean_t new_ulsch = (find_ulsch(ulsch_pdu->ulsch_pdu_rel8.rnti,eNB,SEARCH_EXIST)==-1) ? TRUE : FALSE;
|
||||
|
||||
AssertFatal((UE_id=find_ulsch(ulsch_pdu->ulsch_pdu_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE))>=0,
|
||||
"No existing/free UE ULSCH for rnti %x\n",ulsch_pdu->ulsch_pdu_rel8.rnti);
|
||||
//AssertFatal((UE_id=find_ulsch(ulsch_pdu->ulsch_pdu_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE))>=0,
|
||||
// "No existing/free UE ULSCH for rnti %x\n",ulsch_pdu->ulsch_pdu_rel8.rnti);
|
||||
|
||||
LTE_eNB_ULSCH_t *ulsch=eNB->ulsch[UE_id];
|
||||
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
|
||||
@@ -1869,7 +1973,10 @@ void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame
|
||||
ulsch->harq_processes[harq_pid]->first_rb = ulsch_pdu->ulsch_pdu_rel8.resource_block_start;
|
||||
ulsch->harq_processes[harq_pid]->nb_rb = ulsch_pdu->ulsch_pdu_rel8.number_of_resource_blocks;
|
||||
|
||||
AssertFatal(ulsch->harq_processes[harq_pid]->nb_rb>0,"nb_rb = 0\n");
|
||||
//AssertFatal(ulsch->harq_processes[harq_pid]->nb_rb>0,"nb_rb = 0\n");
|
||||
if(ulsch->harq_processes[harq_pid]->nb_rb == 0){
|
||||
LOG_E(PHY, "fill_ulsch UE_id %d nb_rb = 0\n", UE_id);
|
||||
}
|
||||
|
||||
ulsch->harq_processes[harq_pid]->dci_alloc = 1;
|
||||
ulsch->harq_processes[harq_pid]->rar_alloc = 0;
|
||||
@@ -1896,14 +2003,16 @@ void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame
|
||||
else if(ulsch->harq_processes[harq_pid]->n_DMRS == 7)
|
||||
ulsch->harq_processes[harq_pid]->n_DMRS2 = 9;
|
||||
|
||||
LOG_D(PHY,"[eNB %d][PUSCH %d] Frame %d, Subframe %d Programming PUSCH with n_DMRS2 %d (cshift %d) ulsch:ndi:%d ulsch_pdu:ndi:%d new_ulsch:%d status:%d ulsch_pdu:rvidx:%d\n",
|
||||
LOG_D(PHY,"[eNB %d][PUSCH %d] Frame %d, Subframe %d Programming PUSCH with n_DMRS2 %d (cshift %d) ulsch:ndi:%d ulsch_pdu:ndi:%d new_ulsch:%d status:%d ulsch_pdu:rvidx:%d ulsch_pdu->ulsch_pdu_rel8.size %d\n",
|
||||
eNB->Mod_id,harq_pid,frame,subframe,
|
||||
ulsch->harq_processes[harq_pid]->n_DMRS2,
|
||||
ulsch->harq_processes[harq_pid]->n_DMRS,
|
||||
ulsch->harq_processes[harq_pid]->ndi, ulsch_pdu->ulsch_pdu_rel8.new_data_indication, new_ulsch, ulsch->harq_processes[harq_pid]->status,
|
||||
ulsch_pdu->ulsch_pdu_rel8.redundancy_version);
|
||||
ulsch_pdu->ulsch_pdu_rel8.redundancy_version,
|
||||
ulsch_pdu->ulsch_pdu_rel8.size);
|
||||
|
||||
ulsch->harq_processes[harq_pid]->rvidx = ulsch_pdu->ulsch_pdu_rel8.redundancy_version;
|
||||
if(ulsch_pdu->ulsch_pdu_rel8.modulation_type!=0)
|
||||
ulsch->harq_processes[harq_pid]->Qm = ulsch_pdu->ulsch_pdu_rel8.modulation_type;
|
||||
// Set O_ACK to 0 by default, will be set of DLSCH is scheduled and needs to be
|
||||
ulsch->harq_processes[harq_pid]->O_ACK = 0;
|
||||
@@ -1924,9 +2033,12 @@ void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame
|
||||
// will be set if MAC has activated ULSCH_CQI_RI_PDU or ULSCH_CQI_HARQ_RI_PDU
|
||||
ulsch->harq_processes[harq_pid]->Or1 = 0;
|
||||
ulsch->harq_processes[harq_pid]->Or2 = 0;
|
||||
}
|
||||
else ulsch->harq_processes[harq_pid]->round++;
|
||||
|
||||
}
|
||||
else {
|
||||
ulsch->harq_processes[harq_pid]->round++;
|
||||
ulsch->harq_processes[harq_pid]->TBS = ulsch_pdu->ulsch_pdu_rel8.size<<3;
|
||||
ulsch->harq_processes[harq_pid]->Msc_initial = 12*ulsch_pdu->ulsch_pdu_rel8.number_of_resource_blocks;
|
||||
}
|
||||
ulsch->rnti = ulsch_pdu->ulsch_pdu_rel8.rnti;
|
||||
LOG_D(PHY,"Filling ULSCH %x (UE_id %d) (new_ulsch %d) for Frame %d, Subframe %d : harq_pid %d, status %d, handled %d, first_rb %d, nb_rb %d, rvidx %d, Qm %d, TBS %d, round %d \n",
|
||||
ulsch->rnti,
|
||||
|
||||
@@ -165,49 +165,6 @@ int8_t delta_PUSCH_acc[4] = {-1,0,1,3};
|
||||
|
||||
int8_t *delta_PUCCH_lut = delta_PUSCH_acc;
|
||||
|
||||
uint8_t get_pmi(uint8_t N_RB_DL, MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb)
|
||||
{
|
||||
/*
|
||||
MIMO_mode_t mode = dlsch_harq->mimo_mode;
|
||||
uint32_t pmi_alloc = dlsch_harq->pmi_alloc;
|
||||
*/
|
||||
|
||||
switch (N_RB_DL) {
|
||||
case 6: // 1 PRB per subband
|
||||
if (mode <= PUSCH_PRECODING1)
|
||||
return((pmi_alloc>>(rb<<1))&3);
|
||||
else
|
||||
return((pmi_alloc>>rb)&1);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
case 25: // 4 PRBs per subband
|
||||
if (mode <= PUSCH_PRECODING1)
|
||||
return((pmi_alloc>>((rb>>2)<<1))&3);
|
||||
else
|
||||
return((pmi_alloc>>(rb>>2))&1);
|
||||
|
||||
break;
|
||||
|
||||
case 50: // 6 PRBs per subband
|
||||
if (mode <= PUSCH_PRECODING1)
|
||||
return((pmi_alloc>>((rb/6)<<1))&3);
|
||||
else
|
||||
return((pmi_alloc>>(rb/6))&1);
|
||||
|
||||
break;
|
||||
|
||||
case 100: // 8 PRBs per subband
|
||||
if (mode <= PUSCH_PRECODING1)
|
||||
return((pmi_alloc>>((rb>>3)<<1))&3);
|
||||
else
|
||||
return((pmi_alloc>>(rb>>3))&1);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t check_phich_reg(LTE_DL_FRAME_PARMS *frame_parms,uint32_t kprime,uint8_t lprime,uint8_t mi)
|
||||
{
|
||||
|
||||
@@ -330,7 +287,7 @@ void conv_eMTC_rballoc(uint16_t resource_block_coding,
|
||||
uint32_t N_RB_DL,
|
||||
uint32_t *rb_alloc) {
|
||||
|
||||
|
||||
|
||||
int narrowband = resource_block_coding>>5;
|
||||
int RIV = resource_block_coding&31;
|
||||
int N_NB_DL = N_RB_DL/6;
|
||||
@@ -346,7 +303,7 @@ void conv_eMTC_rballoc(uint16_t resource_block_coding,
|
||||
rb_alloc[2] = 0;
|
||||
rb_alloc[3] = 0;
|
||||
rb_alloc[ind] = alloc<<ind_mod;
|
||||
if (ind_mod > 26) rb_alloc[ind+1] = alloc>>(6-(ind_mod-26));
|
||||
if (ind_mod > 26) rb_alloc[ind+1] = alloc>>(6-(ind_mod-26));
|
||||
}
|
||||
|
||||
void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t *rb_alloc2)
|
||||
@@ -400,28 +357,36 @@ void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t
|
||||
break;
|
||||
|
||||
case 50:
|
||||
AssertFatal(ra_header==0,"resource type 1 not supported for N_RB_DL=50\n");
|
||||
if (ra_header==0) {
|
||||
|
||||
for (i=16; i>0; i--) {
|
||||
if ((rb_alloc&(1<<i)) != 0)
|
||||
rb_alloc2[(3*(16-i))>>5] |= (7<<((3*(16-i))%32));
|
||||
for (i=16; i>0; i--) {
|
||||
if ((rb_alloc&(1<<i)) != 0)
|
||||
rb_alloc2[(3*(16-i))>>5] |= (7<<((3*(16-i))%32));
|
||||
}
|
||||
|
||||
// bit mask across
|
||||
if ((rb_alloc2[0]>>31)==1)
|
||||
rb_alloc2[1] |= 1;
|
||||
|
||||
if ((rb_alloc&1) != 0)
|
||||
rb_alloc2[1] |= (3<<16);
|
||||
}
|
||||
else {
|
||||
LOG_W(PHY,"resource type 1 not supported for N_RB_DL=50\n");
|
||||
}
|
||||
|
||||
// bit mask across
|
||||
if ((rb_alloc2[0]>>31)==1)
|
||||
rb_alloc2[1] |= 1;
|
||||
|
||||
if ((rb_alloc&1) != 0)
|
||||
rb_alloc2[1] |= (3<<16);
|
||||
break;
|
||||
|
||||
case 100:
|
||||
AssertFatal(ra_header==0,"resource type 1 not supported for N_RB_DL=100\n");
|
||||
for (i=0; i<25; i++) {
|
||||
if ((rb_alloc&(1<<(24-i))) != 0)
|
||||
rb_alloc2[(4*i)>>5] |= (0xf<<((4*i)%32));
|
||||
|
||||
// printf("rb_alloc2[%d] (type 0) %x (%d)\n",(4*i)>>5,rb_alloc2[(4*i)>>5],rb_alloc&(1<<i));
|
||||
if (ra_header==0) {
|
||||
for (i=0; i<25; i++) {
|
||||
if ((rb_alloc&(1<<(24-i))) != 0)
|
||||
rb_alloc2[(4*i)>>5] |= (0xf<<((4*i)%32));
|
||||
|
||||
// printf("rb_alloc2[%d] (type 0) %x (%d)\n",(4*i)>>5,rb_alloc2[(4*i)>>5],rb_alloc&(1<<i));
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOG_W(PHY,"resource type 1 not supported for N_RB_DL=100\n");
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -979,28 +944,23 @@ uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t
|
||||
} else {
|
||||
|
||||
switch (frame_parms->tdd_config) {
|
||||
|
||||
case 1:
|
||||
if ((subframe==2) ||
|
||||
(subframe==3) ||
|
||||
(subframe==7) ||
|
||||
(subframe==8))
|
||||
switch (subframe) {
|
||||
case 2:
|
||||
case 3:
|
||||
ret = (subframe-2);
|
||||
break;
|
||||
switch (subframe) {
|
||||
case 2:
|
||||
case 3:
|
||||
ret = (subframe-2);
|
||||
break;
|
||||
|
||||
case 7:
|
||||
case 8:
|
||||
ret = (subframe-5);
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
ret = (subframe-5);
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config);
|
||||
ret = (255);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config);
|
||||
ret = (255);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -1052,10 +1012,13 @@ uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n)
|
||||
uint8_t ul_subframe = 255;
|
||||
|
||||
if ((frame_parms->frame_type == TDD) &&
|
||||
(frame_parms->tdd_config == 1) &&
|
||||
((n==1)||(n==6))) // tdd_config 0,1 SF 1,5
|
||||
ul_subframe = ((n+6)%10);
|
||||
else if ((frame_parms->frame_type == TDD) &&
|
||||
(frame_parms->tdd_config == 1)) {
|
||||
if ((n==1)||(n==6)) { // tdd_config 0,1 SF 1,5
|
||||
ul_subframe = ((n+6)%10);
|
||||
} else if ((n==4)||(n==9)) {
|
||||
ul_subframe = ((n+4)%10);
|
||||
}
|
||||
} else if ((frame_parms->frame_type == TDD) &&
|
||||
(frame_parms->tdd_config == 6) &&
|
||||
((n==0)||(n==1)||(n==5)||(n==6)))
|
||||
ul_subframe = ((n+7)%10);
|
||||
@@ -1063,10 +1026,10 @@ uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n)
|
||||
(frame_parms->tdd_config == 6) &&
|
||||
(n==9)) // tdd_config 6 SF 9
|
||||
ul_subframe = ((n+5)%10);
|
||||
else
|
||||
else
|
||||
ul_subframe = ((n+4)%10);
|
||||
|
||||
AssertFatal(frame_parms->frame_type == FDD || subframe_select(frame_parms,ul_subframe) == SF_UL,"illegal ul_subframe %d (n %d)\n",ul_subframe,n);
|
||||
if ( (subframe_select(frame_parms,ul_subframe) != SF_UL) && (frame_parms->frame_type == TDD)) return(255);
|
||||
|
||||
LOG_D(PHY, "subframe %d: PUSCH subframe = %d\n", n, ul_subframe);
|
||||
return ul_subframe;
|
||||
@@ -1075,10 +1038,13 @@ uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n)
|
||||
uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n)
|
||||
{
|
||||
if ((frame_parms->frame_type == TDD) &&
|
||||
(frame_parms->tdd_config == 1) &&
|
||||
((n==7)||(n==2))) // tdd_config 0,1 SF 1,5
|
||||
return((n==7)? 1 : 6);
|
||||
else if ((frame_parms->frame_type == TDD) &&
|
||||
(frame_parms->tdd_config == 1)) {
|
||||
if ((n==7)||(n==2)) { // tdd_config 0,1 SF 1,5
|
||||
return((n==7)? 1 : 6);
|
||||
} else if ((n==3)||(n==8)) {
|
||||
return((n==3)? 9 : 4);
|
||||
}
|
||||
} else if ((frame_parms->frame_type == TDD) &&
|
||||
(frame_parms->tdd_config == 6) &&
|
||||
((n==7)||(n==8)||(n==2)||(n==3)))
|
||||
return((n+3)%10);
|
||||
@@ -1088,6 +1054,9 @@ uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t
|
||||
return(9);
|
||||
else
|
||||
return((n+6)%10);
|
||||
|
||||
LOG_E(PHY, "%s %s:%i pdcch allocation error\n",__FUNCTION__,__FILE__,__LINE__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t pdcch_alloc2ul_frame(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t n)
|
||||
@@ -1096,9 +1065,9 @@ uint32_t pdcch_alloc2ul_frame(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, ui
|
||||
|
||||
if ((frame_parms->frame_type == TDD) &&
|
||||
(frame_parms->tdd_config == 1) &&
|
||||
((n==1)||(n==6))) // tdd_config 0,1 SF 1,5
|
||||
ul_frame = (frame + (n==1 ? 0 : 1));
|
||||
else if ((frame_parms->frame_type == TDD) &&
|
||||
((n==1)||(n==6)||(n==4)||(n==9))) { // tdd_config 0,1 SF 1,5
|
||||
ul_frame = (frame + (n < 5 ? 0 : 1));
|
||||
} else if ((frame_parms->frame_type == TDD) &&
|
||||
(frame_parms->tdd_config == 6) &&
|
||||
((n==0)||(n==1)||(n==5)||(n==6)))
|
||||
ul_frame = (frame + (n>=5 ? 1 : 0));
|
||||
|
||||
@@ -38,8 +38,8 @@
|
||||
#include "PHY/LTE_TRANSPORT/transport_eNB.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
||||
#include "SCHED/sched_eNB.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include <syscall.h>
|
||||
#include "targets/RT/USER/rt_wrapper.h"
|
||||
|
||||
@@ -148,8 +148,8 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
|
||||
|
||||
}*/
|
||||
|
||||
for (i=0; i<10; i++)
|
||||
dlsch->harq_ids[i] = Mdlharq;
|
||||
for (i=0; i<20; i++)
|
||||
dlsch->harq_ids[i/10][i%10] = Mdlharq;
|
||||
|
||||
for (i=0; i<Mdlharq; i++) {
|
||||
dlsch->harq_processes[i] = (LTE_DL_eNB_HARQ_t *)malloc16(sizeof(LTE_DL_eNB_HARQ_t));
|
||||
@@ -227,11 +227,16 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch)
|
||||
if (dlsch) {
|
||||
Mdlharq = dlsch->Mdlharq;
|
||||
dlsch->rnti = 0;
|
||||
#ifdef PHY_TX_THREAD
|
||||
for (i=0; i<10; i++)
|
||||
dlsch->active[i] = 0;
|
||||
#else
|
||||
dlsch->active = 0;
|
||||
#endif
|
||||
dlsch->harq_mask = 0;
|
||||
|
||||
for (i=0; i<10; i++)
|
||||
dlsch->harq_ids[i] = Mdlharq;
|
||||
for (i=0; i<20; i++)
|
||||
dlsch->harq_ids[i/10][i%10] = Mdlharq;
|
||||
|
||||
for (i=0; i<Mdlharq; i++) {
|
||||
if (dlsch->harq_processes[i]) {
|
||||
@@ -260,8 +265,6 @@ int dlsch_encoding_2threads0(te_params *tep) {
|
||||
unsigned int total_worker = tep->total_worker;
|
||||
unsigned int current_worker = tep->current_worker;
|
||||
|
||||
unsigned short iind;
|
||||
|
||||
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
|
||||
unsigned int Kr=0,Kr_bytes,r,r_offset=0;
|
||||
// unsigned short m=dlsch->harq_processes[harq_pid]->mcs;
|
||||
@@ -280,28 +283,10 @@ int dlsch_encoding_2threads0(te_params *tep) {
|
||||
|
||||
Kr_bytes = Kr>>3;
|
||||
|
||||
// get interleaver index for Turbo code (lookup in Table 5.1.3-3 36-212, V8.6 2009-03, p. 13-14)
|
||||
if (Kr_bytes<=64)
|
||||
iind = (Kr_bytes-5);
|
||||
else if (Kr_bytes <=128)
|
||||
iind = 59 + ((Kr_bytes-64)>>1);
|
||||
else if (Kr_bytes <= 256)
|
||||
iind = 91 + ((Kr_bytes-128)>>2);
|
||||
else if (Kr_bytes <= 768)
|
||||
iind = 123 + ((Kr_bytes-256)>>3);
|
||||
else {
|
||||
printf("dlsch_coding: Illegal codeword size %d!!!\n",Kr_bytes);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
encoder(dlsch->harq_processes[harq_pid]->c[r],
|
||||
Kr>>3,
|
||||
&dlsch->harq_processes[harq_pid]->d[r][96],
|
||||
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
|
||||
f1f2mat_old[iind*2], // f1 (see 36121-820, page 14)
|
||||
f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14)
|
||||
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0
|
||||
);
|
||||
dlsch->harq_processes[harq_pid]->RTC[r] =
|
||||
sub_block_interleaving_turbo(4+(Kr_bytes*8),
|
||||
@@ -411,9 +396,12 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
|
||||
eNB_proc_t *proc = &eNB->proc;
|
||||
unsigned int G;
|
||||
unsigned int crc=1;
|
||||
unsigned short iind;
|
||||
|
||||
unsigned char harq_pid = dlsch->harq_ids[subframe];
|
||||
unsigned char harq_pid = dlsch->harq_ids[frame%2][subframe];
|
||||
if(harq_pid >= dlsch->Mdlharq) {
|
||||
LOG_E(PHY,"dlsch_encoding_2threads illegal harq_pid %d\n", harq_pid);
|
||||
return(-1);
|
||||
}
|
||||
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
|
||||
unsigned int A;
|
||||
unsigned char mod_order;
|
||||
@@ -496,28 +484,11 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
|
||||
|
||||
Kr_bytes = Kr>>3;
|
||||
|
||||
// get interleaver index for Turbo code (lookup in Table 5.1.3-3 36-212, V8.6 2009-03, p. 13-14)
|
||||
if (Kr_bytes<=64)
|
||||
iind = (Kr_bytes-5);
|
||||
else if (Kr_bytes <=128)
|
||||
iind = 59 + ((Kr_bytes-64)>>1);
|
||||
else if (Kr_bytes <= 256)
|
||||
iind = 91 + ((Kr_bytes-128)>>2);
|
||||
else if (Kr_bytes <= 768)
|
||||
iind = 123 + ((Kr_bytes-256)>>3);
|
||||
else {
|
||||
printf("dlsch_coding: Illegal codeword size %d!!!\n",Kr_bytes);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
start_meas(te_stats);
|
||||
encoder(dlsch->harq_processes[harq_pid]->c[r],
|
||||
Kr>>3,
|
||||
&dlsch->harq_processes[harq_pid]->d[r][96],
|
||||
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
|
||||
f1f2mat_old[iind*2], // f1 (see 36121-820, page 14)
|
||||
f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14)
|
||||
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0
|
||||
);
|
||||
stop_meas(te_stats);
|
||||
|
||||
@@ -540,16 +511,15 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
|
||||
proc->tep[i].total_worker = worker_num;
|
||||
proc->tep[i].current_worker = i;
|
||||
if (pthread_cond_signal(&proc->tep[i].cond_te) != 0) {
|
||||
printf("[eNB] ERROR pthread_cond_signal for te thread exit\n");
|
||||
exit_fun( "ERROR pthread_cond_signal" );
|
||||
return (-1);
|
||||
printf("[eNB] ERROR pthread_cond_signal for te thread exit\n");
|
||||
exit_fun( "ERROR pthread_cond_signal" );
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the
|
||||
// outputs for each code segment, see Section 5.1.5 p.20
|
||||
|
||||
for (r=0,r_offset=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
||||
|
||||
// get information for E for the segments that are handled by the worker thread
|
||||
@@ -629,7 +599,7 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB,
|
||||
{
|
||||
int encoding_return = 0;
|
||||
unsigned int L,C,B;
|
||||
B = dlsch->harq_processes[dlsch->harq_ids[subframe]]->B;
|
||||
B = dlsch->harq_processes[dlsch->harq_ids[frame%2][subframe]]->B;
|
||||
if(B<=6144)
|
||||
{
|
||||
L=0;
|
||||
@@ -729,10 +699,13 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
||||
|
||||
unsigned int G;
|
||||
unsigned int crc=1;
|
||||
unsigned short iind;
|
||||
|
||||
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
|
||||
unsigned char harq_pid = dlsch->harq_ids[subframe];
|
||||
unsigned char harq_pid = dlsch->harq_ids[frame%2][subframe];
|
||||
if(harq_pid >= dlsch->Mdlharq) {
|
||||
LOG_E(PHY,"dlsch_encoding illegal harq_pid %d\n", harq_pid);
|
||||
return(-1);
|
||||
}
|
||||
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
|
||||
unsigned int A;
|
||||
unsigned char mod_order;
|
||||
@@ -800,21 +773,6 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
||||
|
||||
Kr_bytes = Kr>>3;
|
||||
|
||||
// get interleaver index for Turbo code (lookup in Table 5.1.3-3 36-212, V8.6 2009-03, p. 13-14)
|
||||
if (Kr_bytes<=64)
|
||||
iind = (Kr_bytes-5);
|
||||
else if (Kr_bytes <=128)
|
||||
iind = 59 + ((Kr_bytes-64)>>1);
|
||||
else if (Kr_bytes <= 256)
|
||||
iind = 91 + ((Kr_bytes-128)>>2);
|
||||
else if (Kr_bytes <= 768)
|
||||
iind = 123 + ((Kr_bytes-256)>>3);
|
||||
else {
|
||||
printf("dlsch_coding: Illegal codeword size %d!!!\n",Kr_bytes);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
printf("Generating Code Segment %d (%d bits)\n",r,Kr);
|
||||
// generate codewords
|
||||
@@ -826,22 +784,17 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
printf("Encoding ... iind %d f1 %d, f2 %d\n",iind,f1f2mat_old[iind*2],f1f2mat_old[(iind*2)+1]);
|
||||
#endif
|
||||
start_meas(te_stats);
|
||||
encoder(dlsch->harq_processes[harq_pid]->c[r],
|
||||
Kr>>3,
|
||||
&dlsch->harq_processes[harq_pid]->d[r][96],
|
||||
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
|
||||
f1f2mat_old[iind*2], // f1 (see 36121-820, page 14)
|
||||
f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14)
|
||||
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0
|
||||
);
|
||||
stop_meas(te_stats);
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
|
||||
if (r==0)
|
||||
write_output("enc_output0.m","enc0",&dlsch->harq_processes[harq_pid]->d[r][96],(3*8*Kr_bytes)+12,1,4);
|
||||
LOG_M("enc_output0.m","enc0",&dlsch->harq_processes[harq_pid]->d[r][96],(3*8*Kr_bytes)+12,1,4);
|
||||
|
||||
#endif
|
||||
start_meas(i_stats);
|
||||
@@ -888,7 +841,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
|
||||
if (r==dlsch->harq_processes[harq_pid]->C-1)
|
||||
write_output("enc_output.m","enc",dlsch->harq_processes[harq_pid]->e,r_offset,1,4);
|
||||
LOG_M("enc_output.m","enc",dlsch->harq_processes[harq_pid]->e,r_offset,1,4);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,748 +0,0 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file PHY/LTE_TRANSPORT/dlsch_decoding.c
|
||||
* \brief Top-level routines for decoding Turbo-coded (DLSCH) transport channels from 36-212, V8.6 2009-03
|
||||
* \author R. Knopp
|
||||
* \date 2011
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: knopp@eurecom.fr
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
//#include "defs.h"
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "PHY/CODING/extern.h"
|
||||
#include "SCHED/extern.h"
|
||||
#include "SIMULATION/TOOLS/defs.h"
|
||||
//#define DEBUG_DLSCH_DECODING
|
||||
//#define UE_DEBUG_TRACE 1
|
||||
|
||||
|
||||
void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch)
|
||||
{
|
||||
|
||||
int i,r;
|
||||
|
||||
if (dlsch) {
|
||||
for (i=0; i<dlsch->Mdlharq; i++) {
|
||||
if (dlsch->harq_processes[i]) {
|
||||
if (dlsch->harq_processes[i]->b) {
|
||||
free16(dlsch->harq_processes[i]->b,MAX_DLSCH_PAYLOAD_BYTES);
|
||||
dlsch->harq_processes[i]->b = NULL;
|
||||
}
|
||||
|
||||
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS; r++) {
|
||||
free16(dlsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+768);
|
||||
dlsch->harq_processes[i]->c[r] = NULL;
|
||||
}
|
||||
|
||||
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS; r++)
|
||||
if (dlsch->harq_processes[i]->d[r]) {
|
||||
free16(dlsch->harq_processes[i]->d[r],((3*8*6144)+12+96)*sizeof(short));
|
||||
dlsch->harq_processes[i]->d[r] = NULL;
|
||||
}
|
||||
|
||||
free16(dlsch->harq_processes[i],sizeof(LTE_DL_UE_HARQ_t));
|
||||
dlsch->harq_processes[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
free16(dlsch,sizeof(LTE_UE_DLSCH_t));
|
||||
dlsch = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_turbo_iterations,uint8_t N_RB_DL, uint8_t abstraction_flag)
|
||||
{
|
||||
|
||||
LTE_UE_DLSCH_t *dlsch;
|
||||
uint8_t exit_flag = 0,i,r;
|
||||
|
||||
unsigned char bw_scaling =1;
|
||||
|
||||
switch (N_RB_DL) {
|
||||
case 6:
|
||||
bw_scaling =16;
|
||||
break;
|
||||
|
||||
case 25:
|
||||
bw_scaling =4;
|
||||
break;
|
||||
|
||||
case 50:
|
||||
bw_scaling =2;
|
||||
break;
|
||||
|
||||
default:
|
||||
bw_scaling =1;
|
||||
break;
|
||||
}
|
||||
|
||||
dlsch = (LTE_UE_DLSCH_t *)malloc16(sizeof(LTE_UE_DLSCH_t));
|
||||
|
||||
if (dlsch) {
|
||||
memset(dlsch,0,sizeof(LTE_UE_DLSCH_t));
|
||||
dlsch->Kmimo = Kmimo;
|
||||
dlsch->Mdlharq = Mdlharq;
|
||||
dlsch->Nsoft = Nsoft;
|
||||
dlsch->max_turbo_iterations = max_turbo_iterations;
|
||||
|
||||
for (i=0; i<Mdlharq; i++) {
|
||||
// printf("new_ue_dlsch: Harq process %d\n",i);
|
||||
dlsch->harq_processes[i] = (LTE_DL_UE_HARQ_t *)malloc16(sizeof(LTE_DL_UE_HARQ_t));
|
||||
|
||||
if (dlsch->harq_processes[i]) {
|
||||
memset(dlsch->harq_processes[i],0,sizeof(LTE_DL_UE_HARQ_t));
|
||||
dlsch->harq_processes[i]->first_tx=1;
|
||||
dlsch->harq_processes[i]->b = (uint8_t*)malloc16(MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
|
||||
|
||||
if (dlsch->harq_processes[i]->b)
|
||||
memset(dlsch->harq_processes[i]->b,0,MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
|
||||
else
|
||||
exit_flag=3;
|
||||
|
||||
if (abstraction_flag == 0) {
|
||||
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS/bw_scaling; r++) {
|
||||
dlsch->harq_processes[i]->c[r] = (uint8_t*)malloc16(((r==0)?8:0) + 3+ 768);
|
||||
|
||||
if (dlsch->harq_processes[i]->c[r])
|
||||
memset(dlsch->harq_processes[i]->c[r],0,((r==0)?8:0) + 3+ 768);
|
||||
else
|
||||
exit_flag=2;
|
||||
|
||||
dlsch->harq_processes[i]->d[r] = (short*)malloc16(((3*8*6144)+12+96)*sizeof(short));
|
||||
|
||||
if (dlsch->harq_processes[i]->d[r])
|
||||
memset(dlsch->harq_processes[i]->d[r],0,((3*8*6144)+12+96)*sizeof(short));
|
||||
else
|
||||
exit_flag=2;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
exit_flag=1;
|
||||
}
|
||||
}
|
||||
|
||||
if (exit_flag==0)
|
||||
return(dlsch);
|
||||
}
|
||||
|
||||
printf("new_ue_dlsch with size %zu: exit_flag = %u\n",sizeof(LTE_DL_UE_HARQ_t), exit_flag);
|
||||
free_ue_dlsch(dlsch);
|
||||
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
|
||||
short *dlsch_llr,
|
||||
LTE_DL_FRAME_PARMS *frame_parms,
|
||||
LTE_UE_DLSCH_t *dlsch,
|
||||
LTE_DL_UE_HARQ_t *harq_process,
|
||||
uint32_t frame,
|
||||
uint8_t subframe,
|
||||
uint8_t harq_pid,
|
||||
uint8_t is_crnti,
|
||||
uint8_t llr8_flag)
|
||||
{
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
time_stats_t *dlsch_rate_unmatching_stats=&phy_vars_ue->dlsch_rate_unmatching_stats;
|
||||
time_stats_t *dlsch_turbo_decoding_stats=&phy_vars_ue->dlsch_turbo_decoding_stats;
|
||||
time_stats_t *dlsch_deinterleaving_stats=&phy_vars_ue->dlsch_deinterleaving_stats;
|
||||
#endif
|
||||
uint32_t A,E;
|
||||
uint32_t G;
|
||||
uint32_t ret,offset;
|
||||
uint16_t iind;
|
||||
// uint8_t dummy_channel_output[(3*8*block_length)+12];
|
||||
short dummy_w[MAX_NUM_DLSCH_SEGMENTS][3*(6144+64)];
|
||||
uint32_t r,r_offset=0,Kr,Kr_bytes,err_flag=0;
|
||||
uint8_t crc_type;
|
||||
#ifdef DEBUG_DLSCH_DECODING
|
||||
uint16_t i;
|
||||
#endif
|
||||
//#ifdef __AVX2__
|
||||
#if 0
|
||||
int Kr_last,skipped_last=0;
|
||||
uint8_t (*tc_2cw)(int16_t *y,
|
||||
int16_t *y2,
|
||||
uint8_t *,
|
||||
uint8_t *,
|
||||
uint16_t,
|
||||
uint16_t,
|
||||
uint16_t,
|
||||
uint8_t,
|
||||
uint8_t,
|
||||
uint8_t,
|
||||
time_stats_t *,
|
||||
time_stats_t *,
|
||||
time_stats_t *,
|
||||
time_stats_t *,
|
||||
time_stats_t *,
|
||||
time_stats_t *,
|
||||
time_stats_t *);
|
||||
|
||||
#endif
|
||||
decoder_if_t tc;
|
||||
|
||||
|
||||
|
||||
|
||||
if (!dlsch_llr) {
|
||||
printf("dlsch_decoding.c: NULL dlsch_llr pointer\n");
|
||||
return(dlsch->max_turbo_iterations);
|
||||
}
|
||||
|
||||
if (!harq_process) {
|
||||
printf("dlsch_decoding.c: NULL harq_process pointer\n");
|
||||
return(dlsch->max_turbo_iterations);
|
||||
}
|
||||
|
||||
if (!frame_parms) {
|
||||
printf("dlsch_decoding.c: NULL frame_parms pointer\n");
|
||||
return(dlsch->max_turbo_iterations);
|
||||
}
|
||||
|
||||
if (subframe>9) {
|
||||
printf("dlsch_decoding.c: Illegal subframe index %d\n",subframe);
|
||||
return(dlsch->max_turbo_iterations);
|
||||
}
|
||||
|
||||
if (dlsch->harq_ack[subframe].ack != 2) {
|
||||
LOG_D(PHY, "[UE %d] DLSCH @ SF%d : ACK bit is %d instead of DTX even before PDSCH is decoded!\n",
|
||||
phy_vars_ue->Mod_id, subframe, dlsch->harq_ack[subframe].ack);
|
||||
}
|
||||
|
||||
if (llr8_flag == 0) {
|
||||
//#ifdef __AVX2__
|
||||
#if 0
|
||||
tc_2cw = phy_threegpplte_turbo_decoder16avx2;
|
||||
#endif
|
||||
tc = decoder16;
|
||||
}
|
||||
else
|
||||
{
|
||||
AssertFatal (harq_process->TBS >= 256 , "Mismatch flag nbRB=%d TBS=%d mcs=%d Qm=%d RIV=%d round=%d \n",
|
||||
harq_process->nb_rb, harq_process->TBS,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round);
|
||||
tc = decoder8;
|
||||
}
|
||||
|
||||
|
||||
// nb_rb = dlsch->nb_rb;
|
||||
|
||||
/*
|
||||
if (nb_rb > frame_parms->N_RB_DL) {
|
||||
printf("dlsch_decoding.c: Illegal nb_rb %d\n",nb_rb);
|
||||
return(max_turbo_iterations);
|
||||
}*/
|
||||
|
||||
/*harq_pid = dlsch->current_harq_pid[phy_vars_ue->current_thread_id[subframe]];
|
||||
if (harq_pid >= 8) {
|
||||
printf("dlsch_decoding.c: Illegal harq_pid %d\n",harq_pid);
|
||||
return(max_turbo_iterations);
|
||||
}
|
||||
*/
|
||||
|
||||
harq_process->trials[harq_process->round]++;
|
||||
|
||||
A = harq_process->TBS; //2072 for QPSK 1/3
|
||||
|
||||
ret = dlsch->max_turbo_iterations;
|
||||
|
||||
|
||||
G = harq_process->G;
|
||||
//get_G(frame_parms,nb_rb,dlsch->rb_alloc,mod_order,num_pdcch_symbols,phy_vars_ue->frame,subframe);
|
||||
|
||||
// printf("DLSCH Decoding, harq_pid %d Ndi %d\n",harq_pid,harq_process->Ndi);
|
||||
|
||||
if (harq_process->round == 0) {
|
||||
// This is a new packet, so compute quantities regarding segmentation
|
||||
harq_process->B = A+24;
|
||||
lte_segmentation(NULL,
|
||||
NULL,
|
||||
harq_process->B,
|
||||
&harq_process->C,
|
||||
&harq_process->Cplus,
|
||||
&harq_process->Cminus,
|
||||
&harq_process->Kplus,
|
||||
&harq_process->Kminus,
|
||||
&harq_process->F);
|
||||
// CLEAR LLR's HERE for first packet in process
|
||||
}
|
||||
|
||||
/*
|
||||
else {
|
||||
printf("dlsch_decoding.c: Ndi>0 not checked yet!!\n");
|
||||
return(max_turbo_iterations);
|
||||
}
|
||||
*/
|
||||
err_flag = 0;
|
||||
r_offset = 0;
|
||||
|
||||
unsigned char bw_scaling =1;
|
||||
|
||||
switch (frame_parms->N_RB_DL) {
|
||||
case 6:
|
||||
bw_scaling =16;
|
||||
break;
|
||||
|
||||
case 25:
|
||||
bw_scaling =4;
|
||||
break;
|
||||
|
||||
case 50:
|
||||
bw_scaling =2;
|
||||
break;
|
||||
|
||||
default:
|
||||
bw_scaling =1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (harq_process->C > MAX_NUM_DLSCH_SEGMENTS/bw_scaling) {
|
||||
LOG_E(PHY,"Illegal harq_process->C %d > %d\n",harq_process->C,MAX_NUM_DLSCH_SEGMENTS/bw_scaling);
|
||||
return((1+dlsch->max_turbo_iterations));
|
||||
}
|
||||
#ifdef DEBUG_DLSCH_DECODING
|
||||
printf("Segmentation: C %d, Cminus %d, Kminus %d, Kplus %d\n",harq_process->C,harq_process->Cminus,harq_process->Kminus,harq_process->Kplus);
|
||||
#endif
|
||||
|
||||
opp_enabled=1;
|
||||
|
||||
for (r=0; r<harq_process->C; r++) {
|
||||
|
||||
|
||||
// Get Turbo interleaver parameters
|
||||
if (r<harq_process->Cminus)
|
||||
Kr = harq_process->Kminus;
|
||||
else
|
||||
Kr = harq_process->Kplus;
|
||||
|
||||
Kr_bytes = Kr>>3;
|
||||
|
||||
if (Kr_bytes<=64)
|
||||
iind = (Kr_bytes-5);
|
||||
else if (Kr_bytes <=128)
|
||||
iind = 59 + ((Kr_bytes-64)>>1);
|
||||
else if (Kr_bytes <= 256)
|
||||
iind = 91 + ((Kr_bytes-128)>>2);
|
||||
else if (Kr_bytes <= 768)
|
||||
iind = 123 + ((Kr_bytes-256)>>3);
|
||||
else {
|
||||
printf("dlsch_decoding: Illegal codeword size %d!!!\n",Kr_bytes);
|
||||
return(dlsch->max_turbo_iterations);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_DLSCH_DECODING
|
||||
printf("f1 %d, f2 %d, F %d\n",f1f2mat_old[2*iind],f1f2mat_old[1+(2*iind)],(r==0) ? harq_process->F : 0);
|
||||
#endif
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(dlsch_rate_unmatching_stats);
|
||||
#endif
|
||||
memset(&dummy_w[r][0],0,3*(6144+64)*sizeof(short));
|
||||
harq_process->RTC[r] = generate_dummy_w(4+(Kr_bytes*8),
|
||||
(uint8_t*) &dummy_w[r][0],
|
||||
(r==0) ? harq_process->F : 0);
|
||||
|
||||
#ifdef DEBUG_DLSCH_DECODING
|
||||
LOG_D(PHY,"HARQ_PID %d Rate Matching Segment %d (coded bits %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d, rv %d, round %d)...\n",
|
||||
harq_pid,r, G,
|
||||
Kr*3,
|
||||
harq_process->TBS,
|
||||
harq_process->Qm,
|
||||
harq_process->nb_rb,
|
||||
harq_process->Nl,
|
||||
harq_process->rvidx,
|
||||
harq_process->round);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_DLSCH_DECODING
|
||||
printf(" in decoding dlsch->harq_processes[harq_pid]->rvidx = %d\n", dlsch->harq_processes[harq_pid]->rvidx);
|
||||
#endif
|
||||
if (lte_rate_matching_turbo_rx(harq_process->RTC[r],
|
||||
G,
|
||||
harq_process->w[r],
|
||||
(uint8_t*)&dummy_w[r][0],
|
||||
dlsch_llr+r_offset,
|
||||
harq_process->C,
|
||||
dlsch->Nsoft,
|
||||
dlsch->Mdlharq,
|
||||
dlsch->Kmimo,
|
||||
harq_process->rvidx,
|
||||
(harq_process->round==0)?1:0,
|
||||
harq_process->Qm,
|
||||
harq_process->Nl,
|
||||
r,
|
||||
&E)==-1) {
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_rate_unmatching_stats);
|
||||
#endif
|
||||
LOG_E(PHY,"dlsch_decoding.c: Problem in rate_matching\n");
|
||||
return(dlsch->max_turbo_iterations);
|
||||
} else
|
||||
{
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_rate_unmatching_stats);
|
||||
#endif
|
||||
}
|
||||
r_offset += E;
|
||||
|
||||
/*
|
||||
printf("Subblock deinterleaving, d %p w %p\n",
|
||||
harq_process->d[r],
|
||||
harq_process->w);
|
||||
*/
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(dlsch_deinterleaving_stats);
|
||||
#endif
|
||||
sub_block_deinterleaving_turbo(4+Kr,
|
||||
&harq_process->d[r][96],
|
||||
|
||||
harq_process->w[r]);
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_deinterleaving_stats);
|
||||
#endif
|
||||
#ifdef DEBUG_DLSCH_DECODING
|
||||
/*
|
||||
if (r==0) {
|
||||
write_output("decoder_llr.m","decllr",dlsch_llr,G,1,0);
|
||||
write_output("decoder_in.m","dec",&harq_process->d[0][96],(3*8*Kr_bytes)+12,1,0);
|
||||
}
|
||||
|
||||
printf("decoder input(segment %d) :",r);
|
||||
int i; for (i=0;i<(3*8*Kr_bytes)+12;i++)
|
||||
printf("%d : %d\n",i,harq_process->d[r][96+i]);
|
||||
printf("\n");*/
|
||||
#endif
|
||||
|
||||
|
||||
// printf("Clearing c, %p\n",harq_process->c[r]);
|
||||
memset(harq_process->c[r],0,Kr_bytes);
|
||||
|
||||
// printf("done\n");
|
||||
if (harq_process->C == 1)
|
||||
crc_type = CRC24_A;
|
||||
else
|
||||
crc_type = CRC24_B;
|
||||
|
||||
/*
|
||||
printf("decoder input(segment %d)\n",r);
|
||||
for (i=0;i<(3*8*Kr_bytes)+12;i++)
|
||||
if ((harq_process->d[r][96+i]>7) ||
|
||||
(harq_process->d[r][96+i] < -8))
|
||||
printf("%d : %d\n",i,harq_process->d[r][96+i]);
|
||||
printf("\n");
|
||||
*/
|
||||
|
||||
//#ifndef __AVX2__
|
||||
#if 1
|
||||
if (err_flag == 0) {
|
||||
/*
|
||||
LOG_I(PHY, "turbo algo Kr=%d cb_cnt=%d C=%d nbRB=%d crc_type %d TBSInput=%d TBSHarq=%d TBSplus24=%d mcs=%d Qm=%d RIV=%d round=%d maxIter %d\n",
|
||||
Kr,r,harq_process->C,harq_process->nb_rb,crc_type,A,harq_process->TBS,
|
||||
harq_process->B,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round,dlsch->max_turbo_iterations);
|
||||
*/
|
||||
if (llr8_flag) {
|
||||
AssertFatal (Kr >= 256, "turbo algo issue Kr=%d cb_cnt=%d C=%d nbRB=%d TBSInput=%d TBSHarq=%d TBSplus24=%d mcs=%d Qm=%d RIV=%d round=%d\n",
|
||||
Kr,r,harq_process->C,harq_process->nb_rb,A,harq_process->TBS,harq_process->B,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round);
|
||||
}
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
#endif
|
||||
LOG_D(PHY,"AbsSubframe %d.%d Start turbo segment %d/%d \n",frame%1024,subframe,r,harq_process->C-1);
|
||||
ret = tc
|
||||
(&harq_process->d[r][96],
|
||||
NULL,
|
||||
harq_process->c[r],
|
||||
NULL,
|
||||
Kr,
|
||||
f1f2mat_old[iind*2],
|
||||
f1f2mat_old[(iind*2)+1],
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
&phy_vars_ue->dlsch_tc_init_stats,
|
||||
&phy_vars_ue->dlsch_tc_alpha_stats,
|
||||
&phy_vars_ue->dlsch_tc_beta_stats,
|
||||
&phy_vars_ue->dlsch_tc_gamma_stats,
|
||||
&phy_vars_ue->dlsch_tc_ext_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl1_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_turbo_decoding_stats);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
if ((harq_process->C == 1) ||
|
||||
((r==harq_process->C-1) && (skipped_last==0))) { // last segment with odd number of segments
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
#endif
|
||||
ret = tc
|
||||
(&harq_process->d[r][96],
|
||||
harq_process->c[r],
|
||||
Kr,
|
||||
f1f2mat_old[iind*2],
|
||||
f1f2mat_old[(iind*2)+1],
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
&phy_vars_ue->dlsch_tc_init_stats,
|
||||
&phy_vars_ue->dlsch_tc_alpha_stats,
|
||||
&phy_vars_ue->dlsch_tc_beta_stats,
|
||||
&phy_vars_ue->dlsch_tc_gamma_stats,
|
||||
&phy_vars_ue->dlsch_tc_ext_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl1_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_turbo_decoding_stats);
|
||||
#endif
|
||||
// printf("single decode, exit\n");
|
||||
// exit(-1);
|
||||
}
|
||||
else {
|
||||
// we can merge code segments
|
||||
if ((skipped_last == 0) && (r<harq_process->C-1)) {
|
||||
skipped_last = 1;
|
||||
Kr_last = Kr;
|
||||
}
|
||||
else {
|
||||
skipped_last=0;
|
||||
|
||||
if (Kr_last == Kr) { // decode 2 code segments with AVX2 version
|
||||
#ifdef DEBUG_DLSCH_DECODING
|
||||
printf("single decoding segment %d (%p)\n",r-1,&harq_process->d[r-1][96]);
|
||||
#endif
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
#endif
|
||||
#ifdef DEBUG_DLSCH_DECODING
|
||||
printf("double decoding segments %d,%d (%p,%p)\n",r-1,r,&harq_process->d[r-1][96],&harq_process->d[r][96]);
|
||||
#endif
|
||||
ret = tc_2cw
|
||||
(&harq_process->d[r-1][96],
|
||||
&harq_process->d[r][96],
|
||||
harq_process->c[r-1],
|
||||
harq_process->c[r],
|
||||
Kr,
|
||||
f1f2mat_old[iind*2],
|
||||
f1f2mat_old[(iind*2)+1],
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
&phy_vars_ue->dlsch_tc_init_stats,
|
||||
&phy_vars_ue->dlsch_tc_alpha_stats,
|
||||
&phy_vars_ue->dlsch_tc_beta_stats,
|
||||
&phy_vars_ue->dlsch_tc_gamma_stats,
|
||||
&phy_vars_ue->dlsch_tc_ext_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl1_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
|
||||
/*
|
||||
ret = tc
|
||||
(&harq_process->d[r-1][96],
|
||||
harq_process->c[r-1],
|
||||
Kr_last,
|
||||
f1f2mat_old[iind*2],
|
||||
f1f2mat_old[(iind*2)+1],
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
&phy_vars_ue->dlsch_tc_init_stats,
|
||||
&phy_vars_ue->dlsch_tc_alpha_stats,
|
||||
&phy_vars_ue->dlsch_tc_beta_stats,
|
||||
&phy_vars_ue->dlsch_tc_gamma_stats,
|
||||
&phy_vars_ue->dlsch_tc_ext_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl1_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
|
||||
|
||||
exit(-1);*/
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_turbo_decoding_stats);
|
||||
#endif
|
||||
}
|
||||
else { // Kr_last != Kr
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
#endif
|
||||
ret = tc
|
||||
(&harq_process->d[r-1][96],
|
||||
harq_process->c[r-1],
|
||||
Kr_last,
|
||||
f1f2mat_old[iind*2],
|
||||
f1f2mat_old[(iind*2)+1],
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
&phy_vars_ue->dlsch_tc_init_stats,
|
||||
&phy_vars_ue->dlsch_tc_alpha_stats,
|
||||
&phy_vars_ue->dlsch_tc_beta_stats,
|
||||
&phy_vars_ue->dlsch_tc_gamma_stats,
|
||||
&phy_vars_ue->dlsch_tc_ext_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl1_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_turbo_decoding_stats);
|
||||
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
#endif
|
||||
|
||||
ret = tc
|
||||
(&harq_process->d[r][96],
|
||||
harq_process->c[r],
|
||||
Kr,
|
||||
f1f2mat_old[iind*2],
|
||||
f1f2mat_old[(iind*2)+1],
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
&phy_vars_ue->dlsch_tc_init_stats,
|
||||
&phy_vars_ue->dlsch_tc_alpha_stats,
|
||||
&phy_vars_ue->dlsch_tc_beta_stats,
|
||||
&phy_vars_ue->dlsch_tc_gamma_stats,
|
||||
&phy_vars_ue->dlsch_tc_ext_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl1_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
|
||||
stop_meas(dlsch_turbo_decoding_stats);
|
||||
|
||||
/*printf("Segmentation: C %d r %d, dlsch_rate_unmatching_stats %5.3f dlsch_deinterleaving_stats %5.3f dlsch_turbo_decoding_stats %5.3f \n",
|
||||
harq_process->C,
|
||||
r,
|
||||
dlsch_rate_unmatching_stats->p_time/(cpuf*1000.0),
|
||||
dlsch_deinterleaving_stats->p_time/(cpuf*1000.0),
|
||||
dlsch_turbo_decoding_stats->p_time/(cpuf*1000.0));*/
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if ((err_flag == 0) && (ret>=(1+dlsch->max_turbo_iterations))) {// a Code segment is in error so break;
|
||||
LOG_D(PHY,"AbsSubframe %d.%d CRC failed, segment %d/%d \n",frame%1024,subframe,r,harq_process->C-1);
|
||||
err_flag = 1;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t frame_rx_prev = frame;
|
||||
int32_t subframe_rx_prev = subframe - 1;
|
||||
if (subframe_rx_prev < 0) {
|
||||
frame_rx_prev--;
|
||||
subframe_rx_prev += 10;
|
||||
}
|
||||
frame_rx_prev = frame_rx_prev%1024;
|
||||
|
||||
if (err_flag == 1) {
|
||||
#if UE_DEBUG_TRACE
|
||||
LOG_I(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n",
|
||||
phy_vars_ue->Mod_id, frame, subframe, harq_pid,harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs,Kr,r,harq_process->round);
|
||||
#endif
|
||||
dlsch->harq_ack[subframe].ack = 0;
|
||||
dlsch->harq_ack[subframe].harq_id = harq_pid;
|
||||
dlsch->harq_ack[subframe].send_harq_status = 1;
|
||||
harq_process->errors[harq_process->round]++;
|
||||
harq_process->round++;
|
||||
|
||||
|
||||
// printf("Rate: [UE %d] DLSCH: Setting NACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round);
|
||||
if (harq_process->round >= dlsch->Mdlharq) {
|
||||
harq_process->status = SCH_IDLE;
|
||||
harq_process->round = 0;
|
||||
}
|
||||
if(is_crnti)
|
||||
{
|
||||
LOG_D(PHY,"[UE %d] DLSCH: Setting NACK for subframe %d (pid %d, pid status %d, round %d/Max %d, TBS %d)\n",
|
||||
phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->status,harq_process->round,dlsch->Mdlharq,harq_process->TBS);
|
||||
}
|
||||
|
||||
return((1+dlsch->max_turbo_iterations));
|
||||
} else {
|
||||
#if UE_DEBUG_TRACE
|
||||
LOG_I(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d TBS %d mcs %d nb_rb %d\n",
|
||||
phy_vars_ue->Mod_id,subframe,harq_process->TBS,harq_process->mcs,harq_process->nb_rb);
|
||||
#endif
|
||||
|
||||
harq_process->status = SCH_IDLE;
|
||||
harq_process->round = 0;
|
||||
dlsch->harq_ack[subframe].ack = 1;
|
||||
dlsch->harq_ack[subframe].harq_id = harq_pid;
|
||||
dlsch->harq_ack[subframe].send_harq_status = 1;
|
||||
//LOG_I(PHY,"[UE %d] DLSCH: Setting ACK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d)\n",
|
||||
// phy_vars_ue->Mod_id, frame, subframe, harq_pid, harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs);
|
||||
|
||||
if(is_crnti)
|
||||
{
|
||||
LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d (pid %d, round %d, TBS %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round,harq_process->TBS);
|
||||
}
|
||||
//LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round);
|
||||
|
||||
}
|
||||
|
||||
// Reassembly of Transport block here
|
||||
offset = 0;
|
||||
|
||||
/*
|
||||
printf("harq_pid %d\n",harq_pid);
|
||||
printf("F %d, Fbytes %d\n",harq_process->F,harq_process->F>>3);
|
||||
printf("C %d\n",harq_process->C);
|
||||
*/
|
||||
for (r=0; r<harq_process->C; r++) {
|
||||
if (r<harq_process->Cminus)
|
||||
Kr = harq_process->Kminus;
|
||||
else
|
||||
Kr = harq_process->Kplus;
|
||||
|
||||
Kr_bytes = Kr>>3;
|
||||
|
||||
// printf("Segment %d : Kr= %d bytes\n",r,Kr_bytes);
|
||||
if (r==0) {
|
||||
memcpy(harq_process->b,
|
||||
&harq_process->c[0][(harq_process->F>>3)],
|
||||
Kr_bytes - (harq_process->F>>3)- ((harq_process->C>1)?3:0));
|
||||
offset = Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0);
|
||||
// printf("copied %d bytes to b sequence (harq_pid %d)\n",
|
||||
// Kr_bytes - (harq_process->F>>3),harq_pid);
|
||||
// printf("b[0] = %x,c[%d] = %x\n",
|
||||
// harq_process->b[0],
|
||||
// harq_process->F>>3,
|
||||
// harq_process->c[0][(harq_process->F>>3)]);
|
||||
} else {
|
||||
memcpy(harq_process->b+offset,
|
||||
harq_process->c[r],
|
||||
Kr_bytes- ((harq_process->C>1)?3:0));
|
||||
offset += (Kr_bytes - ((harq_process->C>1)?3:0));
|
||||
}
|
||||
}
|
||||
|
||||
dlsch->last_iteration_cnt = ret;
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -35,11 +35,11 @@
|
||||
#include "PHY/CODING/coding_extern.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_eNB.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
||||
|
||||
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
|
||||
//#define DEBUG_DLSCH_MODULATION
|
||||
#define NEW_ALLOC_RE
|
||||
//#define NEW_ALLOC_RE
|
||||
|
||||
//#define is_not_pilot(pilots,re,nushift,use2ndpilots) ((pilots==0) || ((re!=nushift) && (re!=nushift+6)&&((re!=nushift+3)||(use2ndpilots==1))&&((re!=nushift+9)||(use2ndpilots==1)))?1:0)
|
||||
|
||||
@@ -706,6 +706,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
|
||||
int *P2_SHIFT)
|
||||
{
|
||||
|
||||
|
||||
uint8_t *x0 = NULL;
|
||||
MIMO_mode_t mimo_mode = -1;
|
||||
|
||||
@@ -714,8 +715,8 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
|
||||
|
||||
int first_layer0 = -1; //= dlsch0_harq->first_layer;
|
||||
int Nlayers0 = -1; // = dlsch0_harq->Nlayers;
|
||||
uint8_t mod_order0=0;
|
||||
uint8_t mod_order1=0;
|
||||
uint8_t mod_order0=0;
|
||||
uint8_t mod_order1=0;
|
||||
uint8_t precoder_index0,precoder_index1;
|
||||
|
||||
uint8_t *x1=NULL;
|
||||
@@ -2077,6 +2078,7 @@ inline int check_skip_dc(int rb,LTE_DL_FRAME_PARMS *frame_parms) {
|
||||
int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
||||
int32_t **txdataF,
|
||||
int16_t amp,
|
||||
int frame,
|
||||
uint32_t subframe_offset,
|
||||
uint8_t num_pdcch_symbols,
|
||||
LTE_eNB_DLSCH_t *dlsch0,
|
||||
@@ -2098,12 +2100,10 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
||||
uint8_t mod_order0 = 0;
|
||||
uint8_t mod_order1 = 0;
|
||||
int16_t amp_rho_a, amp_rho_b;
|
||||
int16_t qam16_table_a0[4],qam64_table_a0[8],qam16_table_b0[4],qam64_table_b0[8];//qpsk_table_a0[2],qpsk_table_b0[2]
|
||||
int16_t qam16_table_a1[4],qam64_table_a1[8],qam16_table_b1[4],qam64_table_b1[8];//qpsk_table_a1[2],qpsk_table_b1[2]
|
||||
int16_t qam16_table_a0[4],qam64_table_a0[8],qam16_table_b0[4],qam64_table_b0[8],qpsk_table_a0[2],qpsk_table_b0[2];
|
||||
int16_t qam16_table_a1[4],qam64_table_a1[8],qam16_table_b1[4],qam64_table_b1[8],qpsk_table_a1[2],qpsk_table_b1[2];
|
||||
|
||||
int16_t *qam_table_s0=NULL,*qam_table_s1=NULL;
|
||||
#ifdef NEW_ALLOC_RE
|
||||
/* TODO: variable to be removed? */
|
||||
int (*allocate_REs)(PHY_VARS_eNB*,
|
||||
int **,
|
||||
uint32_t*,
|
||||
@@ -2125,7 +2125,8 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
||||
uint8_t,
|
||||
int *,
|
||||
int *);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int P1_SHIFT[13],P2_SHIFT[13];
|
||||
int offset,nushiftmod3;
|
||||
@@ -2149,7 +2150,11 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
||||
|
||||
if ((dlsch0 != NULL) && (dlsch1 != NULL)){
|
||||
|
||||
harq_pid = dlsch0->harq_ids[subframe_offset];
|
||||
harq_pid = dlsch0->harq_ids[frame%2][subframe_offset];
|
||||
if(harq_pid >= dlsch0->Mdlharq) {
|
||||
LOG_E(PHY,"illegal harq_pid %d\n", harq_pid);
|
||||
return(-1);
|
||||
}
|
||||
dlsch0_harq = dlsch0->harq_processes[harq_pid];
|
||||
mimo_mode = dlsch0_harq->mimo_mode;
|
||||
mod_order0 = dlsch0_harq->Qm;
|
||||
@@ -2166,7 +2171,11 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
||||
|
||||
}else if ((dlsch0 != NULL) && (dlsch1 == NULL)){
|
||||
|
||||
harq_pid = dlsch0->harq_ids[subframe_offset];
|
||||
harq_pid = dlsch0->harq_ids[frame%2][subframe_offset];
|
||||
if(harq_pid >= dlsch0->Mdlharq) {
|
||||
LOG_E(PHY,"illegal harq_pid %d\n", harq_pid);
|
||||
return(-1);
|
||||
}
|
||||
dlsch0_harq = dlsch0->harq_processes[harq_pid];
|
||||
mimo_mode = dlsch0_harq->mimo_mode;
|
||||
mod_order0 = dlsch0_harq->Qm;
|
||||
@@ -2183,7 +2192,11 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
||||
|
||||
}else if ((dlsch0 == NULL) && (dlsch1 != NULL)){
|
||||
|
||||
harq_pid = dlsch1->harq_ids[subframe_offset];
|
||||
harq_pid = dlsch1->harq_ids[frame%2][subframe_offset];
|
||||
if(harq_pid >= dlsch1->Mdlharq) {
|
||||
LOG_E(PHY,"illegal harq_pid %d\n", harq_pid);
|
||||
return(-1);
|
||||
}
|
||||
dlsch1_harq = dlsch1->harq_processes[harq_pid];
|
||||
mimo_mode = dlsch1_harq->mimo_mode;
|
||||
mod_order0 = dlsch1_harq->Qm;
|
||||
@@ -2212,7 +2225,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
||||
amp_rho_b = (int16_t)(((int32_t)amp*dlsch1->sqrt_rho_b)>>13);
|
||||
}
|
||||
|
||||
/*if(mod_order0 == 2)
|
||||
if(mod_order0 == 2)
|
||||
{
|
||||
for(i=0;i<2;i++)
|
||||
{
|
||||
@@ -2220,7 +2233,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
||||
qpsk_table_b0[i] = (int16_t)(((int32_t)qpsk_table[i]*amp_rho_b)>>15);
|
||||
}
|
||||
}
|
||||
else*/ if (mod_order0 == 4)
|
||||
else if (mod_order0 == 4)
|
||||
for (i=0;i<4; i++) {
|
||||
qam16_table_a0[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_a)>>15);
|
||||
qam16_table_b0[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_b)>>15);
|
||||
@@ -2231,14 +2244,14 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
||||
qam64_table_b0[i] = (int16_t)(((int32_t)qam64_table[i]*amp_rho_b)>>15);
|
||||
}
|
||||
|
||||
/*if (mod_order1 == 2)
|
||||
if (mod_order1 == 2)
|
||||
{
|
||||
for (i=0; i<2; i++) {
|
||||
qpsk_table_a1[i] = (int16_t)(((int32_t)qpsk_table[i]*amp_rho_a)>>15);
|
||||
qpsk_table_b1[i] = (int16_t)(((int32_t)qpsk_table[i]*amp_rho_b)>>15);
|
||||
}
|
||||
}
|
||||
else*/ if (mod_order1 == 4)
|
||||
else if (mod_order1 == 4)
|
||||
for (i=0; i<4; i++) {
|
||||
qam16_table_a1[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_a)>>15);
|
||||
qam16_table_b1[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_b)>>15);
|
||||
@@ -2359,53 +2372,36 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
||||
|
||||
re_offset = frame_parms->first_carrier_offset;
|
||||
symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(l+(subframe_offset*nsymb));
|
||||
|
||||
#ifdef NEW_ALLOC_RE
|
||||
/* TODO: remove this code? */
|
||||
allocate_REs = allocate_REs_in_RB;
|
||||
#endif
|
||||
|
||||
switch (mod_order0) {
|
||||
case 2:
|
||||
qam_table_s0 = NULL;
|
||||
/*if (pilots) {
|
||||
if (pilots) {
|
||||
qam_table_s0 = qpsk_table_b0;
|
||||
#ifdef NEW_ALLOC_RE
|
||||
// TODO: remove this code? //
|
||||
allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ?
|
||||
allocate_REs_in_RB_pilots_QPSK_siso :
|
||||
allocate_REs_in_RB;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
qam_table_s0 = qpsk_table_a0;
|
||||
#ifdef NEW_ALLOC_RE
|
||||
// TODO: remove this code? //
|
||||
allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ?
|
||||
allocate_REs_in_RB_no_pilots_QPSK_siso :
|
||||
allocate_REs_in_RB;
|
||||
#endif
|
||||
|
||||
}*/
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (pilots) {
|
||||
qam_table_s0 = qam16_table_b0;
|
||||
#ifdef NEW_ALLOC_RE
|
||||
/* TODO: remove this code? */
|
||||
allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ?
|
||||
allocate_REs_in_RB_pilots_16QAM_siso :
|
||||
allocate_REs_in_RB;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
qam_table_s0 = qam16_table_a0;
|
||||
#ifdef NEW_ALLOC_RE
|
||||
/* TODO: remove this code? */
|
||||
allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ?
|
||||
allocate_REs_in_RB_no_pilots_16QAM_siso :
|
||||
allocate_REs_in_RB;
|
||||
#endif
|
||||
|
||||
}
|
||||
break;
|
||||
@@ -2413,39 +2409,41 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
||||
case 6:
|
||||
if (pilots) {
|
||||
qam_table_s0 = qam64_table_b0;
|
||||
#ifdef NEW_ALLOC_RE
|
||||
/* TODO: remove this code? */
|
||||
allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ?
|
||||
allocate_REs_in_RB_pilots_64QAM_siso :
|
||||
allocate_REs_in_RB;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
qam_table_s0 = qam64_table_a0;
|
||||
#ifdef NEW_ALLOC_RE
|
||||
/* TODO: remove this code? */
|
||||
allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ?
|
||||
allocate_REs_in_RB_no_pilots_64QAM_siso :
|
||||
allocate_REs_in_RB;
|
||||
#endif
|
||||
}
|
||||
/* TODO: this is a quick hack to be removed. There is a problem
|
||||
* with above code that needs to be analyzed and fixed. In the
|
||||
* meantime, let's use the generic function.
|
||||
*/
|
||||
allocate_REs = allocate_REs_in_RB;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
/* TODO: hack, to be removed. The power is too different from
|
||||
* previous version. Some more work/validation is needed before
|
||||
* we switch to the new version.
|
||||
*/
|
||||
allocate_REs = allocate_REs_in_RB;
|
||||
|
||||
switch (mod_order1) {
|
||||
case 2:
|
||||
qam_table_s1 = NULL;
|
||||
#ifdef NEW_ALLOC_RE
|
||||
/* TODO: remove this code? */
|
||||
allocate_REs = allocate_REs_in_RB;
|
||||
#endif
|
||||
/*if (pilots) {
|
||||
if (pilots) {
|
||||
qam_table_s1 = qpsk_table_b1;
|
||||
}
|
||||
else {
|
||||
qam_table_s1 = qpsk_table_a1;
|
||||
}*/
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (pilots) {
|
||||
@@ -2521,7 +2519,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
||||
rb);
|
||||
|
||||
|
||||
allocate_REs_in_RB(phy_vars_eNB,
|
||||
allocate_REs(phy_vars_eNB,
|
||||
txdataF,
|
||||
&jj,
|
||||
&jj2,
|
||||
|
||||
@@ -34,47 +34,20 @@
|
||||
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
#include "PHY/CODING/coding_extern.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "transport_eNB.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
|
||||
static inline unsigned int lte_gold_scram(unsigned int *x1, unsigned int *x2, unsigned char reset) __attribute__((always_inline));
|
||||
static inline unsigned int lte_gold_scram(unsigned int *x1, unsigned int *x2, unsigned char reset)
|
||||
{
|
||||
int n;
|
||||
|
||||
if (reset) {
|
||||
*x1 = 1+ (1<<31);
|
||||
*x2=*x2 ^ ((*x2 ^ (*x2>>1) ^ (*x2>>2) ^ (*x2>>3))<<31);
|
||||
|
||||
// skip first 50 double words (1600 bits)
|
||||
// printf("n=0 : x1 %x, x2 %x\n",x1,x2);
|
||||
for (n=1; n<50; n++) {
|
||||
*x1 = (*x1>>1) ^ (*x1>>4);
|
||||
*x1 = *x1 ^ (*x1<<31) ^ (*x1<<28);
|
||||
*x2 = (*x2>>1) ^ (*x2>>2) ^ (*x2>>3) ^ (*x2>>4);
|
||||
*x2 = *x2 ^ (*x2<<31) ^ (*x2<<30) ^ (*x2<<29) ^ (*x2<<28);
|
||||
}
|
||||
}
|
||||
|
||||
*x1 = (*x1>>1) ^ (*x1>>4);
|
||||
*x1 = *x1 ^ (*x1<<31) ^ (*x1<<28);
|
||||
*x2 = (*x2>>1) ^ (*x2>>2) ^ (*x2>>3) ^ (*x2>>4);
|
||||
*x2 = *x2 ^ (*x2<<31) ^ (*x2<<30) ^ (*x2<<29) ^ (*x2<<28);
|
||||
return(*x1^*x2);
|
||||
// printf("n=%d : c %x\n",n,x1^x2);
|
||||
|
||||
}
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
|
||||
void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
int mbsfn_flag,
|
||||
LTE_eNB_DLSCH_t *dlsch,
|
||||
int harq_pid,
|
||||
int harq_pid,
|
||||
int G,
|
||||
uint8_t q,
|
||||
uint16_t frame,
|
||||
uint16_t frame,
|
||||
uint8_t Ns)
|
||||
{
|
||||
|
||||
@@ -87,18 +60,32 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_SCRAMBLING, VCD_FUNCTION_IN);
|
||||
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
// Rule for accumulation of subframes for BL/CE UEs
|
||||
uint8_t Nacc=4;
|
||||
uint16_t j0,j,idelta;
|
||||
uint16_t i = (Ns>>1) + (10*frame);
|
||||
#ifdef PHY_TX_THREAD
|
||||
uint16_t i0 = dlsch->harq_processes[harq_pid]->i0;
|
||||
#else
|
||||
uint16_t i0 = dlsch->i0;
|
||||
#endif
|
||||
|
||||
#ifdef PHY_TX_THREAD
|
||||
if (dlsch->harq_processes[harq_pid]->sib1_br_flag==1) Nacc=1;
|
||||
#else
|
||||
if (dlsch->sib1_br_flag==1) Nacc=1;
|
||||
#endif
|
||||
else if (dlsch->rnti == 0xFFFF || dlsch->rnti == 0xFFFE) Nacc = (frame_parms->frame_type == TDD) ? 10 : 4;
|
||||
#ifdef PHY_TX_THREAD
|
||||
// Note: above SC-RNTI will also have to be added when/if implemented
|
||||
else if (dlsch->harq_processes[harq_pid]->CEmode == CEmodeA) Nacc=1;
|
||||
else if (dlsch->harq_processes[harq_pid]->CEmode == CEmodeB) Nacc = (frame_parms->frame_type == TDD) ? 10 : 4;
|
||||
#else
|
||||
// Note: above SC-RNTI will also have to be added when/if implemented
|
||||
else if (dlsch->CEmode == CEmodeA) Nacc=1;
|
||||
else if (dlsch->CEmode == CEmodeB) Nacc = (frame_parms->frame_type == TDD) ? 10 : 4;
|
||||
#endif
|
||||
|
||||
if (frame_parms->frame_type == FDD || Nacc == 1) idelta = 0;
|
||||
else idelta = Nacc-2;
|
||||
@@ -110,8 +97,12 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
// reset = 1;
|
||||
// x1 is set in lte_gold_generic
|
||||
if (mbsfn_flag == 0) {
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#ifdef PHY_TX_THREAD
|
||||
if (dlsch->harq_processes[harq_pid]->i0 != 0xFFFF) {
|
||||
#else
|
||||
if (dlsch->i0 != 0xFFFF) {
|
||||
#endif
|
||||
// rule for BL/CE UEs from Section 6.3.1 in 36.211
|
||||
x2= (dlsch->rnti<<14) + (q<<13) + ((((j0+j)*Nacc)%10)<<9) + frame_parms->Nid_cell;
|
||||
if ((frame&1023) < 200) LOG_D(PHY,"Scrambling init for (i0 %d, i %d, j0 %d, j %d, Nacc %d) => x2 %d\n",i0,i,j0,j,Nacc,x2);
|
||||
@@ -124,13 +115,13 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
}
|
||||
|
||||
#ifdef DEBUG_SCRAMBLING
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
printf("scrambling: i0 %d rnti %x, q %d, Ns %d, Nid_cell %d, G %d x2 %x\n",dlsch->i0,dlsch->rnti,q,Ns,frame_parms->Nid_cell, G, x2);
|
||||
#else
|
||||
printf("scrambling: rnti %x, q %d, Ns %d, Nid_cell %d, G %d x2 %x\n",dlsch->rnti,q,Ns,frame_parms->Nid_cell, G, x2);
|
||||
#endif
|
||||
#endif
|
||||
s = lte_gold_scram(&x1, &x2, 1);
|
||||
s = lte_gold_generic(&x1, &x2, 1);
|
||||
|
||||
for (n=0; n<(1+(G>>5)); n++) {
|
||||
|
||||
@@ -179,7 +170,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
|
||||
|
||||
s = lte_gold_scram(&x1, &x2, 0);
|
||||
s = lte_gold_generic(&x1, &x2, 0);
|
||||
e += 32;
|
||||
}
|
||||
|
||||
@@ -225,7 +216,7 @@ void dlsch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
#ifdef DEBUG_SCRAMBLING
|
||||
printf("unscrambling: rnti %x, q %d, Ns %d, Nid_cell %d G %d, x2 %x\n",dlsch->rnti,q,Ns,frame_parms->Nid_cell,G,x2);
|
||||
#endif
|
||||
s = lte_gold_scram(&x1, &x2, 1);
|
||||
s = lte_gold_generic(&x1, &x2, 1);
|
||||
|
||||
for (i=0; i<(1+(G>>5)); i++) {
|
||||
for (j=0; j<32; j++,k++) {
|
||||
@@ -238,7 +229,7 @@ void dlsch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
#endif
|
||||
}
|
||||
|
||||
s = lte_gold_scram(&x1, &x2, 0);
|
||||
s = lte_gold_generic(&x1, &x2, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,173 +0,0 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file PHY/LTE_TRANSPORT/drs_modulation.c
|
||||
* \brief Top-level routines for generating the Demodulation Reference Signals from 36-211, V8.6 2009-03
|
||||
* \author R. Knopp, F. Kaltenberger, A. Bhamri
|
||||
* \date 2011
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr,ankit.bhamri@eurecom.fr
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "PHY/sse_intrin.h"
|
||||
//#define DEBUG_DRS
|
||||
|
||||
int generate_drs_pusch(PHY_VARS_UE *ue,
|
||||
UE_rxtx_proc_t *proc,
|
||||
uint8_t eNB_id,
|
||||
short amp,
|
||||
unsigned int subframe,
|
||||
unsigned int first_rb,
|
||||
unsigned int nb_rb,
|
||||
uint8_t ant)
|
||||
{
|
||||
|
||||
uint16_t k,l,Msc_RS,Msc_RS_idx,rb,drs_offset;
|
||||
uint16_t * Msc_idx_ptr;
|
||||
int subframe_offset,re_offset,symbol_offset;
|
||||
|
||||
//uint32_t phase_shift; // phase shift for cyclic delay in DM RS
|
||||
//uint8_t alpha_ind;
|
||||
|
||||
int16_t alpha_re[12] = {32767, 28377, 16383, 0,-16384, -28378,-32768,-28378,-16384, -1, 16383, 28377};
|
||||
int16_t alpha_im[12] = {0, 16383, 28377, 32767, 28377, 16383, 0,-16384,-28378,-32768,-28378,-16384};
|
||||
|
||||
uint8_t cyclic_shift,cyclic_shift0,cyclic_shift1;
|
||||
LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
|
||||
int32_t *txdataF = ue->common_vars.txdataF[ant];
|
||||
uint32_t u,v,alpha_ind;
|
||||
uint32_t u0=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[subframe<<1];
|
||||
uint32_t u1=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[1+(subframe<<1)];
|
||||
uint32_t v0=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1];
|
||||
uint32_t v1=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)];
|
||||
int32_t ref_re,ref_im;
|
||||
uint8_t harq_pid = subframe2harq_pid(frame_parms,proc->frame_tx,subframe);
|
||||
|
||||
cyclic_shift0 = (frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift +
|
||||
ue->ulsch[eNB_id]->harq_processes[harq_pid]->n_DMRS2 +
|
||||
frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[subframe<<1]+
|
||||
((ue->ulsch[0]->cooperation_flag==2)?10:0)+
|
||||
ant*6) % 12;
|
||||
// printf("PUSCH.cyclicShift %d, n_DMRS2 %d, nPRS %d\n",frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift,ue->ulsch[eNB_id]->n_DMRS2,ue->lte_frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[subframe<<1]);
|
||||
cyclic_shift1 = (frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift +
|
||||
ue->ulsch[eNB_id]->harq_processes[harq_pid]->n_DMRS2 +
|
||||
frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[(subframe<<1)+1]+
|
||||
((ue->ulsch[0]->cooperation_flag==2)?10:0)+
|
||||
ant*6) % 12;
|
||||
|
||||
// cyclic_shift0 = 0;
|
||||
// cyclic_shift1 = 0;
|
||||
Msc_RS = 12*nb_rb;
|
||||
|
||||
Msc_idx_ptr = (uint16_t*) bsearch(&Msc_RS, dftsizes, 33, sizeof(uint16_t), compareints);
|
||||
|
||||
if (Msc_idx_ptr)
|
||||
Msc_RS_idx = Msc_idx_ptr - dftsizes;
|
||||
else {
|
||||
LOG_I(PHY,"generate_drs_pusch: index for Msc_RS=%d not found\n",Msc_RS);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
for (l = (3 - frame_parms->Ncp),u=u0,v=v0,cyclic_shift=cyclic_shift0;
|
||||
l<frame_parms->symbols_per_tti;
|
||||
l += (7 - frame_parms->Ncp),u=u1,v=v1,cyclic_shift=cyclic_shift1) {
|
||||
|
||||
drs_offset = 0;
|
||||
#ifdef DEBUG_DRS
|
||||
printf("drs_modulation: Msc_RS = %d, Msc_RS_idx = %d, u=%d,v=%d\n",Msc_RS, Msc_RS_idx,u,v);
|
||||
#endif
|
||||
|
||||
|
||||
re_offset = frame_parms->first_carrier_offset;
|
||||
subframe_offset = subframe*frame_parms->symbols_per_tti*frame_parms->ofdm_symbol_size;
|
||||
symbol_offset = subframe_offset + frame_parms->ofdm_symbol_size*l;
|
||||
|
||||
|
||||
#ifdef DEBUG_DRS
|
||||
printf("generate_drs_pusch: symbol_offset %d, subframe offset %d, cyclic shift %d\n",symbol_offset,subframe_offset,cyclic_shift);
|
||||
#endif
|
||||
alpha_ind = 0;
|
||||
|
||||
for (rb=0; rb<frame_parms->N_RB_UL; rb++) {
|
||||
|
||||
if ((rb >= first_rb) && (rb<(first_rb+nb_rb))) {
|
||||
|
||||
#ifdef DEBUG_DRS
|
||||
printf("generate_drs_pusch: doing RB %d, re_offset=%d, drs_offset=%d,cyclic shift %d\n",rb,re_offset,drs_offset,cyclic_shift);
|
||||
#endif
|
||||
|
||||
for (k=0; k<12; k++) {
|
||||
ref_re = (int32_t) ul_ref_sigs[u][v][Msc_RS_idx][drs_offset<<1];
|
||||
ref_im = (int32_t) ul_ref_sigs[u][v][Msc_RS_idx][(drs_offset<<1)+1];
|
||||
|
||||
((int16_t*) txdataF)[2*(symbol_offset + re_offset)] = (int16_t) (((ref_re*alpha_re[alpha_ind]) -
|
||||
(ref_im*alpha_im[alpha_ind]))>>15);
|
||||
((int16_t*) txdataF)[2*(symbol_offset + re_offset)+1] = (int16_t) (((ref_re*alpha_im[alpha_ind]) +
|
||||
(ref_im*alpha_re[alpha_ind]))>>15);
|
||||
((short*) txdataF)[2*(symbol_offset + re_offset)] = (short) ((((short*) txdataF)[2*(symbol_offset + re_offset)]*(int32_t)amp)>>15);
|
||||
((short*) txdataF)[2*(symbol_offset + re_offset)+1] = (short) ((((short*) txdataF)[2*(symbol_offset + re_offset)+1]*(int32_t)amp)>>15);
|
||||
|
||||
|
||||
alpha_ind = (alpha_ind + cyclic_shift);
|
||||
|
||||
if (alpha_ind > 11)
|
||||
alpha_ind-=12;
|
||||
|
||||
#ifdef DEBUG_DRS
|
||||
printf("symbol_offset %d, alpha_ind %d , re_offset %d : (%d,%d)\n",
|
||||
symbol_offset,
|
||||
alpha_ind,
|
||||
re_offset,
|
||||
((short*) txdataF)[2*(symbol_offset + re_offset)],
|
||||
((short*) txdataF)[2*(symbol_offset + re_offset)+1]);
|
||||
|
||||
#endif // DEBUG_DRS
|
||||
re_offset++;
|
||||
drs_offset++;
|
||||
|
||||
if (re_offset >= frame_parms->ofdm_symbol_size)
|
||||
re_offset = 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
re_offset+=12; // go to next RB
|
||||
|
||||
// check if we crossed the symbol boundary and skip DC
|
||||
|
||||
if (re_offset >= frame_parms->ofdm_symbol_size) {
|
||||
if (frame_parms->N_RB_DL&1) // odd number of RBs
|
||||
re_offset=6;
|
||||
else // even number of RBs (doesn't straddle DC)
|
||||
re_offset=0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -40,15 +40,14 @@
|
||||
#include "transport_proto.h"
|
||||
#include "transport_common_proto.h"
|
||||
#include "assertions.h"
|
||||
#include "T.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
|
||||
//#define DEBUG_DCI_ENCODING 1
|
||||
//#define DEBUG_DCI_DECODING 1
|
||||
//#define DEBUG_PHY
|
||||
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
void generate_edci_top(PHY_VARS_eNB *eNB, int frame, int subframe) {
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -37,7 +37,7 @@
|
||||
|
||||
//#include "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
|
||||
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
//#define DEBUG_DL_MOBIPASS
|
||||
//#define DEBUG_UL_MOBIPASS
|
||||
#define SUBFRAME_SKIP_NUM_MOBIPASS 8
|
||||
@@ -297,7 +297,7 @@ void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int subframe, uint8_t
|
||||
#ifdef DEBUG_DL_MOBIPASS
|
||||
if(subframe==0) {
|
||||
if (dummy_cnt==100) {
|
||||
write_output("txsigmb.m","txs",(void*)dummy_buffer, fp->samples_per_tti,1, 5);
|
||||
LOG_M("txsigmb.m","txs",(void*)dummy_buffer, fp->samples_per_tti,1, 5);
|
||||
exit(-1);
|
||||
} else {
|
||||
dummy_cnt++;
|
||||
@@ -601,7 +601,7 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16
|
||||
if (rxe > 0){
|
||||
LOG_I(PHY,"[Mobipass] frame:%d, subframe:%d, energy %d\n", (*proc_timestamp/(10*fp->samples_per_tti))&1023,subframe, rxe);
|
||||
|
||||
// write_output("rxsigmb.m","rxs",(void*)dummy_buffer_rx, fp->samples_per_tti,1, 5);
|
||||
// LOG_M("rxsigmb.m","rxs",(void*)dummy_buffer_rx, fp->samples_per_tti,1, 5);
|
||||
// exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include "PHY/types.h"
|
||||
|
||||
/**
|
||||
\brief Gold Sequence Generation defined in 3x.211
|
||||
\param x1 x1 shift register
|
||||
\param x2 x2 shift register / cinit if reset is set
|
||||
\param reset Reset flag / reinitialize the generator
|
||||
\return c 32 bits of gold output
|
||||
*/
|
||||
extern inline uint32_t lte_gold_generic(uint32_t *x1, uint32_t *x2, uint8_t reset)
|
||||
{
|
||||
int32_t n;
|
||||
|
||||
// 3GPP 3x.211
|
||||
// Nc = 1600
|
||||
// c(n) = [x1(n+Nc) + x2(n+Nc)]mod2
|
||||
// x1(n+31) = [x1(n+3) + x1(n)]mod2
|
||||
// x2(n+31) = [x2(n+3) + x2(n+2) + x2(n+1) + x2(n)]mod2
|
||||
if (reset)
|
||||
{
|
||||
// Init value for x1: x1(0) = 1, x1(n) = 0, n=1,2,...,30
|
||||
// x1(31) = [x1(3) + x1(0)]mod2 = 1
|
||||
*x1 = 1 + (1<<31);
|
||||
// Init value for x2: cinit = sum_{i=0}^30 x2*2^i
|
||||
// x2(31) = [x2(3) + x2(2) + x2(1) + x2(0)]mod2
|
||||
// = (*x2>>3) ^ (*x2>>2) + (*x2>>1) + *x2
|
||||
*x2 = *x2 ^ ((*x2 ^ (*x2>>1) ^ (*x2>>2) ^ (*x2>>3))<<31);
|
||||
|
||||
// x1 and x2 contain bits n = 0,1,...,31
|
||||
|
||||
// Nc = 1600 bits are skipped at the beginning
|
||||
// i.e., 1600 / 32 = 50 32bit words
|
||||
|
||||
for (n = 1; n < 50; n++)
|
||||
{
|
||||
// Compute x1(0),...,x1(27)
|
||||
*x1 = (*x1>>1) ^ (*x1>>4);
|
||||
// Compute x1(28),..,x1(31) and xor
|
||||
*x1 = *x1 ^ (*x1<<31) ^ (*x1<<28);
|
||||
// Compute x2(0),...,x2(27)
|
||||
*x2 = (*x2>>1) ^ (*x2>>2) ^ (*x2>>3) ^ (*x2>>4);
|
||||
// Compute x2(28),..,x2(31) and xor
|
||||
*x2 = *x2 ^ (*x2<<31) ^ (*x2<<30) ^ (*x2<<29) ^ (*x2<<28);
|
||||
}
|
||||
}
|
||||
|
||||
*x1 = (*x1>>1) ^ (*x1>>4);
|
||||
*x1 = *x1 ^ (*x1<<31) ^ (*x1<<28);
|
||||
*x2 = (*x2>>1) ^ (*x2>>2) ^ (*x2>>3) ^ (*x2>>4);
|
||||
*x2 = *x2 ^ (*x2<<31) ^ (*x2<<30) ^ (*x2<<29) ^ (*x2<<28);
|
||||
|
||||
// c(n) = [x1(n+Nc) + x2(n+Nc)]mod2
|
||||
return(*x1^*x2);
|
||||
}
|
||||
@@ -281,7 +281,7 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_PBCH
|
||||
write_output("pbch_encoded_output2.m","pbch_encoded_out2",
|
||||
LOG_M"pbch_encoded_output2.m","pbch_encoded_out2",
|
||||
pbch_coded_data2,
|
||||
pbch_coded_bits,
|
||||
1,
|
||||
@@ -308,7 +308,7 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
|
||||
|
||||
#ifdef DEBUG_PBCH
|
||||
if (frame_mod4==0) {
|
||||
write_output("pbch_e.m","pbch_e",
|
||||
LOG_M"pbch_e.m","pbch_e",
|
||||
eNB_pbch->pbch_e,
|
||||
pbch_E,
|
||||
1,
|
||||
@@ -325,7 +325,7 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
|
||||
pbch_E);
|
||||
#ifdef DEBUG_PBCH
|
||||
if (frame_mod4==0) {
|
||||
write_output("pbch_e_s.m","pbch_e_s",
|
||||
LOG_M"pbch_e_s.m","pbch_e_s",
|
||||
eNB_pbch->pbch_e,
|
||||
pbch_E,
|
||||
1,
|
||||
|
||||
@@ -712,12 +712,10 @@ void generate_phich_top(PHY_VARS_eNB *eNB,
|
||||
|
||||
LTE_DL_FRAME_PARMS *frame_parms=&eNB->frame_parms;
|
||||
int32_t **txdataF = eNB->common_vars.txdataF;
|
||||
uint8_t harq_pid;
|
||||
uint8_t Ngroup_PHICH,ngroup_PHICH,nseq_PHICH;
|
||||
uint8_t NSF_PHICH = 4;
|
||||
uint8_t pusch_subframe;
|
||||
uint8_t i;
|
||||
uint32_t pusch_frame;
|
||||
int subframe = proc->subframe_tx;
|
||||
phich_config_t *phich;
|
||||
|
||||
@@ -732,9 +730,7 @@ void generate_phich_top(PHY_VARS_eNB *eNB,
|
||||
NSF_PHICH = 2;
|
||||
|
||||
if (eNB->phich_vars[subframe&1].num_hi > 0) {
|
||||
pusch_frame = phich_frame2_pusch_frame(frame_parms,proc->frame_tx,subframe);
|
||||
pusch_subframe = phich_subframe2_pusch_subframe(frame_parms,subframe);
|
||||
harq_pid = subframe2harq_pid(frame_parms,pusch_frame,pusch_subframe);
|
||||
}
|
||||
|
||||
for (i=0; i<eNB->phich_vars[subframe&1].num_hi; i++) {
|
||||
@@ -753,13 +749,15 @@ void generate_phich_top(PHY_VARS_eNB *eNB,
|
||||
nseq_PHICH = ((phich->first_rb/Ngroup_PHICH) +
|
||||
phich->n_DMRS)%(2*NSF_PHICH);
|
||||
LOG_D(PHY,"[eNB %d][PUSCH %d] Frame %d subframe %d Generating PHICH, AMP %d ngroup_PHICH %d/%d, nseq_PHICH %d : HI %d, first_rb %d)\n",
|
||||
eNB->Mod_id,harq_pid,proc->frame_tx,
|
||||
eNB->Mod_id,subframe2harq_pid(frame_parms,
|
||||
phich_frame2_pusch_frame(frame_parms,proc->frame_tx,subframe),pusch_subframe),proc->frame_tx,
|
||||
subframe,amp,ngroup_PHICH,Ngroup_PHICH,nseq_PHICH,
|
||||
phich->hi,
|
||||
phich->first_rb);
|
||||
|
||||
T(T_ENB_PHY_PHICH, T_INT(eNB->Mod_id), T_INT(proc->frame_tx), T_INT(subframe),
|
||||
T_INT(-1 /* TODO: rnti */), T_INT(harq_pid),
|
||||
T_INT(-1 /* TODO: rnti */),
|
||||
T_INT(subframe2harq_pid(frame_parms,phich_frame2_pusch_frame(frame_parms,proc->frame_tx,subframe),pusch_subframe)),
|
||||
T_INT(Ngroup_PHICH), T_INT(NSF_PHICH),
|
||||
T_INT(ngroup_PHICH), T_INT(nseq_PHICH),
|
||||
T_INT(phich->hi),
|
||||
|
||||
@@ -35,15 +35,10 @@
|
||||
//#include "prach.h"
|
||||
#include "PHY/LTE_TRANSPORT/if4_tools.h"
|
||||
#include "SCHED/sched_eNB.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "prach_extern.h"
|
||||
|
||||
//#define PRACH_DEBUG 1
|
||||
//#define PRACH_WRITE_OUTPUT_DEBUG 1
|
||||
|
||||
|
||||
|
||||
#ifndef Rel14
|
||||
#if (RRC_VERSION < MAKE_VERSION(14, 0, 0))
|
||||
#define rx_prach0 rx_prach
|
||||
#endif
|
||||
|
||||
@@ -54,7 +49,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
uint16_t *max_preamble_delay,
|
||||
uint16_t Nf,
|
||||
uint8_t tdd_mapindex
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
,uint8_t br_flag,
|
||||
uint8_t ce_level
|
||||
#endif
|
||||
@@ -70,10 +65,6 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
uint8_t Ncs_config;
|
||||
uint8_t restricted_set;
|
||||
uint8_t n_ra_prb;
|
||||
|
||||
#ifdef PRACH_DEBUG
|
||||
int frame;
|
||||
#endif
|
||||
int subframe;
|
||||
int16_t *prachF=NULL;
|
||||
int16_t **rxsigF=NULL;
|
||||
@@ -92,7 +83,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
uint8_t not_found;
|
||||
int k=0;
|
||||
uint16_t u;
|
||||
int16_t *Xu;
|
||||
int16_t *Xu=0;
|
||||
uint16_t offset;
|
||||
int16_t Ncp;
|
||||
uint16_t first_nonzero_root_idx=0;
|
||||
@@ -104,12 +95,10 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
int16_t prach_ifft_tmp[2048*2] __attribute__((aligned(32)));
|
||||
int32_t *prach_ifft=(int32_t*)NULL;
|
||||
int32_t **prach_ifftp=(int32_t **)NULL;
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
int prach_ifft_cnt=0;
|
||||
#endif
|
||||
#ifdef PRACH_DEBUG
|
||||
int en0=0;
|
||||
#endif
|
||||
|
||||
|
||||
if (ru) {
|
||||
fp = ru->frame_parms;
|
||||
@@ -123,7 +112,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
|
||||
frame_type = fp->frame_type;
|
||||
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
if (br_flag == 1) {
|
||||
AssertFatal(fp->prach_emtc_config_common.prach_Config_enabled==1,
|
||||
"emtc prach_Config is not enabled\n");
|
||||
@@ -158,64 +147,52 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
uint16_t N_ZC = (prach_fmt <4)?839:139;
|
||||
|
||||
if (eNB) {
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
if (br_flag == 1) {
|
||||
prach_ifftp = eNB->prach_vars_br.prach_ifft[ce_level];
|
||||
#ifdef PRACH_DEBUG
|
||||
frame = eNB->proc.frame_prach_br;
|
||||
#endif
|
||||
subframe = eNB->proc.subframe_prach_br;
|
||||
prachF = eNB->prach_vars_br.prachF;
|
||||
rxsigF = eNB->prach_vars_br.rxsigF[ce_level];
|
||||
#ifdef PRACH_DEBUG
|
||||
if ((frame&1023) < 20) LOG_I(PHY,"PRACH (eNB) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d, rootSequenceIndex %d, repetition number %d,numRepetitionsPrePreambleAttempt %d\n",
|
||||
br_flag,ce_level,frame,subframe,
|
||||
LOG_DEBUG_BEGIN(PRACH)
|
||||
if (((ru->proc.frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (eNB) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d, rootSequenceIndex %d, repetition number %d,numRepetitionsPrePreambleAttempt %d\n",
|
||||
br_flag,ce_level,ru->proc.frame_prach,subframe,
|
||||
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level],
|
||||
prach_ConfigIndex,rootSequenceIndex,
|
||||
eNB->prach_vars_br.repetition_number[ce_level],
|
||||
fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[ce_level]);
|
||||
#endif
|
||||
LOG_DEBUG_END
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
prach_ifftp = eNB->prach_vars.prach_ifft[0];
|
||||
#ifdef PRACH_DEBUG
|
||||
frame = eNB->proc.frame_prach;
|
||||
#endif
|
||||
subframe = eNB->proc.subframe_prach;
|
||||
prachF = eNB->prach_vars.prachF;
|
||||
rxsigF = eNB->prach_vars.rxsigF[0];
|
||||
#ifdef PRACH_DEBUG
|
||||
//if ((frame&1023) < 20) LOG_I(PHY,"PRACH (eNB) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", subframe,fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex,rootSequenceIndex);
|
||||
#endif
|
||||
LOG_DEBUG_BEGIN(PRACH)
|
||||
if (((ru->proc.frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (eNB) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", subframe,fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex,rootSequenceIndex);
|
||||
LOG_DEBUG_END
|
||||
}
|
||||
}
|
||||
else {
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
if (br_flag == 1) {
|
||||
#ifdef PRACH_DEBUG
|
||||
frame = ru->proc.frame_prach_br;
|
||||
#endif
|
||||
subframe = ru->proc.subframe_prach_br;
|
||||
rxsigF = ru->prach_rxsigF_br[ce_level];
|
||||
#ifdef PRACH_DEBUG
|
||||
if ((frame&1023) < 20) LOG_I(PHY,"PRACH (RU) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n",
|
||||
br_flag,ce_level,frame,subframe,fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level],prach_ConfigIndex);
|
||||
#endif
|
||||
LOG_DEBUG_BEGIN(PRACH)
|
||||
if (((ru->proc.frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (RU) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n",
|
||||
br_flag,ce_level,ru->proc.frame_prach,subframe,fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level],prach_ConfigIndex);
|
||||
LOG_DEBUG_END
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#ifdef PRACH_DEBUG
|
||||
frame = ru->proc.frame_prach;
|
||||
#endif
|
||||
subframe = ru->proc.subframe_prach;
|
||||
rxsigF = ru->prach_rxsigF;
|
||||
#ifdef PRACH_DEBUG
|
||||
if ((frame&1023) < 20) LOG_I(PHY,"PRACH (RU) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n",
|
||||
LOG_DEBUG_BEGIN(PRACH)
|
||||
if (((ru->proc.frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (RU) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n",
|
||||
subframe,fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex);
|
||||
#endif
|
||||
LOG_DEBUG_END
|
||||
}
|
||||
|
||||
}
|
||||
@@ -226,31 +203,28 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
if (ru->if_south == LOCAL_RF) { // set the time-domain signal if we have to use it in this node
|
||||
// DJP - indexing below in subframe zero takes us off the beginning of the array???
|
||||
prach[aa] = (int16_t*)&ru->common.rxdata[aa][(subframe*fp->samples_per_tti)-ru->N_TA_offset];
|
||||
#ifdef PRACH_DEBUG
|
||||
int32_t en0=signal_energy((int32_t*)prach[aa],fp->samples_per_tti);
|
||||
int8_t dbEn0 = dB_fixed(en0);
|
||||
int8_t rach_dBm = dbEn0 - eNB->rx_total_gain_dB;
|
||||
|
||||
#ifdef PRACH_WRITE_OUTPUT_DEBUG
|
||||
LOG_M_BEGIN(PRACH)
|
||||
int32_t en0=signal_energy((int32_t*)prach[aa],fp->samples_per_tti);
|
||||
int8_t dbEn0 = dB_fixed(en0);
|
||||
int8_t rach_dBm = dbEn0 - ru->rx_total_gain_dB;
|
||||
char buffer[80];
|
||||
if (dbEn0>32 && prach[0]!= NULL)
|
||||
{
|
||||
static int counter=0;
|
||||
|
||||
char buffer[80];
|
||||
//counter++;
|
||||
sprintf(buffer, "%s%d", "/tmp/prach_rx",counter);
|
||||
write_output(buffer,"prach_rx",prach[0],fp->samples_per_tti,1,13);
|
||||
LOG_M(buffer,"prach_rx",prach[0],fp->samples_per_tti,1,13);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (dbEn0>32)
|
||||
if (dB_fixed(en0)>32)
|
||||
{
|
||||
#ifdef PRACH_WRITE_OUTPUT_DEBUG
|
||||
if (prach[0]!= NULL) write_output("prach_rx","prach_rx",prach[0],fp->samples_per_tti,1,1);
|
||||
#endif
|
||||
LOG_I(PHY,"RU %d, br_flag %d ce_level %d frame %d subframe %d per_tti:%d prach:%p (energy %d) TA:%d rach_dBm:%d rxdata:%p index:%d\n",ru->idx,br_flag,ce_level,frame,subframe,fp->samples_per_tti,prach[aa],dbEn0,ru->N_TA_offset,rach_dBm,ru->common.rxdata[aa], (subframe*fp->samples_per_tti)-ru->N_TA_offset);
|
||||
sprintf(buffer, "rach_dBm:%d",rach_dBm);
|
||||
if (prach[0]!= NULL) LOG_M("prach_rx","prach_rx",prach[0],fp->samples_per_tti,1,1);
|
||||
LOG_I(PHY,"RU %d, br_flag %d ce_level %d frame %d subframe %d per_tti:%d prach:%p (energy %d) TA:%d %s rxdata:%p index:%d\n",
|
||||
ru->idx,br_flag,ce_level,ru->proc.frame_prach,subframe,fp->samples_per_tti,
|
||||
prach[aa],dbEn0,ru->N_TA_offset,buffer,ru->common.rxdata[aa],
|
||||
(subframe*fp->samples_per_tti)-ru->N_TA_offset);
|
||||
}
|
||||
#endif
|
||||
LOG_M_END
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,9 +306,9 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
if (((eNB!=NULL) && (ru->function != NGFI_RAU_IF4p5))||
|
||||
((eNB==NULL) && (ru->function == NGFI_RRU_IF4p5))) { // compute the DFTs of the PRACH temporal resources
|
||||
// Do forward transform
|
||||
#ifdef PRACH_DEBUG
|
||||
LOG_DEBUG_BEGIN(PRACH)
|
||||
LOG_D(PHY,"rx_prach: Doing FFT for N_RB_UL %d nb_rx:%d Ncp:%d\n",fp->N_RB_UL, nb_rx, Ncp);
|
||||
#endif
|
||||
LOG_DEBUG_END
|
||||
for (aa=0; aa<nb_rx; aa++) {
|
||||
AssertFatal(prach[aa]!=NULL,"prach[%d] is null\n",aa);
|
||||
prach2 = prach[aa] + (Ncp<<1);
|
||||
@@ -385,10 +359,10 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
if (prach_fmt == 4) {
|
||||
dft2048(prach2,rxsigF[aa],1);
|
||||
} else {
|
||||
dft12288(prach2,rxsigF[aa]);
|
||||
dft12288(prach2,rxsigF[aa],1);
|
||||
|
||||
if (prach_fmt>1)
|
||||
dft12288(prach2+24576,rxsigF[aa]+24576);
|
||||
dft12288(prach2+24576,rxsigF[aa]+24576,1);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -397,10 +371,10 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
if (prach_fmt == 4) {
|
||||
dft3072(prach2,rxsigF[aa],1);
|
||||
} else {
|
||||
dft18432(prach2,rxsigF[aa]);
|
||||
dft18432(prach2,rxsigF[aa],1);
|
||||
|
||||
if (prach_fmt>1)
|
||||
dft18432(prach2+36864,rxsigF[aa]+36864);
|
||||
dft18432(prach2+36864,rxsigF[aa]+36864,1);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -410,19 +384,19 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
if (prach_fmt == 4) {
|
||||
dft4096(prach2,rxsigF[aa],1);
|
||||
} else {
|
||||
dft24576(prach2,rxsigF[aa]);
|
||||
dft24576(prach2,rxsigF[aa],1);
|
||||
|
||||
if (prach_fmt>1)
|
||||
dft24576(prach2+49152,rxsigF[aa]+49152);
|
||||
dft24576(prach2+49152,rxsigF[aa]+49152,1);
|
||||
}
|
||||
} else {
|
||||
if (prach_fmt == 4) {
|
||||
dft3072(prach2,rxsigF[aa],1);
|
||||
} else {
|
||||
dft18432(prach2,rxsigF[aa]);
|
||||
dft18432(prach2,rxsigF[aa],1);
|
||||
|
||||
if (prach_fmt>1)
|
||||
dft18432(prach2+36864,rxsigF[aa]+36864);
|
||||
dft18432(prach2+36864,rxsigF[aa]+36864,1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,7 +429,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
if ((eNB==NULL) && (ru!=NULL) && ru->function == NGFI_RRU_IF4p5) {
|
||||
|
||||
/// **** send_IF4 of rxsigF to RAU **** ///
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
if (br_flag == 1) send_IF4p5(ru, ru->proc.frame_prach, ru->proc.subframe_prach, IF4p5_PRACH+1+ce_level);
|
||||
|
||||
else
|
||||
@@ -465,10 +439,10 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
return;
|
||||
} else if (eNB!=NULL) {
|
||||
|
||||
#ifdef PRACH_DEBUG
|
||||
LOG_DEBUG_BEGIN(PRACH)
|
||||
int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
|
||||
if ((en > 60)&&(br_flag==1)) LOG_I(PHY,"PRACH (br_flag %d,ce_level %d, n_ra_prb %d, k %d): Frame %d, Subframe %d => %d dB\n",br_flag,ce_level,n_ra_prb,k,eNB->proc.frame_rx,eNB->proc.subframe_rx,en);
|
||||
#endif
|
||||
LOG_DEBUG_END
|
||||
}
|
||||
|
||||
// in case of RAU and prach received rx_thread wakes up prach
|
||||
@@ -503,9 +477,10 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
*max_preamble_energy=0;
|
||||
for (preamble_index=0 ; preamble_index<64 ; preamble_index++) {
|
||||
|
||||
#ifdef PRACH_DEBUG
|
||||
if (en>60) LOG_I(PHY,"frame %d, subframe %d : Trying preamble %d (br_flag %d)\n",frame,subframe,preamble_index,br_flag);
|
||||
#endif
|
||||
LOG_DEBUG_BEGIN(PRACH)
|
||||
int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
|
||||
if (en>60) LOG_I(PHY,"frame %d, subframe %d : Trying preamble %d (br_flag %d)\n",ru->proc.frame_prach,subframe,preamble_index,br_flag);
|
||||
LOG_DEBUG_END
|
||||
if (restricted_set == 0) {
|
||||
// This is the relative offset in the root sequence table (5.7.2-4 from 36.211) for the given preamble index
|
||||
preamble_offset = ((NCS==0)? preamble_index : (preamble_index/(N_ZC/NCS)));
|
||||
@@ -588,17 +563,18 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
}
|
||||
|
||||
// Compute DFT of RX signal (conjugate input, results in conjugate output) for each new rootSequenceIndex
|
||||
#ifdef PRACH_DEBUG
|
||||
LOG_DEBUG_BEGIN(PRACH)
|
||||
int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
|
||||
if (en>60) LOG_I(PHY,"frame %d, subframe %d : preamble index %d: offset %d, preamble shift %d (br_flag %d, en %d)\n",
|
||||
frame,subframe,preamble_index,preamble_offset,preamble_shift,br_flag,en);
|
||||
#endif
|
||||
ru->proc.frame_prach,subframe,preamble_index,preamble_offset,preamble_shift,br_flag,en);
|
||||
LOG_DEBUG_END
|
||||
log2_ifft_size = 10;
|
||||
fft_size = 6144;
|
||||
|
||||
if (new_dft == 1) {
|
||||
new_dft = 0;
|
||||
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
if (br_flag == 1) {
|
||||
Xu=(int16_t*)eNB->X_u_br[ce_level][preamble_offset-first_nonzero_root_idx];
|
||||
prach_ifft = prach_ifftp[prach_ifft_cnt++];
|
||||
@@ -613,12 +589,12 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
}
|
||||
|
||||
memset(prachF, 0, sizeof(int16_t)*2*1024 );
|
||||
#if defined(PRACH_WRITE_OUTPUT_DEBUG)
|
||||
if (prach[0]!= NULL) write_output("prach_rx0.m","prach_rx0",prach[0],6144+792,1,1);
|
||||
#endif
|
||||
// write_output("prach_rx1.m","prach_rx1",prach[1],6144+792,1,1);
|
||||
// write_output("prach_rxF0.m","prach_rxF0",rxsigF[0],24576,1,1);
|
||||
// write_output("prach_rxF1.m","prach_rxF1",rxsigF[1],6144,1,1);
|
||||
LOG_M_BEGIN(PRACH)
|
||||
if (prach[0]!= NULL) LOG_M("prach_rx0.m","prach_rx0",prach[0],6144+792,1,1);
|
||||
LOG_M("prach_rx1.m","prach_rx1",prach[1],6144+792,1,1);
|
||||
LOG_M("prach_rxF0.m","prach_rxF0",rxsigF[0],24576,1,1);
|
||||
LOG_M("prach_rxF1.m","prach_rxF1",rxsigF[1],6144,1,1);
|
||||
LOG_M_END
|
||||
|
||||
for (aa=0;aa<nb_rx; aa++) {
|
||||
// Do componentwise product with Xu* on each antenna
|
||||
@@ -646,24 +622,25 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
for (i=0;i<256;i++)
|
||||
prach_ifft[i] += (prach_ifft_tmp[i<<1]*prach_ifft_tmp[(i<<1)] + prach_ifft_tmp[1+(i<<1)]*prach_ifft_tmp[1+(i<<1)])>>10;
|
||||
}
|
||||
|
||||
#if defined(PRACH_WRITE_OUTPUT_DEBUG)
|
||||
if (aa==0) write_output("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
|
||||
#endif
|
||||
// if (aa=1) write_output("prach_rxF_comp1.m","prach_rxF_comp1",prachF,1024,1,1);
|
||||
|
||||
LOG_M_BEGIN(PRACH)
|
||||
if (aa==0) LOG_M("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
|
||||
if (aa==1) LOG_M("prach_rxF_comp1.m","prach_rxF_comp1",prachF,1024,1,1);
|
||||
LOG_M_END
|
||||
}// antennas_rx
|
||||
} // new dft
|
||||
|
||||
// check energy in nth time shift, for
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
if ((br_flag==0) ||
|
||||
(eNB->prach_vars_br.repetition_number[ce_level]==
|
||||
eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[ce_level]))
|
||||
#endif
|
||||
{
|
||||
#ifdef PRACH_DEBUG
|
||||
if (en>60) LOG_I(PHY,"frame %d, subframe %d: Checking for peak in time-domain (br_flag %d, en %d)\n",frame,subframe,br_flag,en);
|
||||
#endif
|
||||
LOG_DEBUG_BEGIN(PRACH)
|
||||
int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
|
||||
if (en>60) LOG_I(PHY,"frame %d, subframe %d: Checking for peak in time-domain (br_flag %d, en %d)\n",ru->proc.frame_prach,subframe,br_flag,en);
|
||||
LOG_DEBUG_END
|
||||
preamble_shift2 = ((preamble_shift==0) ? 0 : ((preamble_shift<<log2_ifft_size)/N_ZC));
|
||||
|
||||
|
||||
@@ -675,17 +652,18 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
*max_preamble_energy = levdB;
|
||||
*max_preamble_delay = ((i*fft_size)>>log2_ifft_size)*update_TA/update_TA2;
|
||||
*max_preamble = preamble_index;
|
||||
#ifdef PRACH_DEBUG
|
||||
if ((en>60) && (br_flag==1)) LOG_D(PHY,"frame %d, subframe %d : max_preamble_energy %d, max_preamble_delay %d, max_preamble %d (br_flag %d,ce_level %d, levdB %d, lev %d)\n",frame,subframe,*max_preamble_energy,*max_preamble_delay,*max_preamble,br_flag,ce_level,levdB,lev);
|
||||
#endif
|
||||
LOG_DEBUG_BEGIN(PRACH)
|
||||
int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
|
||||
if ((en>60) && (br_flag==1)) LOG_D(PHY,"frame %d, subframe %d : max_preamble_energy %d, max_preamble_delay %d, max_preamble %d (br_flag %d,ce_level %d, levdB %d, lev %d)\n",ru->proc.frame_prach,subframe,*max_preamble_energy,*max_preamble_delay,*max_preamble,br_flag,ce_level,levdB,lev);
|
||||
LOG_DEBUG_END
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}// preamble_index
|
||||
|
||||
#ifdef PRACH_DEBUG
|
||||
|
||||
LOG_M_BEGIN(PRACH)
|
||||
int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
|
||||
if (en>60) {
|
||||
k = (12*n_ra_prb) - 6*fp->N_RB_UL;
|
||||
|
||||
@@ -696,31 +674,27 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
k*=2;
|
||||
|
||||
if (br_flag == 0) {
|
||||
#if defined(PRACH_WRITE_OUTPUT_DEBUG)
|
||||
write_output("rxsigF.m","prach_rxF",&rxsigF[0][0],12288,1,1);
|
||||
write_output("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
|
||||
write_output("Xu.m","xu",Xu,N_ZC,1,1);
|
||||
write_output("prach_ifft0.m","prach_t0",prach_ifft,1024,1,1);
|
||||
#endif
|
||||
LOG_M("rxsigF.m","prach_rxF",&rxsigF[0][0],12288,1,1);
|
||||
LOG_M("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
|
||||
LOG_M("Xu.m","xu",Xu,N_ZC,1,1);
|
||||
LOG_M("prach_ifft0.m","prach_t0",prach_ifft,1024,1,1);
|
||||
}
|
||||
else {
|
||||
#if defined(PRACH_WRITE_OUTPUT_DEBUG)
|
||||
printf("Dumping prach (br_flag %d), k = %d (n_ra_prb %d)\n",br_flag,k,n_ra_prb);
|
||||
write_output("rxsigF_br.m","prach_rxF_br",&rxsigF[0][0],12288,1,1);
|
||||
write_output("prach_rxF_comp0_br.m","prach_rxF_comp0_br",prachF,1024,1,1);
|
||||
write_output("Xu_br.m","xu_br",Xu,N_ZC,1,1);
|
||||
write_output("prach_ifft0_br.m","prach_t0_br",prach_ifft,1024,1,1);
|
||||
LOG_E(PHY,"Dumping prach (br_flag %d), k = %d (n_ra_prb %d)\n",br_flag,k,n_ra_prb);
|
||||
LOG_M("rxsigF_br.m","prach_rxF_br",&rxsigF[0][0],12288,1,1);
|
||||
LOG_M("prach_rxF_comp0_br.m","prach_rxF_comp0_br",prachF,1024,1,1);
|
||||
LOG_M("Xu_br.m","xu_br",Xu,N_ZC,1,1);
|
||||
LOG_M("prach_ifft0_br.m","prach_t0_br",prach_ifft,1024,1,1);
|
||||
exit(-1);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
LOG_M_END
|
||||
if (eNB) stop_meas(&eNB->rx_prach);
|
||||
|
||||
}
|
||||
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
|
||||
void rx_prach(PHY_VARS_eNB *eNB,
|
||||
RU_t *ru,
|
||||
@@ -762,6 +736,4 @@ void rx_prach(PHY_VARS_eNB *eNB,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* Rel14 */
|
||||
|
||||
|
||||
#endif /* #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) */
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "PHY/defs_common.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "PHY/phy_extern_ue.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
|
||||
|
||||
uint16_t NCS_unrestricted[16] = {0,13,15,18,22,26,32,38,46,59,76,93,119,167,279,419};
|
||||
@@ -570,7 +570,7 @@ int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t su
|
||||
uint8_t prach_ConfigIndex = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
|
||||
int prach_mask = is_prach_subframe0(frame_parms,prach_ConfigIndex,frame,subframe);
|
||||
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
int i;
|
||||
|
||||
for (i=0;i<4;i++) {
|
||||
|
||||
@@ -75,6 +75,11 @@ int generate_pss(int32_t **txdataF,
|
||||
a = (frame_parms->nb_antenna_ports_eNB == 1) ? amp: (amp*ONE_OVER_SQRT2_Q15)>>15;
|
||||
//printf("[PSS] amp=%d, a=%d\n",amp,a);
|
||||
|
||||
#if BASIC_SIMULATOR
|
||||
/* a hack to remove at some point (the UE doesn't synch with 100 RBs) */
|
||||
a = (frame_parms->nb_antenna_ports_eNB == 1) ? 4*amp: (amp*ONE_OVER_SQRT2_Q15)>>15;
|
||||
#endif
|
||||
|
||||
Nsymb = (frame_parms->Ncp==NORMAL)?14:12;
|
||||
|
||||
for (aa=0; aa<frame_parms->nb_antenna_ports_eNB; aa++) {
|
||||
|
||||
@@ -34,10 +34,9 @@
|
||||
#include "LAYER2/MAC/mac.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
|
||||
#include "UTIL/LOG/log.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
|
||||
#include "T.h"
|
||||
|
||||
//uint8_t ncs_cell[20][7];
|
||||
//#define DEBUG_PUCCH_TXS
|
||||
@@ -204,7 +203,7 @@ uint16_t pucchfmt3_ChannelEstimation( int16_t SubCarrierDeMapData[NB_ANTENNAS_RX
|
||||
int32_t IP_CsData_allsfavg[NB_ANTENNAS_RX][14][4][2];
|
||||
int32_t IP_allavg[D_NPUCCH_SF5];
|
||||
//int16_t temp_ch[2];
|
||||
int16_t m[NUMBER_OF_UE_MAX], m_self, same_m_number;
|
||||
int16_t m[NUMBER_OF_UE_MAX], m_self=0, same_m_number;
|
||||
uint16_t n3_pucch_sameRB[NUMBER_OF_UE_MAX];
|
||||
int16_t n_oc0[NUMBER_OF_UE_MAX];
|
||||
int16_t n_oc1[NUMBER_OF_UE_MAX];
|
||||
@@ -795,25 +794,11 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
for (j=0;j<NUMBER_OF_UE_MAX;j++) {
|
||||
eNB->pucch1_stats_cnt[j][i]=0;
|
||||
eNB->pucch1ab_stats_cnt[j][i]=0;
|
||||
}
|
||||
}
|
||||
#if defined(USRP_REC_PLAY)
|
||||
// It's probably bad to do this statically only once.
|
||||
// Looks like the above is incomplete.
|
||||
// Such reset needs to be done once a UE PHY structure is being used/re-used
|
||||
// Don't know if this is ever possible in current architecture
|
||||
for (i=0;i<10240;i++) {
|
||||
for (j=0;j<NUMBER_OF_UE_MAX;j++) {
|
||||
eNB->pucch1_stats[j][i]=0;
|
||||
#if defined(USRP_REC_PLAY) // not 100% sure
|
||||
eNB->pucch1_stats_thres[j][i]=0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
for (i=0;i<20480;i++) {
|
||||
for (j=0;j<NUMBER_OF_UE_MAX;j++) {
|
||||
eNB->pucch1ab_stats[j][i]=0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
first_call=0;
|
||||
}
|
||||
|
||||
@@ -1103,7 +1088,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_PUCCH_RX
|
||||
LOG_D(PHY,"[eNB] PUCCH fmt1: stat_max : %d, sigma2_dB %d (%d, %d), phase_max : %d\n",dB_fixed(stat_max),sigma2_dB,eNB->measurements.n0_subband_power_tot_dBm[6],pucch1_thres,phase_max);
|
||||
LOG_I(PHY,"[eNB] PUCCH fmt1: stat_max : %d, sigma2_dB %d (%d, %d), phase_max : %d\n",dB_fixed(stat_max),sigma2_dB,eNB->measurements.n0_subband_power_tot_dBm[6],pucch1_thres,phase_max);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1116,7 +1101,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
|
||||
/*
|
||||
if (eNB->pucch1_stats_cnt[UE_id][subframe] == 0) {
|
||||
write_output("pucch_debug.m","pucch_energy",
|
||||
LOG_M("pucch_debug.m","pucch_energy",
|
||||
&eNB->pucch1_stats[UE_id][(subframe<<10)],
|
||||
1024,1,2);
|
||||
AssertFatal(0,"Exiting for PUCCH 1 debug\n");
|
||||
@@ -1236,6 +1221,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
#if defined(USRP_REC_PLAY)
|
||||
// It looks like the value is a bit messy when RF is replayed.
|
||||
// For instance i assume to skip pucch1_thres from the test below.
|
||||
// Not 100% sure
|
||||
if (sigma2_dB<(dB_fixed(stat_max))) {//
|
||||
#else
|
||||
if (sigma2_dB<(dB_fixed(stat_max)-pucch1_thres)) {//
|
||||
@@ -1366,7 +1352,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
|
||||
LOG_D(PHY,"PUCCH 1a/b: subframe %d : stat %d,%d (pos %d)\n",subframe,stat_re,stat_im,
|
||||
(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe]));
|
||||
LOG_D(PHY,"PUCCH 1a/b: subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
|
||||
LOG_D(PHY,"PUCCH 1a/b: subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
|
||||
|
||||
eNB->pucch1ab_stats[UE_id][(subframe<<11) + 2*(eNB->pucch1ab_stats_cnt[UE_id][subframe])] = (stat_re);
|
||||
eNB->pucch1ab_stats[UE_id][(subframe<<11) + 1+2*(eNB->pucch1ab_stats_cnt[UE_id][subframe])] = (stat_im);
|
||||
|
||||
@@ -33,11 +33,10 @@
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "LAYER2/MAC/mac.h"
|
||||
|
||||
#include "UTIL/LOG/log.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
|
||||
#include "T.h"
|
||||
|
||||
void init_ncs_cell(LTE_DL_FRAME_PARMS *frame_parms,uint8_t ncs_cell[20][7])
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "SCHED/sched_eNB.h"
|
||||
#include "LAYER2/MAC/mac.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
||||
#include "assertions.h"
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ typedef enum {
|
||||
|
||||
|
||||
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
typedef enum {
|
||||
CEmodeA = 0,
|
||||
CEmodeB = 1
|
||||
@@ -137,7 +137,7 @@ typedef enum {
|
||||
HARQ_SR_CQI
|
||||
} UCI_type_t;
|
||||
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
typedef enum {
|
||||
NOCE,
|
||||
CEMODEA,
|
||||
@@ -182,5 +182,100 @@ typedef struct {
|
||||
PRACH_TDD_PREAMBLE_MAP_elem map[6];
|
||||
} PRACH_TDD_PREAMBLE_MAP;
|
||||
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
|
||||
typedef struct {
|
||||
uint16_t slss_id;
|
||||
uint8_t *slmib;
|
||||
} SLSS_t;
|
||||
|
||||
typedef struct {
|
||||
// SL Configuration
|
||||
/// Number of SL resource blocks (1-100)
|
||||
uint32_t N_SL_RB;
|
||||
/// prb-start (0-99)
|
||||
uint32_t prb_Start;
|
||||
/// prb-End (0-99)
|
||||
uint32_t prb_End;
|
||||
/// SL-OffsetIndicator (0-10239)
|
||||
uint32_t SL_OffsetIndicator;
|
||||
/// PSCCH subframe bitmap, first 64-bits (up to 40 bits for Rel 12)
|
||||
uint64_t bitmap1;
|
||||
/// PSCCH subframe bitmap, 2nd 64-bits (up to 100 bits for Rel 14)
|
||||
uint64_t bitmap2;
|
||||
|
||||
// SCI parameters
|
||||
/// npscch resource index
|
||||
uint32_t n_pscch;
|
||||
/// format of SCI (0,1)
|
||||
uint32_t format;
|
||||
/// SCI0 frequency hopping flag
|
||||
uint32_t freq_hopping_flag;
|
||||
/// SCI0 Resource Block Coding
|
||||
uint32_t resource_block_coding;
|
||||
/// SCI0 Time Resource Pattern for SLSCH
|
||||
uint32_t time_resource_pattern;
|
||||
/// SCI0 MCS for SLSCH
|
||||
uint32_t mcs;
|
||||
/// SCI0 Timing advance indication for SLSCH
|
||||
uint32_t timing_advance_indication;
|
||||
/// SCI0 Group Destination ID for SLSCH
|
||||
uint32_t group_destination_id;
|
||||
|
||||
// SLSCH Parameters
|
||||
/// Number of Subbands (36.213 14.1.1.2)
|
||||
uint32_t Nsb;
|
||||
/// N_RB_HO (36.213 14.1.1.2)
|
||||
uint32_t N_RB_HO;
|
||||
/// n_ss_PSSCH (36.211 9.2.4)
|
||||
uint32_t n_ss_PSSCH;
|
||||
/// n_ssf_PSSCH
|
||||
uint32_t n_ssf_PSSCH;
|
||||
/// cinit (36.331 hoppingParameter-r12)
|
||||
uint32_t cinit;
|
||||
/// redundancy version
|
||||
uint32_t rvidx;
|
||||
/// n_prime_VRB (36.213 14.1.1.2.1)
|
||||
uint32_t n_prime_VRB;
|
||||
/// M_RB_PSSCH_RP (36.213 14.1.3
|
||||
uint32_t M_RB_PSSCH_RP;
|
||||
/// n_prime_PRB (36.213 14.1.1.4
|
||||
uint32_t n_prime_PRB;
|
||||
/// m_nprime_PRB_PSSCH (36.213 14.1.3)
|
||||
uint32_t m_nprime_PRB_PSCCH;
|
||||
/// payload length
|
||||
int payload_length;
|
||||
/// pointer to payload
|
||||
uint8_t *payload;
|
||||
} SLSCH_t;
|
||||
|
||||
typedef struct {
|
||||
/// payload length
|
||||
int payload_length;
|
||||
uint8_t payload[100];
|
||||
} SLDCH_t;
|
||||
|
||||
#define TTI_SYNC 0
|
||||
#define SLSS 1
|
||||
#define SLDCH 2
|
||||
#define SLSCH 3
|
||||
|
||||
typedef struct UE_tport_header_s {
|
||||
int packet_type;
|
||||
uint16_t absSF;
|
||||
} UE_tport_header_t;
|
||||
|
||||
typedef struct UE_tport_s {
|
||||
UE_tport_header_t header;
|
||||
union {
|
||||
SLSS_t slss;
|
||||
SLDCH_t sldch;
|
||||
SLSCH_t slsch;
|
||||
};
|
||||
uint8_t payload[1500];
|
||||
} UE_tport_t;
|
||||
|
||||
#endif
|
||||
|
||||
/**@}*/
|
||||
#endif
|
||||
|
||||
@@ -291,4 +291,6 @@ uint32_t conv_1C_RIV(int32_t rballoc,uint32_t N_RB_DL);
|
||||
|
||||
void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t *rb_alloc2);
|
||||
|
||||
int16_t estimate_ue_tx_power(uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#ifndef __TRANSPORT_ENB__H__
|
||||
#define __TRANSPORT_ENB__H__
|
||||
#include "transport_common.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
//#include "PHY/defs_eNB.h"
|
||||
#include "dci.h"
|
||||
#include "mdci.h"
|
||||
#include "uci_common.h"
|
||||
@@ -124,6 +124,15 @@ typedef struct {
|
||||
uint8_t first_layer;
|
||||
/// codeword this transport block is mapped to
|
||||
uint8_t codeword;
|
||||
#ifdef PHY_TX_THREAD
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
/// indicator that this DLSCH corresponds to SIB1-BR, needed for c_init for scrambling
|
||||
uint8_t sib1_br_flag;
|
||||
/// initial absolute subframe (see 36.211 Section 6.3.1), needed for c_init for scrambling
|
||||
uint16_t i0;
|
||||
CEmode_t CEmode;
|
||||
#endif
|
||||
#endif
|
||||
} LTE_DL_eNB_HARQ_t;
|
||||
|
||||
|
||||
@@ -131,13 +140,17 @@ typedef struct {
|
||||
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
|
||||
int32_t *txdataF[8];
|
||||
/// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers?
|
||||
int32_t **ue_spec_bf_weights[4];
|
||||
int32_t **ue_spec_bf_weights[4];
|
||||
/// dl channel estimates (estimated from ul channel estimates)
|
||||
int32_t **calib_dl_ch_estimates;
|
||||
/// Allocated RNTI (0 means DLSCH_t is not currently used)
|
||||
uint16_t rnti;
|
||||
/// Active flag for baseband transmitter processing
|
||||
#ifdef PHY_TX_THREAD
|
||||
uint8_t active[10];
|
||||
#else
|
||||
uint8_t active;
|
||||
#endif
|
||||
/// HARQ process mask, indicates which processes are currently active
|
||||
uint16_t harq_mask;
|
||||
/// Indicator of TX activation per subframe. Used during PUCCH detection for ACK/NAK.
|
||||
@@ -145,7 +158,7 @@ typedef struct {
|
||||
/// First CCE of last PDSCH scheduling per subframe. Again used during PUCCH detection for ACK/NAK.
|
||||
uint8_t nCCE[10];
|
||||
/// Process ID's per subframe. Used to associate received ACKs on PUSCH/PUCCH to DLSCH harq process ids
|
||||
uint8_t harq_ids[10];
|
||||
uint8_t harq_ids[2][10];
|
||||
/// Window size (in outgoing transport blocks) for fine-grain rate adaptation
|
||||
uint8_t ra_window_size;
|
||||
/// First-round error threshold for fine-grain rate adaptation
|
||||
@@ -168,13 +181,15 @@ typedef struct {
|
||||
int16_t sqrt_rho_a;
|
||||
/// amplitude of PDSCH (compared to RS) in symbols containing pilots
|
||||
int16_t sqrt_rho_b;
|
||||
#ifdef Rel14
|
||||
#ifndef PHY_TX_THREAD
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
/// indicator that this DLSCH corresponds to SIB1-BR, needed for c_init for scrambling
|
||||
uint8_t sib1_br_flag;
|
||||
/// initial absolute subframe (see 36.211 Section 6.3.1), needed for c_init for scrambling
|
||||
uint16_t i0;
|
||||
CEmode_t CEmode;
|
||||
#endif
|
||||
#endif
|
||||
} LTE_eNB_DLSCH_t;
|
||||
|
||||
|
||||
@@ -205,7 +220,7 @@ typedef struct {
|
||||
/// is done after a new scheduling
|
||||
uint16_t previous_first_rb;
|
||||
/// Current Number of RBs
|
||||
uint16_t nb_rb;
|
||||
uint16_t nb_rb;
|
||||
/// Current Modulation order
|
||||
uint8_t Qm;
|
||||
/// Transport block size
|
||||
@@ -332,7 +347,7 @@ typedef struct {
|
||||
uint8_t tdd_bundling;
|
||||
/// Received Energy
|
||||
uint32_t stat;
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
/// non BL/CE, CEmodeA, CEmodeB
|
||||
UE_type_t ue_type;
|
||||
/// Indicates the symbols that are left empty due to eMTC retuning.
|
||||
@@ -458,7 +473,5 @@ typedef struct {
|
||||
} LTE_eNB_ULSCH_t;
|
||||
|
||||
|
||||
|
||||
|
||||
/**@}*/
|
||||
#endif
|
||||
|
||||
@@ -241,6 +241,7 @@ int32_t allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
|
||||
int32_t dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
|
||||
int32_t **txdataF,
|
||||
int16_t amp,
|
||||
int frame,
|
||||
uint32_t sub_frame_offset,
|
||||
uint8_t num_pdcch_symbols,
|
||||
LTE_eNB_DLSCH_t *dlsch0,
|
||||
@@ -418,7 +419,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
|
||||
void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc,DCI_ALLOC_t *dci_alloc,
|
||||
nfapi_hi_dci0_dci_pdu *pdu);
|
||||
|
||||
void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame,int subframe);
|
||||
void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame,int subframe);
|
||||
|
||||
int generate_eNB_ulsch_params_from_rar(PHY_VARS_eNB *eNB,
|
||||
unsigned char *rar_pdu,
|
||||
@@ -577,7 +578,7 @@ void rx_prach(PHY_VARS_eNB *phy_vars_eNB,RU_t *ru,
|
||||
uint16_t *max_preamble_energy,
|
||||
uint16_t *max_preamble_delay,
|
||||
uint16_t Nf, uint8_t tdd_mapindex
|
||||
#ifdef Rel14
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
,
|
||||
uint8_t br_flag
|
||||
#endif
|
||||
@@ -611,11 +612,11 @@ void conv_eMTC_rballoc(uint16_t resource_block_coding,
|
||||
uint32_t N_RB_DL,
|
||||
uint32_t *rb_alloc);
|
||||
|
||||
int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
|
||||
int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
|
||||
|
||||
int8_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
|
||||
int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
|
||||
|
||||
int8_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type);
|
||||
int16_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type);
|
||||
|
||||
/**@}*/
|
||||
#endif
|
||||
|
||||
@@ -37,10 +37,9 @@
|
||||
//#define DEBUG_UCI 1
|
||||
|
||||
|
||||
int8_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type) {
|
||||
uint8_t i;
|
||||
int8_t first_free_index=-1;
|
||||
|
||||
int16_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type) {
|
||||
uint16_t i;
|
||||
int16_t first_free_index=-1;
|
||||
AssertFatal(eNB!=NULL,"eNB is null\n");
|
||||
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
|
||||
if ((eNB->uci_vars[i].active >0) &&
|
||||
|
||||
@@ -1,933 +0,0 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file PHY/LTE_TRANSPORT/ulsch_coding.c
|
||||
* \brief Top-level routines for coding the ULSCH transport channel as described in 36.212 V8.6 2009-03
|
||||
* \author R. Knopp
|
||||
* \date 2011
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: knopp@eurecom.fr
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
|
||||
#include "PHY/CODING/defs.h"
|
||||
#include "PHY/CODING/extern.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "PHY/LTE_TRANSPORT/defs.h"
|
||||
#include "defs.h"
|
||||
#include "extern.h"
|
||||
#include "SIMULATION/ETH_TRANSPORT/extern.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
|
||||
//#define DEBUG_ULSCH_CODING
|
||||
//#define DEBUG_ULSCH_FREE 1
|
||||
|
||||
/*
|
||||
#define is_not_pilot(pilots,first_pilot,re) (pilots==0) || \
|
||||
((pilots==1)&&(first_pilot==1)&&(((re>2)&&(re<6))||((re>8)&&(re<12)))) || \
|
||||
((pilots==1)&&(first_pilot==0)&&(((re<3))||((re>5)&&(re<9)))) \
|
||||
*/
|
||||
#define is_not_pilot(pilots,first_pilot,re) (1)
|
||||
|
||||
|
||||
|
||||
|
||||
void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch)
|
||||
{
|
||||
int i;
|
||||
int r;
|
||||
|
||||
if (ulsch) {
|
||||
#ifdef DEBUG_ULSCH_FREE
|
||||
printf("Freeing ulsch %p\n",ulsch);
|
||||
#endif
|
||||
|
||||
for (i=0; i<8; i++) {
|
||||
if (ulsch->harq_processes[i]) {
|
||||
if (ulsch->harq_processes[i]->b) {
|
||||
free16(ulsch->harq_processes[i]->b,MAX_ULSCH_PAYLOAD_BYTES);
|
||||
ulsch->harq_processes[i]->b = NULL;
|
||||
}
|
||||
for (r=0; r<MAX_NUM_ULSCH_SEGMENTS; r++) {
|
||||
if (ulsch->harq_processes[i]->c[r]) {
|
||||
free16(ulsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+768);
|
||||
ulsch->harq_processes[i]->c[r] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
free16(ulsch->harq_processes[i],sizeof(LTE_UL_UE_HARQ_t));
|
||||
ulsch->harq_processes[i] = NULL;
|
||||
}
|
||||
}
|
||||
free16(ulsch,sizeof(LTE_UE_ULSCH_t));
|
||||
ulsch = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag)
|
||||
{
|
||||
|
||||
LTE_UE_ULSCH_t *ulsch;
|
||||
unsigned char exit_flag = 0,i,j,r;
|
||||
unsigned char bw_scaling =1;
|
||||
|
||||
switch (N_RB_UL) {
|
||||
case 6:
|
||||
bw_scaling =16;
|
||||
break;
|
||||
|
||||
case 25:
|
||||
bw_scaling =4;
|
||||
break;
|
||||
|
||||
case 50:
|
||||
bw_scaling =2;
|
||||
break;
|
||||
|
||||
default:
|
||||
bw_scaling =1;
|
||||
break;
|
||||
}
|
||||
|
||||
ulsch = (LTE_UE_ULSCH_t *)malloc16(sizeof(LTE_UE_ULSCH_t));
|
||||
|
||||
if (ulsch) {
|
||||
memset(ulsch,0,sizeof(LTE_UE_ULSCH_t));
|
||||
|
||||
ulsch->Mlimit = 4;
|
||||
|
||||
for (i=0; i<8; i++) {
|
||||
|
||||
ulsch->harq_processes[i] = (LTE_UL_UE_HARQ_t *)malloc16(sizeof(LTE_UL_UE_HARQ_t));
|
||||
|
||||
// printf("ulsch->harq_processes[%d] %p\n",i,ulsch->harq_processes[i]);
|
||||
if (ulsch->harq_processes[i]) {
|
||||
memset(ulsch->harq_processes[i], 0, sizeof(LTE_UL_UE_HARQ_t));
|
||||
ulsch->harq_processes[i]->b = (unsigned char*)malloc16(MAX_ULSCH_PAYLOAD_BYTES/bw_scaling);
|
||||
|
||||
if (ulsch->harq_processes[i]->b)
|
||||
memset(ulsch->harq_processes[i]->b,0,MAX_ULSCH_PAYLOAD_BYTES/bw_scaling);
|
||||
else {
|
||||
LOG_E(PHY,"Can't get b\n");
|
||||
exit_flag=1;
|
||||
}
|
||||
|
||||
if (abstraction_flag==0) {
|
||||
for (r=0; r<MAX_NUM_ULSCH_SEGMENTS; r++) {
|
||||
ulsch->harq_processes[i]->c[r] = (unsigned char*)malloc16(((r==0)?8:0) + 3+768); // account for filler in first segment and CRCs for multiple segment case
|
||||
|
||||
if (ulsch->harq_processes[i]->c[r])
|
||||
memset(ulsch->harq_processes[i]->c[r],0,((r==0)?8:0) + 3+768);
|
||||
else {
|
||||
LOG_E(PHY,"Can't get c\n");
|
||||
exit_flag=2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ulsch->harq_processes[i]->subframe_scheduling_flag = 0;
|
||||
ulsch->harq_processes[i]->first_tx = 1;
|
||||
} else {
|
||||
LOG_E(PHY,"Can't get harq_p %d\n",i);
|
||||
exit_flag=3;
|
||||
}
|
||||
}
|
||||
|
||||
if ((abstraction_flag == 0) && (exit_flag==0)) {
|
||||
for (i=0; i<8; i++)
|
||||
for (j=0; j<96; j++)
|
||||
for (r=0; r<MAX_NUM_ULSCH_SEGMENTS; r++)
|
||||
ulsch->harq_processes[i]->d[r][j] = LTE_NULL;
|
||||
|
||||
return(ulsch);
|
||||
} else if (abstraction_flag==1)
|
||||
return(ulsch);
|
||||
}
|
||||
|
||||
LOG_E(PHY,"new_ue_ulsch exit flag, size of %d , %zu\n",exit_flag, sizeof(LTE_UE_ULSCH_t));
|
||||
free_ue_ulsch(ulsch);
|
||||
return(NULL);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
uint32_t ulsch_encoding(uint8_t *a,
|
||||
PHY_VARS_UE *ue,
|
||||
uint8_t harq_pid,
|
||||
uint8_t eNB_id,
|
||||
uint8_t subframe_rx,
|
||||
uint8_t tmode,
|
||||
uint8_t control_only_flag,
|
||||
uint8_t Nbundled)
|
||||
{
|
||||
|
||||
time_stats_t *seg_stats=&ue->ulsch_segmentation_stats;
|
||||
time_stats_t *rm_stats=&ue->ulsch_rate_matching_stats;
|
||||
time_stats_t *te_stats=&ue->ulsch_turbo_encoding_stats;
|
||||
time_stats_t *i_stats=&ue->ulsch_interleaving_stats;
|
||||
time_stats_t *m_stats=&ue->ulsch_multiplexing_stats;
|
||||
|
||||
// uint16_t offset;
|
||||
uint32_t crc=1;
|
||||
uint16_t iind;
|
||||
uint32_t A;
|
||||
uint8_t Q_m=0;
|
||||
uint32_t Kr=0,Kr_bytes,r,r_offset=0;
|
||||
uint8_t y[6*14*1200],*yptr;;
|
||||
uint8_t *columnset;
|
||||
uint32_t sumKr=0;
|
||||
uint32_t Qprime,L,G,Q_CQI=0,Q_RI=0,Q_ACK=0,H=0,Hprime=0,Hpp=0,Cmux=0,Rmux=0,Rmux_prime=0;
|
||||
uint32_t Qprime_ACK=0,Qprime_CQI=0,Qprime_RI=0,len_ACK=0,len_RI=0;
|
||||
// uint32_t E;
|
||||
uint8_t ack_parity;
|
||||
uint32_t i,q,j,iprime,j2;
|
||||
uint16_t o_RCC;
|
||||
uint8_t o_flip[8];
|
||||
uint32_t wACK_idx;
|
||||
LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
|
||||
PHY_MEASUREMENTS *meas = &ue->measurements;
|
||||
LTE_UE_ULSCH_t *ulsch=ue->ulsch[eNB_id];
|
||||
LTE_UE_DLSCH_t **dlsch = ue->dlsch[0][eNB_id];
|
||||
uint16_t rnti = 0xffff;
|
||||
|
||||
if (!ulsch) {
|
||||
LOG_E(PHY,"Null ulsch ptr %p\n",ulsch);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (harq_pid >= 8) {
|
||||
LOG_E(PHY,"Illegal harq_pid %d\n",harq_pid);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (ulsch->harq_processes[harq_pid]->O_ACK > 2) {
|
||||
LOG_E(PHY,"Illegal O_ACK %d\n",ulsch->harq_processes[harq_pid]->O_ACK);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (ulsch->O_RI > 1) {
|
||||
LOG_E(PHY,"Illegal O_RI %d\n",ulsch->O_RI);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_IN);
|
||||
|
||||
// fill CQI/PMI information
|
||||
if (ulsch->O>0) {
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING_FILL_CQI, VCD_FUNCTION_IN);
|
||||
rnti = ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti;
|
||||
fill_CQI(ulsch,meas,0,harq_pid,ue->frame_parms.N_RB_DL,rnti, tmode,ue->sinr_eff);
|
||||
|
||||
LOG_D(PHY,"ULSCH Encoding rnti %x \n", rnti);
|
||||
print_CQI(ulsch->o,ulsch->uci_format,0,ue->frame_parms.N_RB_DL);
|
||||
|
||||
// save PUSCH pmi for later (transmission modes 4,5,6)
|
||||
if (dlsch[0]) {
|
||||
//LOG_I(PHY,"XXX saving pmi for DL %x\n",pmi2hex_2Ar1(((wideband_cqi_rank1_2A_5MHz *)ulsch->o)->pmi));
|
||||
dlsch[0]->pmi_alloc = ((wideband_cqi_rank1_2A_5MHz *)ulsch->o)->pmi;
|
||||
}
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING_FILL_CQI, VCD_FUNCTION_OUT);
|
||||
}
|
||||
|
||||
if (ulsch->O<=32) {
|
||||
o_flip[0] = ulsch->o[3];
|
||||
o_flip[1] = ulsch->o[2];
|
||||
o_flip[2] = ulsch->o[1];
|
||||
o_flip[3] = ulsch->o[0];
|
||||
} else {
|
||||
o_flip[0] = ulsch->o[7];
|
||||
o_flip[1] = ulsch->o[6];
|
||||
o_flip[2] = ulsch->o[5];
|
||||
o_flip[3] = ulsch->o[4];
|
||||
o_flip[4] = ulsch->o[3];
|
||||
o_flip[5] = ulsch->o[2];
|
||||
o_flip[6] = ulsch->o[1];
|
||||
o_flip[7] = ulsch->o[0];
|
||||
}
|
||||
|
||||
if (control_only_flag == 0) {
|
||||
A=ulsch->harq_processes[harq_pid]->TBS;
|
||||
Q_m = get_Qm_ul(ulsch->harq_processes[harq_pid]->mcs);
|
||||
|
||||
ulsch->harq_processes[harq_pid]->control_only = 0;
|
||||
|
||||
#ifdef DEBUG_ULSCH_CODING
|
||||
printf("[PHY][UE] ULSCH coding : A %d, Qm %d, mcs %d, harq_pid %d, round %d, RV %d\n",
|
||||
ulsch->harq_processes[harq_pid]->TBS,
|
||||
Q_m,
|
||||
ulsch->harq_processes[harq_pid]->mcs,
|
||||
harq_pid,
|
||||
ulsch->harq_processes[harq_pid]->round,
|
||||
ulsch->harq_processes[harq_pid]->rvidx);
|
||||
|
||||
for (i=0; i<ulsch->harq_processes[harq_pid]->O_ACK; i++)
|
||||
printf("ulsch_coding: o_ACK[%d] %d\n",i,ulsch->o_ACK[i]);
|
||||
|
||||
for (i=0; i<ulsch->O_RI; i++)
|
||||
printf("ulsch_coding: o_RI[%d] %d\n",i,ulsch->o_RI[i]);
|
||||
|
||||
printf("ulsch_coding: O=%d\n",ulsch->O);
|
||||
|
||||
for (i=0; i<1+((8+ulsch->O)/8); i++) {
|
||||
// ulsch->o[i] = i;
|
||||
printf("ulsch_coding: O[%d] %d\n",i,ulsch->o[i]);
|
||||
}
|
||||
|
||||
if ((tmode != 4))
|
||||
print_CQI(ulsch->o,wideband_cqi_rank1_2A,0,ue->frame_parms.N_RB_DL);
|
||||
else
|
||||
print_CQI(ulsch->o,HLC_subband_cqi_rank1_2A,0,ue->frame_parms.N_RB_DL);
|
||||
|
||||
#endif
|
||||
|
||||
if (ulsch->harq_processes[harq_pid]->round == 0) { // this is a new packet
|
||||
|
||||
start_meas(seg_stats);
|
||||
// Add 24-bit crc (polynomial A) to payload
|
||||
crc = crc24a(a,
|
||||
A)>>8;
|
||||
|
||||
a[A>>3] = ((uint8_t*)&crc)[2];
|
||||
a[1+(A>>3)] = ((uint8_t*)&crc)[1];
|
||||
a[2+(A>>3)] = ((uint8_t*)&crc)[0];
|
||||
|
||||
ulsch->harq_processes[harq_pid]->B = A+24;
|
||||
ulsch->harq_processes[harq_pid]->b = a;
|
||||
lte_segmentation(ulsch->harq_processes[harq_pid]->b,
|
||||
ulsch->harq_processes[harq_pid]->c,
|
||||
ulsch->harq_processes[harq_pid]->B,
|
||||
&ulsch->harq_processes[harq_pid]->C,
|
||||
&ulsch->harq_processes[harq_pid]->Cplus,
|
||||
&ulsch->harq_processes[harq_pid]->Cminus,
|
||||
&ulsch->harq_processes[harq_pid]->Kplus,
|
||||
&ulsch->harq_processes[harq_pid]->Kminus,
|
||||
&ulsch->harq_processes[harq_pid]->F);
|
||||
|
||||
stop_meas(seg_stats);
|
||||
|
||||
for (r=0; r<ulsch->harq_processes[harq_pid]->C; r++) {
|
||||
if (r<ulsch->harq_processes[harq_pid]->Cminus)
|
||||
Kr = ulsch->harq_processes[harq_pid]->Kminus;
|
||||
else
|
||||
Kr = ulsch->harq_processes[harq_pid]->Kplus;
|
||||
|
||||
Kr_bytes = Kr>>3;
|
||||
|
||||
// get interleaver index for Turbo code (lookup in Table 5.1.3-3 36-212, V8.6 2009-03, p. 13-14)
|
||||
if (Kr_bytes<=64)
|
||||
iind = (Kr_bytes-5);
|
||||
else if (Kr_bytes <=128)
|
||||
iind = 59 + ((Kr_bytes-64)>>1);
|
||||
else if (Kr_bytes <= 256)
|
||||
iind = 91 + ((Kr_bytes-128)>>2);
|
||||
else if (Kr_bytes <= 768)
|
||||
iind = 123 + ((Kr_bytes-256)>>3);
|
||||
else {
|
||||
LOG_E(PHY,"ulsch_coding: Illegal codeword size %d!!!\n",Kr_bytes);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG_ULSCH_CODING
|
||||
printf("Generating Code Segment %d (%d bits)\n",r,Kr);
|
||||
// generate codewords
|
||||
|
||||
printf("bits_per_codeword (Kr)= %d\n",Kr);
|
||||
printf("N_RB = %d\n",ulsch->harq_processes[harq_pid]->nb_rb);
|
||||
printf("Ncp %d\n",frame_parms->Ncp);
|
||||
printf("Qm %d\n",Q_m);
|
||||
#endif
|
||||
|
||||
// offset=0;
|
||||
|
||||
|
||||
#ifdef DEBUG_ULSCH_CODING
|
||||
printf("Encoding ... iind %d f1 %d, f2 %d\n",iind,f1f2mat_old[iind*2],f1f2mat_old[(iind*2)+1]);
|
||||
#endif
|
||||
start_meas(te_stats);
|
||||
encoder(ulsch->harq_processes[harq_pid]->c[r],
|
||||
Kr>>3,
|
||||
&ulsch->harq_processes[harq_pid]->d[r][96],
|
||||
(r==0) ? ulsch->harq_processes[harq_pid]->F : 0,
|
||||
f1f2mat_old[iind*2], // f1 (see 36212-820, page 14)
|
||||
f1f2mat_old[(iind*2)+1] // f2 (see 36212-820, page 14)
|
||||
);
|
||||
stop_meas(te_stats);
|
||||
#ifdef DEBUG_ULSCH_CODING
|
||||
|
||||
if (r==0)
|
||||
write_output("enc_output0.m","enc0",&ulsch->harq_processes[harq_pid]->d[r][96],(3*8*Kr_bytes)+12,1,4);
|
||||
|
||||
#endif
|
||||
start_meas(i_stats);
|
||||
ulsch->harq_processes[harq_pid]->RTC[r] =
|
||||
sub_block_interleaving_turbo(4+(Kr_bytes*8),
|
||||
&ulsch->harq_processes[harq_pid]->d[r][96],
|
||||
ulsch->harq_processes[harq_pid]->w[r]);
|
||||
stop_meas(i_stats);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (ulsch->harq_processes[harq_pid]->C == 0) {
|
||||
LOG_E(PHY,"null segment\n");
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
sumKr = 0;
|
||||
|
||||
for (r=0; r<ulsch->harq_processes[harq_pid]->C; r++) {
|
||||
if (r<ulsch->harq_processes[harq_pid]->Cminus)
|
||||
Kr = ulsch->harq_processes[harq_pid]->Kminus;
|
||||
else
|
||||
Kr = ulsch->harq_processes[harq_pid]->Kplus;
|
||||
|
||||
sumKr += Kr;
|
||||
}
|
||||
} else { // This is a control-only PUSCH, set sumKr to O_CQI-MIN
|
||||
ulsch->harq_processes[harq_pid]->control_only = 1;
|
||||
sumKr = ulsch->O_CQI_MIN;
|
||||
}
|
||||
|
||||
ulsch->harq_processes[harq_pid]->sumKr = sumKr;
|
||||
// Compute Q_ri (p. 23 36-212)
|
||||
|
||||
Qprime = ulsch->O_RI*ulsch->harq_processes[harq_pid]->Msc_initial*ulsch->harq_processes[harq_pid]->Nsymb_initial * ulsch->beta_offset_ri_times8;
|
||||
|
||||
if (Qprime > 0) {
|
||||
if ((Qprime % (8*sumKr)) > 0)
|
||||
Qprime = 1+(Qprime/(8*sumKr));
|
||||
else
|
||||
Qprime = Qprime/(8*sumKr);
|
||||
|
||||
if (Qprime > 4*ulsch->harq_processes[harq_pid]->nb_rb * 12)
|
||||
Qprime = 4*ulsch->harq_processes[harq_pid]->nb_rb * 12;
|
||||
}
|
||||
|
||||
Q_RI = Q_m*Qprime;
|
||||
Qprime_RI = Qprime;
|
||||
|
||||
// Compute Q_ack (p. 23 36-212)
|
||||
Qprime = ulsch->harq_processes[harq_pid]->O_ACK*ulsch->harq_processes[harq_pid]->Msc_initial*ulsch->harq_processes[harq_pid]->Nsymb_initial * ulsch->beta_offset_harqack_times8;
|
||||
|
||||
if (Qprime > 0) {
|
||||
if ((Qprime % (8*sumKr)) > 0)
|
||||
Qprime = 1+(Qprime/(8*sumKr));
|
||||
else
|
||||
Qprime = Qprime/(8*sumKr);
|
||||
|
||||
if (Qprime > 4*ulsch->harq_processes[harq_pid]->nb_rb * 12)
|
||||
Qprime = 4*ulsch->harq_processes[harq_pid]->nb_rb * 12;
|
||||
}
|
||||
|
||||
Q_ACK = Qprime * Q_m;
|
||||
Qprime_ACK = Qprime;
|
||||
|
||||
LOG_D(PHY,"UE (%x/%d) O_ACK %d, Mcs_initial %d, Nsymb_initial %d, beta_offset_harqack*8 %d, sum Kr %d, Qprime_ACK %d, Q_ACK %d\n",
|
||||
rnti, harq_pid,
|
||||
ulsch->harq_processes[harq_pid]->O_ACK,
|
||||
ulsch->harq_processes[harq_pid]->Msc_initial,
|
||||
ulsch->harq_processes[harq_pid]->Nsymb_initial,
|
||||
ulsch->beta_offset_harqack_times8,
|
||||
sumKr,
|
||||
Qprime_ACK,
|
||||
Q_ACK);
|
||||
|
||||
// Compute Q_cqi, assume O>11, p. 26 36-212
|
||||
if (control_only_flag == 0) {
|
||||
|
||||
if (ulsch->O < 12)
|
||||
L=0;
|
||||
else
|
||||
L=8;
|
||||
|
||||
if (ulsch->O > 0)
|
||||
Qprime = (ulsch->O + L) * ulsch->harq_processes[harq_pid]->Msc_initial*ulsch->harq_processes[harq_pid]->Nsymb_initial * ulsch->beta_offset_cqi_times8;
|
||||
else
|
||||
Qprime = 0;
|
||||
|
||||
if (Qprime > 0) {
|
||||
if ((Qprime % (8*sumKr)) > 0)
|
||||
Qprime = 1+(Qprime/(8*sumKr));
|
||||
else
|
||||
Qprime = Qprime/(8*sumKr);
|
||||
}
|
||||
|
||||
G = ulsch->harq_processes[harq_pid]->nb_rb * (12 * Q_m) * (ulsch->Nsymb_pusch);
|
||||
|
||||
if (Qprime > (G - ulsch->O_RI))
|
||||
Qprime = G - ulsch->O_RI;
|
||||
|
||||
Q_CQI = Q_m * Qprime;
|
||||
Qprime_CQI = Qprime;
|
||||
|
||||
|
||||
|
||||
G = G - Q_RI - Q_CQI;
|
||||
ulsch->harq_processes[harq_pid]->G = G;
|
||||
|
||||
/*
|
||||
LOG_I(PHY,"ULSCH Encoding G %d, Q_RI %d (O_RI%d, Msc_initial %d, Nsymb_initial%d, beta_offset_ri_times8 %d), Q_CQI %d, Q_ACK %d \n",G,Q_RI,ulsch->O_RI,ulsch->harq_processes[harq_pid]->Msc_initial,ulsch->harq_processes[harq_pid]->Nsymb_initial,ulsch->beta_offset_ri_times8,Q_CQI,Q_ACK);
|
||||
|
||||
LOG_I(PHY,"ULSCH Encoding (Nid_cell %d, rnti %x): harq_pid %d round %d, RV %d, mcs %d, O_RI %d, O_ACK %d, G %d\n",
|
||||
frame_parms->Nid_cell,ulsch->rnti,
|
||||
harq_pid,
|
||||
ulsch->harq_processes[harq_pid]->round,
|
||||
ulsch->harq_processes[harq_pid]->rvidx,
|
||||
ulsch->harq_processes[harq_pid]->mcs,
|
||||
ulsch->O_RI,
|
||||
ulsch->harq_processes[harq_pid]->O_ACK,
|
||||
G);
|
||||
*/
|
||||
|
||||
if ((int)G < 0) {
|
||||
LOG_E(PHY,"FATAL: ulsch_coding.c G < 0 (%d) : Q_RI %d, Q_CQI %d, O %d, betaCQI_times8 %d)\n",G,Q_RI,Q_CQI,ulsch->O,ulsch->beta_offset_cqi_times8);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
// Data and control multiplexing (5.2.2.7 36-212)
|
||||
|
||||
H = G + Q_CQI;
|
||||
Hprime = H/Q_m;
|
||||
|
||||
|
||||
|
||||
// Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the
|
||||
// outputs for each code segment, see Section 5.1.5 p.20
|
||||
|
||||
for (r=0; r<ulsch->harq_processes[harq_pid]->C; r++) {
|
||||
#ifdef DEBUG_ULSCH_CODING
|
||||
printf("Rate Matching, Code segment %d (coded bits (G) %d,unpunctured/repeated bits per code segment %d,mod_order %d, nb_rb %d)...\n",
|
||||
r,
|
||||
G,
|
||||
Kr*3,
|
||||
Q_m,ulsch->harq_processes[harq_pid]->nb_rb);
|
||||
#endif
|
||||
|
||||
start_meas(rm_stats);
|
||||
r_offset += lte_rate_matching_turbo(ulsch->harq_processes[harq_pid]->RTC[r],
|
||||
G,
|
||||
ulsch->harq_processes[harq_pid]->w[r],
|
||||
ulsch->e+r_offset,
|
||||
ulsch->harq_processes[harq_pid]->C, // C
|
||||
NSOFT, // Nsoft,
|
||||
0, // this means UL
|
||||
1,
|
||||
ulsch->harq_processes[harq_pid]->rvidx,
|
||||
get_Qm_ul(ulsch->harq_processes[harq_pid]->mcs),
|
||||
1,
|
||||
r,
|
||||
ulsch->harq_processes[harq_pid]->nb_rb);
|
||||
//ulsch->harq_processes[harq_pid]->mcs); // r
|
||||
stop_meas(rm_stats);
|
||||
#ifdef DEBUG_ULSCH_CODING
|
||||
|
||||
if (r==ulsch->harq_processes[harq_pid]->C-1)
|
||||
write_output("enc_output.m","enc",ulsch->e,r_offset,1,4);
|
||||
|
||||
#endif
|
||||
}
|
||||
} else { //control-only PUSCH
|
||||
Q_CQI = (ulsch->harq_processes[harq_pid]->nb_rb * (12 * Q_m) * (ulsch->Nsymb_pusch)) - Q_RI;
|
||||
H = Q_CQI;
|
||||
Hprime = H/Q_m;
|
||||
}
|
||||
|
||||
|
||||
// Do CQI coding
|
||||
if ((ulsch->O>1) && (ulsch->O < 12)) {
|
||||
LOG_E(PHY,"short CQI sizes not supported yet\n");
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT);
|
||||
return(-1);
|
||||
} else {
|
||||
// add 8-bit CRC
|
||||
crc = crc8(o_flip,
|
||||
ulsch->O)>>24;
|
||||
#ifdef DEBUG_ULSCH_CODING
|
||||
printf("crc(cqi) tx : %x\n",crc);
|
||||
#endif
|
||||
memset((void *)&ulsch->o_d[0],LTE_NULL,96);
|
||||
|
||||
ccodelte_encode(ulsch->O,
|
||||
1,
|
||||
o_flip,
|
||||
&ulsch->o_d[96],
|
||||
0);
|
||||
|
||||
|
||||
o_RCC = sub_block_interleaving_cc(8+ulsch->O,
|
||||
&ulsch->o_d[96],
|
||||
ulsch->o_w);
|
||||
|
||||
lte_rate_matching_cc(o_RCC,
|
||||
Q_CQI,
|
||||
ulsch->o_w,
|
||||
ulsch->q);
|
||||
|
||||
}
|
||||
|
||||
i=0;
|
||||
|
||||
// Do RI coding
|
||||
if (ulsch->O_RI == 1) {
|
||||
switch (Q_m) {
|
||||
case 2:
|
||||
ulsch->q_RI[0] = ulsch->o_RI[0];
|
||||
ulsch->q_RI[1] = PUSCH_y;//ulsch->o_RI[0];
|
||||
len_RI=2;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
ulsch->q_RI[0] = ulsch->o_RI[0];
|
||||
ulsch->q_RI[1] = PUSCH_y;//1;
|
||||
ulsch->q_RI[2] = PUSCH_x;//ulsch->o_RI[0];
|
||||
ulsch->q_RI[3] = PUSCH_x;//1;
|
||||
len_RI=4;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
ulsch->q_RI[0] = ulsch->o_RI[0];
|
||||
ulsch->q_RI[1] = PUSCH_y;//1;
|
||||
ulsch->q_RI[2] = PUSCH_x;//1;
|
||||
ulsch->q_RI[3] = PUSCH_x;//ulsch->o_RI[0];
|
||||
ulsch->q_RI[4] = PUSCH_x;//1;
|
||||
ulsch->q_RI[5] = PUSCH_x;//1;
|
||||
len_RI=6;
|
||||
break;
|
||||
}
|
||||
} else if (ulsch->O_RI>1) {
|
||||
LOG_E(PHY,"RI cannot be more than 1 bit yet\n");
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
// Do ACK coding, Section 5.2.2.6 36.213 (p.23-24 in v8.6)
|
||||
wACK_idx = (ulsch->bundling==0) ? 4 : ((Nbundled-1)&3);
|
||||
#ifdef DEBUG_ULSCH_CODING
|
||||
printf("ulsch_coding.c: Bundling %d, Nbundled %d, wACK_idx %d\n",
|
||||
ulsch->bundling,Nbundled,wACK_idx);
|
||||
#endif
|
||||
|
||||
// 1-bit ACK/NAK
|
||||
if (ulsch->harq_processes[harq_pid]->O_ACK == 1) {
|
||||
switch (Q_m) {
|
||||
case 2:
|
||||
ulsch->q_ACK[0] = (ulsch->o_ACK[0]+wACK[wACK_idx][0])&1;
|
||||
ulsch->q_ACK[1] = (ulsch->bundling==0)? PUSCH_y : ((ulsch->o_ACK[0]+wACK[wACK_idx][1])&1);//ulsch->o_ACK[0];
|
||||
len_ACK = 2;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
ulsch->q_ACK[0] = (ulsch->o_ACK[0]+wACK[wACK_idx][0])&1;
|
||||
ulsch->q_ACK[1] = (ulsch->bundling==0)? PUSCH_y : ((ulsch->o_ACK[0]+wACK[wACK_idx][1])&1);
|
||||
ulsch->q_ACK[2] = PUSCH_x;
|
||||
ulsch->q_ACK[3] = PUSCH_x;
|
||||
len_ACK = 4;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
ulsch->q_ACK[0] = (ulsch->o_ACK[0]+wACK[wACK_idx][0])&1;
|
||||
ulsch->q_ACK[1] = (ulsch->bundling==0)? PUSCH_y : ((ulsch->o_ACK[0]+wACK[wACK_idx][1])&1);
|
||||
ulsch->q_ACK[2] = PUSCH_x;
|
||||
ulsch->q_ACK[3] = PUSCH_x;
|
||||
ulsch->q_ACK[4] = PUSCH_x;
|
||||
ulsch->q_ACK[6] = PUSCH_x;
|
||||
len_ACK = 6;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// two-bit ACK/NAK
|
||||
if (ulsch->harq_processes[harq_pid]->O_ACK == 2) {
|
||||
ack_parity = (ulsch->o_ACK[0]+ulsch->o_ACK[1])&1;
|
||||
|
||||
switch (Q_m) {
|
||||
case 2:
|
||||
ulsch->q_ACK[0] = (ulsch->o_ACK[0]+wACK[wACK_idx][0])&1;
|
||||
ulsch->q_ACK[1] = (ulsch->o_ACK[1]+wACK[wACK_idx][0])&1;
|
||||
ulsch->q_ACK[2] = (ack_parity+wACK[wACK_idx][0])&1;
|
||||
ulsch->q_ACK[3] = (ulsch->o_ACK[0]+wACK[wACK_idx][1])&1;
|
||||
ulsch->q_ACK[4] = (ulsch->o_ACK[1]+wACK[wACK_idx][1])&1;
|
||||
ulsch->q_ACK[5] = (ack_parity+wACK[wACK_idx][1])&1;
|
||||
len_ACK = 6;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
ulsch->q_ACK[0] = (ulsch->o_ACK[0]+wACK[wACK_idx][0])&1;
|
||||
ulsch->q_ACK[1] = (ulsch->o_ACK[1]+wACK[wACK_idx][0])&1;
|
||||
ulsch->q_ACK[2] = PUSCH_x;
|
||||
ulsch->q_ACK[3] = PUSCH_x;//1;
|
||||
ulsch->q_ACK[4] = (ack_parity+wACK[wACK_idx][0])&1;
|
||||
ulsch->q_ACK[5] = (ulsch->o_ACK[0]+wACK[wACK_idx][1])&1;
|
||||
ulsch->q_ACK[6] = PUSCH_x;
|
||||
ulsch->q_ACK[7] = PUSCH_x;//1;
|
||||
ulsch->q_ACK[8] = (ulsch->o_ACK[1]+wACK[wACK_idx][1])&1;
|
||||
ulsch->q_ACK[9] = (ack_parity+wACK[wACK_idx][1])&1;
|
||||
ulsch->q_ACK[10] = PUSCH_x;
|
||||
ulsch->q_ACK[11] = PUSCH_x;//1;
|
||||
len_ACK = 12;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
ulsch->q_ACK[0] = (ulsch->o_ACK[0]+wACK[wACK_idx][0])&1;
|
||||
ulsch->q_ACK[1] = (ulsch->o_ACK[1]+wACK[wACK_idx][0])&1;
|
||||
ulsch->q_ACK[2] = PUSCH_x;
|
||||
ulsch->q_ACK[3] = PUSCH_x;
|
||||
ulsch->q_ACK[4] = PUSCH_x;
|
||||
ulsch->q_ACK[5] = PUSCH_x;
|
||||
|
||||
ulsch->q_ACK[6] = (ack_parity+wACK[wACK_idx][0])&1;
|
||||
ulsch->q_ACK[7] = (ulsch->o_ACK[0]+wACK[wACK_idx][1])&1;
|
||||
ulsch->q_ACK[8] = PUSCH_x;
|
||||
ulsch->q_ACK[9] = PUSCH_x;
|
||||
ulsch->q_ACK[10] = PUSCH_x;
|
||||
ulsch->q_ACK[11] = PUSCH_x;
|
||||
|
||||
ulsch->q_ACK[12] = (ulsch->o_ACK[1]+wACK[wACK_idx][1])&1;
|
||||
ulsch->q_ACK[13] = (ack_parity+wACK[wACK_idx][1])&1;
|
||||
ulsch->q_ACK[14] = PUSCH_x;
|
||||
ulsch->q_ACK[15] = PUSCH_x;
|
||||
ulsch->q_ACK[16] = PUSCH_x;
|
||||
ulsch->q_ACK[17] = PUSCH_x;
|
||||
len_ACK = 18;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ulsch->harq_processes[harq_pid]->O_ACK > 2) {
|
||||
LOG_E(PHY,"ACK cannot be more than 2 bits yet\n");
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
// channel multiplexing/interleaving
|
||||
|
||||
start_meas(m_stats);
|
||||
Hpp = Hprime + Q_RI;
|
||||
|
||||
Cmux = ulsch->Nsymb_pusch;
|
||||
Rmux = Hpp*Q_m/Cmux;
|
||||
Rmux_prime = Rmux/Q_m;
|
||||
|
||||
Qprime_RI = Q_RI / Q_m;
|
||||
Qprime_ACK = Q_ACK / Q_m;
|
||||
Qprime_CQI = Q_CQI / Q_m;
|
||||
|
||||
// printf("Qprime_CQI = %d\n",Qprime_CQI);
|
||||
// RI BITS
|
||||
|
||||
memset(y,LTE_NULL,Q_m*Hpp);
|
||||
|
||||
if (frame_parms->Ncp == 0)
|
||||
columnset = cs_ri_normal;
|
||||
else
|
||||
columnset = cs_ri_extended;
|
||||
|
||||
j=0;
|
||||
|
||||
for (i=0; i<Qprime_RI; i++) {
|
||||
r = Rmux_prime - 1 - (i>>2);
|
||||
|
||||
for (q=0; q<Q_m; q++) {
|
||||
y[q+(Q_m*((r*Cmux) + columnset[j]))] = ulsch->q_RI[(q+(Q_m*i))%len_RI];
|
||||
// printf("ri[%d] %d => y[%d]\n",q+(Q_m*i)%len_RI,ulsch->q_RI[(q+(Q_m*i))%len_RI],q+(Q_m*((r*Cmux) + columnset[j])),y[q+(Q_m*((r*Cmux) + columnset[j]))]);
|
||||
}
|
||||
|
||||
j=(j+3)&3;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// CQI and Data bits
|
||||
j=0;
|
||||
/*
|
||||
for (i=0,iprime=-Qprime_CQI;i<Hprime;i++,iprime++) {
|
||||
|
||||
while (y[Q_m*j] != LTE_NULL) j++;
|
||||
|
||||
if (i<Qprime_CQI) {
|
||||
for (q=0;q<Q_m;q++) {
|
||||
y[q+(Q_m*j)] = ulsch->q[q+(Q_m*i)];
|
||||
//printf("cqi[%d] %d => y[%d]\n",q+(Q_m*i),ulsch->q[q+(Q_m*i)],q+(Q_m*j));
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (q=0;q<Q_m;q++) {
|
||||
y[q+(Q_m*j)] = ulsch->e[q+(Q_m*iprime)];
|
||||
// printf("e[%d] %d => y[%d]\n",q+(Q_m*iprime),ulsch->e[q+(Q_m*iprime)],q+(Q_m*j));
|
||||
}
|
||||
}
|
||||
j++;
|
||||
}
|
||||
*/
|
||||
|
||||
for (i=0; i<Qprime_CQI; i++) {
|
||||
|
||||
while (y[Q_m*j] != LTE_NULL) j++;
|
||||
|
||||
for (q=0; q<Q_m; q++) {
|
||||
y[q+(Q_m*j)] = ulsch->q[q+(Q_m*i)];
|
||||
// printf("cqi[%d] %d => y[%d] (j %d)\n",q+(Q_m*i),ulsch->q[q+(Q_m*i)],q+(Q_m*j),j);
|
||||
}
|
||||
|
||||
j++;
|
||||
}
|
||||
|
||||
j2 = j*Q_m;
|
||||
|
||||
switch (Q_m) {
|
||||
|
||||
case 2:
|
||||
|
||||
for (iprime=0; iprime<(Hprime-Qprime_CQI)<<1; iprime+=2) {
|
||||
while (y[j2] != LTE_NULL) j2+=2;
|
||||
|
||||
y[j2] = ulsch->e[iprime];
|
||||
y[1+j2] = ulsch->e[1+iprime];
|
||||
j2+=2;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
for (iprime=0; iprime<(Hprime-Qprime_CQI)<<2; iprime+=4) {
|
||||
while (y[j2] != LTE_NULL) j2+=4;
|
||||
|
||||
y[j2] = ulsch->e[iprime];
|
||||
y[1+j2] = ulsch->e[1+iprime];
|
||||
y[2+j2] = ulsch->e[2+iprime];
|
||||
y[3+j2] = ulsch->e[3+iprime];
|
||||
j2+=4;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
for (iprime=0; iprime<(Hprime-Qprime_CQI)*6; iprime+=6) {
|
||||
while (y[j2] != LTE_NULL) j2+=6;
|
||||
|
||||
y[j2] = ulsch->e[iprime];
|
||||
y[1+j2] = ulsch->e[1+iprime];
|
||||
y[2+j2] = ulsch->e[2+iprime];
|
||||
y[3+j2] = ulsch->e[3+iprime];
|
||||
y[4+j2] = ulsch->e[4+iprime];
|
||||
y[5+j2] = ulsch->e[5+iprime];
|
||||
j2+=6;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
// HARQ-ACK Bits (Note these overwrite some bits)
|
||||
|
||||
if (frame_parms->Ncp == 0)
|
||||
columnset = cs_ack_normal;
|
||||
else
|
||||
columnset = cs_ack_extended;
|
||||
|
||||
j=0;
|
||||
|
||||
for (i=0; i<Qprime_ACK; i++) {
|
||||
r = Rmux_prime - 1 - (i>>2);
|
||||
|
||||
for (q=0; q<Q_m; q++) {
|
||||
y[q+(Q_m*((r*Cmux) + columnset[j]))] = ulsch->q_ACK[(q+(Q_m*i))%len_ACK];
|
||||
#ifdef DEBUG_ULSCH_CODING
|
||||
printf("ulsch_coding.c: ACK %d => y[%d]=%d (i %d, r*Cmux %d, columnset %d)\n",q+(Q_m*i),
|
||||
q+(Q_m*((r*Cmux) + columnset[j])),ulsch->q_ACK[(q+(Q_m*i))%len_ACK],
|
||||
i,r*Cmux,columnset[j]);
|
||||
#endif
|
||||
}
|
||||
|
||||
j=(j+3)&3;
|
||||
|
||||
}
|
||||
|
||||
// write out buffer
|
||||
j=0;
|
||||
|
||||
switch (Q_m) {
|
||||
case 2:
|
||||
for (i=0; i<Cmux; i++)
|
||||
for (r=0; r<Rmux_prime; r++) {
|
||||
yptr=&y[((r*Cmux)+i)<<1];
|
||||
ulsch->h[j++] = *yptr++;
|
||||
ulsch->h[j++] = *yptr++;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
for (i=0; i<Cmux; i++)
|
||||
for (r=0; r<Rmux_prime; r++) {
|
||||
yptr = &y[((r*Cmux)+i)<<2];
|
||||
ulsch->h[j++] = *yptr++;
|
||||
ulsch->h[j++] = *yptr++;
|
||||
ulsch->h[j++] = *yptr++;
|
||||
ulsch->h[j++] = *yptr++;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
for (i=0; i<Cmux; i++)
|
||||
for (r=0; r<Rmux_prime; r++) {
|
||||
yptr = &y[((r*Cmux)+i)*6];
|
||||
ulsch->h[j++] = *yptr++;
|
||||
ulsch->h[j++] = *yptr++;
|
||||
ulsch->h[j++] = *yptr++;
|
||||
ulsch->h[j++] = *yptr++;
|
||||
ulsch->h[j++] = *yptr++;
|
||||
ulsch->h[j++] = *yptr++;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
stop_meas(m_stats);
|
||||
|
||||
if (j!=(H+Q_RI)) {
|
||||
LOG_E(PHY,"Error in output buffer length (j %d, H+Q_RI %d)\n",j,H+Q_RI);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT);
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include "RRC/LTE/rrc_extern.h"
|
||||
#include "PHY_INTERFACE/phy_interface.h"
|
||||
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
//#define DEBUG_ULSCH_DECODING
|
||||
#include "targets/RT/USER/rt_wrapper.h"
|
||||
#include "transport_proto.h"
|
||||
@@ -228,7 +228,7 @@ int ulsch_decoding_data_2thread0(td_params* tdp) {
|
||||
int harq_pid = tdp->harq_pid;
|
||||
int llr8_flag = tdp->llr8_flag;
|
||||
|
||||
unsigned int r,r_offset=0,Kr,Kr_bytes,iind;
|
||||
unsigned int r,r_offset=0,Kr,Kr_bytes;
|
||||
uint8_t crc_type;
|
||||
int offset = 0;
|
||||
int ret = 1;
|
||||
@@ -240,7 +240,7 @@ int ulsch_decoding_data_2thread0(td_params* tdp) {
|
||||
uint32_t E=0;
|
||||
uint32_t Gp,GpmodC,Nl=1;
|
||||
uint32_t C = ulsch_harq->C;
|
||||
decoder_if_t tc;
|
||||
decoder_if_t *tc;
|
||||
|
||||
if (llr8_flag == 0)
|
||||
tc = decoder16;
|
||||
@@ -260,18 +260,6 @@ int ulsch_decoding_data_2thread0(td_params* tdp) {
|
||||
|
||||
Kr_bytes = Kr>>3;
|
||||
|
||||
if (Kr_bytes<=64)
|
||||
iind = (Kr_bytes-5);
|
||||
else if (Kr_bytes <=128)
|
||||
iind = 59 + ((Kr_bytes-64)>>1);
|
||||
else if (Kr_bytes <= 256)
|
||||
iind = 91 + ((Kr_bytes-128)>>2);
|
||||
else if (Kr_bytes <= 768)
|
||||
iind = 123 + ((Kr_bytes-256)>>3);
|
||||
else {
|
||||
AssertFatal(1==0,"ulsch_decoding: Illegal codeword size %d!!!\n",Kr_bytes);
|
||||
}
|
||||
|
||||
// This is stolen from rate-matching algorithm to get the value of E
|
||||
|
||||
Gp = G/Nl/Q_m;
|
||||
@@ -304,23 +292,6 @@ int ulsch_decoding_data_2thread0(td_params* tdp) {
|
||||
|
||||
Kr_bytes = Kr>>3;
|
||||
|
||||
if (Kr_bytes<=64)
|
||||
iind = (Kr_bytes-5);
|
||||
else if (Kr_bytes <=128)
|
||||
iind = 59 + ((Kr_bytes-64)>>1);
|
||||
else if (Kr_bytes <= 256)
|
||||
iind = 91 + ((Kr_bytes-128)>>2);
|
||||
else if (Kr_bytes <= 768)
|
||||
iind = 123 + ((Kr_bytes-256)>>3);
|
||||
else {
|
||||
LOG_E(PHY,"ulsch_decoding: Illegal codeword size %d!!!\n",Kr_bytes);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ULSCH_DECODING
|
||||
printf("f1 %d, f2 %d, F %d\n",f1f2mat_old[2*iind],f1f2mat_old[1+(2*iind)],(r==0) ? ulsch_harq->F : 0);
|
||||
#endif
|
||||
|
||||
memset(&dummy_w[r][0],0,3*(6144+64)*sizeof(short));
|
||||
ulsch_harq->RTC[r] = generate_dummy_w(4+(Kr_bytes*8),
|
||||
(uint8_t*)&dummy_w[r][0],
|
||||
@@ -366,14 +337,12 @@ int ulsch_decoding_data_2thread0(td_params* tdp) {
|
||||
else
|
||||
crc_type = CRC24_B;
|
||||
|
||||
|
||||
|
||||
ret = tc(&ulsch_harq->d[r][96],
|
||||
NULL,
|
||||
ulsch_harq->c[r],
|
||||
NULL,
|
||||
Kr,
|
||||
f1f2mat_old[iind*2],
|
||||
f1f2mat_old[(iind*2)+1],
|
||||
ulsch->max_turbo_iterations,//MAX_TURBO_ITERATIONS,
|
||||
crc_type,
|
||||
(r==0) ? ulsch_harq->F : 0,
|
||||
@@ -444,7 +413,7 @@ void *td_thread(void *param) {
|
||||
int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag) {
|
||||
|
||||
eNB_proc_t *proc = &eNB->proc;
|
||||
unsigned int r,r_offset=0,Kr,Kr_bytes,iind;
|
||||
unsigned int r,r_offset=0,Kr,Kr_bytes;
|
||||
uint8_t crc_type;
|
||||
int offset = 0;
|
||||
int ret = 1;
|
||||
@@ -455,7 +424,7 @@ int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr
|
||||
int G = ulsch_harq->G;
|
||||
unsigned int E;
|
||||
int Cby2;
|
||||
decoder_if_t tc;
|
||||
decoder_if_t *tc;
|
||||
|
||||
struct timespec wait;
|
||||
|
||||
@@ -516,23 +485,6 @@ int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr
|
||||
|
||||
Kr_bytes = Kr>>3;
|
||||
|
||||
if (Kr_bytes<=64)
|
||||
iind = (Kr_bytes-5);
|
||||
else if (Kr_bytes <=128)
|
||||
iind = 59 + ((Kr_bytes-64)>>1);
|
||||
else if (Kr_bytes <= 256)
|
||||
iind = 91 + ((Kr_bytes-128)>>2);
|
||||
else if (Kr_bytes <= 768)
|
||||
iind = 123 + ((Kr_bytes-256)>>3);
|
||||
else {
|
||||
LOG_E(PHY,"ulsch_decoding: Illegal codeword size %d!!!\n",Kr_bytes);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ULSCH_DECODING
|
||||
printf("f1 %d, f2 %d, F %d\n",f1f2mat_old[2*iind],f1f2mat_old[1+(2*iind)],(r==0) ? ulsch_harq->F : 0);
|
||||
#endif
|
||||
|
||||
memset(&dummy_w[r][0],0,3*(6144+64)*sizeof(short));
|
||||
ulsch_harq->RTC[r] = generate_dummy_w(4+(Kr_bytes*8),
|
||||
(uint8_t*)&dummy_w[r][0],
|
||||
@@ -589,8 +541,6 @@ int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr
|
||||
ulsch_harq->c[r],
|
||||
NULL,
|
||||
Kr,
|
||||
f1f2mat_old[iind*2],
|
||||
f1f2mat_old[(iind*2)+1],
|
||||
ulsch->max_turbo_iterations,//MAX_TURBO_ITERATIONS,
|
||||
crc_type,
|
||||
(r==0) ? ulsch_harq->F : 0,
|
||||
@@ -640,7 +590,7 @@ int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr
|
||||
|
||||
int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag) {
|
||||
|
||||
unsigned int r,r_offset=0,Kr,Kr_bytes,iind;
|
||||
unsigned int r,r_offset=0,Kr,Kr_bytes;
|
||||
uint8_t crc_type;
|
||||
int offset = 0;
|
||||
int ret = 1;
|
||||
@@ -650,7 +600,7 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag)
|
||||
|
||||
int G = ulsch_harq->G;
|
||||
unsigned int E;
|
||||
decoder_if_t tc;
|
||||
decoder_if_t *tc;
|
||||
|
||||
if (llr8_flag == 0)
|
||||
tc = *decoder16;
|
||||
@@ -669,23 +619,6 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag)
|
||||
|
||||
Kr_bytes = Kr>>3;
|
||||
|
||||
if (Kr_bytes<=64)
|
||||
iind = (Kr_bytes-5);
|
||||
else if (Kr_bytes <=128)
|
||||
iind = 59 + ((Kr_bytes-64)>>1);
|
||||
else if (Kr_bytes <= 256)
|
||||
iind = 91 + ((Kr_bytes-128)>>2);
|
||||
else if (Kr_bytes <= 768)
|
||||
iind = 123 + ((Kr_bytes-256)>>3);
|
||||
else {
|
||||
LOG_E(PHY,"ulsch_decoding: Illegal codeword size %d!!!\n",Kr_bytes);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ULSCH_DECODING
|
||||
printf("f1 %d, f2 %d, F %d\n",f1f2mat_old[2*iind],f1f2mat_old[1+(2*iind)],(r==0) ? ulsch_harq->F : 0);
|
||||
#endif
|
||||
|
||||
memset(&dummy_w[r][0],0,3*(6144+64)*sizeof(short));
|
||||
ulsch_harq->RTC[r] = generate_dummy_w(4+(Kr_bytes*8),
|
||||
(uint8_t*)&dummy_w[r][0],
|
||||
@@ -734,7 +667,8 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag)
|
||||
crc_type = CRC24_A;
|
||||
else
|
||||
crc_type = CRC24_B;
|
||||
|
||||
|
||||
|
||||
start_meas(&eNB->ulsch_turbo_decoding_stats);
|
||||
|
||||
ret = tc(&ulsch_harq->d[r][96],
|
||||
@@ -742,8 +676,6 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag)
|
||||
ulsch_harq->c[r],
|
||||
NULL,
|
||||
Kr,
|
||||
f1f2mat_old[iind*2],
|
||||
f1f2mat_old[(iind*2)+1],
|
||||
ulsch->max_turbo_iterations,//MAX_TURBO_ITERATIONS,
|
||||
crc_type,
|
||||
(r==0) ? ulsch_harq->F : 0,
|
||||
@@ -915,8 +847,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
|
||||
nb_rb);
|
||||
|
||||
//#endif
|
||||
|
||||
if (ulsch_harq->round == 0) {
|
||||
//if (ulsch_harq->round == 0) { // delete for RB shortage pattern
|
||||
// This is a new packet, so compute quantities regarding segmentation
|
||||
ulsch_harq->B = A+24;
|
||||
lte_segmentation(NULL,
|
||||
@@ -929,8 +860,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
|
||||
&ulsch_harq->Kminus,
|
||||
&ulsch_harq->F);
|
||||
// CLEAR LLR's HERE for first packet in process
|
||||
}
|
||||
|
||||
//}
|
||||
// printf("after segmentation c[%d] = %p\n",0,ulsch_harq->c[0]);
|
||||
|
||||
sumKr = 0;
|
||||
|
||||
@@ -1024,20 +1024,6 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext,
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ulsch_channel_level(int32_t **drs_ch_estimates_ext,
|
||||
LTE_DL_FRAME_PARMS *frame_parms,
|
||||
int32_t *avg,
|
||||
@@ -1047,24 +1033,23 @@ void ulsch_channel_level(int32_t **drs_ch_estimates_ext,
|
||||
int16_t rb;
|
||||
uint8_t aarx;
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i avg128U;
|
||||
__m128i *ul_ch128;
|
||||
__m128 avg128U;
|
||||
#elif defined(__arm__)
|
||||
int16x4_t *ul_ch128;
|
||||
int32x4_t avg128U;
|
||||
int16x4_t *ul_ch128;
|
||||
#endif
|
||||
|
||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||
//clear average level
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
avg128U = _mm_setzero_si128();
|
||||
avg128U = _mm_setzero_ps();
|
||||
ul_ch128=(__m128i *)drs_ch_estimates_ext[aarx];
|
||||
|
||||
for (rb=0; rb<nb_rb; rb++) {
|
||||
|
||||
avg128U = _mm_add_epi32(avg128U,_mm_madd_epi16(ul_ch128[0],ul_ch128[0]));
|
||||
avg128U = _mm_add_epi32(avg128U,_mm_madd_epi16(ul_ch128[1],ul_ch128[1]));
|
||||
avg128U = _mm_add_epi32(avg128U,_mm_madd_epi16(ul_ch128[2],ul_ch128[2]));
|
||||
avg128U = _mm_add_ps(avg128U,_mm_cvtepi32_ps(_mm_madd_epi16(ul_ch128[0],ul_ch128[0])));
|
||||
avg128U = _mm_add_ps(avg128U,_mm_cvtepi32_ps(_mm_madd_epi16(ul_ch128[1],ul_ch128[1])));
|
||||
avg128U = _mm_add_ps(avg128U,_mm_cvtepi32_ps(_mm_madd_epi16(ul_ch128[2],ul_ch128[2])));
|
||||
|
||||
ul_ch128+=3;
|
||||
|
||||
@@ -1091,10 +1076,10 @@ void ulsch_channel_level(int32_t **drs_ch_estimates_ext,
|
||||
#endif
|
||||
|
||||
DevAssert( nb_rb );
|
||||
avg[aarx] = (((int*)&avg128U)[0] +
|
||||
((int*)&avg128U)[1] +
|
||||
((int*)&avg128U)[2] +
|
||||
((int*)&avg128U)[3])/(nb_rb*12);
|
||||
avg[aarx] = (int)((((float*)&avg128U)[0] +
|
||||
((float*)&avg128U)[1] +
|
||||
((float*)&avg128U)[2] +
|
||||
((float*)&avg128U)[3])/(float)(nb_rb*12));
|
||||
|
||||
}
|
||||
|
||||
@@ -1199,8 +1184,8 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
|
||||
}
|
||||
|
||||
|
||||
//write_output("rxdataF_ext.m","rxF_ext",pusch_vars->rxdataF_ext[eNB_id][0],300*(frame_parms->symbols_per_tti-ulsch[UE_id]->srs_active),1,1);
|
||||
//write_output("ulsch_chest.m","drs_est",pusch_vars->drs_ch_estimates[eNB_id][0],300*(frame_parms->symbols_per_tti-ulsch[UE_id]->srs_active),1,1);
|
||||
//LOG_M("rxdataF_ext.m","rxF_ext",pusch_vars->rxdataF_ext[eNB_id][0],300*(frame_parms->symbols_per_tti-ulsch[UE_id]->srs_active),1,1);
|
||||
//LOG_M("ulsch_chest.m","drs_est",pusch_vars->drs_ch_estimates[eNB_id][0],300*(frame_parms->symbols_per_tti-ulsch[UE_id]->srs_active),1,1);
|
||||
|
||||
|
||||
ulsch_channel_level(pusch_vars->drs_ch_estimates,
|
||||
@@ -1365,70 +1350,70 @@ void rx_ulsch_emul(PHY_VARS_eNB *eNB,
|
||||
eNB->ulsch[UE_id]->harq_processes[harq_pid]->Nsymb_pusch);
|
||||
sprintf(fname,"/tmp/ulsch_r%d_d",round);
|
||||
sprintf(vname,"/tmp/ulsch_r%d_dseq",round);
|
||||
write_output(fname,vname,&eNB->ulsch[UE_id]->harq_processes[harq_pid]->d[0][96],
|
||||
LOG_UM(fname,vname,&eNB->ulsch[UE_id]->harq_processes[harq_pid]->d[0][96],
|
||||
eNB->ulsch[UE_id]->harq_processes[harq_pid]->Kplus*3,1,0);
|
||||
if (eNB->common_vars.rxdata) {
|
||||
sprintf(fname,"/tmp/rxsig0_r%d.m",round);
|
||||
sprintf(vname,"rxs0_r%d",round);
|
||||
write_output(fname,vname, &eNB->common_vars.rxdata[0][0],eNB->frame_parms.samples_per_tti*10,1,1);
|
||||
LOG_UM(fname,vname, &eNB->common_vars.rxdata[0][0],eNB->frame_parms.samples_per_tti*10,1,1);
|
||||
|
||||
if (eNB->frame_parms.nb_antennas_rx>1)
|
||||
if (eNB->common_vars.rxdata) {
|
||||
sprintf(fname,"/tmp/rxsig1_r%d.m",round);
|
||||
sprintf(vname,"rxs1_r%d",round);
|
||||
write_output(fname,vname, &eNB->common_vars.rxdata[1][0],eNB->frame_parms.samples_per_tti*10,1,1);
|
||||
LOG_UM(fname,vname, &eNB->common_vars.rxdata[1][0],eNB->frame_parms.samples_per_tti*10,1,1);
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(fname,"/tmp/rxsigF0_r%d.m",round);
|
||||
sprintf(vname,"rxsF0_r%d",round);
|
||||
write_output(fname,vname, (void*)&eNB->common_vars.rxdataF[0][0],eNB->frame_parms.ofdm_symbol_size*nsymb,1,1);
|
||||
LOG_UM(fname,vname, (void*)&eNB->common_vars.rxdataF[0][0],eNB->frame_parms.ofdm_symbol_size*nsymb,1,1);
|
||||
|
||||
if (eNB->frame_parms.nb_antennas_rx>1) {
|
||||
sprintf(fname,"/tmp/rxsigF1_r%d.m",round);
|
||||
sprintf(vname,"rxsF1_r%d",round);
|
||||
write_output(vname,fname, &eNB->common_vars.rxdataF[1][0],eNB->frame_parms.ofdm_symbol_size*nsymb,1,1);
|
||||
LOG_UM(vname,fname, &eNB->common_vars.rxdataF[1][0],eNB->frame_parms.ofdm_symbol_size*nsymb,1,1);
|
||||
}
|
||||
|
||||
sprintf(fname,"/tmp/rxsigF0_ext_r%d.m",round);
|
||||
sprintf(vname,"rxsF0_ext_r%d",round);
|
||||
write_output(fname,vname, &eNB->pusch_vars[UE_id]->rxdataF_ext[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||
LOG_UM(fname,vname, &eNB->pusch_vars[UE_id]->rxdataF_ext[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||
|
||||
if (eNB->frame_parms.nb_antennas_rx>1) {
|
||||
sprintf(fname,"/tmp/rxsigF1_ext_r%d.m",round);
|
||||
sprintf(vname,"rxsF1_ext_r%d",round);
|
||||
write_output(fname,vname,&eNB->pusch_vars[UE_id]->rxdataF_ext[1][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||
LOG_UM(fname,vname,&eNB->pusch_vars[UE_id]->rxdataF_ext[1][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||
}
|
||||
/*
|
||||
if (eNB->srs_vars[UE_id].srs_ch_estimates) write_output("/tmp/srs_est0.m","srsest0",eNB->srs_vars[UE_id].srs_ch_estimates[0],eNB->frame_parms.ofdm_symbol_size,1,1);
|
||||
if (eNB->srs_vars[UE_id].srs_ch_estimates) LOG_UM("/tmp/srs_est0.m","srsest0",eNB->srs_vars[UE_id].srs_ch_estimates[0],eNB->frame_parms.ofdm_symbol_size,1,1);
|
||||
|
||||
if (eNB->frame_parms.nb_antennas_rx>1)
|
||||
if (eNB->srs_vars[UE_id].srs_ch_estimates) write_output("/tmp/srs_est1.m","srsest1",eNB->srs_vars[UE_id].srs_ch_estimates[1],eNB->frame_parms.ofdm_symbol_size,1,1);
|
||||
if (eNB->srs_vars[UE_id].srs_ch_estimates) LOG_UM("/tmp/srs_est1.m","srsest1",eNB->srs_vars[UE_id].srs_ch_estimates[1],eNB->frame_parms.ofdm_symbol_size,1,1);
|
||||
*/
|
||||
|
||||
sprintf(fname,"/tmp/drs_est0_r%d.m",round);
|
||||
sprintf(vname,"drsest0_r%d",round);
|
||||
write_output(fname,vname,eNB->pusch_vars[UE_id]->drs_ch_estimates[0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||
LOG_UM(fname,vname,eNB->pusch_vars[UE_id]->drs_ch_estimates[0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||
|
||||
if (eNB->frame_parms.nb_antennas_rx>1) {
|
||||
sprintf(fname,"/tmp/drs_est1_r%d.m",round);
|
||||
sprintf(vname,"drsest1_r%d",round);
|
||||
write_output(fname,vname,eNB->pusch_vars[UE_id]->drs_ch_estimates[1],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||
LOG_UM(fname,vname,eNB->pusch_vars[UE_id]->drs_ch_estimates[1],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||
}
|
||||
|
||||
sprintf(fname,"/tmp/ulsch0_rxF_comp0_r%d.m",round);
|
||||
sprintf(vname,"ulsch0_rxF_comp0_r%d",round);
|
||||
write_output(fname,vname,&eNB->pusch_vars[UE_id]->rxdataF_comp[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||
// write_output("ulsch_rxF_comp1.m","ulsch0_rxF_comp1",&eNB->pusch_vars[UE_id]->rxdataF_comp[0][1][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||
LOG_UM(fname,vname,&eNB->pusch_vars[UE_id]->rxdataF_comp[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||
// LOG_M("ulsch_rxF_comp1.m","ulsch0_rxF_comp1",&eNB->pusch_vars[UE_id]->rxdataF_comp[0][1][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||
sprintf(fname,"/tmp/ulsch_rxF_llr_r%d.m",round);
|
||||
sprintf(vname,"ulsch_llr_r%d",round);
|
||||
write_output(fname,vname,eNB->pusch_vars[UE_id]->llr,
|
||||
LOG_UM(fname,vname,eNB->pusch_vars[UE_id]->llr,
|
||||
eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12*eNB->ulsch[UE_id]->harq_processes[harq_pid]->Qm
|
||||
*eNB->ulsch[UE_id]->harq_processes[harq_pid]->Nsymb_pusch,1,0);
|
||||
sprintf(fname,"/tmp/ulsch_ch_mag_r%d.m",round);
|
||||
sprintf(vname,"ulsch_ch_mag_r%d",round);
|
||||
write_output(fname,vname,&eNB->pusch_vars[UE_id]->ul_ch_mag[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||
// write_output("ulsch_ch_mag1.m","ulsch_ch_mag1",&eNB->pusch_vars[UE_id]->ul_ch_mag[1][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||
LOG_UM(fname,vname,&eNB->pusch_vars[UE_id]->ul_ch_mag[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||
// LOG_UM("ulsch_ch_mag1.m","ulsch_ch_mag1",&eNB->pusch_vars[UE_id]->ul_ch_mag[1][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1);
|
||||
//#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1,777 +0,0 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file PHY/LTE_TRANSPORT/ulsch_modulation.c
|
||||
* \brief Top-level routines for generating PUSCH physical channel from 36.211 V8.6 2009-03
|
||||
* \author R. Knopp, F. Kaltenberger, A. Bhamri
|
||||
* \date 2011
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr,ankit.bhamri@eurecom.fr
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "PHY/CODING/defs.h"
|
||||
#include "PHY/CODING/extern.h"
|
||||
#include "PHY/LTE_TRANSPORT/defs.h"
|
||||
#include "defs.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
|
||||
|
||||
|
||||
//#define DEBUG_ULSCH_MODULATION
|
||||
|
||||
#ifndef OFDMA_ULSCH
|
||||
void dft_lte(int32_t *z,int32_t *d, int32_t Msc_PUSCH, uint8_t Nsymb)
|
||||
{
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i dft_in128[4][1200],dft_out128[4][1200];
|
||||
#elif defined(__arm__)
|
||||
int16x8_t dft_in128[4][1200],dft_out128[4][1200];
|
||||
#endif
|
||||
uint32_t *dft_in0=(uint32_t*)dft_in128[0],*dft_out0=(uint32_t*)dft_out128[0];
|
||||
uint32_t *dft_in1=(uint32_t*)dft_in128[1],*dft_out1=(uint32_t*)dft_out128[1];
|
||||
uint32_t *dft_in2=(uint32_t*)dft_in128[2],*dft_out2=(uint32_t*)dft_out128[2];
|
||||
// uint32_t *dft_in3=(uint32_t*)dft_in128[3],*dft_out3=(uint32_t*)dft_out128[3];
|
||||
|
||||
uint32_t *d0,*d1,*d2,*d3,*d4,*d5,*d6,*d7,*d8,*d9,*d10,*d11;
|
||||
|
||||
uint32_t *z0,*z1,*z2,*z3,*z4,*z5,*z6,*z7,*z8,*z9,*z10,*z11;
|
||||
uint32_t i,ip;
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i norm128;
|
||||
#elif defined(__arm__)
|
||||
int16x8_t norm128;
|
||||
#endif
|
||||
// printf("Doing lte_dft for Msc_PUSCH %d\n",Msc_PUSCH);
|
||||
|
||||
d0 = (uint32_t *)d;
|
||||
d1 = d0+Msc_PUSCH;
|
||||
d2 = d1+Msc_PUSCH;
|
||||
d3 = d2+Msc_PUSCH;
|
||||
d4 = d3+Msc_PUSCH;
|
||||
d5 = d4+Msc_PUSCH;
|
||||
d6 = d5+Msc_PUSCH;
|
||||
d7 = d6+Msc_PUSCH;
|
||||
d8 = d7+Msc_PUSCH;
|
||||
d9 = d8+Msc_PUSCH;
|
||||
d10 = d9+Msc_PUSCH;
|
||||
d11 = d10+Msc_PUSCH;
|
||||
|
||||
// printf("symbol 0 (d0 %p, d %p)\n",d0,d);
|
||||
for (i=0,ip=0; i<Msc_PUSCH; i++,ip+=4) {
|
||||
dft_in0[ip] = d0[i];
|
||||
dft_in0[ip+1] = d1[i];
|
||||
dft_in0[ip+2] = d2[i];
|
||||
dft_in0[ip+3] = d3[i];
|
||||
dft_in1[ip] = d4[i];
|
||||
dft_in1[ip+1] = d5[i];
|
||||
dft_in1[ip+2] = d6[i];
|
||||
dft_in1[ip+3] = d7[i];
|
||||
dft_in2[ip] = d8[i];
|
||||
dft_in2[ip+1] = d9[i];
|
||||
dft_in2[ip+2] = d10[i];
|
||||
dft_in2[ip+3] = d11[i];
|
||||
// printf("dft%d %d: %d,%d,%d,%d\n",Msc_PUSCH,ip,d0[i],d1[i],d2[i],d3[i]);
|
||||
|
||||
// dft_in_re2[ip+1] = d9[i];
|
||||
// dft_in_re2[ip+2] = d10[i];
|
||||
}
|
||||
|
||||
// printf("\n");
|
||||
|
||||
switch (Msc_PUSCH) {
|
||||
case 12:
|
||||
dft12((int16_t *)dft_in0,(int16_t *)dft_out0);
|
||||
dft12((int16_t *)dft_in1,(int16_t *)dft_out1);
|
||||
dft12((int16_t *)dft_in2,(int16_t *)dft_out2);
|
||||
|
||||
/*
|
||||
dft12f(&((__m128i *)dft_in0)[0],&((__m128i *)dft_in0)[1],&((__m128i *)dft_in0)[2],&((__m128i *)dft_in0)[3],&((__m128i *)dft_in0)[4],&((__m128i *)dft_in0)[5],&((__m128i *)dft_in0)[6],&((__m128i *)dft_in0)[7],&((__m128i *)dft_in0)[8],&((__m128i *)dft_in0)[9],&((__m128i *)dft_in0)[10],&((__m128i *)dft_in0)[11],
|
||||
&((__m128i *)dft_out0)[0],&((__m128i *)dft_out0)[1],&((__m128i *)dft_out0)[2],&((__m128i *)dft_out0)[3],&((__m128i *)dft_out0)[4],&((__m128i *)dft_out0)[5],&((__m128i *)dft_out0)[6],&((__m128i *)dft_out0)[7],&((__m128i *)dft_out0)[8],&((__m128i *)dft_out0)[9],&((__m128i *)dft_out0)[10],&((__m128i *)dft_out0)[11]);
|
||||
|
||||
dft12f(&((__m128i *)dft_in1)[0],&((__m128i *)dft_in1)[1],&((__m128i *)dft_in1)[2],&((__m128i *)dft_in1)[3],&((__m128i *)dft_in1)[4],&((__m128i *)dft_in1)[5],&((__m128i *)dft_in1)[6],&((__m128i *)dft_in1)[7],&((__m128i *)dft_in1)[8],&((__m128i *)dft_in1)[9],&((__m128i *)dft_in1)[10],&((__m128i *)dft_in1)[11],
|
||||
&((__m128i *)dft_out1)[0],&((__m128i *)dft_out1)[1],&((__m128i *)dft_out1)[2],&((__m128i *)dft_out1)[3],&((__m128i *)dft_out1)[4],&((__m128i *)dft_out1)[5],&((__m128i *)dft_out1)[6],&((__m128i *)dft_out1)[7],&((__m128i *)dft_out1)[8],&((__m128i *)dft_out1)[9],&((__m128i *)dft_out1)[10],&((__m128i *)dft_out1)[11]);
|
||||
|
||||
dft12f(&((__m128i *)dft_in2)[0],&((__m128i *)dft_in2)[1],&((__m128i *)dft_in2)[2],&((__m128i *)dft_in2)[3],&((__m128i *)dft_in2)[4],&((__m128i *)dft_in2)[5],&((__m128i *)dft_in2)[6],&((__m128i *)dft_in2)[7],&((__m128i *)dft_in2)[8],&((__m128i *)dft_in2)[9],&((__m128i *)dft_in2)[10],&((__m128i *)dft_in2)[11],
|
||||
&((__m128i *)dft_out2)[0],&((__m128i *)dft_out2)[1],&((__m128i *)dft_out2)[2],&((__m128i *)dft_out2)[3],&((__m128i *)dft_out2)[4],&((__m128i *)dft_out2)[5],&((__m128i *)dft_out2)[6],&((__m128i *)dft_out2)[7],&((__m128i *)dft_out2)[8],&((__m128i *)dft_out2)[9],&((__m128i *)dft_out2)[10],&((__m128i *)dft_out2)[11]);
|
||||
*/
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
norm128 = _mm_set1_epi16(9459);
|
||||
#elif defined(__arm__)
|
||||
norm128 = vdupq_n_s16(9459);
|
||||
#endif
|
||||
for (i=0; i<12; i++) {
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
((__m128i*)dft_out0)[i] = _mm_slli_epi16(_mm_mulhi_epi16(((__m128i*)dft_out0)[i],norm128),1);
|
||||
((__m128i*)dft_out1)[i] = _mm_slli_epi16(_mm_mulhi_epi16(((__m128i*)dft_out1)[i],norm128),1);
|
||||
((__m128i*)dft_out2)[i] = _mm_slli_epi16(_mm_mulhi_epi16(((__m128i*)dft_out2)[i],norm128),1);
|
||||
#elif defined(__arm__)
|
||||
((int16x8_t*)dft_out0)[i] = vqdmulhq_s16(((int16x8_t*)dft_out0)[i],norm128);
|
||||
((int16x8_t*)dft_out1)[i] = vqdmulhq_s16(((int16x8_t*)dft_out1)[i],norm128);
|
||||
((int16x8_t*)dft_out2)[i] = vqdmulhq_s16(((int16x8_t*)dft_out2)[i],norm128);
|
||||
#endif
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 24:
|
||||
dft24((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft24((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft24((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 36:
|
||||
dft36((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft36((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft36((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 48:
|
||||
dft48((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft48((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft48((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 60:
|
||||
dft60((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft60((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft60((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 72:
|
||||
dft72((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft72((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft72((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 96:
|
||||
dft96((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft96((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft96((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 108:
|
||||
dft108((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft108((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft108((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 120:
|
||||
dft120((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft120((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft120((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 144:
|
||||
dft144((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft144((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft144((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 180:
|
||||
dft180((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft180((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft180((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 192:
|
||||
dft192((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft192((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft192((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 216:
|
||||
dft216((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft216((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft216((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 240:
|
||||
dft240((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft240((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft240((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 288:
|
||||
dft288((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft288((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft288((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 300:
|
||||
dft300((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft300((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft300((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 324:
|
||||
dft324((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft324((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft324((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 360:
|
||||
dft360((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft360((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft360((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 384:
|
||||
dft384((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft384((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft384((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 432:
|
||||
dft432((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft432((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft432((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 480:
|
||||
dft480((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft480((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft480((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 540:
|
||||
dft540((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft540((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft540((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 576:
|
||||
dft576((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft576((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft576((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 600:
|
||||
dft600((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft600((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft600((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 648:
|
||||
dft648((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft648((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft648((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 720:
|
||||
dft720((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft720((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft720((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 864:
|
||||
dft864((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft864((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft864((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 900:
|
||||
dft900((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft900((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft900((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 960:
|
||||
dft960((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft960((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft960((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 972:
|
||||
dft972((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft972((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft972((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 1080:
|
||||
dft1080((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft1080((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft1080((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 1152:
|
||||
dft1152((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft1152((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft1152((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
|
||||
case 1200:
|
||||
dft1200((int16_t*)dft_in0,(int16_t*)dft_out0,1);
|
||||
dft1200((int16_t*)dft_in1,(int16_t*)dft_out1,1);
|
||||
dft1200((int16_t*)dft_in2,(int16_t*)dft_out2,1);
|
||||
break;
|
||||
}
|
||||
|
||||
z0 = (uint32_t *)z;
|
||||
z1 = z0+Msc_PUSCH;
|
||||
z2 = z1+Msc_PUSCH;
|
||||
z3 = z2+Msc_PUSCH;
|
||||
z4 = z3+Msc_PUSCH;
|
||||
z5 = z4+Msc_PUSCH;
|
||||
z6 = z5+Msc_PUSCH;
|
||||
z7 = z6+Msc_PUSCH;
|
||||
z8 = z7+Msc_PUSCH;
|
||||
z9 = z8+Msc_PUSCH;
|
||||
z10 = z9+Msc_PUSCH;
|
||||
z11 = z10+Msc_PUSCH;
|
||||
|
||||
// printf("symbol0 (dft)\n");
|
||||
for (i=0,ip=0; i<Msc_PUSCH; i++,ip+=4) {
|
||||
z0[i] = dft_out0[ip];
|
||||
// printf("%d,%d,",((short*)&z0[i])[0],((short*)&z0[i])[1]);
|
||||
z1[i] = dft_out0[ip+1];
|
||||
z2[i] = dft_out0[ip+2];
|
||||
z3[i] = dft_out0[ip+3];
|
||||
z4[i] = dft_out1[ip+0];
|
||||
z5[i] = dft_out1[ip+1];
|
||||
z6[i] = dft_out1[ip+2];
|
||||
z7[i] = dft_out1[ip+3];
|
||||
z8[i] = dft_out2[ip];
|
||||
z9[i] = dft_out2[ip+1];
|
||||
z10[i] = dft_out2[ip+2];
|
||||
z11[i] = dft_out2[ip+3];
|
||||
// printf("out dft%d %d: %d,%d,%d,%d,%d,%d,%d,%d\n",Msc_PUSCH,ip,z0[i],z1[i],z2[i],z3[i],z4[i],z5[i],z6[i],z7[i]);
|
||||
|
||||
}
|
||||
|
||||
// printf("\n");
|
||||
}
|
||||
|
||||
#endif
|
||||
void ulsch_modulation(int32_t **txdataF,
|
||||
short amp,
|
||||
uint32_t frame,
|
||||
uint32_t subframe,
|
||||
LTE_DL_FRAME_PARMS *frame_parms,
|
||||
LTE_UE_ULSCH_t *ulsch)
|
||||
{
|
||||
|
||||
uint8_t qam64_table_offset_re = 0;
|
||||
uint8_t qam64_table_offset_im = 0;
|
||||
uint8_t qam16_table_offset_re = 0;
|
||||
uint8_t qam16_table_offset_im = 0;
|
||||
short gain_lin_QPSK;
|
||||
|
||||
DevAssert(frame_parms);
|
||||
|
||||
int re_offset,re_offset0,i,Msymb,j,k,nsymb,Msc_PUSCH,l;
|
||||
// uint8_t harq_pid = (rag_flag == 1) ? 0 : subframe2harq_pid_tdd(frame_parms->tdd_config,subframe);
|
||||
uint8_t harq_pid = subframe2harq_pid(frame_parms,frame,subframe);
|
||||
uint8_t Q_m;
|
||||
int32_t *txptr;
|
||||
uint32_t symbol_offset;
|
||||
uint16_t first_rb;
|
||||
uint16_t nb_rb;
|
||||
int G;
|
||||
|
||||
uint32_t x1, x2, s=0;
|
||||
uint8_t c;
|
||||
|
||||
if (!ulsch) {
|
||||
printf("ulsch_modulation.c: Null ulsch\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// x1 is set in lte_gold_generic
|
||||
x2 = (ulsch->rnti<<14) + (subframe<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.3.1
|
||||
|
||||
if (harq_pid>=8) {
|
||||
printf("ulsch_modulation.c: Illegal harq_pid %d\n",harq_pid);
|
||||
return;
|
||||
}
|
||||
|
||||
first_rb = ulsch->harq_processes[harq_pid]->first_rb;
|
||||
nb_rb = ulsch->harq_processes[harq_pid]->nb_rb;
|
||||
|
||||
if (nb_rb == 0) {
|
||||
printf("ulsch_modulation.c: Frame %d, Subframe %d Illegal nb_rb %d\n",frame,subframe,nb_rb);
|
||||
return;
|
||||
}
|
||||
|
||||
if (first_rb > frame_parms->N_RB_UL) {
|
||||
printf("ulsch_modulation.c: Frame %d, Subframe %d Illegal first_rb %d\n",frame,subframe,first_rb);
|
||||
return;
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_MODULATION, VCD_FUNCTION_IN);
|
||||
|
||||
Q_m = get_Qm_ul(ulsch->harq_processes[harq_pid]->mcs);
|
||||
|
||||
G = (int)ulsch->harq_processes[harq_pid]->nb_rb * (12 * Q_m) * (ulsch->Nsymb_pusch);
|
||||
|
||||
|
||||
// Mapping
|
||||
nsymb = (frame_parms->Ncp==0) ? 14:12;
|
||||
Msc_PUSCH = ulsch->harq_processes[harq_pid]->nb_rb*12;
|
||||
|
||||
#ifdef DEBUG_ULSCH_MODULATION
|
||||
LOG_D(PHY,"ulsch_modulation.c: Doing modulation (rnti %x,x2 %x) for G=%d bits, harq_pid %d , nb_rb %d, Q_m %d, Nsymb_pusch %d (nsymb %d), subframe %d\n",
|
||||
ulsch->rnti,x2,G,harq_pid,ulsch->harq_processes[harq_pid]->nb_rb,Q_m, ulsch->Nsymb_pusch,nsymb,subframe);
|
||||
#endif
|
||||
|
||||
// scrambling (Note the placeholding bits are handled in ulsch_coding.c directly!)
|
||||
//printf("ulsch bits: ");
|
||||
s = lte_gold_generic(&x1, &x2, 1);
|
||||
k=0;
|
||||
|
||||
//printf("G %d\n",G);
|
||||
for (i=0; i<(1+(G>>5)); i++) {
|
||||
for (j=0; j<32; j++,k++) {
|
||||
c = (uint8_t)((s>>j)&1);
|
||||
|
||||
if (ulsch->h[k] == PUSCH_x) {
|
||||
// printf("i %d: PUSCH_x\n",i);
|
||||
ulsch->b_tilde[k] = 1;
|
||||
} else if (ulsch->h[k] == PUSCH_y) {
|
||||
// printf("i %d: PUSCH_y\n",i);
|
||||
ulsch->b_tilde[k] = ulsch->b_tilde[k-1];
|
||||
} else {
|
||||
ulsch->b_tilde[k] = (ulsch->h[k]+c)&1;
|
||||
// printf("i %d : %d (h %d c %d)\n", (i<<5)+j,ulsch->b_tilde[k],ulsch->h[k],c);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
s = lte_gold_generic(&x1, &x2, 0);
|
||||
}
|
||||
|
||||
//printf("\n");
|
||||
|
||||
|
||||
gain_lin_QPSK = (short)((amp*ONE_OVER_SQRT2_Q15)>>15);
|
||||
|
||||
|
||||
// Modulation
|
||||
|
||||
Msymb = G/Q_m;
|
||||
|
||||
if(ulsch->cooperation_flag == 2)
|
||||
// For Distributed Alamouti Scheme in Collabrative Communication
|
||||
{
|
||||
for (i=0,j=Q_m; i<Msymb; i+=2,j+=2*Q_m) {
|
||||
|
||||
switch (Q_m) {
|
||||
|
||||
case 2:
|
||||
|
||||
|
||||
//UE1, -x1*
|
||||
((int16_t*)&ulsch->d[i])[0] = (ulsch->b_tilde[j] == 1) ? (gain_lin_QPSK) : -gain_lin_QPSK;
|
||||
((int16_t*)&ulsch->d[i])[1] = (ulsch->b_tilde[j+1] == 1)? (-gain_lin_QPSK) : gain_lin_QPSK;
|
||||
// if (i<Msc_PUSCH)
|
||||
// printf("input %d (%p): %d,%d\n", i,&ulsch->d[i],((int16_t*)&ulsch->d[i])[0],((int16_t*)&ulsch->d[i])[1]);
|
||||
|
||||
// UE1, x0*
|
||||
((int16_t*)&ulsch->d[i+1])[0] = (ulsch->b_tilde[j-2] == 1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
|
||||
((int16_t*)&ulsch->d[i+1])[1] = (ulsch->b_tilde[j-1] == 1)? (gain_lin_QPSK) : -gain_lin_QPSK;
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
||||
|
||||
//UE1,-x1*
|
||||
qam16_table_offset_re = 0;
|
||||
qam16_table_offset_im = 0;
|
||||
|
||||
if (ulsch->b_tilde[j] == 1)
|
||||
qam16_table_offset_re+=2;
|
||||
|
||||
if (ulsch->b_tilde[j+1] == 1)
|
||||
qam16_table_offset_im+=2;
|
||||
|
||||
|
||||
|
||||
if (ulsch->b_tilde[j+2] == 1)
|
||||
qam16_table_offset_re+=1;
|
||||
|
||||
if (ulsch->b_tilde[j+3] == 1)
|
||||
qam16_table_offset_im+=1;
|
||||
|
||||
|
||||
((int16_t*)&ulsch->d[i])[0]=-(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
|
||||
((int16_t*)&ulsch->d[i])[1]=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
|
||||
|
||||
//UE1,x0*
|
||||
qam16_table_offset_re = 0;
|
||||
qam16_table_offset_im = 0;
|
||||
|
||||
if (ulsch->b_tilde[j-4] == 1)
|
||||
qam16_table_offset_re+=2;
|
||||
|
||||
if (ulsch->b_tilde[j-3] == 1)
|
||||
qam16_table_offset_im+=2;
|
||||
|
||||
|
||||
if (ulsch->b_tilde[j-2] == 1)
|
||||
qam16_table_offset_re+=1;
|
||||
|
||||
if (ulsch->b_tilde[j-1] == 1)
|
||||
qam16_table_offset_im+=1;
|
||||
|
||||
|
||||
// ((int16_t*)&ulsch->d[i+1])[0]=-(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
|
||||
// ((int16_t*)&ulsch->d[i+1])[1]=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
|
||||
((int16_t*)&ulsch->d[i+1])[0]=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
|
||||
((int16_t*)&ulsch->d[i+1])[1]=-(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
|
||||
|
||||
|
||||
//UE1,-x1*FPGA_UE
|
||||
qam64_table_offset_re = 0;
|
||||
qam64_table_offset_im = 0;
|
||||
|
||||
if (ulsch->b_tilde[j] == 1)
|
||||
qam64_table_offset_re+=4;
|
||||
|
||||
if (ulsch->b_tilde[j+1] == 1)
|
||||
qam64_table_offset_im+=4;
|
||||
|
||||
if (ulsch->b_tilde[j+2] == 1)
|
||||
qam64_table_offset_re+=2;
|
||||
|
||||
|
||||
if (ulsch->b_tilde[j+3] == 1)
|
||||
qam64_table_offset_im+=2;
|
||||
|
||||
if (ulsch->b_tilde[j+4] == 1)
|
||||
qam64_table_offset_re+=1;
|
||||
|
||||
if (ulsch->b_tilde[j+5] == 1)
|
||||
qam64_table_offset_im+=1;
|
||||
|
||||
|
||||
((int16_t*)&ulsch->d[i])[0]=-(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15);
|
||||
((int16_t*)&ulsch->d[i])[1]=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15);
|
||||
|
||||
//UE1,x0*
|
||||
qam64_table_offset_re = 0;
|
||||
qam64_table_offset_im = 0;
|
||||
|
||||
if (ulsch->b_tilde[j-6] == 1)
|
||||
qam64_table_offset_re+=4;
|
||||
|
||||
if (ulsch->b_tilde[j-5] == 1)
|
||||
qam64_table_offset_im+=4;
|
||||
|
||||
if (ulsch->b_tilde[j-4] == 1)
|
||||
qam64_table_offset_re+=2;
|
||||
|
||||
|
||||
if (ulsch->b_tilde[j-3] == 1)
|
||||
qam64_table_offset_im+=2;
|
||||
|
||||
if (ulsch->b_tilde[j-2] == 1)
|
||||
qam64_table_offset_re+=1;
|
||||
|
||||
if (ulsch->b_tilde[j-1] == 1)
|
||||
qam64_table_offset_im+=1;
|
||||
|
||||
|
||||
((int16_t*)&ulsch->d[i+1])[0]=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15);
|
||||
((int16_t*)&ulsch->d[i+1])[1]=-(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15);
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
}//for
|
||||
}//cooperation_flag == 2
|
||||
else {
|
||||
for (i=0,j=0; i<Msymb; i++,j+=Q_m) {
|
||||
|
||||
switch (Q_m) {
|
||||
|
||||
case 2:
|
||||
// TODO: this has to be updated!!!
|
||||
|
||||
((int16_t*)&ulsch->d[i])[0] = (ulsch->b_tilde[j] == 1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
|
||||
((int16_t*)&ulsch->d[i])[1] = (ulsch->b_tilde[j+1] == 1)? (-gain_lin_QPSK) : gain_lin_QPSK;
|
||||
// if (i<Msc_PUSCH)
|
||||
// printf("input %d/%d Msc_PUSCH %d (%p): %d,%d\n", i,Msymb,Msc_PUSCH,&ulsch->d[i],((int16_t*)&ulsch->d[i])[0],((int16_t*)&ulsch->d[i])[1]);
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
||||
qam16_table_offset_re = 0;
|
||||
qam16_table_offset_im = 0;
|
||||
|
||||
if (ulsch->b_tilde[j] == 1)
|
||||
qam16_table_offset_re+=2;
|
||||
|
||||
if (ulsch->b_tilde[j+1] == 1)
|
||||
qam16_table_offset_im+=2;
|
||||
|
||||
if (ulsch->b_tilde[j+2] == 1)
|
||||
qam16_table_offset_re+=1;
|
||||
|
||||
if (ulsch->b_tilde[j+3] == 1)
|
||||
qam16_table_offset_im+=1;
|
||||
|
||||
|
||||
((int16_t*)&ulsch->d[i])[0]=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
|
||||
((int16_t*)&ulsch->d[i])[1]=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
|
||||
// printf("input(16qam) %d (%p): %d,%d\n", i,&ulsch->d[i],((int16_t*)&ulsch->d[i])[0],((int16_t*)&ulsch->d[i])[1]);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
|
||||
|
||||
qam64_table_offset_re = 0;
|
||||
qam64_table_offset_im = 0;
|
||||
|
||||
if (ulsch->b_tilde[j] == 1)
|
||||
qam64_table_offset_re+=4;
|
||||
|
||||
if (ulsch->b_tilde[j+1] == 1)
|
||||
qam64_table_offset_im+=4;
|
||||
|
||||
if (ulsch->b_tilde[j+2] == 1)
|
||||
qam64_table_offset_re+=2;
|
||||
|
||||
if (ulsch->b_tilde[j+3] == 1)
|
||||
qam64_table_offset_im+=2;
|
||||
|
||||
if (ulsch->b_tilde[j+4] == 1)
|
||||
qam64_table_offset_re+=1;
|
||||
|
||||
if (ulsch->b_tilde[j+5] == 1)
|
||||
qam64_table_offset_im+=1;
|
||||
|
||||
|
||||
((int16_t*)&ulsch->d[i])[0]=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15);
|
||||
((int16_t*)&ulsch->d[i])[1]=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15);
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}// normal symbols
|
||||
|
||||
|
||||
// Transform Precoding
|
||||
|
||||
#ifdef OFDMA_ULSCH
|
||||
|
||||
for (i=0; i<Msymb; i++) {
|
||||
ulsch->z[i] = ulsch->d[i];
|
||||
}
|
||||
|
||||
#else
|
||||
dft_lte(ulsch->z,ulsch->d,Msc_PUSCH,ulsch->Nsymb_pusch);
|
||||
#endif
|
||||
|
||||
DevAssert(txdataF);
|
||||
|
||||
#ifdef OFDMA_ULSCH
|
||||
re_offset0 = frame_parms->first_carrier_offset + (ulsch->harq_processes[harq_pid]->first_rb*12);
|
||||
|
||||
if (re_offset0>frame_parms->ofdm_symbol_size) {
|
||||
re_offset0 -= frame_parms->ofdm_symbol_size;
|
||||
// re_offset0++;
|
||||
}
|
||||
|
||||
// printf("re_offset0 %d\n",re_offset0);
|
||||
|
||||
|
||||
for (j=0,l=0; l<(nsymb-ulsch->srs_active); l++) {
|
||||
re_offset = re_offset0;
|
||||
symbol_offset = (int)frame_parms->ofdm_symbol_size*(l+(subframe*nsymb));
|
||||
#ifdef DEBUG_ULSCH_MODULATION
|
||||
printf("symbol %d (subframe %d): symbol_offset %d\n",l,subframe,symbol_offset);
|
||||
#endif
|
||||
txptr = &txdataF[0][symbol_offset];
|
||||
|
||||
if (((frame_parms->Ncp == 0) && ((l==3) || (l==10)))||
|
||||
((frame_parms->Ncp == 1) && ((l==2) || (l==8)))) {
|
||||
}
|
||||
// Skip reference symbols
|
||||
else {
|
||||
|
||||
// printf("copying %d REs\n",Msc_PUSCH);
|
||||
for (i=0; i<Msc_PUSCH; i++,j++) {
|
||||
#ifdef DEBUG_ULSCH_MODULATION
|
||||
printf("re_offset %d (%p): %d,%d\n", re_offset,&ulsch->z[j],((int16_t*)&ulsch->z[j])[0],((int16_t*)&ulsch->z[j])[1]);
|
||||
#endif
|
||||
txptr[re_offset++] = ulsch->z[j];
|
||||
|
||||
if (re_offset==frame_parms->ofdm_symbol_size)
|
||||
re_offset = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# else // OFDMA_ULSCH = 0
|
||||
re_offset0 = frame_parms->first_carrier_offset + (ulsch->harq_processes[harq_pid]->first_rb*12);
|
||||
|
||||
if (re_offset0>frame_parms->ofdm_symbol_size) {
|
||||
re_offset0 -= frame_parms->ofdm_symbol_size;
|
||||
// re_offset0++;
|
||||
}
|
||||
|
||||
// printf("re_offset0 %d\n",re_offset0);
|
||||
// printf("txdataF %p\n",&txdataF[0][0]);
|
||||
for (j=0,l=0; l<(nsymb-ulsch->srs_active); l++) {
|
||||
re_offset = re_offset0;
|
||||
symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(l+(subframe*nsymb));
|
||||
#ifdef DEBUG_ULSCH_MODULATION
|
||||
printf("ulsch_mod (SC-FDMA) symbol %d (subframe %d): symbol_offset %d\n",l,subframe,symbol_offset);
|
||||
#endif
|
||||
txptr = &txdataF[0][symbol_offset];
|
||||
|
||||
if (((frame_parms->Ncp == 0) && ((l==3) || (l==10)))||
|
||||
((frame_parms->Ncp == 1) && ((l==2) || (l==8)))) {
|
||||
}
|
||||
// Skip reference symbols
|
||||
else {
|
||||
// printf("copying %d REs\n",Msc_PUSCH);
|
||||
for (i=0; i<Msc_PUSCH; i++,j++) {
|
||||
|
||||
#ifdef DEBUG_ULSCH_MODULATION
|
||||
printf("re_offset %d (%p): %d,%d => %p\n", re_offset,&ulsch->z[j],((int16_t*)&ulsch->z[j])[0],((int16_t*)&ulsch->z[j])[1],&txptr[re_offset]);
|
||||
#endif //DEBUG_ULSCH_MODULATION
|
||||
txptr[re_offset++] = ulsch->z[j];
|
||||
|
||||
if (re_offset==frame_parms->ofdm_symbol_size)
|
||||
re_offset = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_MODULATION, VCD_FUNCTION_OUT);
|
||||
|
||||
}
|
||||
|
||||
@@ -943,7 +943,7 @@ int check_dci_format1_1a_coherency(DCI_format_t dci_format,
|
||||
}
|
||||
}
|
||||
|
||||
if ((rnti==si_rnti) || (rnti==p_rnti) || (rnti==ra_rnti))
|
||||
if (dci_format == format1A && ((rnti==si_rnti) || (rnti==p_rnti) || (rnti==ra_rnti)))
|
||||
{
|
||||
NPRB = (TPC&1) + 2;
|
||||
switch (N_RB_DL) {
|
||||
@@ -960,8 +960,8 @@ int check_dci_format1_1a_coherency(DCI_format_t dci_format,
|
||||
RIV_max = RIV_max100;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else if (dci_format == format1A)
|
||||
{
|
||||
switch (N_RB_DL) {
|
||||
case 6:
|
||||
@@ -996,13 +996,13 @@ int check_dci_format1_1a_coherency(DCI_format_t dci_format,
|
||||
}
|
||||
|
||||
|
||||
if(dci_format == format1)
|
||||
else if (dci_format == format1)
|
||||
{
|
||||
NPRB = conv_nprb(rah, rballoc, N_RB_DL);
|
||||
}
|
||||
|
||||
|
||||
if(rballoc > RIV_max)
|
||||
if(dci_format == format1A && rballoc > RIV_max)
|
||||
{
|
||||
// LOG_I(PHY,"bad dci rballoc rballoc %d RIV_max %lld \n",rballoc, RIV_max);
|
||||
// DCI false detection
|
||||
@@ -3128,7 +3128,7 @@ void fill_CQI(LTE_UE_ULSCH_t *ulsch,PHY_MEASUREMENTS *meas,uint8_t eNB_id,uint8_
|
||||
// this is the cba mcs uci for cba transmission
|
||||
((HLC_subband_cqi_mcs_CBA_5MHz *)o)->mcs = ulsch->harq_processes[harq_pid]->mcs;
|
||||
((HLC_subband_cqi_mcs_CBA_5MHz *)o)->crnti = rnti;
|
||||
LOG_N(PHY,"fill uci for cba rnti %x, mcs %d \n", rnti, ulsch->harq_processes[harq_pid]->mcs);
|
||||
LOG_I(PHY,"fill uci for cba rnti %x, mcs %d \n", rnti, ulsch->harq_processes[harq_pid]->mcs);
|
||||
break;
|
||||
|
||||
case ue_selected:
|
||||
@@ -3182,7 +3182,7 @@ void fill_CQI(LTE_UE_ULSCH_t *ulsch,PHY_MEASUREMENTS *meas,uint8_t eNB_id,uint8_
|
||||
// this is the cba mcs uci for cba transmission
|
||||
((HLC_subband_cqi_mcs_CBA_10MHz *)o)->mcs = ulsch->harq_processes[harq_pid]->mcs;
|
||||
((HLC_subband_cqi_mcs_CBA_10MHz *)o)->crnti = rnti;
|
||||
LOG_N(PHY,"fill uci for cba rnti %x, mcs %d \n", rnti, ulsch->harq_processes[harq_pid]->mcs);
|
||||
LOG_I(PHY,"fill uci for cba rnti %x, mcs %d \n", rnti, ulsch->harq_processes[harq_pid]->mcs);
|
||||
break;
|
||||
|
||||
case ue_selected:
|
||||
@@ -3236,7 +3236,7 @@ void fill_CQI(LTE_UE_ULSCH_t *ulsch,PHY_MEASUREMENTS *meas,uint8_t eNB_id,uint8_
|
||||
// this is the cba mcs uci for cba transmission
|
||||
((HLC_subband_cqi_mcs_CBA_20MHz *)o)->mcs = ulsch->harq_processes[harq_pid]->mcs;
|
||||
((HLC_subband_cqi_mcs_CBA_20MHz *)o)->crnti = rnti;
|
||||
LOG_N(PHY,"fill uci for cba rnti %x, mcs %d \n", rnti, ulsch->harq_processes[harq_pid]->mcs);
|
||||
LOG_I(PHY,"fill uci for cba rnti %x, mcs %d \n", rnti, ulsch->harq_processes[harq_pid]->mcs);
|
||||
break;
|
||||
|
||||
case ue_selected:
|
||||
|
||||
@@ -43,9 +43,8 @@
|
||||
#include "SCHED/sched_common.h"
|
||||
|
||||
#include "assertions.h"
|
||||
#include "T.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
|
||||
//#define DEBUG_DCI_ENCODING 1
|
||||
//#define DEBUG_DCI_DECODING 1
|
||||
@@ -1357,7 +1356,7 @@ int32_t rx_pdcch(PHY_VARS_UE *ue,
|
||||
|
||||
if (subframe==5) {
|
||||
printf("Writing output s0\n");
|
||||
write_output("rxF_comp_d0.m","rxF_c_d",&pdcch_vars[eNB_id]->rxdataF_comp[0][0*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);
|
||||
LOG_M("rxF_comp_d0.m","rxF_c_d",&pdcch_vars[eNB_id]->rxdataF_comp[0][0*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1435,7 +1434,7 @@ int32_t rx_pdcch(PHY_VARS_UE *ue,
|
||||
#ifdef DEBUG_PHY
|
||||
|
||||
if (subframe==5) {
|
||||
write_output("rxF_comp_ds.m","rxF_c_ds",&pdcch_vars[eNB_id]->rxdataF_comp[0][s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);
|
||||
LOG_M("rxF_comp_ds.m","rxF_c_ds",&pdcch_vars[eNB_id]->rxdataF_comp[0][s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1460,7 +1459,7 @@ int32_t rx_pdcch(PHY_VARS_UE *ue,
|
||||
(char *)pdcch_vars[eNB_id]->llr,
|
||||
s);
|
||||
/*#ifdef DEBUG_PHY
|
||||
write_output("llr8_seq.m","llr8",&pdcch_vars[eNB_id]->llr[s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,4);
|
||||
LOG_M("llr8_seq.m","llr8",&pdcch_vars[eNB_id]->llr[s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,4);
|
||||
#endif*/
|
||||
}
|
||||
|
||||
|
||||
@@ -35,10 +35,10 @@
|
||||
#include "PHY/CODING/coding_extern.h"
|
||||
#include "SCHED/sched_common_extern.h"
|
||||
#include "SIMULATION/TOOLS/sim.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
|
||||
//#define DEBUG_DLSCH_DECODING
|
||||
//#define UE_DEBUG_TRACE 1
|
||||
#define UE_DEBUG_TRACE 1
|
||||
|
||||
|
||||
void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch)
|
||||
@@ -176,7 +176,6 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
|
||||
uint32_t A,E;
|
||||
uint32_t G;
|
||||
uint32_t ret,offset;
|
||||
uint16_t iind;
|
||||
// uint8_t dummy_channel_output[(3*8*block_length)+12];
|
||||
short dummy_w[MAX_NUM_DLSCH_SEGMENTS][3*(6144+64)];
|
||||
uint32_t r,r_offset=0,Kr,Kr_bytes,err_flag=0;
|
||||
@@ -206,9 +205,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
|
||||
time_stats_t *);
|
||||
|
||||
#endif
|
||||
decoder_if_t tc;
|
||||
|
||||
|
||||
decoder_if_t *tc;
|
||||
|
||||
|
||||
if (!dlsch_llr) {
|
||||
@@ -237,17 +234,13 @@ decoder_if_t tc;
|
||||
}
|
||||
|
||||
if (llr8_flag == 0) {
|
||||
//#ifdef __AVX2__
|
||||
#if 0
|
||||
tc_2cw = phy_threegpplte_turbo_decoder16avx2;
|
||||
#endif
|
||||
tc = decoder16;
|
||||
}
|
||||
else
|
||||
{
|
||||
AssertFatal (harq_process->TBS >= 256 , "Mismatch flag nbRB=%d TBS=%d mcs=%d Qm=%d RIV=%d round=%d \n",
|
||||
harq_process->nb_rb, harq_process->TBS,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round);
|
||||
tc = decoder8;
|
||||
AssertFatal (harq_process->TBS >= 256 , "Mismatch flag nbRB=%d TBS=%d mcs=%d Qm=%d RIV=%d round=%d \n",
|
||||
harq_process->nb_rb, harq_process->TBS,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round);
|
||||
tc = decoder8;
|
||||
}
|
||||
|
||||
|
||||
@@ -343,23 +336,6 @@ decoder_if_t tc;
|
||||
|
||||
Kr_bytes = Kr>>3;
|
||||
|
||||
if (Kr_bytes<=64)
|
||||
iind = (Kr_bytes-5);
|
||||
else if (Kr_bytes <=128)
|
||||
iind = 59 + ((Kr_bytes-64)>>1);
|
||||
else if (Kr_bytes <= 256)
|
||||
iind = 91 + ((Kr_bytes-128)>>2);
|
||||
else if (Kr_bytes <= 768)
|
||||
iind = 123 + ((Kr_bytes-256)>>3);
|
||||
else {
|
||||
printf("dlsch_decoding: Illegal codeword size %d!!!\n",Kr_bytes);
|
||||
return(dlsch->max_turbo_iterations);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_DLSCH_DECODING
|
||||
printf("f1 %d, f2 %d, F %d\n",f1f2mat_old[2*iind],f1f2mat_old[1+(2*iind)],(r==0) ? harq_process->F : 0);
|
||||
#endif
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(dlsch_rate_unmatching_stats);
|
||||
#endif
|
||||
@@ -429,8 +405,8 @@ decoder_if_t tc;
|
||||
#ifdef DEBUG_DLSCH_DECODING
|
||||
/*
|
||||
if (r==0) {
|
||||
write_output("decoder_llr.m","decllr",dlsch_llr,G,1,0);
|
||||
write_output("decoder_in.m","dec",&harq_process->d[0][96],(3*8*Kr_bytes)+12,1,0);
|
||||
LOG_M("decoder_llr.m","decllr",dlsch_llr,G,1,0);
|
||||
LOG_M("decoder_in.m","dec",&harq_process->d[0][96],(3*8*Kr_bytes)+12,1,0);
|
||||
}
|
||||
|
||||
printf("decoder input(segment %d) :",r);
|
||||
@@ -480,8 +456,6 @@ decoder_if_t tc;
|
||||
harq_process->c[r],
|
||||
NULL,
|
||||
Kr,
|
||||
f1f2mat_old[iind*2],
|
||||
f1f2mat_old[(iind*2)+1],
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
@@ -508,8 +482,6 @@ decoder_if_t tc;
|
||||
(&harq_process->d[r][96],
|
||||
harq_process->c[r],
|
||||
Kr,
|
||||
f1f2mat_old[iind*2],
|
||||
f1f2mat_old[(iind*2)+1],
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
@@ -551,8 +523,6 @@ decoder_if_t tc;
|
||||
harq_process->c[r-1],
|
||||
harq_process->c[r],
|
||||
Kr,
|
||||
f1f2mat_old[iind*2],
|
||||
f1f2mat_old[(iind*2)+1],
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
@@ -568,8 +538,6 @@ decoder_if_t tc;
|
||||
(&harq_process->d[r-1][96],
|
||||
harq_process->c[r-1],
|
||||
Kr_last,
|
||||
f1f2mat_old[iind*2],
|
||||
f1f2mat_old[(iind*2)+1],
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
@@ -594,8 +562,6 @@ decoder_if_t tc;
|
||||
(&harq_process->d[r-1][96],
|
||||
harq_process->c[r-1],
|
||||
Kr_last,
|
||||
f1f2mat_old[iind*2],
|
||||
f1f2mat_old[(iind*2)+1],
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
@@ -616,8 +582,6 @@ decoder_if_t tc;
|
||||
(&harq_process->d[r][96],
|
||||
harq_process->c[r],
|
||||
Kr,
|
||||
f1f2mat_old[iind*2],
|
||||
f1f2mat_old[(iind*2)+1],
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
@@ -760,7 +724,6 @@ int dlsch_encoding_SIC(PHY_VARS_UE *ue,
|
||||
|
||||
unsigned int G;
|
||||
unsigned int crc=1;
|
||||
unsigned short iind;
|
||||
|
||||
LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
|
||||
unsigned char harq_pid = ue->dlsch[subframe&2][0][0]->rnti;
|
||||
@@ -830,21 +793,6 @@ int dlsch_encoding_SIC(PHY_VARS_UE *ue,
|
||||
|
||||
Kr_bytes = Kr>>3;
|
||||
|
||||
// get interleaver index for Turbo code (lookup in Table 5.1.3-3 36-212, V8.6 2009-03, p. 13-14)
|
||||
if (Kr_bytes<=64)
|
||||
iind = (Kr_bytes-5);
|
||||
else if (Kr_bytes <=128)
|
||||
iind = 59 + ((Kr_bytes-64)>>1);
|
||||
else if (Kr_bytes <= 256)
|
||||
iind = 91 + ((Kr_bytes-128)>>2);
|
||||
else if (Kr_bytes <= 768)
|
||||
iind = 123 + ((Kr_bytes-256)>>3);
|
||||
else {
|
||||
printf("dlsch_coding: Illegal codeword size %d!!!\n",Kr_bytes);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
printf("Generating Code Segment %d (%d bits)\n",r,Kr);
|
||||
// generate codewords
|
||||
@@ -856,22 +804,17 @@ int dlsch_encoding_SIC(PHY_VARS_UE *ue,
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
printf("Encoding ... iind %d f1 %d, f2 %d\n",iind,f1f2mat_old[iind*2],f1f2mat_old[(iind*2)+1]);
|
||||
#endif
|
||||
start_meas(te_stats);
|
||||
encoder(dlsch->harq_processes[harq_pid]->c[r],
|
||||
Kr>>3,
|
||||
&dlsch->harq_processes[harq_pid]->d[r][96],
|
||||
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
|
||||
f1f2mat_old[iind*2], // f1 (see 36121-820, page 14)
|
||||
f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14)
|
||||
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0
|
||||
);
|
||||
stop_meas(te_stats);
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
|
||||
if (r==0)
|
||||
write_output("enc_output0.m","enc0",&dlsch->harq_processes[harq_pid]->d[r][96],(3*8*Kr_bytes)+12,1,4);
|
||||
LOG_M("enc_output0.m","enc0",&dlsch->harq_processes[harq_pid]->d[r][96],(3*8*Kr_bytes)+12,1,4);
|
||||
|
||||
#endif
|
||||
start_meas(i_stats);
|
||||
@@ -918,7 +861,7 @@ int dlsch_encoding_SIC(PHY_VARS_UE *ue,
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
|
||||
if (r==dlsch->harq_processes[harq_pid]->C-1)
|
||||
write_output("enc_output.m","enc",dlsch->harq_processes[harq_pid]->e,r_offset,1,4);
|
||||
LOG_M("enc_output.m","enc",dlsch->harq_processes[harq_pid]->e,r_offset,1,4);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -642,7 +642,7 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
uint32_t *rxF = (uint32_t*)&rxdataF_comp[0][((int32_t)symbol*frame_parms->N_RB_DL*12)];
|
||||
uint32_t *llr32;
|
||||
int i,len;
|
||||
int len;
|
||||
uint8_t symbol_mod = (symbol >= (7-frame_parms->Ncp))? (symbol-(7-frame_parms->Ncp)) : symbol;
|
||||
|
||||
/*
|
||||
@@ -681,19 +681,28 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
dlsch_llr,
|
||||
llr32);
|
||||
*/
|
||||
//printf("ll32p=%p , dlsch_llr=%p, symbol=%d, flag=%d \n", llr32, dlsch_llr, symbol, first_symbol_flag);
|
||||
for (i=0; i<len; i++) {
|
||||
*llr32 = *rxF;
|
||||
//printf("llr %d : (%d,%d)\n",i,((int16_t*)llr32)[0],((int16_t*)llr32)[1]);
|
||||
rxF++;
|
||||
llr32++;
|
||||
}
|
||||
|
||||
//*llr32p = (int16_t *)llr32;
|
||||
qpsk_llr((short *)rxF,
|
||||
(short *)llr32,
|
||||
len);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
void qpsk_llr(int16_t *stream0_in,
|
||||
int16_t *stream0_out,
|
||||
int length)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<2*length; i++) {
|
||||
*stream0_out = *stream0_in;
|
||||
//printf("llr %d : (%d,%d)\n",i,((int16_t*)stream0_out)[0],((int16_t*)stream0_out)[1]);
|
||||
stream0_in++;
|
||||
stream0_out++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
int32_t **rxdataF_comp,
|
||||
int32_t **sic_buffer, //Q15
|
||||
@@ -765,11 +774,11 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
13);
|
||||
|
||||
#ifdef DEBUG_LLR_SIC
|
||||
write_output("rho_for_multipl.m","rho_for_m", rho_1,len,1,
|
||||
LOG_M("rho_for_multipl.m","rho_for_m", rho_1,len,1,
|
||||
symbol==num_pdcch_symbols ? 15 :
|
||||
symbol==nsymb-1 ? 14 : 13);
|
||||
|
||||
write_output("rho_rho_in_llr.m","rho2", rho_rho_amp_x0,len,1,
|
||||
LOG_M("rho_rho_in_llr.m","rho2", rho_rho_amp_x0,len,1,
|
||||
symbol==num_pdcch_symbols ? 15 :
|
||||
symbol==nsymb-1 ? 14 : 13);
|
||||
#endif
|
||||
@@ -781,8 +790,8 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
len*2);
|
||||
|
||||
#ifdef DEBUG_LLR_SIC
|
||||
write_output("rxFdata_comp1_after.m","rxF_a", rxF,len,1,1);
|
||||
write_output("rxF_comp1.m","rxF_1_comp", rxF,len,1,
|
||||
LOG_M("rxFdata_comp1_after.m","rxF_a", rxF,len,1,1);
|
||||
LOG_M("rxF_comp1.m","rxF_1_comp", rxF,len,1,
|
||||
symbol==num_pdcch_symbols ? 15 :
|
||||
symbol==nsymb-1 ? 14 : 13);
|
||||
#endif
|
||||
@@ -817,45 +826,21 @@ void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
int16_t **llr32p,
|
||||
uint8_t beamforming_mode)
|
||||
{
|
||||
int32_t *rxF = (int32_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)];
|
||||
int32_t *ch_mag = (int32_t*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)];
|
||||
int32_t *llr32;
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i *rxF = (__m128i*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)];
|
||||
__m128i *ch_mag;
|
||||
__m128i llr128[2];
|
||||
uint32_t *llr32;
|
||||
#elif defined(__arm__)
|
||||
int16x8_t *rxF = (int16x8_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)];
|
||||
int16x8_t *ch_mag;
|
||||
int16x8_t xmm0;
|
||||
int16_t *llr16;
|
||||
#endif
|
||||
|
||||
|
||||
int i,len;
|
||||
int len;
|
||||
unsigned char symbol_mod,len_mod4=0;
|
||||
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
if (first_symbol_flag==1) {
|
||||
llr32 = (uint32_t*)dlsch_llr;
|
||||
llr32 = (int32_t*)dlsch_llr;
|
||||
} else {
|
||||
llr32 = (uint32_t*)*llr32p;
|
||||
llr32 = (int32_t*)*llr32p;
|
||||
}
|
||||
#elif defined(__arm__)
|
||||
if (first_symbol_flag==1) {
|
||||
llr16 = (int16_t*)dlsch_llr;
|
||||
} else {
|
||||
llr16 = (int16_t*)*llr32p;
|
||||
}
|
||||
#endif
|
||||
|
||||
symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
ch_mag = (__m128i*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)];
|
||||
#elif defined(__arm__)
|
||||
ch_mag = (int16x8_t*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)];
|
||||
#endif
|
||||
if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) {
|
||||
if (frame_parms->nb_antenna_ports_eNB!=1)
|
||||
len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3);
|
||||
@@ -881,18 +866,45 @@ void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
len>>=2; // length in quad words (4 REs)
|
||||
// printf("len>>=2=%d\n", len);
|
||||
len+=(len_mod4==0 ? 0 : 1);
|
||||
// printf("len+=%d\n", len);
|
||||
for (i=0; i<len; i++) {
|
||||
|
||||
qam16_llr((short *)rxF,
|
||||
(short *)ch_mag,
|
||||
(short *)llr32,
|
||||
len);
|
||||
// printf ("This line in qam16_llr is %d.\n", __LINE__);
|
||||
|
||||
}
|
||||
|
||||
void qam16_llr(int16_t *stream0_in,
|
||||
int16_t *chan_magn,
|
||||
int16_t *llr,
|
||||
int length)
|
||||
{
|
||||
int i;
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i *rxF_128 = (__m128i*)stream0_in;
|
||||
__m128i *ch_mag_128 = (__m128i*)chan_magn;
|
||||
__m128i llr128[2];
|
||||
int32_t *llr32 = (int32_t*) llr;
|
||||
#elif defined(__arm__)
|
||||
int16x8_t *rxF_128 = (int16x8_t*)stream0_in;
|
||||
int16x8_t *ch_mag_128 = (int16x8_t*)chan_magn;
|
||||
int16x8_t xmm0;
|
||||
int16_t *llr16 = (int16_t*)llr;
|
||||
#endif
|
||||
|
||||
// printf ("This line in qam16_llr is %d.\n", __LINE__);
|
||||
|
||||
for (i=0; i<length; i++) {
|
||||
#if defined(__x86_64__) || defined(__i386)
|
||||
xmm0 = _mm_abs_epi16(rxF[i]);
|
||||
xmm0 = _mm_subs_epi16(ch_mag[i],xmm0);
|
||||
xmm0 = _mm_abs_epi16(rxF_128[i]);
|
||||
xmm0 = _mm_subs_epi16(ch_mag_128[i],xmm0);
|
||||
|
||||
// lambda_1=y_R, lambda_2=|y_R|-|h|^2, lamda_3=y_I, lambda_4=|y_I|-|h|^2
|
||||
llr128[0] = _mm_unpacklo_epi32(rxF[i],xmm0);
|
||||
llr128[1] = _mm_unpackhi_epi32(rxF[i],xmm0);
|
||||
llr128[0] = _mm_unpacklo_epi32(rxF_128[i],xmm0);
|
||||
llr128[1] = _mm_unpackhi_epi32(rxF_128[i],xmm0);
|
||||
llr32[0] = _mm_extract_epi32(llr128[0],0); //((uint32_t *)&llr128[0])[0];
|
||||
llr32[1] = _mm_extract_epi32(llr128[0],1); //((uint32_t *)&llr128[0])[1];
|
||||
llr32[1] = _mm_extract_epi32(llr128[0],1); //((uint32_t *)&llr128[0])[0];
|
||||
llr32[2] = _mm_extract_epi32(llr128[0],2); //((uint32_t *)&llr128[0])[2];
|
||||
llr32[3] = _mm_extract_epi32(llr128[0],3); //((uint32_t *)&llr128[0])[3];
|
||||
llr32[4] = _mm_extract_epi32(llr128[1],0); //((uint32_t *)&llr128[1])[0];
|
||||
@@ -922,14 +934,17 @@ void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
llr16[14] = vgetq_lane_s16(xmm0,7);
|
||||
llr16[15] = vgetq_lane_s16(xmm0,7);
|
||||
llr16+=16;
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
#if defined(__x86_64__) || defined(__i386)
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
void dlsch_16qam_llr_SIC (LTE_DL_FRAME_PARMS *frame_parms,
|
||||
@@ -1036,6 +1051,7 @@ void dlsch_16qam_llr_SIC (LTE_DL_FRAME_PARMS *frame_parms,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// 64-QAM
|
||||
//----------------------------------------------------------------------------------------------
|
||||
@@ -1053,14 +1069,10 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
uint32_t llr_offset,
|
||||
uint8_t beamforming_mode)
|
||||
{
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i *rxF = (__m128i*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)];
|
||||
__m128i *ch_mag,*ch_magb;
|
||||
#elif defined(__arm__)
|
||||
int16x8_t *rxF = (int16x8_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)];
|
||||
int16x8_t *ch_mag,*ch_magb,xmm1,xmm2;
|
||||
#endif
|
||||
int i,len,len2;
|
||||
int32_t *rxF = (int32_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)];
|
||||
int32_t *ch_mag = (int32_t*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)];
|
||||
int32_t *ch_magb = (int32_t*)&dl_ch_magb[0][(symbol*frame_parms->N_RB_DL*12)];
|
||||
int len,len2;
|
||||
unsigned char symbol_mod,len_mod4;
|
||||
short *llr;
|
||||
int16_t *llr2;
|
||||
@@ -1079,13 +1091,6 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
ch_mag = (__m128i*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)];
|
||||
ch_magb = (__m128i*)&dl_ch_magb[0][(symbol*frame_parms->N_RB_DL*12)];
|
||||
#elif defined(__arm__)
|
||||
ch_mag = (int16x8_t*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)];
|
||||
ch_magb = (int16x8_t*)&dl_ch_magb[0][(symbol*frame_parms->N_RB_DL*12)];
|
||||
#endif
|
||||
if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) {
|
||||
if (frame_parms->nb_antenna_ports_eNB!=1)
|
||||
len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3);
|
||||
@@ -1115,18 +1120,49 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
len2=len>>2; // length in quad words (4 REs)
|
||||
len2+=((len_mod4==0)?0:1);
|
||||
|
||||
for (i=0; i<len2; i++) {
|
||||
qam64_llr((short *)rxF,
|
||||
(short *)ch_mag,
|
||||
(short *)ch_magb,
|
||||
llr2,
|
||||
len2);
|
||||
}
|
||||
|
||||
|
||||
void qam64_llr(int16_t *stream0_in,
|
||||
int16_t *chan_magn,
|
||||
int16_t *chan_magn_b,
|
||||
int16_t *llr,
|
||||
int length)
|
||||
{
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
xmm1 = _mm_abs_epi16(rxF[i]);
|
||||
xmm1 = _mm_subs_epi16(ch_mag[i],xmm1);
|
||||
xmm2 = _mm_abs_epi16(xmm1);
|
||||
xmm2 = _mm_subs_epi16(ch_magb[i],xmm2);
|
||||
__m128i *rxF_128 = (__m128i*)stream0_in;
|
||||
__m128i *ch_mag_128 = (__m128i*)chan_magn;
|
||||
__m128i *ch_magb_128 = (__m128i*)chan_magn_b;
|
||||
#elif defined(__arm__)
|
||||
xmm1 = vabsq_s16(rxF[i]);
|
||||
xmm1 = vsubq_s16(ch_mag[i],xmm1);
|
||||
int16x8_t *rxF_128 = (int16x8_t*)stream0_in;
|
||||
int16x8_t *ch_mag_128 = (int16x8_t*)chan_magn;
|
||||
int16x8_t *ch_magb_128 = (int16x8_t*)chan_magn_b;
|
||||
int16x8_t xmm1,xmm2;
|
||||
#endif
|
||||
|
||||
|
||||
int i;
|
||||
//int16_t *llr2;
|
||||
//llr2 = llr;
|
||||
|
||||
for (i=0; i<length; i++) {
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
xmm1 = _mm_abs_epi16(rxF_128[i]);
|
||||
xmm1 = _mm_subs_epi16(ch_mag_128[i],xmm1);
|
||||
xmm2 = _mm_abs_epi16(xmm1);
|
||||
xmm2 = _mm_subs_epi16(ch_magb_128[i],xmm2);
|
||||
#elif defined(__arm__)
|
||||
xmm1 = vabsq_s16(rxF_128[i]);
|
||||
xmm1 = vsubq_s16(ch_mag_128[i],xmm1);
|
||||
xmm2 = vabsq_s16(xmm1);
|
||||
xmm2 = vsubq_s16(ch_magb[i],xmm2);
|
||||
xmm2 = vsubq_s16(ch_magb_128[i],xmm2);
|
||||
#endif
|
||||
// loop over all LLRs in quad word (24 coded bits)
|
||||
/*
|
||||
@@ -1141,64 +1177,64 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
llr2+=6;
|
||||
}
|
||||
*/
|
||||
llr2[0] = ((short *)&rxF[i])[0];
|
||||
llr2[1] = ((short *)&rxF[i])[1];
|
||||
llr[0] = ((short *)&rxF_128[i])[0];
|
||||
llr[1] = ((short *)&rxF_128[i])[1];
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
llr2[2] = _mm_extract_epi16(xmm1,0);
|
||||
llr2[3] = _mm_extract_epi16(xmm1,1);//((short *)&xmm1)[j+1];
|
||||
llr2[4] = _mm_extract_epi16(xmm2,0);//((short *)&xmm2)[j];
|
||||
llr2[5] = _mm_extract_epi16(xmm2,1);//((short *)&xmm2)[j+1];
|
||||
llr[2] = _mm_extract_epi16(xmm1,0);
|
||||
llr[3] = _mm_extract_epi16(xmm1,1);//((short *)&xmm1)[j+1];
|
||||
llr[4] = _mm_extract_epi16(xmm2,0);//((short *)&xmm2)[j];
|
||||
llr[5] = _mm_extract_epi16(xmm2,1);//((short *)&xmm2)[j+1];
|
||||
#elif defined(__arm__)
|
||||
llr2[2] = vgetq_lane_s16(xmm1,0);
|
||||
llr2[3] = vgetq_lane_s16(xmm1,1);//((short *)&xmm1)[j+1];
|
||||
llr2[4] = vgetq_lane_s16(xmm2,0);//((short *)&xmm2)[j];
|
||||
llr2[5] = vgetq_lane_s16(xmm2,1);//((short *)&xmm2)[j+1];
|
||||
llr[2] = vgetq_lane_s16(xmm1,0);
|
||||
llr[3] = vgetq_lane_s16(xmm1,1);//((short *)&xmm1)[j+1];
|
||||
llr[4] = vgetq_lane_s16(xmm2,0);//((short *)&xmm2)[j];
|
||||
llr[5] = vgetq_lane_s16(xmm2,1);//((short *)&xmm2)[j+1];
|
||||
#endif
|
||||
|
||||
llr2+=6;
|
||||
llr2[0] = ((short *)&rxF[i])[2];
|
||||
llr2[1] = ((short *)&rxF[i])[3];
|
||||
llr+=6;
|
||||
llr[0] = ((short *)&rxF_128[i])[2];
|
||||
llr[1] = ((short *)&rxF_128[i])[3];
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
llr2[2] = _mm_extract_epi16(xmm1,2);
|
||||
llr2[3] = _mm_extract_epi16(xmm1,3);//((short *)&xmm1)[j+1];
|
||||
llr2[4] = _mm_extract_epi16(xmm2,2);//((short *)&xmm2)[j];
|
||||
llr2[5] = _mm_extract_epi16(xmm2,3);//((short *)&xmm2)[j+1];
|
||||
llr[2] = _mm_extract_epi16(xmm1,2);
|
||||
llr[3] = _mm_extract_epi16(xmm1,3);//((short *)&xmm1)[j+1];
|
||||
llr[4] = _mm_extract_epi16(xmm2,2);//((short *)&xmm2)[j];
|
||||
llr[5] = _mm_extract_epi16(xmm2,3);//((short *)&xmm2)[j+1];
|
||||
#elif defined(__arm__)
|
||||
llr2[2] = vgetq_lane_s16(xmm1,2);
|
||||
llr2[3] = vgetq_lane_s16(xmm1,3);//((short *)&xmm1)[j+1];
|
||||
llr2[4] = vgetq_lane_s16(xmm2,2);//((short *)&xmm2)[j];
|
||||
llr2[5] = vgetq_lane_s16(xmm2,3);//((short *)&xmm2)[j+1];
|
||||
llr[2] = vgetq_lane_s16(xmm1,2);
|
||||
llr[3] = vgetq_lane_s16(xmm1,3);//((short *)&xmm1)[j+1];
|
||||
llr[4] = vgetq_lane_s16(xmm2,2);//((short *)&xmm2)[j];
|
||||
llr[5] = vgetq_lane_s16(xmm2,3);//((short *)&xmm2)[j+1];
|
||||
#endif
|
||||
|
||||
llr2+=6;
|
||||
llr2[0] = ((short *)&rxF[i])[4];
|
||||
llr2[1] = ((short *)&rxF[i])[5];
|
||||
llr+=6;
|
||||
llr[0] = ((short *)&rxF_128[i])[4];
|
||||
llr[1] = ((short *)&rxF_128[i])[5];
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
llr2[2] = _mm_extract_epi16(xmm1,4);
|
||||
llr2[3] = _mm_extract_epi16(xmm1,5);//((short *)&xmm1)[j+1];
|
||||
llr2[4] = _mm_extract_epi16(xmm2,4);//((short *)&xmm2)[j];
|
||||
llr2[5] = _mm_extract_epi16(xmm2,5);//((short *)&xmm2)[j+1];
|
||||
llr[2] = _mm_extract_epi16(xmm1,4);
|
||||
llr[3] = _mm_extract_epi16(xmm1,5);//((short *)&xmm1)[j+1];
|
||||
llr[4] = _mm_extract_epi16(xmm2,4);//((short *)&xmm2)[j];
|
||||
llr[5] = _mm_extract_epi16(xmm2,5);//((short *)&xmm2)[j+1];
|
||||
#elif defined(__arm__)
|
||||
llr2[2] = vgetq_lane_s16(xmm1,4);
|
||||
llr2[3] = vgetq_lane_s16(xmm1,5);//((short *)&xmm1)[j+1];
|
||||
llr2[4] = vgetq_lane_s16(xmm2,4);//((short *)&xmm2)[j];
|
||||
llr2[5] = vgetq_lane_s16(xmm2,5);//((short *)&xmm2)[j+1];
|
||||
llr[2] = vgetq_lane_s16(xmm1,4);
|
||||
llr[3] = vgetq_lane_s16(xmm1,5);//((short *)&xmm1)[j+1];
|
||||
llr[4] = vgetq_lane_s16(xmm2,4);//((short *)&xmm2)[j];
|
||||
llr[5] = vgetq_lane_s16(xmm2,5);//((short *)&xmm2)[j+1];
|
||||
#endif
|
||||
llr2+=6;
|
||||
llr2[0] = ((short *)&rxF[i])[6];
|
||||
llr2[1] = ((short *)&rxF[i])[7];
|
||||
llr+=6;
|
||||
llr[0] = ((short *)&rxF_128[i])[6];
|
||||
llr[1] = ((short *)&rxF_128[i])[7];
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
llr2[2] = _mm_extract_epi16(xmm1,6);
|
||||
llr2[3] = _mm_extract_epi16(xmm1,7);//((short *)&xmm1)[j+1];
|
||||
llr2[4] = _mm_extract_epi16(xmm2,6);//((short *)&xmm2)[j];
|
||||
llr2[5] = _mm_extract_epi16(xmm2,7);//((short *)&xmm2)[j+1];
|
||||
llr[2] = _mm_extract_epi16(xmm1,6);
|
||||
llr[3] = _mm_extract_epi16(xmm1,7);//((short *)&xmm1)[j+1];
|
||||
llr[4] = _mm_extract_epi16(xmm2,6);//((short *)&xmm2)[j];
|
||||
llr[5] = _mm_extract_epi16(xmm2,7);//((short *)&xmm2)[j+1];
|
||||
#elif defined(__arm__)
|
||||
llr2[2] = vgetq_lane_s16(xmm1,6);
|
||||
llr2[3] = vgetq_lane_s16(xmm1,7);//((short *)&xmm1)[j+1];
|
||||
llr2[4] = vgetq_lane_s16(xmm2,6);//((short *)&xmm2)[j];
|
||||
llr2[5] = vgetq_lane_s16(xmm2,7);//((short *)&xmm2)[j+1];
|
||||
llr[2] = vgetq_lane_s16(xmm1,6);
|
||||
llr[3] = vgetq_lane_s16(xmm1,7);//((short *)&xmm1)[j+1];
|
||||
llr[4] = vgetq_lane_s16(xmm2,6);//((short *)&xmm2)[j];
|
||||
llr[5] = vgetq_lane_s16(xmm2,7);//((short *)&xmm2)[j+1];
|
||||
#endif
|
||||
llr2+=6;
|
||||
llr+=6;
|
||||
|
||||
}
|
||||
|
||||
@@ -1208,7 +1244,6 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
#endif
|
||||
}
|
||||
|
||||
//#if 0
|
||||
void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
int32_t **rxdataF_comp,
|
||||
int32_t **sic_buffer, //Q15
|
||||
@@ -8859,15 +8894,6 @@ int dlsch_64qam_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
memcpy(ch_mag_i_256i, ch_mag_i, len*4);
|
||||
memcpy(rho_256i, rho, len*4);
|
||||
|
||||
#if 0
|
||||
qam64_qam16_avx2((short *)rxF_256i,
|
||||
(short *)rxF_i_256i,
|
||||
(short *)ch_mag_256i,
|
||||
(short *)ch_mag_i_256i,
|
||||
(short *)llr16,
|
||||
(short *) rho_256i,
|
||||
len);
|
||||
#else
|
||||
qam64_qam64_avx2((int32_t *)rxF_256i,
|
||||
(int32_t *)rxF_i_256i,
|
||||
(int32_t *)ch_mag_256i,
|
||||
@@ -8875,8 +8901,7 @@ int dlsch_64qam_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
(int16_t *)llr16,
|
||||
(int32_t *) rho_256i,
|
||||
len);
|
||||
#endif
|
||||
|
||||
|
||||
free16(rxF_256i, sizeof(rxF_256i));
|
||||
free16(rxF_i_256i, sizeof(rxF_i_256i));
|
||||
free16(ch_mag_256i, sizeof(ch_mag_256i));
|
||||
|
||||
@@ -19,5 +19,47 @@
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include "lte_interleaver.h"
|
||||
#include "lte_interleaver2.h"
|
||||
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
|
||||
|
||||
uint8_t get_pmi(uint8_t N_RB_DL, MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb)
|
||||
{
|
||||
/*
|
||||
MIMO_mode_t mode = dlsch_harq->mimo_mode;
|
||||
uint32_t pmi_alloc = dlsch_harq->pmi_alloc;
|
||||
*/
|
||||
|
||||
switch (N_RB_DL) {
|
||||
case 6: // 1 PRB per subband
|
||||
if (mode <= PUSCH_PRECODING1)
|
||||
return((pmi_alloc>>(rb<<1))&3);
|
||||
else
|
||||
return((pmi_alloc>>rb)&1);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
case 25: // 4 PRBs per subband
|
||||
if (mode <= PUSCH_PRECODING1)
|
||||
return((pmi_alloc>>((rb>>2)<<1))&3);
|
||||
else
|
||||
return((pmi_alloc>>(rb>>2))&1);
|
||||
|
||||
break;
|
||||
|
||||
case 50: // 6 PRBs per subband
|
||||
if (mode <= PUSCH_PRECODING1)
|
||||
return((pmi_alloc>>((rb/6)<<1))&3);
|
||||
else
|
||||
return((pmi_alloc>>(rb/6))&1);
|
||||
|
||||
break;
|
||||
|
||||
case 100: // 8 PRBs per subband
|
||||
if (mode <= PUSCH_PRECODING1)
|
||||
return((pmi_alloc>>((rb>>3)<<1))&3);
|
||||
else
|
||||
return((pmi_alloc>>(rb>>3))&1);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -284,14 +284,14 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
|
||||
|
||||
init_frame_parms(frame_parms,1);
|
||||
/*
|
||||
write_output("rxdata0.m","rxd0",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
|
||||
LOG_M("rxdata0.m","rxd0",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
|
||||
exit(-1);
|
||||
*/
|
||||
sync_pos = lte_sync_time(ue->common_vars.rxdata,
|
||||
frame_parms,
|
||||
(int *)&ue->common_vars.eNb_id);
|
||||
|
||||
// write_output("rxdata1.m","rxd1",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
|
||||
// LOG_M("rxdata1.m","rxd1",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
|
||||
if (sync_pos >= frame_parms->nb_prefix_samples)
|
||||
sync_pos2 = sync_pos - frame_parms->nb_prefix_samples;
|
||||
else
|
||||
@@ -325,7 +325,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
|
||||
init_frame_parms(&ue->frame_parms,1);
|
||||
lte_gold(frame_parms,ue->lte_gold_table[0],frame_parms->Nid_cell);
|
||||
ret = pbch_detection(ue,mode);
|
||||
// write_output("rxdata2.m","rxd2",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
|
||||
// LOG_M("rxdata2.m","rxd2",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
|
||||
|
||||
#ifdef DEBUG_INITIAL_SYNCH
|
||||
LOG_I(PHY,"FDD Normal prefix: CellId %d metric %d, phase %d, flip %d, pbch %d\n",
|
||||
@@ -372,7 +372,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
|
||||
init_frame_parms(&ue->frame_parms,1);
|
||||
lte_gold(frame_parms,ue->lte_gold_table[0],frame_parms->Nid_cell);
|
||||
ret = pbch_detection(ue,mode);
|
||||
// write_output("rxdata3.m","rxd3",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
|
||||
// LOG_M("rxdata3.m","rxd3",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
|
||||
#ifdef DEBUG_INITIAL_SYNCH
|
||||
LOG_I(PHY,"FDD Extended prefix: CellId %d metric %d, phase %d, flip %d, pbch %d\n",
|
||||
frame_parms->Nid_cell,metric_fdd_ecp,phase_fdd_ecp,flip_fdd_ecp,ret);
|
||||
@@ -387,6 +387,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
|
||||
// Now TDD normal prefix
|
||||
frame_parms->Ncp=NORMAL;
|
||||
frame_parms->frame_type=TDD;
|
||||
frame_parms->tdd_config=1;
|
||||
init_frame_parms(frame_parms,1);
|
||||
|
||||
if (sync_pos >= frame_parms->nb_prefix_samples)
|
||||
@@ -415,7 +416,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
|
||||
|
||||
lte_gold(frame_parms,ue->lte_gold_table[0],frame_parms->Nid_cell);
|
||||
ret = pbch_detection(ue,mode);
|
||||
// write_output("rxdata4.m","rxd4",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
|
||||
// LOG_M("rxdata4.m","rxd4",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
|
||||
|
||||
#ifdef DEBUG_INITIAL_SYNCH
|
||||
LOG_I(PHY,"TDD Normal prefix: CellId %d metric %d, phase %d, flip %d, pbch %d\n",
|
||||
@@ -426,6 +427,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
|
||||
// Now TDD extended prefix
|
||||
frame_parms->Ncp=EXTENDED;
|
||||
frame_parms->frame_type=TDD;
|
||||
frame_parms->tdd_config=1;
|
||||
init_frame_parms(frame_parms,1);
|
||||
sync_pos2 = sync_pos - frame_parms->nb_prefix_samples;
|
||||
|
||||
@@ -452,7 +454,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
|
||||
lte_gold(frame_parms,ue->lte_gold_table[0],frame_parms->Nid_cell);
|
||||
ret = pbch_detection(ue,mode);
|
||||
|
||||
// write_output("rxdata5.m","rxd5",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
|
||||
// LOG_M("rxdata5.m","rxd5",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
|
||||
#ifdef DEBUG_INITIAL_SYNCH
|
||||
LOG_I(PHY,"TDD Extended prefix: CellId %d metric %d, phase %d, flip %d, pbch %d\n",
|
||||
frame_parms->Nid_cell,metric_tdd_ecp,phase_tdd_ecp,flip_tdd_ecp,ret);
|
||||
@@ -493,17 +495,6 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
|
||||
#endif
|
||||
|
||||
// send sync status to higher layers later when timing offset converge to target timing
|
||||
#if OAISIM
|
||||
if (ue->mac_enabled==1) {
|
||||
LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id);
|
||||
//mac_resynch();
|
||||
dl_phy_sync_success(ue->Mod_id,ue->proc.proc_rxtx[0].frame_rx,0,1);//ue->common_vars.eNb_id);
|
||||
ue->UE_mode[0] = PRACH;
|
||||
}
|
||||
else {
|
||||
ue->UE_mode[0] = PUSCH;
|
||||
}
|
||||
#endif
|
||||
|
||||
generate_pcfich_reg_mapping(frame_parms);
|
||||
generate_phich_reg_mapping(frame_parms);
|
||||
|
||||
@@ -0,0 +1,374 @@
|
||||
/* These functions compute linear preprocessing for
|
||||
the UE using LAPACKE and CBLAS modules of
|
||||
LAPACK libraries.
|
||||
MMSE and MMSE whitening filters are available.
|
||||
Functions are using RowMajor storage of the
|
||||
matrices, like in conventional C. Traditional
|
||||
Fortran functions of LAPACK employ ColumnMajor
|
||||
data storage. */
|
||||
|
||||
#include<stdio.h>
|
||||
#include<math.h>
|
||||
#include<complex.h>
|
||||
#include <stdlib.h>
|
||||
#include <cblas.h>
|
||||
#include <string.h>
|
||||
#include <linux/version.h>
|
||||
#if RHEL_RELEASE_CODE >= 1796
|
||||
#include <lapacke/lapacke_utils.h>
|
||||
#include <lapacke/lapacke.h>
|
||||
#else
|
||||
#include <lapacke_utils.h>
|
||||
#include <lapacke.h>
|
||||
#endif
|
||||
//#define DEBUG_PREPROC
|
||||
|
||||
|
||||
void transpose (int N, float complex *A, float complex *Result)
|
||||
{
|
||||
// COnputes C := alpha*op(A)*op(B) + beta*C,
|
||||
enum CBLAS_TRANSPOSE transa = CblasTrans;
|
||||
enum CBLAS_TRANSPOSE transb = CblasNoTrans;
|
||||
int rows_opA = N; // number of rows in op(A) and in C
|
||||
int col_opB = N; //number of columns of op(B) and in C
|
||||
int col_opA = N; //number of columns in op(A) and rows in op(B)
|
||||
int col_B; //number of columns in B
|
||||
float complex alpha = 1.0+I*0;
|
||||
int lda = rows_opA;
|
||||
float complex beta = 0.0+I*0;
|
||||
int ldc = rows_opA;
|
||||
int i;
|
||||
float complex* B;
|
||||
|
||||
int ldb = col_opB;
|
||||
|
||||
if (transb == CblasNoTrans) {
|
||||
B = (float complex*)calloc(ldb*col_opB,sizeof(float complex));
|
||||
col_B= col_opB;
|
||||
}
|
||||
else {
|
||||
B = (float complex*)calloc(ldb*col_opA, sizeof(float complex));
|
||||
col_B = col_opA;
|
||||
}
|
||||
float complex* C = (float complex*)malloc(ldc*col_opB*sizeof(float complex));
|
||||
|
||||
for (i=0; i<lda*col_B; i+=N+1)
|
||||
B[i]=1.0+I*0;
|
||||
|
||||
cblas_cgemm(CblasRowMajor, transa, transb, rows_opA, col_opB, col_opA, &alpha, A, lda, B, ldb, &beta, C, ldc);
|
||||
|
||||
memcpy(Result, C, N*N*sizeof(float complex));
|
||||
|
||||
free(B);
|
||||
free(C);
|
||||
}
|
||||
|
||||
|
||||
void conjugate_transpose (int N, float complex *A, float complex *Result)
|
||||
{
|
||||
// Computes C := alpha*op(A)*op(B) + beta*C,
|
||||
enum CBLAS_TRANSPOSE transa = CblasConjTrans;
|
||||
enum CBLAS_TRANSPOSE transb = CblasNoTrans;
|
||||
int rows_opA = N; // number of rows in op(A) and in C
|
||||
int col_opB = N; //number of columns of op(B) and in C
|
||||
int col_opA = N; //number of columns in op(A) and rows in op(B)
|
||||
int col_B; //number of columns in B
|
||||
float complex alpha = 1.0+I*0;
|
||||
int lda = rows_opA;
|
||||
float complex beta = 0.0+I*0;
|
||||
int ldc = rows_opA;
|
||||
int i;
|
||||
float complex* B;
|
||||
int ldb = col_opB;
|
||||
|
||||
if (transb == CblasNoTrans) {
|
||||
B = (float complex*)calloc(ldb*col_opB,sizeof(float complex));
|
||||
col_B= col_opB;
|
||||
}
|
||||
else {
|
||||
B = (float complex*)calloc(ldb*col_opA, sizeof(float complex));
|
||||
col_B = col_opA;
|
||||
}
|
||||
float complex* C = (float complex*)malloc(ldc*col_opB*sizeof(float complex));
|
||||
|
||||
for (i=0; i<lda*col_B; i+=N+1)
|
||||
B[i]=1.0+I*0;
|
||||
|
||||
cblas_cgemm(CblasRowMajor, transa, transb, rows_opA, col_opB, col_opA, &alpha, A, lda, B, ldb, &beta, C, ldc);
|
||||
|
||||
memcpy(Result, C, N*N*sizeof(float complex));
|
||||
|
||||
free(B);
|
||||
free(C);
|
||||
}
|
||||
|
||||
void H_hermH_plus_sigma2I (int N, int M, float complex *A, float sigma2, float complex *Result)
|
||||
{
|
||||
//C := alpha*op(A)*op(B) + beta*C,
|
||||
enum CBLAS_TRANSPOSE transa = CblasConjTrans;
|
||||
enum CBLAS_TRANSPOSE transb = CblasNoTrans;
|
||||
int rows_opA = N; // number of rows in op(A) and in C
|
||||
int col_opB = N; //number of columns of op(B) and in C
|
||||
int col_opA = N; //number of columns in op(A) and rows in op(B)
|
||||
int col_C = N; //number of columns in B
|
||||
float complex alpha = 1.0+I*0;
|
||||
int lda = col_opA;
|
||||
float complex beta = 1.0 + I*0;
|
||||
int ldc = col_opA;
|
||||
int i;
|
||||
|
||||
float complex* C = (float complex*)calloc(ldc*col_opB, sizeof(float complex));
|
||||
|
||||
for (i=0; i<lda*col_C; i+=N+1)
|
||||
C[i]=sigma2*(1.0+I*0);
|
||||
|
||||
cblas_cgemm(CblasRowMajor, transa, transb, rows_opA, col_opB, col_opA, &alpha, A, lda, A, lda, &beta, C, ldc);
|
||||
|
||||
memcpy(Result, C, N*M*sizeof(float complex));
|
||||
free(C);
|
||||
|
||||
}
|
||||
|
||||
void HH_herm_plus_sigma2I (int M, int N, float complex *A, float sigma2, float complex *Result)
|
||||
{
|
||||
//C := alpha*op(A)*op(B) + beta*C,
|
||||
enum CBLAS_TRANSPOSE transa = CblasNoTrans;
|
||||
enum CBLAS_TRANSPOSE transb = CblasConjTrans;
|
||||
int k = N; //number of columns in op(A) and rows in op(B),k
|
||||
float complex alpha = 1.0+I*0;
|
||||
int lda = N;
|
||||
int ldb = N;
|
||||
int ldc = M;
|
||||
int i;
|
||||
|
||||
float complex* C = (float complex*)calloc(M*M, sizeof(float complex));
|
||||
|
||||
for (i=0; i<M*M; i+=M+1)
|
||||
C[i]=1.0+I*0;
|
||||
|
||||
cblas_cgemm(CblasRowMajor, transa, transb, M, M, k, &alpha, A, lda, A, ldb, &sigma2, C, ldc);
|
||||
|
||||
memcpy(Result, C, M*M*sizeof(float complex));
|
||||
free(C);
|
||||
|
||||
}
|
||||
|
||||
void eigen_vectors_values (int N, float complex *A, float complex *Vectors, float *Values_Matrix)
|
||||
{
|
||||
// This function computes ORTHONORMAL eigenvectors and eigenvalues of matrix A,
|
||||
// where Values_Matrix is a diagonal matrix of eigenvalues.
|
||||
// A=Vectors*Values_Matrix*Vectors'
|
||||
char jobz = 'V';
|
||||
char uplo = 'U';
|
||||
int order_A = N;
|
||||
int lda = N;
|
||||
int i;
|
||||
float* Values = (float*)malloc(sizeof(float)*1*N);
|
||||
|
||||
LAPACKE_cheev(LAPACK_ROW_MAJOR, jobz, uplo, order_A, A, lda, Values);
|
||||
|
||||
memcpy(Vectors, A, N*N*sizeof(float complex));
|
||||
|
||||
for (i=0; i<lda; i+=1)
|
||||
Values_Matrix[i*(lda+1)]=Values[i];
|
||||
|
||||
free(Values);
|
||||
}
|
||||
|
||||
void lin_eq_solver (int N, float complex* A, float complex* B, float complex* Result)
|
||||
{
|
||||
int n = N;
|
||||
int lda = N;
|
||||
int ldb = N;
|
||||
int nrhs = N;
|
||||
|
||||
char transa = 'N';
|
||||
int* IPIV = malloc(N*N*sizeof(int));
|
||||
|
||||
// Compute LU-factorization
|
||||
LAPACKE_cgetrf(LAPACK_ROW_MAJOR, n, nrhs, A, lda, IPIV);
|
||||
|
||||
// Solve AX=B
|
||||
LAPACKE_cgetrs(LAPACK_ROW_MAJOR, transa, n, nrhs, A, lda, IPIV, B, ldb);
|
||||
|
||||
// cgetrs( "N", N, 4, A, lda, IPIV, B, ldb, INFO )
|
||||
|
||||
memcpy(Result, B, N*N*sizeof(float complex));
|
||||
|
||||
free(IPIV);
|
||||
|
||||
}
|
||||
|
||||
void mutl_matrix_matrix_row_based(float complex* M0, float complex* M1, int rows_M0, int col_M0, int rows_M1, int col_M1, float complex* Result ){
|
||||
enum CBLAS_TRANSPOSE transa = CblasNoTrans;
|
||||
enum CBLAS_TRANSPOSE transb = CblasNoTrans;
|
||||
int rows_opA = rows_M0; // number of rows in op(A) and in C
|
||||
int col_opB = col_M1; //number of columns of op(B) and in C
|
||||
int col_opA = col_M0; //number of columns in op(A) and rows in op(B)
|
||||
float complex alpha =1.0;
|
||||
int lda = col_M0;
|
||||
float complex beta = 0.0;
|
||||
int ldc = col_M1;
|
||||
int ldb = col_M1;
|
||||
|
||||
#ifdef DEBUG_PREPROC
|
||||
int i=0;
|
||||
printf("rows_M0 %d, col_M0 %d, rows_M1 %d, col_M1 %d\n", rows_M0, col_M0, rows_M1, col_M1);
|
||||
|
||||
for(i=0; i<rows_M0*col_M0; ++i)
|
||||
printf(" rows_opA = %d, col_opB = %d, W_MMSE[%d] = (%f + i%f)\n", rows_opA, col_opB, i , creal(M0[i]), cimag(M0[i]));
|
||||
|
||||
for(i=0; i<rows_M1*col_M1; ++i)
|
||||
printf(" M1[%d] = (%f + i%f)\n", i , creal(M1[i]), cimag(M1[i]));
|
||||
#endif
|
||||
|
||||
cblas_cgemm(CblasRowMajor, transa, transb, rows_opA, col_opB, col_opA, &alpha, M0, lda, M1, ldb, &beta, Result, ldc);
|
||||
|
||||
#ifdef DEBUG_PREPROC
|
||||
for(i=0; i<rows_opA*col_opB; ++i)
|
||||
printf(" result[%d] = (%f + i%f)\n", i , creal(Result[i]), cimag(Result[i]));
|
||||
#endif
|
||||
|
||||
}
|
||||
void mutl_matrix_matrix_col_based(float complex* M0, float complex* M1, int rows_M0, int col_M0, int rows_M1, int col_M1, float complex* Result ){
|
||||
enum CBLAS_TRANSPOSE transa = CblasNoTrans;
|
||||
enum CBLAS_TRANSPOSE transb = CblasNoTrans;
|
||||
int rows_opA = rows_M0; // number of rows in op(A) and in C
|
||||
int col_opB = col_M1; //number of columns of op(B) and in C
|
||||
int col_opA = col_M0; //number of columns in op(A) and rows in op(B)
|
||||
float complex alpha =1.0;
|
||||
int lda = col_M0;
|
||||
float complex beta = 0.0;
|
||||
int ldc = rows_M1;
|
||||
int ldb = rows_M1;
|
||||
|
||||
#ifdef DEBUG_PREPROC
|
||||
int i = 0;
|
||||
printf("rows_M0 %d, col_M0 %d, rows_M1 %d, col_M1 %d\n", rows_M0, col_M0, rows_M1, col_M1);
|
||||
|
||||
for(i=0; i<rows_M0*col_M0; ++i)
|
||||
printf(" rows_opA = %d, col_opB = %d, W_MMSE[%d] = (%f + i%f)\n", rows_opA, col_opB, i , creal(M0[i]), cimag(M0[i]));
|
||||
|
||||
|
||||
for(i=0; i<rows_M1*col_M1; ++i)
|
||||
printf(" M1[%d] = (%f + i%f)\n", i , creal(M1[i]), cimag(M1[i]));
|
||||
#endif
|
||||
|
||||
cblas_cgemm(CblasColMajor, transa, transb, rows_opA, col_opB, col_opA, &alpha, M0, lda, M1, ldb, &beta, Result, ldc);
|
||||
|
||||
#ifdef DEBUG_PREPROC
|
||||
for(i=0; i<rows_opA*col_opB; ++i)
|
||||
printf(" result[%d] = (%f + i%f)\n", i , creal(Result[i]), cimag(Result[i]));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*FILTERS */
|
||||
void compute_MMSE(float complex* H, int order_H, float sigma2, float complex* W_MMSE)
|
||||
{
|
||||
int N = order_H;
|
||||
float complex* H_hermH_sigmaI = malloc(N*N*sizeof(float complex));
|
||||
float complex* H_herm = malloc(N*N*sizeof(float complex));
|
||||
|
||||
H_hermH_plus_sigma2I(N, N, H, sigma2, H_hermH_sigmaI);
|
||||
|
||||
#ifdef DEBUG_PREPROC
|
||||
int i =0;
|
||||
for(i=0;i<N*N;i++)
|
||||
printf(" H_hermH_sigmaI[%d] = (%f + i%f)\n", i , creal(H_hermH_sigmaI[i]), cimag(H_hermH_sigmaI[i]));
|
||||
#endif
|
||||
|
||||
conjugate_transpose (N, H, H_herm); //equals H_herm
|
||||
|
||||
#ifdef DEBUG_PREPROC
|
||||
for(i=0;i<N*N;i++)
|
||||
printf(" H_herm[%d] = (%f + i%f)\n", i , creal(H_herm[i]), cimag(H_herm[i]));
|
||||
#endif
|
||||
|
||||
lin_eq_solver(N, H_hermH_sigmaI, H_herm, W_MMSE);
|
||||
|
||||
#ifdef DEBUG_PREPROC
|
||||
for(i=0;i<N*N;i++)
|
||||
printf(" W_MMSE[%d] = (%f + i%f)\n", i , creal(W_MMSE[i]), cimag(W_MMSE[i]));
|
||||
#endif
|
||||
|
||||
free(H_hermH_sigmaI);
|
||||
free(H_herm);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void compute_white_filter(float complex* H_re,
|
||||
int order_H,
|
||||
float sigma2,
|
||||
float complex* W_Wh_0_re,
|
||||
float complex* W_Wh_1_re){
|
||||
|
||||
int aatx, aarx, re;
|
||||
int i,j;
|
||||
int M =n_rx;
|
||||
int N = n_tx;
|
||||
int sigma2=noise_power;
|
||||
|
||||
float complex *H0_re = malloc(n_rx*(n_tx>>2)*sizeof(float complex));
|
||||
float complex *H1_re = malloc(n_rx*(n_tx>>2)*sizeof(float complex));
|
||||
float complex *R_corr_col_n_0_re = malloc(n_rx*n_tx*sizeof(float complex));
|
||||
float complex *R_corr_col_n_1_re = malloc(n_rx*n_tx*sizeof(float complex));
|
||||
float complex *U_0_re = malloc(n_rx*n_tx*sizeof(float complex));
|
||||
float complex *U_1_re = malloc(n_rx*n_tx*sizeof(float complex));
|
||||
float complex *U_0_herm_re = malloc(n_rx*n_tx*sizeof(float complex));
|
||||
float complex *U_1_herm_re = malloc(n_rx*n_tx*sizeof(float complex));
|
||||
float complex *D_0_re = malloc(n_rx*n_tx*sizeof(float complex));
|
||||
float complex *D_1_re = malloc(n_rx*n_tx*sizeof(float complex));
|
||||
float complex *W_Wh_0_re = malloc(n_rx*n_tx*sizeof(float complex));
|
||||
float complex *W_Wh_1_re = malloc(n_rx*n_tx*sizeof(float complex));
|
||||
|
||||
for (aatx=0; aatx<n_tx/2; aatx++){
|
||||
for (aarx=0; aarx<n_rx; aarx++) {
|
||||
H0_re[aatx*n_rx + aarx] = H_re[aatx*n_rx + aarx][re]; // H0 gets [0 1 2 3; 4,5,6,7].' coefficients of H
|
||||
H1_re[aatx*n_rx + aarx] = H_re[aatx*n_rx + aarx + 8][re]; // H1 gets [8 9 10 11; 12, 13, 14, 15].' coefficients of H
|
||||
if (re == 0)
|
||||
printf("ant %d, H_re = (%f + i%f) \n", aatx*n_rx + aarx, creal(H[aatx*n_rx + aarx][re]), cimag(H[aatx*n_rx + aarx][re]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//HH_herm_plus_sigma2I(n_rx, (n_tx>>2), H1_re, sigma2, R_corr_col_n_0_re);
|
||||
HH_herm_plus_sigma2I(n_rx, (n_tx>>2), H0_re, sigma2, R_corr_col_n_1_re);
|
||||
|
||||
eigen_vectors_values(n_rx, R_corr_col_n_0_re, U_0_re, D_0_re);
|
||||
eigen_vectors_values(n_rx, R_corr_col_n_1_re, U_1_re, D_1_re);
|
||||
|
||||
transpose (n_rx, U_0_re, U_0_herm_re);
|
||||
transpose (n_rx, U_1_re, U_1_herm_re);
|
||||
|
||||
sigma = (float)(sqrt((double)(sigma2)));
|
||||
|
||||
/*The inverse of a diagonal matrix is obtained by replacing each element in the diagonal with its reciprocal.
|
||||
A square root of a diagonal matrix is given by the diagonal matrix, whose diagonal entries are just the square
|
||||
roots of the original matrix.*/
|
||||
|
||||
|
||||
D_0_re_inv_sqrt[0] = sqrt_float(1/D_0_re_inv[0]);
|
||||
D_0_re_inv_sqrt[5] = sqrt_float(1/D_0_re_inv[5]);
|
||||
D_0_re_inv_sqrt[10] = sqrt_float(1/D_0_re_inv[10]);
|
||||
D_0_re_inv_sqrt[15] = sqrt_float(1/D_0_re_inv[15]);
|
||||
|
||||
D_1_re_inv[0] = sqrt_float(1/D_1_re_inv[0]);
|
||||
D_1_re_inv[5] = sqrt_float(1/D_1_re_inv[5]);
|
||||
D_1_re_inv[10] = sqrt_float(1/D_1_re_inv[10]);
|
||||
D_1_re_inv[15] = sqrt_float(1/D_1_re_inv[15]);
|
||||
|
||||
now only to multiply
|
||||
|
||||
free(H0);
|
||||
free(H1);
|
||||
free(R_corr_col_n_0);
|
||||
free(R_corr_col_n_1);
|
||||
}
|
||||
#endif
|
||||
|
||||
float sqrt_float(float x, float sqrt_x)
|
||||
{
|
||||
sqrt_x = (float)(sqrt((double)(x)));
|
||||
return sqrt_x;
|
||||
}
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
|
||||
#include<stdio.h>
|
||||
#include<math.h>
|
||||
#include<complex.h>
|
||||
#include <stdlib.h>
|
||||
#include "PHY/defs_UE.h"
|
||||
|
||||
|
||||
/* FUNCTIONS FOR LINEAR PREPROCESSING: MMSE, WHITENNING, etc*/
|
||||
void transpose(int N, float complex *A, float complex *Result);
|
||||
|
||||
void conjugate_transpose(int N, float complex *A, float complex *Result);
|
||||
|
||||
void H_hermH_plus_sigma2I(int N, int M, float complex *A, float sigma2, float complex *Result);
|
||||
|
||||
void HH_herm_plus_sigma2I(int M, int N, float complex *A, float sigma2, float complex *Result);
|
||||
|
||||
void eigen_vectors_values(int N, float complex *A, float complex *Vectors, float *Values_Matrix);
|
||||
|
||||
void lin_eq_solver(int N, float complex *A, float complex* B);
|
||||
//float complex* lin_eq_solver (int N, float complex* A, float complex* B);
|
||||
|
||||
/* mutl_matrix_matrix_row_based performs multiplications when matrix is row-oriented H[0], H[1]; H[2], H[3]*/
|
||||
void mutl_matrix_matrix_row_based(float complex* M0, float complex* M1, int rows_M0, int col_M0, int rows_M1, int col_M1, float complex* Result );
|
||||
|
||||
/* mutl_matrix_matrix_col_based performs multiplications matrix is column-oriented H[0], H[2]; H[1], H[3]*/
|
||||
void mutl_matrix_matrix_col_based(float complex* M0, float complex* M1, int rows_M0, int col_M0, int rows_M1, int col_M1, float complex* Result );
|
||||
|
||||
void compute_MMSE(float complex* H, int order_H, float sigma2, float complex* W_MMSE);
|
||||
|
||||
void compute_white_filter(float complex* H, int order_H, float sigma2, float complex* U_1, float complex* D_1);
|
||||
|
||||
void mmse_processing_oai(LTE_UE_PDSCH *pdsch_vars,
|
||||
LTE_DL_FRAME_PARMS *frame_parms,
|
||||
PHY_MEASUREMENTS *measurements,
|
||||
unsigned char first_symbol_flag,
|
||||
MIMO_mode_t mimo_mode,
|
||||
unsigned short mmse_flag,
|
||||
int noise_power,
|
||||
unsigned char symbol,
|
||||
unsigned short nb_rb);
|
||||
|
||||
|
||||
void precode_channel_est(int32_t **dl_ch_estimates_ext,
|
||||
LTE_DL_FRAME_PARMS *frame_parms,
|
||||
LTE_UE_PDSCH *pdsch_vars,
|
||||
unsigned char symbol,
|
||||
unsigned short nb_rb,
|
||||
MIMO_mode_t mimo_mode);
|
||||
|
||||
|
||||
void rxdataF_to_float(int32_t **rxdataF_ext,
|
||||
float complex **rxdataF_f,
|
||||
int n_rx,
|
||||
int length,
|
||||
int start_point);
|
||||
|
||||
void chan_est_to_float(int32_t **dl_ch_estimates_ext,
|
||||
float complex **dl_ch_estimates_ext_f,
|
||||
int n_tx,
|
||||
int n_rx,
|
||||
int length,
|
||||
int start_point);
|
||||
|
||||
void float_to_chan_est(int32_t **dl_ch_estimates_ext,
|
||||
float complex **dl_ch_estimates_ext_f,
|
||||
int n_tx,
|
||||
int n_rx,
|
||||
int length,
|
||||
int start_point);
|
||||
|
||||
void float_to_rxdataF(int32_t **rxdataF_ext,
|
||||
float complex **rxdataF_f,
|
||||
int n_tx,
|
||||
int n_rx,
|
||||
int length,
|
||||
int start_point);
|
||||
|
||||
void mult_mmse_rxdataF(float complex** Wmmse,
|
||||
float complex** rxdataF_ext_f,
|
||||
int n_tx,
|
||||
int n_rx,
|
||||
int length,
|
||||
int start_point);
|
||||
|
||||
void mult_mmse_chan_est(float complex** Wmmse,
|
||||
float complex** dl_ch_estimates_ext_f,
|
||||
int n_tx,
|
||||
int n_rx,
|
||||
int length,
|
||||
int start_point);
|
||||
|
||||
void mmse_processing_core(int32_t **rxdataF_ext,
|
||||
int32_t **dl_ch_estimates_ext,
|
||||
int sigma2,
|
||||
int n_tx,
|
||||
int n_rx,
|
||||
int length,
|
||||
int start_point);
|
||||
|
||||
void mmse_processing_core_flp(float complex** rxdataF_ext_flcpx,
|
||||
float complex **H,
|
||||
int32_t **rxdataF_ext,
|
||||
int32_t **dl_ch_estimates_ext,
|
||||
float sigma2,
|
||||
int n_tx,
|
||||
int n_rx,
|
||||
int length,
|
||||
int start_point);
|
||||
|
||||
void whitening_processing_core_flp(float complex** rxdataF_ext_flcpx,
|
||||
float complex **H,
|
||||
int32_t **rxdataF_ext,
|
||||
int32_t **dl_ch_estimates_ext,
|
||||
float sigma2,
|
||||
int n_tx,
|
||||
int n_rx,
|
||||
int length,
|
||||
int start_point);
|
||||
|
||||
float sqrt_float(float x, float sqrt_x);
|
||||
@@ -369,7 +369,7 @@ void rx_phich(PHY_VARS_UE *ue,
|
||||
|
||||
if (HI16>0) { //NACK
|
||||
if (ue->ulsch_Msg3_active[eNB_id] == 1) {
|
||||
LOG_D(PHY,"[UE %d][PUSCH %d][RAPROC] Frame %d subframe %d Msg3 PHICH, received NAK (%d) nseq %d, ngroup %d\n",
|
||||
LOG_I(PHY,"[UE %d][PUSCH %d][RAPROC] Frame %d subframe %d Msg3 PHICH, received NAK (%d) nseq %d, ngroup %d\n",
|
||||
ue->Mod_id,harq_pid,
|
||||
proc->frame_rx,
|
||||
subframe,
|
||||
@@ -379,7 +379,7 @@ void rx_phich(PHY_VARS_UE *ue,
|
||||
|
||||
ulsch->f_pusch += delta_PUSCH_acc[ulsch->harq_processes[harq_pid]->TPC];
|
||||
|
||||
LOG_D(PHY,"[PUSCH %d] AbsSubframe %d.%d: f_pusch (ACC) %d, adjusting by %d (TPC %d)\n",
|
||||
LOG_I(PHY,"[PUSCH %d] AbsSubframe %d.%d: f_pusch (ACC) %d, adjusting by %d (TPC %d)\n",
|
||||
harq_pid,proc->frame_rx,subframe,ulsch->f_pusch,
|
||||
delta_PUSCH_acc[ulsch->harq_processes[harq_pid]->TPC],
|
||||
ulsch->harq_processes[harq_pid]->TPC);
|
||||
|
||||
@@ -43,46 +43,44 @@
|
||||
void dump_mch(PHY_VARS_UE *ue,uint8_t eNB_id,uint16_t coded_bits_per_codeword,int subframe)
|
||||
{
|
||||
|
||||
unsigned int nsymb_pmch=12;
|
||||
char fname[32],vname[32];
|
||||
int N_RB_DL=ue->frame_parms.N_RB_DL;
|
||||
|
||||
#define NSYMB_PMCH 12
|
||||
sprintf(fname,"mch_rxF_ext0.m");
|
||||
sprintf(vname,"pmch_rxF_ext0");
|
||||
write_output(fname,vname,ue->pdsch_vars_MCH[eNB_id]->rxdataF_ext[0],12*N_RB_DL*nsymb_pmch,1,1);
|
||||
LOG_M(fname,vname,ue->pdsch_vars_MCH[eNB_id]->rxdataF_ext[0],12*(ue->frame_parms.N_RB_DL)*12,1,1);
|
||||
sprintf(fname,"mch_ch_ext00.m");
|
||||
sprintf(vname,"pmch_ch_ext00");
|
||||
write_output(fname,vname,ue->pdsch_vars_MCH[eNB_id]->dl_ch_estimates_ext[0],12*N_RB_DL*nsymb_pmch,1,1);
|
||||
LOG_M(fname,vname,ue->pdsch_vars_MCH[eNB_id]->dl_ch_estimates_ext[0],12*(ue->frame_parms.N_RB_DL)*NSYMB_PMCH,1,1);
|
||||
/*
|
||||
write_output("dlsch%d_ch_ext01.m","dl01_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*nsymb_pmch,1,1);
|
||||
write_output("dlsch%d_ch_ext10.m","dl10_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*nsymb_pmch,1,1);
|
||||
write_output("dlsch%d_ch_ext11.m","dl11_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[3],12*N_RB_DL*nsymb_pmch,1,1);
|
||||
write_output("dlsch%d_rho.m","dl_rho",pdsch_vars[eNB_id]->rho[0],12*N_RB_DL*nsymb_pmch,1,1);
|
||||
LOG_M("dlsch%d_ch_ext01.m","dl01_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*NSYMB_PMCH,1,1);
|
||||
LOG_M("dlsch%d_ch_ext10.m","dl10_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*NSYMB_PMCH,1,1);
|
||||
LOG_M("dlsch%d_ch_ext11.m","dl11_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[3],12*N_RB_DL*NSYMB_PMCH,1,1);
|
||||
LOG_M("dlsch%d_rho.m","dl_rho",pdsch_vars[eNB_id]->rho[0],12*N_RB_DL*NSYMB_PMCH,1,1);
|
||||
*/
|
||||
sprintf(fname,"mch_rxF_comp0.m");
|
||||
sprintf(vname,"pmch_rxF_comp0");
|
||||
write_output(fname,vname,ue->pdsch_vars_MCH[eNB_id]->rxdataF_comp0[0],12*N_RB_DL*nsymb_pmch,1,1);
|
||||
LOG_M(fname,vname,ue->pdsch_vars_MCH[eNB_id]->rxdataF_comp0[0],12*(ue->frame_parms.N_RB_DL)*NSYMB_PMCH,1,1);
|
||||
sprintf(fname,"mch_rxF_llr.m");
|
||||
sprintf(vname,"pmch_llr");
|
||||
write_output(fname,vname, ue->pdsch_vars_MCH[eNB_id]->llr[0],coded_bits_per_codeword,1,0);
|
||||
LOG_M(fname,vname, ue->pdsch_vars_MCH[eNB_id]->llr[0],coded_bits_per_codeword,1,0);
|
||||
sprintf(fname,"mch_mag1.m");
|
||||
sprintf(vname,"pmch_mag1");
|
||||
write_output(fname,vname,ue->pdsch_vars_MCH[eNB_id]->dl_ch_mag0[0],12*N_RB_DL*nsymb_pmch,1,1);
|
||||
LOG_M(fname,vname,ue->pdsch_vars_MCH[eNB_id]->dl_ch_mag0[0],12*(ue->frame_parms.N_RB_DL)*NSYMB_PMCH,1,1);
|
||||
sprintf(fname,"mch_mag2.m");
|
||||
sprintf(vname,"pmch_mag2");
|
||||
write_output(fname,vname,ue->pdsch_vars_MCH[eNB_id]->dl_ch_magb0[0],12*N_RB_DL*nsymb_pmch,1,1);
|
||||
LOG_M(fname,vname,ue->pdsch_vars_MCH[eNB_id]->dl_ch_magb0[0],12*(ue->frame_parms.N_RB_DL)*NSYMB_PMCH,1,1);
|
||||
|
||||
write_output("mch00_ch0.m","pmch00_ch0",
|
||||
LOG_M("mch00_ch0.m","pmch00_ch0",
|
||||
&(ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][0][0]),
|
||||
ue->frame_parms.ofdm_symbol_size*12,1,1);
|
||||
|
||||
write_output("rxsig_mch.m","rxs_mch",
|
||||
LOG_M("rxsig_mch.m","rxs_mch",
|
||||
&ue->common_vars.rxdata[0][subframe*ue->frame_parms.samples_per_tti],
|
||||
ue->frame_parms.samples_per_tti,1,1);
|
||||
|
||||
/*
|
||||
if (PHY_vars_eNB_g)
|
||||
write_output("txsig_mch.m","txs_mch",
|
||||
LOG_M("txsig_mch.m","txs_mch",
|
||||
&PHY_vars_eNB_g[0][0]->common_vars.txdata[0][0][subframe*ue->frame_parms.samples_per_tti],
|
||||
ue->frame_parms.samples_per_tti,1,1);*/
|
||||
}
|
||||
|
||||
@@ -37,10 +37,12 @@
|
||||
|
||||
#include "SCHED_UE/sched_UE.h"
|
||||
#include "SCHED/sched_common_extern.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
|
||||
#include "../LTE_TRANSPORT/prach_extern.h"
|
||||
|
||||
//#define PRACH_DEBUG 1
|
||||
|
||||
int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint16_t Nf )
|
||||
{
|
||||
|
||||
@@ -98,7 +100,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
|
||||
|
||||
#else //normal case (simulation)
|
||||
prach_start = subframe*ue->frame_parms.samples_per_tti-ue->N_TA_offset;
|
||||
LOG_D(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id,
|
||||
LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id,
|
||||
prach_start,
|
||||
ue->rx_offset,
|
||||
ue->hw_timing_advance,
|
||||
@@ -413,7 +415,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
|
||||
memmove( prach, prach+4096, Ncp<<2 );
|
||||
prach_len = 2048+Ncp;
|
||||
} else {
|
||||
idft12288(prachF,prach2);
|
||||
idft12288(prachF,prach2,1);
|
||||
memmove( prach, prach+24576, Ncp<<2 );
|
||||
prach_len = 12288+Ncp;
|
||||
|
||||
@@ -432,7 +434,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
|
||||
memmove( prach, prach+6144, Ncp<<2 );
|
||||
prach_len = 3072+Ncp;
|
||||
} else {
|
||||
idft18432(prachF,prach2);
|
||||
idft18432(prachF,prach2,1);
|
||||
memmove( prach, prach+36864, Ncp<<2 );
|
||||
prach_len = 18432+Ncp;
|
||||
|
||||
@@ -451,7 +453,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
|
||||
memmove( prach, prach+8192, Ncp<<2 );
|
||||
prach_len = 4096+Ncp;
|
||||
} else {
|
||||
idft24576(prachF,prach2);
|
||||
idft24576(prachF,prach2,1);
|
||||
memmove( prach, prach+49152, Ncp<<2 );
|
||||
prach_len = 24576+Ncp;
|
||||
|
||||
@@ -468,7 +470,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
|
||||
memmove( prach, prach+6144, Ncp<<2 );
|
||||
prach_len = 3072+Ncp;
|
||||
} else {
|
||||
idft18432(prachF,prach2);
|
||||
idft18432(prachF,prach2,1);
|
||||
memmove( prach, prach+36864, Ncp<<2 );
|
||||
prach_len = 18432+Ncp;
|
||||
printf("Generated prach for 100 PRB, 3/4 sampling\n");
|
||||
@@ -486,19 +488,19 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
|
||||
|
||||
AssertFatal(prach_fmt<4,
|
||||
"prach_fmt4 not fully implemented" );
|
||||
#if defined(EXMIMO) || defined(OAI_USRP)
|
||||
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
|
||||
int j;
|
||||
int overflow = prach_start + prach_len - LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*ue->frame_parms.samples_per_tti;
|
||||
LOG_I( PHY, "prach_start=%d, overflow=%d\n", prach_start, overflow );
|
||||
|
||||
for (i=prach_start,j=0; i<min(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,prach_start+prach_len); i++,j++) {
|
||||
((int16_t*)ue->common_vars.txdata[0])[2*i] = prach[2*j]<<4;
|
||||
((int16_t*)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1]<<4;
|
||||
((int16_t*)ue->common_vars.txdata[0])[2*i] = prach[2*j];
|
||||
((int16_t*)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1];
|
||||
}
|
||||
|
||||
for (i=0; i<overflow; i++,j++) {
|
||||
((int16_t*)ue->common_vars.txdata[0])[2*i] = prach[2*j]<<4;
|
||||
((int16_t*)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1]<<4;
|
||||
((int16_t*)ue->common_vars.txdata[0])[2*i] = prach[2*j];
|
||||
((int16_t*)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1];
|
||||
}
|
||||
#if defined(EXMIMO)
|
||||
// handle switch before 1st TX subframe, guarantee that the slot prior to transmission is switch on
|
||||
@@ -523,9 +525,9 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
|
||||
|
||||
|
||||
#if defined(PRACH_WRITE_OUTPUT_DEBUG)
|
||||
write_output("prach_txF0.m","prachtxF0",prachF,prach_len-Ncp,1,1);
|
||||
write_output("prach_tx0.m","prachtx0",prach+(Ncp<<1),prach_len-Ncp,1,1);
|
||||
write_output("txsig.m","txs",(int16_t*)(&ue->common_vars.txdata[0][0]),2*ue->frame_parms.samples_per_tti,1,1);
|
||||
LOG_M("prach_txF0.m","prachtxF0",prachF,prach_len-Ncp,1,1);
|
||||
LOG_M("prach_tx0.m","prachtx0",prach+(Ncp<<1),prach_len-Ncp,1,1);
|
||||
LOG_M("txsig.m","txs",(int16_t*)(&ue->common_vars.txdata[0][0]),2*ue->frame_parms.samples_per_tti,1,1);
|
||||
exit(-1);
|
||||
#endif
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user