more additions
This commit is contained in:
@@ -22,8 +22,6 @@
|
|||||||
#include "nr_modulation.h"
|
#include "nr_modulation.h"
|
||||||
#include "PHY/NR_REFSIG/nr_mod_table.h"
|
#include "PHY/NR_REFSIG/nr_mod_table.h"
|
||||||
|
|
||||||
extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT];
|
|
||||||
|
|
||||||
void nr_modulation(uint32_t *in,
|
void nr_modulation(uint32_t *in,
|
||||||
uint32_t length,
|
uint32_t length,
|
||||||
uint16_t mod_order,
|
uint16_t mod_order,
|
||||||
@@ -114,7 +112,7 @@ void nr_modulation(uint32_t *in,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
nr_mod_table32 = (int32_t*) nr_mod_table;
|
nr_mod_table32 = (int32_t*) nr_256qam_mod_table;
|
||||||
for (i=0; i<length/8; i++)
|
for (i=0; i<length/8; i++)
|
||||||
out32[i] = nr_mod_table32[(offset+in_bytes[i])];
|
out32[i] = nr_mod_table32[(offset+in_bytes[i])];
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -32,15 +32,9 @@ void nr_generate_modulation_table() {
|
|||||||
uint32_t i,j;
|
uint32_t i,j;
|
||||||
short* table;
|
short* table;
|
||||||
|
|
||||||
//QPSK m128
|
short nr_qpsk_mod_table[8] = {16384,16384,-16384,16384,16384,-16384,-16384,-16384};
|
||||||
for (i=0; i<256; i++) {
|
|
||||||
for (j=0; j<4; j++) {
|
|
||||||
nr_qpsk_byte_mod_table[i*8+(j*2)] = (short)(1-2*((i>>(j*2))&1))*val*sqrt2*sqrt2;
|
|
||||||
nr_qpsk_byte_mod_table[i*8+(j*2)+1] = (short)(1-2*((i>>(j*2+1))&1))*val*sqrt2*sqrt2;
|
|
||||||
//printf("%d j%d\n",nr_qpsk_byte_mod_table[i*8+(j*2)],nr_qpsk_byte_mod_table[i*8+(j*2)+1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
#if defined(__AVX2__)
|
||||||
//QPSK m256
|
//QPSK m256
|
||||||
table = (short*) nr_qpsk_2byte_mod_table;
|
table = (short*) nr_qpsk_2byte_mod_table;
|
||||||
for (i=0; i<65536; i++) {
|
for (i=0; i<65536; i++) {
|
||||||
@@ -50,6 +44,18 @@ void nr_generate_modulation_table() {
|
|||||||
//printf("%d j%d\n",nr_qpsk_byte_mod_table[i*8+(j*2)],nr_qpsk_byte_mod_table[i*8+(j*2)+1]);
|
//printf("%d j%d\n",nr_qpsk_byte_mod_table[i*8+(j*2)],nr_qpsk_byte_mod_table[i*8+(j*2)+1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#elif defined(__SSE2__)
|
||||||
|
|
||||||
|
//QPSK m128
|
||||||
|
table = (short*) nr_qpsk_byte_mod_table;
|
||||||
|
for (i=0; i<256; i++) {
|
||||||
|
for (j=0; j<4; j++) {
|
||||||
|
table[i*8+(j*2)] = (short)(1-2*((i>>(j*2))&1))*val*sqrt2*sqrt2;
|
||||||
|
table[i*8+(j*2)+1] = (short)(1-2*((i>>(j*2+1))&1))*val*sqrt2*sqrt2;
|
||||||
|
//printf("%d j%d\n",nr_qpsk_byte_mod_table[i*8+(j*2)],nr_qpsk_byte_mod_table[i*8+(j*2)+1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//16QAM
|
//16QAM
|
||||||
for (i=0; i<256; i++) {
|
for (i=0; i<256; i++) {
|
||||||
@@ -69,5 +75,12 @@ void nr_generate_modulation_table() {
|
|||||||
//printf("%d j%d\n",table[i*4+(j*2)],table[i*4+(j*2)+1]);
|
//printf("%d j%d\n",table[i*4+(j*2)],table[i*4+(j*2)+1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//256QAM
|
||||||
|
table = (short*) nr_256qam_mod_table;
|
||||||
|
for (i=0; i<256; i++) {
|
||||||
|
table[i*2] = (short)((1-2*(i&1))*(8-(1-2*((i>>2)&1))*(4-(1-2*((i>>4)&1))*(2-(1-2*((i>>6)&1))))))*val*sqrt170*sqrt2;
|
||||||
|
table[i*2+1] = (short)((1-2*((i>>1)&1))*(8-(1-2*((i>>3)&1))*(4-(1-2*((i>>5)&1))*(2-(1-2*((i>>7)&1))))))*val*sqrt170*sqrt2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,8 @@
|
|||||||
#define NR_MOD_TABLE_QAM16_OFFSET 7
|
#define NR_MOD_TABLE_QAM16_OFFSET 7
|
||||||
#define NR_MOD_TABLE_QAM64_OFFSET 23
|
#define NR_MOD_TABLE_QAM64_OFFSET 23
|
||||||
#define NR_MOD_TABLE_QAM256_OFFSET 87
|
#define NR_MOD_TABLE_QAM256_OFFSET 87
|
||||||
short nr_qpsk_mod_table[8] = {16384,16384,-16384,16384,16384,-16384,-16384,-16384};
|
|
||||||
|
short nr_qpsk_mod_table[8];
|
||||||
|
|
||||||
#if defined(__AVX2__)
|
#if defined(__AVX2__)
|
||||||
__m256i nr_qpsk_2byte_mod_table[65536];
|
__m256i nr_qpsk_2byte_mod_table[65536];
|
||||||
@@ -39,4 +40,6 @@ __m128i nr_qpsk_byte_mod_table[2048];
|
|||||||
int64_t nr_16qam_byte_mod_table[1024];
|
int64_t nr_16qam_byte_mod_table[1024];
|
||||||
|
|
||||||
int64_t nr_64qam_mod_table[4096];
|
int64_t nr_64qam_mod_table[4096];
|
||||||
|
|
||||||
|
int32_t nr_256qam_mod_table[512];
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
//#define DEBUG_PBCH_ENCODING
|
//#define DEBUG_PBCH_ENCODING
|
||||||
//#define DEBUG_PBCH_DMRS
|
//#define DEBUG_PBCH_DMRS
|
||||||
|
|
||||||
extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT];
|
extern short nr_qpsk_mod_table[8];
|
||||||
|
|
||||||
uint8_t nr_pbch_payload_interleaving_pattern[32] = {16, 23, 18, 17, 8, 30, 10, 6, 24, 7, 0, 5, 3, 2, 1, 4,
|
uint8_t nr_pbch_payload_interleaving_pattern[32] = {16, 23, 18, 17, 8, 30, 10, 6, 24, 7, 0, 5, 3, 2, 1, 4,
|
||||||
9, 11, 12, 13, 14, 15, 19, 20, 21, 22, 25, 26, 27, 28, 29, 31
|
9, 11, 12, 13, 14, 15, 19, 20, 21, 22, 25, 26, 27, 28, 29, 31
|
||||||
@@ -62,8 +62,8 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
|
|||||||
/// QPSK modulation
|
/// QPSK modulation
|
||||||
for (int m=0; m<NR_PBCH_DMRS_LENGTH; m++) {
|
for (int m=0; m<NR_PBCH_DMRS_LENGTH; m++) {
|
||||||
idx = ((((gold_pbch_dmrs[(m<<1)>>5])>>((m<<1)&0x1f))&1)<<1) ^ (((gold_pbch_dmrs[((m<<1)+1)>>5])>>(((m<<1)+1)&0x1f))&1);
|
idx = ((((gold_pbch_dmrs[(m<<1)>>5])>>((m<<1)&0x1f))&1)<<1) ^ (((gold_pbch_dmrs[((m<<1)+1)>>5])>>(((m<<1)+1)&0x1f))&1);
|
||||||
mod_dmrs[m<<1] = nr_mod_table[(NR_MOD_TABLE_QPSK_OFFSET + idx)<<1];
|
mod_dmrs[m<<1] = nr_qpsk_mod_table[idx<<1];
|
||||||
mod_dmrs[(m<<1)+1] = nr_mod_table[((NR_MOD_TABLE_QPSK_OFFSET + idx)<<1) + 1];
|
mod_dmrs[(m<<1)+1] = nr_qpsk_mod_table[(idx<<1) + 1];
|
||||||
#ifdef DEBUG_PBCH_DMRS
|
#ifdef DEBUG_PBCH_DMRS
|
||||||
printf("m %d idx %d gold seq %d b0-b1 %d-%d mod_dmrs %d %d\n", m, idx, gold_pbch_dmrs[(m<<1)>>5], (((gold_pbch_dmrs[(m<<1)>>5])>>((m<<1)&0x1f))&1),
|
printf("m %d idx %d gold seq %d b0-b1 %d-%d mod_dmrs %d %d\n", m, idx, gold_pbch_dmrs[(m<<1)>>5], (((gold_pbch_dmrs[(m<<1)>>5])>>((m<<1)&0x1f))&1),
|
||||||
(((gold_pbch_dmrs[((m<<1)+1)>>5])>>(((m<<1)+1)&0x1f))&1), mod_dmrs[(m<<1)], mod_dmrs[(m<<1)+1]);
|
(((gold_pbch_dmrs[((m<<1)+1)>>5])>>(((m<<1)+1)&0x1f))&1), mod_dmrs[(m<<1)], mod_dmrs[(m<<1)+1]);
|
||||||
@@ -324,8 +324,8 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
|
|||||||
/// QPSK modulation
|
/// QPSK modulation
|
||||||
for (int i=0; i<NR_POLAR_PBCH_E>>1; i++) {
|
for (int i=0; i<NR_POLAR_PBCH_E>>1; i++) {
|
||||||
idx = (((pbch->pbch_e[(i<<1)>>5]>>((i<<1)&0x1f))&1)<<1) ^ ((pbch->pbch_e[((i<<1)+1)>>5]>>(((i<<1)+1)&0x1f))&1);
|
idx = (((pbch->pbch_e[(i<<1)>>5]>>((i<<1)&0x1f))&1)<<1) ^ ((pbch->pbch_e[((i<<1)+1)>>5]>>(((i<<1)+1)&0x1f))&1);
|
||||||
mod_pbch_e[i<<1] = nr_mod_table[(NR_MOD_TABLE_QPSK_OFFSET + idx)<<1];
|
mod_pbch_e[i<<1] = nr_qpsk_mod_table[idx<<1];
|
||||||
mod_pbch_e[(i<<1)+1] = nr_mod_table[((NR_MOD_TABLE_QPSK_OFFSET + idx)<<1)+1];
|
mod_pbch_e[(i<<1)+1] = nr_qpsk_mod_table[(idx<<1)+1];
|
||||||
#ifdef DEBUG_PBCH
|
#ifdef DEBUG_PBCH
|
||||||
printf("i %d idx %d mod_pbch %d %d\n", i, idx, mod_pbch_e[2*i], mod_pbch_e[2*i+1]);
|
printf("i %d idx %d mod_pbch %d %d\n", i, idx, mod_pbch_e[2*i], mod_pbch_e[2*i+1]);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user