fix-ubsan
This commit is contained in:
@@ -95,11 +95,11 @@ crc table initialization
|
|||||||
static unsigned int crc24aTable[256];
|
static unsigned int crc24aTable[256];
|
||||||
static unsigned int crc24bTable[256];
|
static unsigned int crc24bTable[256];
|
||||||
static unsigned int crc24cTable[256];
|
static unsigned int crc24cTable[256];
|
||||||
static unsigned short crc16Table[256];
|
static unsigned int crc16Table[256];
|
||||||
static unsigned short crc12Table[256];
|
static unsigned int crc12Table[256];
|
||||||
static unsigned short crc11Table[256];
|
static unsigned int crc11Table[256];
|
||||||
static unsigned char crc8Table[256];
|
static unsigned int crc8Table[256];
|
||||||
static unsigned char crc6Table[256];
|
static unsigned int crc6Table[256];
|
||||||
|
|
||||||
#if USE_INTEL_CRC
|
#if USE_INTEL_CRC
|
||||||
static DECLARE_ALIGNED(struct crc_pclmulqdq_ctx lte_crc24a_pclmulqdq, 16) = {
|
static DECLARE_ALIGNED(struct crc_pclmulqdq_ctx lte_crc24a_pclmulqdq, 16) = {
|
||||||
@@ -131,11 +131,11 @@ void crcTableInit (void)
|
|||||||
crc24aTable[c] = crcbit (&c, 1, poly24a);
|
crc24aTable[c] = crcbit (&c, 1, poly24a);
|
||||||
crc24bTable[c] = crcbit (&c, 1, poly24b);
|
crc24bTable[c] = crcbit (&c, 1, poly24b);
|
||||||
crc24cTable[c] = crcbit (&c, 1, poly24c);
|
crc24cTable[c] = crcbit (&c, 1, poly24c);
|
||||||
crc16Table[c] = (unsigned short) (crcbit (&c, 1, poly16) >> 16);
|
crc16Table[c] = crcbit(&c, 1, poly16) >> 16;
|
||||||
crc12Table[c] = (unsigned short) (crcbit (&c, 1, poly12) >> 16);
|
crc12Table[c] = crcbit(&c, 1, poly12) >> 16;
|
||||||
crc11Table[c] = (unsigned short) (crcbit (&c, 1, poly11) >> 16);
|
crc11Table[c] = crcbit(&c, 1, poly11) >> 16;
|
||||||
crc8Table[c] = (unsigned char) (crcbit (&c, 1, poly8) >> 24);
|
crc8Table[c] = crcbit(&c, 1, poly8) >> 24;
|
||||||
crc6Table[c] = (unsigned char) (crcbit (&c, 1, poly6) >> 24);
|
crc6Table[c] = crcbit(&c, 1, poly6) >> 24;
|
||||||
} while (++c);
|
} while (++c);
|
||||||
#if USE_INTEL_CRC
|
#if USE_INTEL_CRC
|
||||||
crc_xmm_be_le_swap128 = _mm_setr_epi32(0x0c0d0e0f, 0x08090a0b,
|
crc_xmm_be_le_swap128 = _mm_setr_epi32(0x0c0d0e0f, 0x08090a0b,
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t
|
|||||||
|
|
||||||
for (i=16; i>0; i--) {
|
for (i=16; i>0; i--) {
|
||||||
if ((rb_alloc&(1<<i)) != 0)
|
if ((rb_alloc&(1<<i)) != 0)
|
||||||
rb_alloc2[(3*(16-i))>>5] |= (7<<((3*(16-i))%32));
|
rb_alloc2[(3 * (16 - i)) >> 5] |= (7U << ((3 * (16 - i)) % 32));
|
||||||
}
|
}
|
||||||
|
|
||||||
// bit mask across
|
// bit mask across
|
||||||
|
|||||||
@@ -840,16 +840,16 @@ int allocate_REs_in_RB_no_pilots_16QAM_tm2(PHY_VARS_eNB* phy_vars_eNB,
|
|||||||
(((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4)|
|
(((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4)|
|
||||||
(((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6);
|
(((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6);
|
||||||
|
|
||||||
txF0[0]=qam_table16_0[qam16_table_offset];
|
memcpy(txF0, &qam_table16_0[qam16_table_offset], sizeof(*txF0));
|
||||||
txF1[0]=qam_table16_1[qam16_table_offset];
|
memcpy(txF1, &qam_table16_1[qam16_table_offset], sizeof(*txF1));
|
||||||
x0p+=8;
|
x0p+=8;
|
||||||
qam16_table_offset=(((uint32_t)x0p[0])<<1)|(((uint32_t)x0p[2]))|
|
qam16_table_offset=(((uint32_t)x0p[0])<<1)|(((uint32_t)x0p[2]))|
|
||||||
(((uint32_t)x0p[1])<<3)|(((uint32_t)x0p[3])<<2) |
|
(((uint32_t)x0p[1])<<3)|(((uint32_t)x0p[3])<<2) |
|
||||||
(((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4) |
|
(((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4) |
|
||||||
(((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6);
|
(((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6);
|
||||||
|
|
||||||
txF0[1]=qam_table16_0[qam16_table_offset];
|
memcpy(txF0 + 1, &qam_table16_0[qam16_table_offset], sizeof(*txF0));
|
||||||
txF1[1]=qam_table16_1[qam16_table_offset];
|
memcpy(txF1 + 1, &qam_table16_1[qam16_table_offset], sizeof(*txF1));
|
||||||
|
|
||||||
x0p+=8;
|
x0p+=8;
|
||||||
qam16_table_offset=(((uint32_t)x0p[0])<<1)|(((uint32_t)x0p[2]))|
|
qam16_table_offset=(((uint32_t)x0p[0])<<1)|(((uint32_t)x0p[2]))|
|
||||||
@@ -857,8 +857,8 @@ int allocate_REs_in_RB_no_pilots_16QAM_tm2(PHY_VARS_eNB* phy_vars_eNB,
|
|||||||
(((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4) |
|
(((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4) |
|
||||||
(((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6);
|
(((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6);
|
||||||
|
|
||||||
txF0[2]=qam_table16_0[qam16_table_offset];
|
memcpy(txF0 + 2, &qam_table16_0[qam16_table_offset], sizeof(*txF0));
|
||||||
txF1[2]=qam_table16_1[qam16_table_offset];
|
memcpy(txF1 + 2, &qam_table16_1[qam16_table_offset], sizeof(*txF1));
|
||||||
|
|
||||||
if(skip_half==0) {
|
if(skip_half==0) {
|
||||||
if (skip_dc>0) {
|
if (skip_dc>0) {
|
||||||
@@ -872,23 +872,23 @@ int allocate_REs_in_RB_no_pilots_16QAM_tm2(PHY_VARS_eNB* phy_vars_eNB,
|
|||||||
(((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4) |
|
(((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4) |
|
||||||
(((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6);
|
(((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6);
|
||||||
|
|
||||||
txF0[3]=qam_table16_0[qam16_table_offset];
|
memcpy(txF0 + 3, &qam_table16_0[qam16_table_offset], sizeof(*txF0));
|
||||||
txF1[3]=qam_table16_1[qam16_table_offset];
|
memcpy(txF1 + 3, &qam_table16_1[qam16_table_offset], sizeof(*txF1));
|
||||||
x0p+=8;
|
x0p+=8;
|
||||||
qam16_table_offset=(((uint32_t)x0p[0])<<1)|(((uint32_t)x0p[2]))|
|
qam16_table_offset=(((uint32_t)x0p[0])<<1)|(((uint32_t)x0p[2]))|
|
||||||
(((uint32_t)x0p[1])<<3)|(((uint32_t)x0p[3])<<2) |
|
(((uint32_t)x0p[1])<<3)|(((uint32_t)x0p[3])<<2) |
|
||||||
(((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4) |
|
(((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4) |
|
||||||
(((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6);
|
(((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6);
|
||||||
|
|
||||||
txF0[4]=qam_table16_0[qam16_table_offset];
|
memcpy(txF0 + 4, &qam_table16_0[qam16_table_offset], sizeof(*txF0));
|
||||||
txF1[4]=qam_table16_1[qam16_table_offset];
|
memcpy(txF1 + 4, &qam_table16_1[qam16_table_offset], sizeof(*txF1));
|
||||||
x0p+=8;
|
x0p+=8;
|
||||||
qam16_table_offset=(((uint32_t)x0p[0])<<1)|(((uint32_t)x0p[2]))|
|
qam16_table_offset=(((uint32_t)x0p[0])<<1)|(((uint32_t)x0p[2]))|
|
||||||
(((uint32_t)x0p[1])<<3)|(((uint32_t)x0p[3])<<2) |
|
(((uint32_t)x0p[1])<<3)|(((uint32_t)x0p[3])<<2) |
|
||||||
(((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4) |
|
(((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4) |
|
||||||
(((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6);
|
(((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6);
|
||||||
txF0[5]=qam_table16_0[qam16_table_offset];
|
memcpy(txF0 + 5, &qam_table16_0[qam16_table_offset], sizeof(*txF0));
|
||||||
txF1[5]=qam_table16_1[qam16_table_offset];
|
memcpy(txF1 + 5, &qam_table16_1[qam16_table_offset], sizeof(*txF1));
|
||||||
}
|
}
|
||||||
if(skip_half!=0)
|
if(skip_half!=0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -218,11 +218,11 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB,
|
|||||||
unsigned short rx_power_avg_dB;
|
unsigned short rx_power_avg_dB;
|
||||||
unsigned short rx_power_tot_dB;
|
unsigned short rx_power_tot_dB;
|
||||||
|
|
||||||
double rx_gain = openair0_cfg[0].rx_gain[0];
|
double rx_gain = openair0_cfg[0].rx_gain[0];
|
||||||
double rx_gain_offset = openair0_cfg[0].rx_gain_offset[0];
|
double rx_gain_offset = openair0_cfg[0].rx_gain_offset[0];
|
||||||
PHY_MEASUREMENTS_gNB *meas = &gNB->measurements;
|
PHY_MEASUREMENTS_gNB *meas = &gNB->measurements;
|
||||||
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
||||||
int ch_offset = fp->ofdm_symbol_size * symbol;
|
int ch_offset = fp->ofdm_symbol_size * symbol;
|
||||||
int N_RB_UL = ulsch->harq_process->ulsch_pdu.rb_size;
|
int N_RB_UL = ulsch->harq_process->ulsch_pdu.rb_size;
|
||||||
ulsch_measurements_gNB *ulsch_measurements = &ulsch->ulsch_measurements;
|
ulsch_measurements_gNB *ulsch_measurements = &ulsch->ulsch_measurements;
|
||||||
|
|
||||||
|
|||||||
@@ -408,42 +408,64 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
|
|||||||
|
|
||||||
__m128i *txl = (__m128i *)&tx_layers[nl][m << 1];
|
__m128i *txl = (__m128i *)&tx_layers[nl][m << 1];
|
||||||
__m128i amp64 = _mm_set1_epi16(amp);
|
__m128i amp64 = _mm_set1_epi16(amp);
|
||||||
DevAssert(upper_limit % 4 == 0);
|
int i;
|
||||||
for (int i = 0; i < (upper_limit >> 2); i++) {
|
for (i = 0; i < (upper_limit >> 2); i++) {
|
||||||
const __m128i txL = _mm_loadu_si128(txl + i);
|
const __m128i txL = _mm_loadu_si128(txl + i);
|
||||||
_mm_storeu_si128(txF + i, _mm_mulhrs_epi16(amp64, txL));
|
_mm_storeu_si128(txF + i, _mm_mulhrs_epi16(amp64, txL));
|
||||||
#ifdef DEBUG_DLSCH_MAPPING
|
#ifdef DEBUG_DLSCH_MAPPING
|
||||||
if ((i&1) > 0)
|
if ((i&1) > 0)
|
||||||
printf("m %d\t l %d \t k %d \t txdataF: %d %d\n",
|
printf("m %d\t l %d \t k %d \t txdataF: %d %d\n",
|
||||||
m, l, start_sc+(i>>1), txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + start_sc+(i>>1))<<1)],
|
m,
|
||||||
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + start_sc+(i>>1))<<1) + 1]);
|
l,
|
||||||
|
start_sc + (i >> 1),
|
||||||
|
txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size + start_sc + (i >> 1)) << 1)],
|
||||||
|
txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size + start_sc + (i >> 1)) << 1) + 1]);
|
||||||
#endif
|
#endif
|
||||||
/* handle this, mute RE */
|
/* handle this, mute RE */
|
||||||
/*else {
|
/*else {
|
||||||
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = 0;
|
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = 0;
|
||||||
txdataF_precoding[anl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = 0;
|
txdataF_precoding[anl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = 0;
|
||||||
}*/
|
}*/
|
||||||
} // RE loop, first part
|
}
|
||||||
|
if (i * 4 != upper_limit) {
|
||||||
|
c16_t *txFc = (c16_t *)&txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size + start_sc) << 1)];
|
||||||
|
c16_t *txlc = (c16_t *)&tx_layers[nl][m << 1];
|
||||||
|
for (i = (upper_limit >> 2) << 2; i < upper_limit; i++) {
|
||||||
|
txFc[i].r = ((txlc[i].r * amp) >> 14) + 1;
|
||||||
|
txFc[i].i = ((txlc[i].i * amp) >> 14) + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
m+=upper_limit;
|
m+=upper_limit;
|
||||||
if (remaining_re > 0) {
|
if (remaining_re > 0) {
|
||||||
txF = (__m128i *)&txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size) << 1)];
|
txF = (__m128i *)&txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size) << 1)];
|
||||||
txl = (__m128i *)&tx_layers[nl][m << 1];
|
txl = (__m128i *)&tx_layers[nl][m << 1];
|
||||||
DevAssert(remaining_re % 4 == 0);
|
int i;
|
||||||
for (int i = 0; i < (remaining_re >> 2); i++) {
|
for (i = 0; i < (remaining_re >> 2); i++) {
|
||||||
const __m128i txL = _mm_loadu_si128(txl + i);
|
const __m128i txL = _mm_loadu_si128(txl + i);
|
||||||
_mm_storeu_si128(txF + i, _mm_mulhrs_epi16(amp64, txL));
|
_mm_storeu_si128(txF + i, _mm_mulhrs_epi16(amp64, txL));
|
||||||
#ifdef DEBUG_DLSCH_MAPPING
|
#ifdef DEBUG_DLSCH_MAPPING
|
||||||
if ((i&1) > 0)
|
if ((i & 1) > 0)
|
||||||
printf("m %d\t l %d \t k %d \t txdataF: %d %d\n",
|
printf("m %d\t l %d \t k %d \t txdataF: %d %d\n",
|
||||||
m, l, i>>1, txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + (i>>1))<<1) ],
|
m,
|
||||||
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + (i>>1))<<1) + 1]);
|
l,
|
||||||
|
i >> 1,
|
||||||
|
txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size + (i >> 1)) << 1)],
|
||||||
|
txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size + (i >> 1)) << 1) + 1]);
|
||||||
#endif
|
#endif
|
||||||
/* handle this, mute RE */
|
/* handle this, mute RE */
|
||||||
/*else {
|
/*else {
|
||||||
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = 0;
|
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = 0;
|
||||||
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = 0;
|
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = 0;
|
||||||
}*/
|
}*/
|
||||||
} // RE loop, second part
|
} // RE loop, second part
|
||||||
|
if (i * 4 != remaining_re) {
|
||||||
|
c16_t *txFc = (c16_t *)&txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size) << 1)];
|
||||||
|
c16_t *txlc = (c16_t *)&tx_layers[nl][m << 1];
|
||||||
|
for (i = (remaining_re >> 2) << 2; i < remaining_re; i++) {
|
||||||
|
txFc[i].r = ((txlc[i].r * amp) >> 14) + 1;
|
||||||
|
txFc[i].i = ((txlc[i].i * amp) >> 14) + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
} //
|
} //
|
||||||
m+=remaining_re;
|
m+=remaining_re;
|
||||||
} // N_RB_DL even
|
} // N_RB_DL even
|
||||||
|
|||||||
Reference in New Issue
Block a user