mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-15 13:40:29 +00:00
Compare commits
2 Commits
develop
...
bupt-ulmim
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e678f88e1 | ||
|
|
09163a2873 |
@@ -33,8 +33,8 @@ set ( NAS_ADDRESS_FIX False )
|
||||
set ( NAS_BUILT_IN_UE True)
|
||||
set ( NAS_MME False )
|
||||
set ( NAS_UE True )
|
||||
set ( NB_ANTENNAS_RX "2" )
|
||||
set ( NB_ANTENNAS_TX "2" )
|
||||
set ( NB_ANTENNAS_RX "4" )
|
||||
set ( NB_ANTENNAS_TX "4" )
|
||||
set ( NO_RRM True )
|
||||
set ( OAISIM False )
|
||||
set ( OAI_NW_DRIVER_TYPE_ETHERNET False )
|
||||
|
||||
@@ -33,8 +33,8 @@ set ( NAS_ADDRESS_FIX False )
|
||||
set ( NAS_BUILT_IN_UE True)
|
||||
set ( NAS_MME False )
|
||||
set ( NAS_UE True )
|
||||
set ( NB_ANTENNAS_RX "2" )
|
||||
set ( NB_ANTENNAS_TX "2" )
|
||||
set ( NB_ANTENNAS_RX "4" )
|
||||
set ( NB_ANTENNAS_TX "4" )
|
||||
set ( NO_RRM True )
|
||||
set ( OAISIM True )
|
||||
set ( OAI_NW_DRIVER_TYPE_ETHERNET False )
|
||||
|
||||
19
doc/UL_MIMO.txt
Normal file
19
doc/UL_MIMO.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
# how to build phy sim
|
||||
cd cmake_targets/
|
||||
sudo ./build_oai --phy_simulators -c
|
||||
|
||||
cd phy_simulators/build/
|
||||
# ULSCH sim
|
||||
# bit level validation
|
||||
# PUSCH encoding and decoding for 4 layers 2 CMD without data
|
||||
sudo ./nr_ulschsim -R 106 -m9 -s13 -n100 -y4 -z4 -W4
|
||||
|
||||
# UL sim
|
||||
# Uplink chain validation
|
||||
# PUSCH on UE side and gNB side,whole chain for PUSCH
|
||||
# No channel model on data domain signal
|
||||
# No cross-path connection
|
||||
# PMI = 0 is only unitary prcoding matrix
|
||||
sudo ./nr_ulsim -n100 -m9 -r106 -s13 -W4 -y4 -z4
|
||||
|
||||
|
||||
@@ -297,9 +297,10 @@ typedef struct
|
||||
uint8_t qam_mod_order;
|
||||
uint8_t mcs_index;
|
||||
uint8_t mcs_table;
|
||||
uint8_t transform_precoding;
|
||||
uint8_t transformPrecoder;
|
||||
uint16_t data_scrambling_id;
|
||||
uint8_t nrOfLayers;
|
||||
uint8_t Tpmi;
|
||||
//DMRS
|
||||
uint16_t ul_dmrs_symb_pos;
|
||||
uint8_t dmrs_config_type;
|
||||
|
||||
@@ -1207,9 +1207,10 @@ typedef struct
|
||||
uint8_t qam_mod_order;
|
||||
uint8_t mcs_index;
|
||||
uint8_t mcs_table;
|
||||
uint8_t transform_precoding;
|
||||
uint8_t transformPrecoder;
|
||||
uint16_t data_scrambling_id;
|
||||
uint8_t nrOfLayers;
|
||||
uint8_t Tpmi;
|
||||
//DMRS
|
||||
uint16_t ul_dmrs_symb_pos;
|
||||
uint8_t dmrs_config_type;
|
||||
|
||||
@@ -940,9 +940,10 @@ static uint8_t pack_ul_tti_request_pusch_pdu(nfapi_nr_pusch_pdu_t *pusch_pdu, ui
|
||||
push8(pusch_pdu->qam_mod_order, ppWritePackedMsg, end) &&
|
||||
push8(pusch_pdu->mcs_index, ppWritePackedMsg, end) &&
|
||||
push8(pusch_pdu->mcs_table, ppWritePackedMsg, end) &&
|
||||
push8(pusch_pdu->transform_precoding, ppWritePackedMsg, end) &&
|
||||
push8(pusch_pdu->transformPrecoder, ppWritePackedMsg, end) &&
|
||||
push16(pusch_pdu->data_scrambling_id, ppWritePackedMsg, end) &&
|
||||
push8(pusch_pdu->nrOfLayers, ppWritePackedMsg, end) &&
|
||||
push8(pusch_pdu->Tpmi, ppWritePackedMsg, end) &&
|
||||
push16(pusch_pdu->ul_dmrs_symb_pos, ppWritePackedMsg, end) &&
|
||||
push8(pusch_pdu->dmrs_config_type, ppWritePackedMsg, end) &&
|
||||
push16(pusch_pdu->ul_dmrs_scrambling_id, ppWritePackedMsg, end) &&
|
||||
@@ -4126,9 +4127,10 @@ static uint8_t unpack_ul_tti_request_pusch_pdu(void *tlv, uint8_t **ppReadPacked
|
||||
pull8(ppReadPackedMsg, &pusch_pdu->qam_mod_order, end) &&
|
||||
pull8(ppReadPackedMsg, &pusch_pdu->mcs_index, end) &&
|
||||
pull8(ppReadPackedMsg, &pusch_pdu->mcs_table, end) &&
|
||||
pull8(ppReadPackedMsg, &pusch_pdu->transform_precoding, end) &&
|
||||
pull8(ppReadPackedMsg, &pusch_pdu->transformPrecoder, end) &&
|
||||
pull16(ppReadPackedMsg, &pusch_pdu->data_scrambling_id, end) &&
|
||||
pull8(ppReadPackedMsg, &pusch_pdu->nrOfLayers, end) &&
|
||||
pull8(ppReadPackedMsg, &pusch_pdu->Tpmi, end) &&
|
||||
pull16(ppReadPackedMsg, &pusch_pdu->ul_dmrs_symb_pos, end) &&
|
||||
pull8(ppReadPackedMsg, &pusch_pdu->dmrs_config_type, end) &&
|
||||
pull16(ppReadPackedMsg, &pusch_pdu->ul_dmrs_scrambling_id, end) &&
|
||||
|
||||
@@ -312,6 +312,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
||||
pusch_vars[ULSCH_id]->ul_ch_mag = (int32_t **)malloc16(n_buf*sizeof(int32_t *) );
|
||||
pusch_vars[ULSCH_id]->ul_ch_magb = (int32_t **)malloc16(n_buf*sizeof(int32_t *) );
|
||||
pusch_vars[ULSCH_id]->rho = (int32_t **)malloc16_clear(n_buf*sizeof(int32_t*) );
|
||||
pusch_vars[ULSCH_id]->llr_layers = (int16_t **)malloc16(max_ul_mimo_layers*sizeof(int32_t *) );
|
||||
|
||||
for (i=0; i<Prx; i++) {
|
||||
pusch_vars[ULSCH_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*N_RB_UL*12*fp->symbols_per_slot );
|
||||
@@ -331,6 +332,11 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
||||
pusch_vars[ULSCH_id]->ul_ch_magb[i] = (int32_t *)malloc16_clear( fp->symbols_per_slot*sizeof(int32_t)*N_RB_UL*12 );
|
||||
pusch_vars[ULSCH_id]->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(fp->N_RB_UL*12*7*2) );
|
||||
}
|
||||
|
||||
for (i=0; i< max_ul_mimo_layers; i++)
|
||||
{
|
||||
pusch_vars[ULSCH_id]->llr_layers[i] = (int16_t *)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) ); // [hna] 6144 is LTE and (8*((3*8*6144)+12)) is not clear
|
||||
}
|
||||
pusch_vars[ULSCH_id]->llr = (int16_t *)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) ); // [hna] 6144 is LTE and (8*((3*8*6144)+12)) is not clear
|
||||
pusch_vars[ULSCH_id]->ul_valid_re_per_slot = (int16_t *)malloc16_clear( sizeof(int16_t)*fp->symbols_per_slot);
|
||||
} //ulsch_id
|
||||
|
||||
@@ -125,6 +125,7 @@ void phy_init_nr_ue_PUSCH(NR_UE_PUSCH *const pusch,
|
||||
|
||||
for (int i=0; i<NR_MAX_NB_LAYERS; i++) {
|
||||
pusch->txdataF_layers[i] = (int32_t *)malloc16_clear((NR_MAX_PUSCH_ENCODED_LENGTH)*sizeof(int32_t *));
|
||||
pusch->txdataF_precoding[i] = (int32_t *)malloc16_clear((NR_MAX_PUSCH_ENCODED_LENGTH)*sizeof(int32_t *));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
fr = filt8_r1;
|
||||
fmm = filt8_mm1;
|
||||
fml = filt8_ml1;
|
||||
fmr = filt8_m1;
|
||||
fmr = filt8_mm1;
|
||||
fdcl = filt8_dcl1;
|
||||
fdcr = filt8_dcr1;
|
||||
fdclh = filt8_dcl1_h;
|
||||
@@ -129,9 +129,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
|
||||
//------------------generate DMRS------------------//
|
||||
|
||||
// transform precoding = 1 means disabled
|
||||
if (pusch_pdu->transform_precoding == 1) {
|
||||
nr_pusch_dmrs_rx(gNB, Ns, gNB->nr_gold_pusch_dmrs[pusch_pdu->scid][Ns][symbol], &pilot[0], 1000, 0, nb_rb_pusch,
|
||||
if (pusch_pdu->transformPrecoder == transformPrecoder_disabled) {
|
||||
nr_pusch_dmrs_rx(gNB, Ns, gNB->nr_gold_pusch_dmrs[pusch_pdu->scid][Ns][symbol], &pilot[0], (1000+p), 0, nb_rb_pusch,
|
||||
(pusch_pdu->bwp_start + pusch_pdu->rb_start)*NR_NB_SC_PER_RB, pusch_pdu->dmrs_config_type);
|
||||
}
|
||||
else { // if transform precoding or SC-FDMA is enabled in Uplink
|
||||
@@ -167,7 +166,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (aarx=0; aarx<gNB->frame_parms.nb_antennas_rx; aarx++) {
|
||||
for (aarx=0; aarx<gNB->frame_parms.nb_antennas_rx; aarx++)
|
||||
{
|
||||
|
||||
re_offset = k; /* Initializing the Resource element offset for each Rx antenna */
|
||||
|
||||
@@ -282,7 +282,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
|
||||
ul_ch+=8;
|
||||
|
||||
for (pilot_cnt=3; pilot_cnt<(6*nb_rb_pusch-3); pilot_cnt+=2) {
|
||||
for (pilot_cnt=3; pilot_cnt<(6*nb_rb_pusch-3); pilot_cnt+=2)
|
||||
{
|
||||
|
||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||
@@ -291,7 +292,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
printf("pilot %u : rxF - > (%d,%d) (%d) ch -> (%d,%d) (%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],dBc(rxF[0],rxF[1]),ch[0],ch[1],dBc(ch[0],ch[1]),pil[0],pil[1]);
|
||||
printf("data %u : rxF - > (%d,%d) (%d)\n",pilot_cnt,rxF[2],rxF[3],dBc(rxF[2],rxF[3]));
|
||||
#endif
|
||||
multadd_real_vector_complex_scalar(fml,
|
||||
multadd_real_vector_complex_scalar(fm,
|
||||
ch,
|
||||
ul_ch,
|
||||
8);
|
||||
@@ -343,11 +344,11 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
|
||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||
#ifdef DEBUG_PUSCH
|
||||
#ifdef DEBUG_PUSCH
|
||||
printf("ch 0 %d\n",((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1]));
|
||||
printf("pilot %u : rxF - > (%d,%d) (%d) ch -> (%d,%d) (%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],dBc(rxF[0],rxF[1]),ch[0],ch[1],dBc(ch[0],ch[1]),pil[0],pil[1]);
|
||||
printf("data %u : rxF - > (%d,%d) (%d)\n",pilot_cnt+1,rxF[2],rxF[3],dBc(rxF[2],rxF[3]));
|
||||
#endif
|
||||
#endif
|
||||
multadd_real_vector_complex_scalar(fmr,
|
||||
ch,
|
||||
ul_ch,
|
||||
@@ -360,10 +361,10 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
|
||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||
#ifdef DEBUG_PUSCH
|
||||
#ifdef DEBUG_PUSCH
|
||||
printf("pilot %u: rxF - > (%d,%d) (%d) ch -> (%d,%d) (%d), pil -> (%d,%d) \n",pilot_cnt+2,rxF[0],rxF[1],dBc(rxF[0],rxF[1]),ch[0],ch[1],dBc(ch[0],ch[1]),pil[0],pil[1]);
|
||||
printf("data %u : rxF - > (%d,%d) (%d)\n",pilot_cnt+2,rxF[2],rxF[3],dBc(rxF[2],rxF[3]));
|
||||
#endif
|
||||
#endif
|
||||
multadd_real_vector_complex_scalar(fr,
|
||||
ch,
|
||||
ul_ch,
|
||||
@@ -371,7 +372,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
|
||||
|
||||
// check if PRB crosses DC and improve estimates around DC
|
||||
if ((bwp_start_subcarrier < gNB->frame_parms.ofdm_symbol_size) && (bwp_start_subcarrier+nb_rb_pusch*12 >= gNB->frame_parms.ofdm_symbol_size)) {
|
||||
if ((bwp_start_subcarrier < gNB->frame_parms.ofdm_symbol_size) && (bwp_start_subcarrier+nb_rb_pusch*12 >= gNB->frame_parms.ofdm_symbol_size))
|
||||
{
|
||||
ul_ch = (int16_t *)&ul_ch_estimates[p*gNB->frame_parms.nb_antennas_rx+aarx][ch_offset];
|
||||
uint16_t idxDC = 2*(gNB->frame_parms.ofdm_symbol_size - bwp_start_subcarrier);
|
||||
uint16_t idxPil = idxDC/2;
|
||||
@@ -386,7 +388,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||
|
||||
// for proper allignment of SIMD vectors
|
||||
if((gNB->frame_parms.N_RB_UL&1)==0) {
|
||||
if((gNB->frame_parms.N_RB_UL&1)==0)
|
||||
{
|
||||
|
||||
multadd_real_vector_complex_scalar(fdcl,
|
||||
ch,
|
||||
@@ -404,7 +407,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
ul_ch-4,
|
||||
8);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
multadd_real_vector_complex_scalar(fdclh,
|
||||
ch,
|
||||
ul_ch,
|
||||
@@ -422,7 +426,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
8);
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG_PUSCH
|
||||
#ifdef DEBUG_PUSCH
|
||||
ul_ch = (int16_t *)&ul_ch_estimates[p*gNB->frame_parms.nb_antennas_rx+aarx][ch_offset];
|
||||
for(uint16_t idxP=0; idxP<ceil((float)nb_rb_pusch*12/8); idxP++) {
|
||||
for(uint8_t idxI=0; idxI<16; idxI+=2) {
|
||||
@@ -430,9 +434,10 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
}
|
||||
printf("%d\n",idxP);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else { //pusch_dmrs_type2 |p_r,p_l,d,d,d,d,p_r,p_l,d,d,d,d|
|
||||
else
|
||||
{ //pusch_dmrs_type2 |p_r,p_l,d,d,d,d,p_r,p_l,d,d,d,d|
|
||||
|
||||
// Treat first DMRS specially (left edge)
|
||||
|
||||
@@ -575,7 +580,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
(int16_t*) ul_ch_estimates_time[aarx],
|
||||
1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -138,18 +138,19 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
@param nb_rb_pusch The number of RBs allocated (used for Resource Allocation Type 1 in NR)
|
||||
@param frame_parms, Pointer to frame descriptor structure
|
||||
*/
|
||||
void nr_ulsch_extract_rbs_single(int32_t **rxdataF,
|
||||
NR_gNB_PUSCH *pusch_vars,
|
||||
unsigned char symbol,
|
||||
uint8_t is_dmrs_symbol,
|
||||
nfapi_nr_pusch_pdu_t *pusch_pdu,
|
||||
NR_DL_FRAME_PARMS *frame_parms);
|
||||
void nr_ulsch_extract_rbs(int32_t **rxdataF,
|
||||
NR_gNB_PUSCH *pusch_vars,
|
||||
unsigned char symbol,
|
||||
uint8_t is_dmrs_symbol,
|
||||
nfapi_nr_pusch_pdu_t *pusch_pdu,
|
||||
NR_DL_FRAME_PARMS *frame_parms);
|
||||
|
||||
void nr_ulsch_scale_channel(int32_t **ul_ch_estimates_ext,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
NR_gNB_ULSCH_t **ulsch_gNB,
|
||||
uint8_t symbol,
|
||||
uint8_t start_symbol,
|
||||
uint8_t nrOfLayers,
|
||||
uint16_t nb_rb,
|
||||
pusch_dmrs_type_t pusch_dmrs_type);
|
||||
|
||||
@@ -255,8 +256,8 @@ void nr_ulsch_64qam_llr(int32_t *rxdataF_comp,
|
||||
@param mod_order modulation order
|
||||
*/
|
||||
void nr_ulsch_compute_llr(int32_t *rxdataF_comp,
|
||||
int32_t **ul_ch_mag,
|
||||
int32_t **ul_ch_magb,
|
||||
int32_t *ul_ch_mag,
|
||||
int32_t *ul_ch_magb,
|
||||
int16_t *ulsch_llr,
|
||||
uint32_t nb_rb,
|
||||
uint32_t nb_re,
|
||||
|
||||
@@ -137,6 +137,38 @@ void nr_ulsch_unscrambling_optim(int16_t* llr,
|
||||
#endif
|
||||
}
|
||||
|
||||
void nr_ulsch_layer_demapping(int16_t *llr_cw,
|
||||
uint8_t Nl,
|
||||
uint8_t mod_order,
|
||||
uint32_t length,
|
||||
int16_t **llr_layers)
|
||||
{
|
||||
|
||||
switch (Nl) {
|
||||
|
||||
case 1:
|
||||
memcpy((void*)llr_cw, (void*)llr_layers[0], (length)*sizeof(int16_t));
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
for (int i=0; i<(length/Nl/mod_order); i++)
|
||||
{
|
||||
for (int l=0; l<Nl; l++)
|
||||
{
|
||||
for (int m=0; m<mod_order; m++){
|
||||
llr_cw[i*Nl*mod_order+l*mod_order+m] = llr_layers[l][i*mod_order+m];
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Not supported number of layers %d\n", Nl);
|
||||
}
|
||||
}
|
||||
|
||||
#define STATSTRLEN 16384
|
||||
void dump_pusch_stats(FILE *fd,PHY_VARS_gNB *gNB) {
|
||||
|
||||
|
||||
@@ -82,6 +82,12 @@ void nr_ulsch_unscrambling_optim(int16_t* llr,
|
||||
uint32_t Nid,
|
||||
uint32_t n_RNTI);
|
||||
|
||||
void nr_ulsch_layer_demapping(int16_t *llr_cw,
|
||||
uint8_t Nl,
|
||||
uint8_t mod_order,
|
||||
uint32_t length,
|
||||
int16_t **llr_layers);
|
||||
|
||||
void nr_ulsch_procedures(PHY_VARS_gNB *gNB,
|
||||
int frame_rx,
|
||||
int slot_rx,
|
||||
|
||||
@@ -302,24 +302,24 @@ void nr_idft(int32_t *z, uint32_t Msc_PUSCH)
|
||||
}
|
||||
|
||||
|
||||
void nr_ulsch_extract_rbs_single(int32_t **rxdataF,
|
||||
NR_gNB_PUSCH *pusch_vars,
|
||||
unsigned char symbol,
|
||||
uint8_t is_dmrs_symbol,
|
||||
nfapi_nr_pusch_pdu_t *pusch_pdu,
|
||||
NR_DL_FRAME_PARMS *frame_parms)
|
||||
void nr_ulsch_extract_rbs(int32_t **rxdataF,
|
||||
NR_gNB_PUSCH *pusch_vars,
|
||||
unsigned char symbol,
|
||||
uint8_t is_dmrs_symbol,
|
||||
nfapi_nr_pusch_pdu_t *pusch_pdu,
|
||||
NR_DL_FRAME_PARMS *frame_parms)
|
||||
{
|
||||
|
||||
unsigned short start_re, re, nb_re_pusch;
|
||||
unsigned char aarx;
|
||||
unsigned char aarx, aatx;
|
||||
uint32_t rxF_ext_index = 0;
|
||||
uint32_t ul_ch0_ext_index = 0;
|
||||
uint32_t ul_ch0_index = 0;
|
||||
uint8_t k_prime;
|
||||
uint16_t n;
|
||||
//uint8_t k_prime;
|
||||
//uint16_t n;
|
||||
int16_t *rxF,*rxF_ext;
|
||||
int *ul_ch0,*ul_ch0_ext;
|
||||
uint8_t delta = 0;
|
||||
//uint8_t delta = 0;
|
||||
|
||||
#ifdef DEBUG_RB_EXT
|
||||
|
||||
@@ -328,7 +328,7 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF,
|
||||
|
||||
#endif
|
||||
|
||||
uint8_t is_dmrs_re;
|
||||
uint8_t is_data_re;
|
||||
start_re = (frame_parms->first_carrier_offset + (pusch_pdu->rb_start + pusch_pdu->bwp_start) * NR_NB_SC_PER_RB)%frame_parms->ofdm_symbol_size;
|
||||
nb_re_pusch = NR_NB_SC_PER_RB * pusch_pdu->rb_size;
|
||||
#ifdef __AVX2__
|
||||
@@ -337,64 +337,97 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF,
|
||||
int nb_re_pusch2 = nb_re_pusch;
|
||||
#endif
|
||||
|
||||
for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
|
||||
for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++)
|
||||
{
|
||||
|
||||
rxF = (int16_t *)&rxdataF[aarx][symbol * frame_parms->ofdm_symbol_size];
|
||||
rxF_ext = (int16_t *)&pusch_vars->rxdataF_ext[aarx][symbol * nb_re_pusch2]; // [hna] rxdataF_ext isn't contiguous in order to solve an alignment problem ib llr computation in case of mod_order = 4, 6
|
||||
|
||||
ul_ch0 = &pusch_vars->ul_ch_estimates[aarx][pusch_vars->dmrs_symbol*frame_parms->ofdm_symbol_size]; // update channel estimates if new dmrs symbol are available
|
||||
|
||||
ul_ch0_ext = &pusch_vars->ul_ch_estimates_ext[aarx][symbol*nb_re_pusch2];
|
||||
|
||||
n = 0;
|
||||
k_prime = 0;
|
||||
rxF_ext_index = 0;
|
||||
ul_ch0_ext_index = 0;
|
||||
ul_ch0_index = 0;
|
||||
|
||||
if (is_dmrs_symbol == 0) {
|
||||
|
||||
if (is_dmrs_symbol == 0)
|
||||
{
|
||||
//
|
||||
//rxF[ ((start_re + re)*2) % (frame_parms->ofdm_symbol_size*2)]);
|
||||
if (start_re + nb_re_pusch < frame_parms->ofdm_symbol_size) {
|
||||
if (start_re + nb_re_pusch < frame_parms->ofdm_symbol_size)
|
||||
{
|
||||
memcpy1((void*)rxF_ext,
|
||||
(void*)&rxF[start_re*2],
|
||||
nb_re_pusch*sizeof(int32_t));
|
||||
} else {
|
||||
int neg_length = frame_parms->ofdm_symbol_size-start_re;
|
||||
int pos_length = nb_re_pusch-neg_length;
|
||||
|
||||
memcpy1((void*)rxF_ext,(void*)&rxF[start_re*2],neg_length*sizeof(int32_t));
|
||||
memcpy1((void*)&rxF_ext[2*neg_length],(void*)rxF,pos_length*sizeof(int32_t));
|
||||
}
|
||||
else
|
||||
{
|
||||
int neg_length = frame_parms->ofdm_symbol_size-start_re;
|
||||
int pos_length = nb_re_pusch-neg_length;
|
||||
memcpy1((void*)rxF_ext,(void*)&rxF[start_re*2],neg_length*sizeof(int32_t));
|
||||
memcpy1((void*)&rxF_ext[2*neg_length],(void*)rxF,pos_length*sizeof(int32_t));
|
||||
}
|
||||
|
||||
#ifdef SUPPORT_PMI_MATRIC
|
||||
for (aatx = 0; aatx < pusch_pdu->nrOfLayers; aatx++)
|
||||
#else
|
||||
aatx = aarx;
|
||||
#endif
|
||||
{
|
||||
ul_ch0 = &pusch_vars->ul_ch_estimates[aatx*frame_parms->nb_antennas_rx+aarx][pusch_vars->dmrs_symbol*frame_parms->ofdm_symbol_size]; // update channel estimates if new dmrs symbol are available
|
||||
ul_ch0_ext = &pusch_vars->ul_ch_estimates_ext[aatx*frame_parms->nb_antennas_rx+aarx][symbol*nb_re_pusch2];
|
||||
|
||||
memcpy1((void*)ul_ch0_ext,(void*)ul_ch0,nb_re_pusch*sizeof(int32_t));
|
||||
}
|
||||
memcpy1((void*)ul_ch0_ext,(void*)ul_ch0,nb_re_pusch*sizeof(int32_t));
|
||||
}
|
||||
else {
|
||||
for (re = 0; re < nb_re_pusch; re++) {
|
||||
else
|
||||
{
|
||||
#ifdef SUPPORT_PMI_MATRIC
|
||||
for (aatx = 0; aatx < pusch_pdu->nrOfLayers; aatx++)
|
||||
#else
|
||||
aatx = aarx;
|
||||
#endif
|
||||
{
|
||||
ul_ch0 = &pusch_vars->ul_ch_estimates[aatx*frame_parms->nb_antennas_rx+aarx][pusch_vars->dmrs_symbol*frame_parms->ofdm_symbol_size]; // update channel estimates if new dmrs symbol are available
|
||||
ul_ch0_ext = &pusch_vars->ul_ch_estimates_ext[aatx*frame_parms->nb_antennas_rx+aarx][symbol*nb_re_pusch2];
|
||||
|
||||
is_dmrs_re = (re == get_dmrs_freq_idx_ul(n, k_prime, delta, pusch_pdu->dmrs_config_type));
|
||||
//n = 0;
|
||||
//k_prime = 0;
|
||||
rxF_ext_index = 0;
|
||||
ul_ch0_ext_index = 0;
|
||||
ul_ch0_index = 0;
|
||||
|
||||
for (re = 0; re < nb_re_pusch; re++)
|
||||
{
|
||||
uint16_t k= start_re+re;
|
||||
|
||||
is_data_re = allowed_xlsch_re_in_dmrs_symbol(k, start_re, frame_parms->ofdm_symbol_size, pusch_pdu->num_dmrs_cdm_grps_no_data, pusch_pdu->dmrs_config_type);
|
||||
|
||||
if (++k >= frame_parms->ofdm_symbol_size)
|
||||
{
|
||||
k -= frame_parms->ofdm_symbol_size;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_RB_EXT
|
||||
printf("re = %d, kprime %d, n %d, is_dmrs_symbol = %d, symbol = %d\n", re, k_prime, n, is_dmrs_symbol, symbol);
|
||||
#endif
|
||||
#ifdef DEBUG_RB_EXT
|
||||
printf("re = %d, kprime %d, n %d, is_dmrs_symbol = %d, symbol = %d\n", re, k_prime, n, is_dmrs_symbol, symbol);
|
||||
#endif
|
||||
|
||||
/* save only data and respective channel estimates */
|
||||
if (is_dmrs_re == 0) {
|
||||
rxF_ext[rxF_ext_index] = (rxF[ ((start_re + re)*2) % (frame_parms->ofdm_symbol_size*2)]);
|
||||
rxF_ext[rxF_ext_index + 1] = (rxF[(((start_re + re)*2) + 1) % (frame_parms->ofdm_symbol_size*2)]);
|
||||
ul_ch0_ext[ul_ch0_ext_index] = ul_ch0[ul_ch0_index];
|
||||
/* save only data and respective channel estimates */
|
||||
if (is_data_re == 1)
|
||||
{
|
||||
#ifdef SUPPORT_PMI_MATRIC
|
||||
if (aatx ==0)
|
||||
#endif
|
||||
{
|
||||
rxF_ext[rxF_ext_index] = (rxF[ ((start_re + re)*2) % (frame_parms->ofdm_symbol_size*2)]);
|
||||
rxF_ext[rxF_ext_index + 1] = (rxF[(((start_re + re)*2) + 1) % (frame_parms->ofdm_symbol_size*2)]);
|
||||
rxF_ext_index +=2;
|
||||
}
|
||||
|
||||
ul_ch0_ext[ul_ch0_ext_index] = ul_ch0[ul_ch0_index];
|
||||
ul_ch0_ext_index++;
|
||||
|
||||
#ifdef DEBUG_RB_EXT
|
||||
printf("dmrs symb %d: rxF_ext[%d] = (%d,%d), ul_ch0_ext[%d] = (%d,%d)\n",
|
||||
#ifdef DEBUG_RB_EXT
|
||||
printf("dmrs symb %d: rxF_ext[%d] = (%d,%d), ul_ch0_ext[%d] = (%d,%d)\n",
|
||||
is_dmrs_symbol,rxF_ext_index>>1, rxF_ext[rxF_ext_index],rxF_ext[rxF_ext_index+1],
|
||||
ul_ch0_ext_index, ((int16_t*)&ul_ch0_ext[ul_ch0_ext_index])[0], ((int16_t*)&ul_ch0_ext[ul_ch0_ext_index])[1]);
|
||||
#endif
|
||||
ul_ch0_ext_index++;
|
||||
rxF_ext_index +=2;
|
||||
} else {
|
||||
n += k_prime;
|
||||
k_prime ^= 1;
|
||||
#endif
|
||||
}
|
||||
ul_ch0_index++;
|
||||
}
|
||||
ul_ch0_index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -405,6 +438,7 @@ void nr_ulsch_scale_channel(int **ul_ch_estimates_ext,
|
||||
NR_gNB_ULSCH_t **ulsch_gNB,
|
||||
uint8_t symbol,
|
||||
uint8_t is_dmrs_symbol,
|
||||
uint8_t nrOfLayers,
|
||||
unsigned short nb_rb,
|
||||
pusch_dmrs_type_t pusch_dmrs_type)
|
||||
{
|
||||
@@ -412,7 +446,7 @@ void nr_ulsch_scale_channel(int **ul_ch_estimates_ext,
|
||||
#if defined(__x86_64__)||defined(__i386__)
|
||||
|
||||
short rb, ch_amp;
|
||||
unsigned char aarx;
|
||||
unsigned char aarx,aatx;
|
||||
__m128i *ul_ch128, ch_amp128;
|
||||
|
||||
// Determine scaling amplitude based the symbol
|
||||
@@ -430,9 +464,11 @@ void nr_ulsch_scale_channel(int **ul_ch_estimates_ext,
|
||||
int off = 0;
|
||||
#endif
|
||||
|
||||
for (aarx=0; aarx < frame_parms->nb_antennas_rx; aarx++) {
|
||||
|
||||
ul_ch128 = (__m128i *)&ul_ch_estimates_ext[aarx][symbol*(off+(nb_rb*NR_NB_SC_PER_RB))];
|
||||
for (aatx = 0; aatx < nrOfLayers; aatx++)
|
||||
{
|
||||
for (aarx=0; aarx < frame_parms->nb_antennas_rx; aarx++)
|
||||
{
|
||||
ul_ch128 = (__m128i *)&ul_ch_estimates_ext[aatx*frame_parms->nb_antennas_rx+aarx][symbol*(off+(nb_rb*NR_NB_SC_PER_RB))];
|
||||
|
||||
if (is_dmrs_symbol==1){
|
||||
if (pusch_dmrs_type == pusch_dmrs_type1)
|
||||
@@ -441,24 +477,28 @@ void nr_ulsch_scale_channel(int **ul_ch_estimates_ext,
|
||||
nb_rb = (2*nb_rb)/3;
|
||||
}
|
||||
|
||||
for (rb=0;rb<nb_rb;rb++) {
|
||||
|
||||
for (rb=0;rb<nb_rb;rb++)
|
||||
{
|
||||
ul_ch128[0] = _mm_mulhi_epi16(ul_ch128[0], ch_amp128);
|
||||
ul_ch128[0] = _mm_slli_epi16(ul_ch128[0], 3);
|
||||
|
||||
ul_ch128[1] = _mm_mulhi_epi16(ul_ch128[1], ch_amp128);
|
||||
ul_ch128[1] = _mm_slli_epi16(ul_ch128[1], 3);
|
||||
|
||||
if (is_dmrs_symbol) {
|
||||
if (is_dmrs_symbol)
|
||||
{
|
||||
ul_ch128+=2;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
ul_ch128[2] = _mm_mulhi_epi16(ul_ch128[2], ch_amp128);
|
||||
ul_ch128[2] = _mm_slli_epi16(ul_ch128[2], 3);
|
||||
ul_ch128+=3;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -488,7 +528,9 @@ void nr_ulsch_channel_level(int **ul_ch_estimates_ext,
|
||||
#endif
|
||||
|
||||
for (aatx = 0; aatx < nrOfLayers; aatx++)
|
||||
for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
|
||||
{
|
||||
for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++)
|
||||
{
|
||||
//clear average level
|
||||
avg128U = _mm_setzero_si128();
|
||||
|
||||
@@ -507,7 +549,8 @@ void nr_ulsch_channel_level(int **ul_ch_estimates_ext,
|
||||
((int32_t*)&avg128U)[3]) / y;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
@@ -633,19 +676,23 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext,
|
||||
__m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128={0},QAM_amp128b={0};
|
||||
QAM_amp128b = _mm_setzero_si128();
|
||||
|
||||
for (aatx=0; aatx<nrOfLayers; aatx++) {
|
||||
|
||||
if (mod_order == 4) {
|
||||
for (aatx=0; aatx<nrOfLayers; aatx++)
|
||||
{
|
||||
if (mod_order == 4)
|
||||
{
|
||||
QAM_amp128 = _mm_set1_epi16(QAM16_n1); // 2/sqrt(10)
|
||||
QAM_amp128b = _mm_setzero_si128();
|
||||
} else if (mod_order == 6) {
|
||||
}
|
||||
else if (mod_order == 6)
|
||||
{
|
||||
QAM_amp128 = _mm_set1_epi16(QAM64_n1); //
|
||||
QAM_amp128b = _mm_set1_epi16(QAM64_n2);
|
||||
}
|
||||
|
||||
// printf("comp: rxdataF_comp %p, symbol %d\n",rxdataF_comp[0],symbol);
|
||||
|
||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++)
|
||||
{
|
||||
|
||||
ul_ch128 = (__m128i *)&ul_ch_estimates_ext[aatx*frame_parms->nb_antennas_rx+aarx][symbol*(off+(nb_rb*12))];
|
||||
ul_ch_mag128 = (__m128i *)&ul_ch_mag[aatx*frame_parms->nb_antennas_rx+aarx][symbol*(off+(nb_rb*12))];
|
||||
@@ -654,8 +701,10 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext,
|
||||
rxdataF_comp128 = (__m128i *)&rxdataF_comp[aatx*frame_parms->nb_antennas_rx+aarx][symbol*(off+(nb_rb*12))];
|
||||
|
||||
|
||||
for (rb=0; rb<nb_rb; rb++) {
|
||||
if (mod_order>2) {
|
||||
for (rb=0; rb<nb_rb; rb++)
|
||||
{
|
||||
if (mod_order>2)
|
||||
{
|
||||
// get channel amplitude if not QPSK
|
||||
|
||||
//print_shorts("ch:",(int16_t*)&ul_ch128[0]);
|
||||
@@ -1100,11 +1149,12 @@ void nr_ulsch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms,
|
||||
int32_t **rxdataF_comp,
|
||||
int32_t **ul_ch_mag,
|
||||
int32_t **ul_ch_magb,
|
||||
uint8_t nrOfLayers,
|
||||
uint8_t symbol,
|
||||
uint16_t nb_rb) {
|
||||
int n_rx = frame_parms->nb_antennas_rx;
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i *rxdataF_comp128[1+n_rx],*ul_ch_mag128[1+n_rx],*ul_ch_mag128b[1+n_rx];
|
||||
__m128i *rxdataF_comp128[2],*ul_ch_mag128[2],*ul_ch_mag128b[2];
|
||||
#elif defined(__arm__)
|
||||
int16x8_t *rxdataF_comp128_0,*ul_ch_mag128_0,*ul_ch_mag128_0b;
|
||||
int16x8_t *rxdataF_comp128_1,*ul_ch_mag128_1,*ul_ch_mag128_1b;
|
||||
@@ -1117,23 +1167,34 @@ void nr_ulsch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms,
|
||||
int off = 0;
|
||||
#endif
|
||||
|
||||
if (frame_parms->nb_antennas_rx>1) {
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
int nb_re = nb_rb*12;
|
||||
for (int aa=0;aa<frame_parms->nb_antennas_rx;aa++) {
|
||||
rxdataF_comp128[aa] = (__m128i *)&rxdataF_comp[aa][(symbol*(nb_re + off))];
|
||||
ul_ch_mag128[aa] = (__m128i *)&ul_ch_mag[aa][(symbol*(nb_re + off))];
|
||||
ul_ch_mag128b[aa] = (__m128i *)&ul_ch_magb[aa][(symbol*(nb_re + off))];
|
||||
if (n_rx > 1)
|
||||
{
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
for (int aatx=0; aatx<nrOfLayers; aatx++)
|
||||
{
|
||||
int nb_re = nb_rb*12;
|
||||
|
||||
rxdataF_comp128[0] = (__m128i *)&rxdataF_comp[aatx*frame_parms->nb_antennas_rx][(symbol*(nb_re + off))];
|
||||
ul_ch_mag128[0] = (__m128i *)&ul_ch_mag[aatx*frame_parms->nb_antennas_rx][(symbol*(nb_re + off))];
|
||||
ul_ch_mag128b[0] = (__m128i *)&ul_ch_magb[aatx*frame_parms->nb_antennas_rx][(symbol*(nb_re + off))];
|
||||
|
||||
for (int aa=1;aa<frame_parms->nb_antennas_rx;aa++)
|
||||
{
|
||||
rxdataF_comp128[1] = (__m128i *)&rxdataF_comp[aatx*frame_parms->nb_antennas_rx+aa][(symbol*(nb_re + off))];
|
||||
ul_ch_mag128[1] = (__m128i *)&ul_ch_mag[aatx*frame_parms->nb_antennas_rx+aa][(symbol*(nb_re + off))];
|
||||
ul_ch_mag128b[1] = (__m128i *)&ul_ch_magb[aatx*frame_parms->nb_antennas_rx+aa][(symbol*(nb_re + off))];
|
||||
|
||||
// MRC on each re of rb, both on MF output and magnitude (for 16QAM/64QAM llr computation)
|
||||
for (i=0; i<nb_rb*3; i++) {
|
||||
rxdataF_comp128[0][i] = _mm_adds_epi16(_mm_srai_epi16(rxdataF_comp128[aa][i],1),_mm_srai_epi16(rxdataF_comp128[aa][i],1));
|
||||
ul_ch_mag128[0][i] = _mm_adds_epi16(_mm_srai_epi16(ul_ch_mag128[aa][i],1),_mm_srai_epi16(ul_ch_mag128[aa][i],1));
|
||||
ul_ch_mag128b[0][i] = _mm_adds_epi16(_mm_srai_epi16(ul_ch_mag128b[aa][i],1),_mm_srai_epi16(ul_ch_mag128b[aa][i],1));
|
||||
// rxdataF_comp128[0][i] = _mm_add_epi16(rxdataF_comp128_0[i],(*(__m128i *)&jitterc[0]));
|
||||
// MRC on each re of rb, both on MF output and magnitude (for 16QAM/64QAM llr computation)
|
||||
for (i=0; i<nb_rb*3; i++)
|
||||
{
|
||||
rxdataF_comp128[0][i] = _mm_adds_epi16(rxdataF_comp128[0][i],rxdataF_comp128[1][i]);
|
||||
ul_ch_mag128[0][i] = _mm_adds_epi16(ul_ch_mag128[0][i],ul_ch_mag128[1][i]);
|
||||
ul_ch_mag128b[0][i] = _mm_adds_epi16(ul_ch_mag128b[0][i],ul_ch_mag128b[1][i]);
|
||||
//rxdataF_comp128[0][i] = _mm_add_epi16(rxdataF_comp128_0[i],(*(__m128i *)&jitterc[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
#elif defined(__arm__)
|
||||
#elif defined(__arm__)
|
||||
rxdataF_comp128_0 = (int16x8_t *)&rxdataF_comp[0][symbol*frame_parms->N_RB_DL*12];
|
||||
rxdataF_comp128_1 = (int16x8_t *)&rxdataF_comp[1][symbol*frame_parms->N_RB_DL*12];
|
||||
ul_ch_mag128_0 = (int16x8_t *)&ul_ch_mag[0][symbol*frame_parms->N_RB_DL*12];
|
||||
@@ -1148,7 +1209,7 @@ void nr_ulsch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms,
|
||||
ul_ch_mag128_0b[i] = vhaddq_s16(ul_ch_mag128_0b[i],ul_ch_mag128_1b[i]);
|
||||
rxdataF_comp128_0[i] = vqaddq_s16(rxdataF_comp128_0[i],(*(int16x8_t *)&jitterc[0]));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
@@ -1183,14 +1244,19 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
//--------------------- Channel estimation ---------------------
|
||||
//----------------------------------------------------------
|
||||
start_meas(&gNB->ulsch_channel_estimation_stats);
|
||||
for(uint8_t symbol = rel15_ul->start_symbol_index; symbol < (rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols); symbol++) {
|
||||
for(uint8_t symbol = rel15_ul->start_symbol_index; symbol < (rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols); symbol++)
|
||||
{
|
||||
uint8_t dmrs_symbol_flag = (rel15_ul->ul_dmrs_symb_pos >> symbol) & 0x01;
|
||||
LOG_D(PHY, "symbol %d, dmrs_symbol_flag :%d\n", symbol, dmrs_symbol_flag);
|
||||
if (dmrs_symbol_flag == 1) {
|
||||
|
||||
if (dmrs_symbol_flag == 1)
|
||||
{
|
||||
if (gNB->pusch_vars[ulsch_id]->dmrs_symbol == INVALID_VALUE)
|
||||
gNB->pusch_vars[ulsch_id]->dmrs_symbol = symbol;
|
||||
|
||||
for (int nl=0; nl<rel15_ul->nrOfLayers; nl++)
|
||||
{
|
||||
|
||||
nr_pusch_channel_estimation(gNB,
|
||||
slot,
|
||||
get_dmrs_port(nl,rel15_ul->dmrs_ports),
|
||||
@@ -1198,6 +1264,7 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
ulsch_id,
|
||||
bwp_start_subcarrier,
|
||||
rel15_ul);
|
||||
}
|
||||
|
||||
nr_gnb_measurements(gNB, ulsch_id, harq_pid, symbol,rel15_ul->nrOfLayers);
|
||||
|
||||
@@ -1206,9 +1273,15 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
gNB->pusch_vars[ulsch_id]->ulsch_power[aarx] = 0;
|
||||
gNB->pusch_vars[ulsch_id]->ulsch_noise_power[aarx] = 0;
|
||||
}
|
||||
gNB->pusch_vars[ulsch_id]->ulsch_power[aarx] += signal_energy_nodc(
|
||||
&gNB->pusch_vars[ulsch_id]->ul_ch_estimates[aarx][symbol * frame_parms->ofdm_symbol_size],
|
||||
aatx = aarx;
|
||||
#ifdef SUPPORT_PMI_MATRIC
|
||||
for (aatx = 0; aatx < rel15_ul->nrOfLayers; aatx++)
|
||||
#endif
|
||||
{
|
||||
gNB->pusch_vars[ulsch_id]->ulsch_power[aarx] += signal_energy_nodc(
|
||||
&gNB->pusch_vars[ulsch_id]->ul_ch_estimates[aatx*gNB->frame_parms.nb_antennas_rx+aarx][symbol * frame_parms->ofdm_symbol_size],
|
||||
rel15_ul->rb_size * 12);
|
||||
}
|
||||
for (int rb = 0; rb < rel15_ul->rb_size; rb++) {
|
||||
gNB->pusch_vars[ulsch_id]->ulsch_noise_power[aarx] +=
|
||||
gNB->measurements.n0_subband_power[aarx][rel15_ul->bwp_start + rel15_ul->rb_start + rb] /
|
||||
@@ -1226,23 +1299,29 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
#endif
|
||||
uint32_t rxdataF_ext_offset = 0;
|
||||
|
||||
for(uint8_t symbol = rel15_ul->start_symbol_index; symbol < (rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols); symbol++) {
|
||||
for(uint8_t symbol = rel15_ul->start_symbol_index; symbol < (rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols); symbol++)
|
||||
{
|
||||
uint8_t dmrs_symbol_flag = (rel15_ul->ul_dmrs_symb_pos >> symbol) & 0x01;
|
||||
if (dmrs_symbol_flag == 1) {
|
||||
if (dmrs_symbol_flag == 1)
|
||||
{
|
||||
if ((rel15_ul->ul_dmrs_symb_pos >> ((symbol + 1) % frame_parms->symbols_per_slot)) & 0x01)
|
||||
AssertFatal(1==0,"Double DMRS configuration is not yet supported\n");
|
||||
|
||||
gNB->pusch_vars[ulsch_id]->dmrs_symbol = symbol;
|
||||
|
||||
if (rel15_ul->dmrs_config_type == 0) {
|
||||
if (rel15_ul->dmrs_config_type == 0)
|
||||
{
|
||||
// if no data in dmrs cdm group is 1 only even REs have no data
|
||||
// if no data in dmrs cdm group is 2 both odd and even REs have no data
|
||||
nb_re_pusch = rel15_ul->rb_size *(12 - (rel15_ul->num_dmrs_cdm_grps_no_data*6));
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
nb_re_pusch = rel15_ul->rb_size *(12 - (rel15_ul->num_dmrs_cdm_grps_no_data*4));
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
nb_re_pusch = rel15_ul->rb_size * NR_NB_SC_PER_RB;
|
||||
}
|
||||
|
||||
@@ -1252,15 +1331,15 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
//----------------------------------------------------------
|
||||
//--------------------- RBs extraction ---------------------
|
||||
//----------------------------------------------------------
|
||||
if (nb_re_pusch > 0) {
|
||||
|
||||
if (nb_re_pusch > 0)
|
||||
{
|
||||
start_meas(&gNB->ulsch_rbs_extraction_stats);
|
||||
nr_ulsch_extract_rbs_single(gNB->common_vars.rxdataF,
|
||||
gNB->pusch_vars[ulsch_id],
|
||||
symbol,
|
||||
dmrs_symbol_flag,
|
||||
rel15_ul,
|
||||
frame_parms);
|
||||
nr_ulsch_extract_rbs(gNB->common_vars.rxdataF,
|
||||
gNB->pusch_vars[ulsch_id],
|
||||
symbol,
|
||||
dmrs_symbol_flag,
|
||||
rel15_ul,
|
||||
frame_parms);
|
||||
stop_meas(&gNB->ulsch_rbs_extraction_stats);
|
||||
|
||||
//----------------------------------------------------------
|
||||
@@ -1271,6 +1350,7 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
gNB->ulsch[ulsch_id],
|
||||
symbol,
|
||||
dmrs_symbol_flag,
|
||||
rel15_ul->nrOfLayers,
|
||||
rel15_ul->rb_size,
|
||||
rel15_ul->dmrs_config_type);
|
||||
|
||||
@@ -1302,7 +1382,11 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
gNB->pusch_vars[ulsch_id]->ul_ch_mag0,
|
||||
gNB->pusch_vars[ulsch_id]->ul_ch_magb0,
|
||||
gNB->pusch_vars[ulsch_id]->rxdataF_comp,
|
||||
#ifdef SUPPORT_PMI_MATRIC
|
||||
(rel15_ul->nrOfLayers>1) ? gNB->pusch_vars[ulsch_id]->rho : NULL,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
frame_parms,
|
||||
symbol,
|
||||
dmrs_symbol_flag,
|
||||
@@ -1315,21 +1399,21 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
start_meas(&gNB->ulsch_mrc_stats);
|
||||
nr_ulsch_detection_mrc(frame_parms,
|
||||
gNB->pusch_vars[ulsch_id]->rxdataF_comp,
|
||||
gNB->pusch_vars[ulsch_id]->ul_ch_mag,
|
||||
gNB->pusch_vars[ulsch_id]->ul_ch_magb,
|
||||
gNB->pusch_vars[ulsch_id]->ul_ch_mag0,
|
||||
gNB->pusch_vars[ulsch_id]->ul_ch_magb0,
|
||||
rel15_ul->nrOfLayers,
|
||||
symbol,
|
||||
rel15_ul->rb_size);
|
||||
stop_meas(&gNB->ulsch_mrc_stats);
|
||||
|
||||
// transform precoding = 0 means enabled
|
||||
if (rel15_ul->transform_precoding == 0) {
|
||||
|
||||
#ifdef __AVX2__
|
||||
if (rel15_ul->transformPrecoder == transformPrecoder_enabled)
|
||||
{
|
||||
#ifdef __AVX2__
|
||||
// For odd number of resource blocks need byte alignment to multiple of 8
|
||||
int nb_re_pusch2 = nb_re_pusch + (nb_re_pusch&7);
|
||||
#else
|
||||
#else
|
||||
int nb_re_pusch2 = nb_re_pusch;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// perform IDFT operation on the compensated rxdata if transform precoding is enabled
|
||||
nr_idft(&gNB->pusch_vars[ulsch_id]->rxdataF_comp[0][symbol * nb_re_pusch2], nb_re_pusch);
|
||||
@@ -1341,7 +1425,8 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
//----------------------------------------------------------
|
||||
/* In case PTRS is enabled then LLR will be calculated after PTRS symbols are processed *
|
||||
* otherwise LLR are calculated for each symbol based upon DMRS channel estimates only. */
|
||||
if (rel15_ul->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
|
||||
if (rel15_ul->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS)
|
||||
{
|
||||
start_meas(&gNB->ulsch_ptrs_processing_stats);
|
||||
nr_pusch_ptrs_processing(gNB,
|
||||
frame_parms,
|
||||
@@ -1360,14 +1445,17 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
/*-------------------- LLRs computation -------------------------------------------------------------*/
|
||||
/*-----------------------------------------------------------------------------------------------------*/
|
||||
start_meas(&gNB->ulsch_llr_stats);
|
||||
nr_ulsch_compute_llr(&gNB->pusch_vars[ulsch_id]->rxdataF_comp[0][symbol * (off + rel15_ul->rb_size * NR_NB_SC_PER_RB)],
|
||||
gNB->pusch_vars[ulsch_id]->ul_ch_mag0,
|
||||
gNB->pusch_vars[ulsch_id]->ul_ch_magb0,
|
||||
&gNB->pusch_vars[ulsch_id]->llr[rxdataF_ext_offset * rel15_ul->qam_mod_order],
|
||||
rel15_ul->rb_size,
|
||||
gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[symbol],
|
||||
symbol,
|
||||
rel15_ul->qam_mod_order);
|
||||
for (aatx=0; aatx < rel15_ul->nrOfLayers; aatx++)
|
||||
{
|
||||
nr_ulsch_compute_llr(&gNB->pusch_vars[ulsch_id]->rxdataF_comp[aatx*frame_parms->nb_antennas_rx][symbol * (off + rel15_ul->rb_size * NR_NB_SC_PER_RB)],
|
||||
gNB->pusch_vars[ulsch_id]->ul_ch_mag0[aatx*frame_parms->nb_antennas_rx],
|
||||
gNB->pusch_vars[ulsch_id]->ul_ch_magb0[aatx*frame_parms->nb_antennas_rx],
|
||||
&gNB->pusch_vars[ulsch_id]->llr_layers[aatx][rxdataF_ext_offset * rel15_ul->qam_mod_order],
|
||||
rel15_ul->rb_size,
|
||||
gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[symbol],
|
||||
symbol,
|
||||
rel15_ul->qam_mod_order);
|
||||
}
|
||||
stop_meas(&gNB->ulsch_llr_stats);
|
||||
rxdataF_ext_offset += gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[symbol];
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ void nr_ulsch_qpsk_llr(int32_t *rxdataF_comp,
|
||||
//----------------------------------------------------------------------------------------------
|
||||
|
||||
void nr_ulsch_16qam_llr(int32_t *rxdataF_comp,
|
||||
int32_t **ul_ch_mag,
|
||||
int32_t *ul_ch_mag,
|
||||
int16_t *ulsch_llr,
|
||||
uint32_t nb_rb,
|
||||
uint32_t nb_re,
|
||||
@@ -110,12 +110,12 @@ void nr_ulsch_16qam_llr(int32_t *rxdataF_comp,
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
#ifdef __AVX2__
|
||||
ch_mag = (__m256i*)&ul_ch_mag[0][(symbol*(off+(nb_rb*12)))];
|
||||
ch_mag = (__m256i*)&ul_ch_mag[(symbol*(off+(nb_rb*12)))];
|
||||
#else
|
||||
ch_mag = (__m128i*)&ul_ch_mag[0][(symbol*(off+(nb_rb*12)))];
|
||||
ch_mag = (__m128i*)&ul_ch_mag[(symbol*(off+(nb_rb*12)))];
|
||||
#endif
|
||||
#elif defined(__arm__)
|
||||
ch_mag = (int16x8_t*)&ul_ch_mag[0][(symbol*nb_rb*12)];
|
||||
ch_mag = (int16x8_t*)&ul_ch_mag[(symbol*nb_rb*12)];
|
||||
#endif
|
||||
|
||||
#ifdef __AVX2__
|
||||
@@ -231,8 +231,8 @@ void nr_ulsch_16qam_llr(int32_t *rxdataF_comp,
|
||||
//----------------------------------------------------------------------------------------------
|
||||
|
||||
void nr_ulsch_64qam_llr(int32_t *rxdataF_comp,
|
||||
int32_t **ul_ch_mag,
|
||||
int32_t **ul_ch_magb,
|
||||
int32_t *ul_ch_mag,
|
||||
int32_t *ul_ch_magb,
|
||||
int16_t *ulsch_llr,
|
||||
uint32_t nb_rb,
|
||||
uint32_t nb_re,
|
||||
@@ -265,15 +265,15 @@ void nr_ulsch_64qam_llr(int32_t *rxdataF_comp,
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
#ifdef __AVX2__
|
||||
ch_mag = (__m256i*)&ul_ch_mag[0][(symbol*(off+(nb_rb*12)))];
|
||||
ch_magb = (__m256i*)&ul_ch_magb[0][(symbol*(off+(nb_rb*12)))];
|
||||
ch_mag = (__m256i*)&ul_ch_mag[(symbol*(off+(nb_rb*12)))];
|
||||
ch_magb = (__m256i*)&ul_ch_magb[(symbol*(off+(nb_rb*12)))];
|
||||
#else
|
||||
ch_mag = (__m128i*)&ul_ch_mag[0][(symbol*nb_rb*12)];
|
||||
ch_magb = (__m128i*)&ul_ch_magb[0][(symbol*nb_rb*12)];
|
||||
ch_mag = (__m128i*)&ul_ch_mag[(symbol*nb_rb*12)];
|
||||
ch_magb = (__m128i*)&ul_ch_magb[(symbol*nb_rb*12)];
|
||||
#endif
|
||||
#elif defined(__arm__)
|
||||
ch_mag = (int16x8_t*)&ul_ch_mag[0][(symbol*nb_rb*12)];
|
||||
ch_magb = (int16x8_t*)&ul_ch_magb[0][(symbol*nb_rb*12)];
|
||||
ch_mag = (int16x8_t*)&ul_ch_mag[(symbol*nb_rb*12)];
|
||||
ch_magb = (int16x8_t*)&ul_ch_magb[(symbol*nb_rb*12)];
|
||||
#endif
|
||||
|
||||
#ifdef __AVX2__
|
||||
@@ -471,8 +471,8 @@ void nr_ulsch_64qam_llr(int32_t *rxdataF_comp,
|
||||
|
||||
|
||||
void nr_ulsch_compute_llr(int32_t *rxdataF_comp,
|
||||
int32_t **ul_ch_mag,
|
||||
int32_t **ul_ch_magb,
|
||||
int32_t *ul_ch_mag,
|
||||
int32_t *ul_ch_magb,
|
||||
int16_t *ulsch_llr,
|
||||
uint32_t nb_rb,
|
||||
uint32_t nb_re,
|
||||
|
||||
@@ -148,7 +148,7 @@ short filt8_dcr0_h[8]= {
|
||||
0,4096,8192,12288,16384,0,0,0};
|
||||
|
||||
short filt8_l1[8] = {
|
||||
24576,16384,0,0,0,0,0,0};
|
||||
24576,16384,8192,0,0,0,0,0};
|
||||
|
||||
short filt8_ml1[8] = {
|
||||
-8192,0,8192,16384,8192,0,0,0};
|
||||
@@ -163,10 +163,10 @@ short filt8_mm1[8]= {
|
||||
0,0,0,0,8192,16384,8192,0};
|
||||
|
||||
short filt8_dcl1[8]= {
|
||||
0,0,0,16384,12288,8192,4096,0};
|
||||
0,0,16384,12288,8192,4096,0,0};
|
||||
|
||||
short filt8_dcr1[8]= {
|
||||
0,0,0,0,4096,8192,12288,16384};
|
||||
0,0,0,4096,8192,12288,16384,0};
|
||||
|
||||
short filt8_dcl1_h[8]= {
|
||||
0,16384,12288,8192,4096,0,0,0};
|
||||
|
||||
@@ -282,7 +282,10 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
|
||||
for (i=0;i<(A>>3);i++)
|
||||
printf("%02x.",harq_process->a[i]);
|
||||
printf("\n");
|
||||
*/
|
||||
*/
|
||||
|
||||
//for (int i=0;i<harq_process->pusch_pdu.pusch_data.tb_size;i++) harq_process->a[i]=0;
|
||||
// harq_process->a[0]=1;
|
||||
|
||||
if (A > 3824) {
|
||||
// Add 24-bit crc (polynomial A) to payload
|
||||
|
||||
@@ -76,7 +76,8 @@ void nr_pusch_codeword_scrambling(uint8_t *in,
|
||||
}
|
||||
if (in[i]==NR_PUSCH_x)
|
||||
*out ^= 1<<b_idx;
|
||||
else if (in[i]==NR_PUSCH_y){
|
||||
else if (in[i]==NR_PUSCH_y)
|
||||
{
|
||||
if (b_idx!=0)
|
||||
*out ^= (*out & (1<<(b_idx-1)))<<1;
|
||||
else{
|
||||
@@ -105,8 +106,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
uint32_t available_bits;
|
||||
uint8_t cwd_index, l;
|
||||
uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5];
|
||||
int16_t **tx_layers;
|
||||
int32_t **txdataF;
|
||||
|
||||
int8_t Wf[2], Wt[2], l_prime[2], delta;
|
||||
uint8_t nb_dmrs_re_per_rb;
|
||||
int ap, i;
|
||||
@@ -114,14 +114,17 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
|
||||
NR_DL_FRAME_PARMS *frame_parms = &UE->frame_parms;
|
||||
NR_UE_PUSCH *pusch_ue = UE->pusch_vars[thread_id][gNB_id];
|
||||
int16_t **tx_layers = (int16_t **)pusch_ue->txdataF_layers;
|
||||
int16_t **tx_precoding = (int16_t **)pusch_ue->txdataF_precoding;
|
||||
int32_t **txdataF = UE->common_vars.txdataF;
|
||||
|
||||
uint8_t num_of_codewords = 1; // tmp assumption
|
||||
int Nid_cell = 0;
|
||||
int N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig
|
||||
uint16_t number_dmrs_symbols = 0;
|
||||
|
||||
for (cwd_index = 0;cwd_index < num_of_codewords; cwd_index++) {
|
||||
|
||||
for (cwd_index = 0;cwd_index < num_of_codewords; cwd_index++)
|
||||
{
|
||||
NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[thread_id][gNB_id][cwd_index];
|
||||
NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid];
|
||||
nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &harq_process_ul_ue->pusch_pdu;
|
||||
@@ -188,107 +191,102 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
available_bits,
|
||||
mod_order,
|
||||
(int16_t *)ulsch_ue->d_mod);
|
||||
|
||||
|
||||
|
||||
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/////////////////////////DMRS Modulation/////////////////////////
|
||||
///////////
|
||||
uint32_t ***pusch_dmrs = UE->nr_gold_pusch_dmrs[slot];
|
||||
uint16_t n_dmrs = (pusch_pdu->bwp_start + start_rb + nb_rb)*((dmrs_type == pusch_dmrs_type1) ? 6:4);
|
||||
int16_t mod_dmrs[n_dmrs<<1] __attribute((aligned(16)));
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////DMRS Modulation/////////////////////////
|
||||
///////////
|
||||
uint32_t ***pusch_dmrs = UE->nr_gold_pusch_dmrs[slot];
|
||||
uint16_t n_dmrs = (pusch_pdu->bwp_start + start_rb + nb_rb)*((dmrs_type == pusch_dmrs_type1) ? 6:4);
|
||||
int16_t mod_dmrs[n_dmrs<<1] __attribute((aligned(16)));
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////PTRS parameters' initialization/////////////////////////
|
||||
///////////
|
||||
/////////////////////////PTRS parameters' initialization/////////////////////////
|
||||
///////////
|
||||
|
||||
int16_t mod_ptrs[nb_rb] __attribute((aligned(16))); // assume maximum number of PTRS per pusch allocation
|
||||
uint8_t L_ptrs, K_ptrs = 0;
|
||||
uint16_t beta_ptrs = 1; // temp value until power control is implemented
|
||||
int16_t mod_ptrs[nb_rb] __attribute((aligned(16))); // assume maximum number of PTRS per pusch allocation
|
||||
uint8_t L_ptrs, K_ptrs = 0;
|
||||
uint16_t beta_ptrs = 1; // temp value until power control is implemented
|
||||
|
||||
if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
|
||||
if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS)
|
||||
{
|
||||
K_ptrs = harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_freq_density;
|
||||
L_ptrs = 1<<harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_time_density;
|
||||
|
||||
K_ptrs = harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_freq_density;
|
||||
L_ptrs = 1<<harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_time_density;
|
||||
|
||||
beta_ptrs = 1; // temp value until power control is implemented
|
||||
|
||||
ulsch_ue->ptrs_symbols = 0;
|
||||
|
||||
set_ptrs_symb_idx(&ulsch_ue->ptrs_symbols,
|
||||
number_of_symbols,
|
||||
start_symbol,
|
||||
L_ptrs,
|
||||
ul_dmrs_symb_pos);
|
||||
}
|
||||
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/////////////////////////ULSCH layer mapping/////////////////////////
|
||||
///////////
|
||||
|
||||
tx_layers = (int16_t **)pusch_ue->txdataF_layers;
|
||||
|
||||
nr_ue_layer_mapping(UE->ulsch[thread_id][gNB_id],
|
||||
Nl,
|
||||
available_bits/mod_order,
|
||||
tx_layers);
|
||||
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//////////////////////// ULSCH transform precoding ////////////////////////
|
||||
///////////
|
||||
|
||||
l_prime[0] = 0; // single symbol ap 0
|
||||
|
||||
uint16_t index;
|
||||
uint8_t u = 0, v = 0;
|
||||
int16_t *dmrs_seq = NULL;
|
||||
|
||||
// if transform precoding is enbaled (value 0)
|
||||
if (pusch_pdu->transform_precoding == 0) {
|
||||
|
||||
uint32_t nb_re_pusch=nb_rb * NR_NB_SC_PER_RB;
|
||||
uint32_t y_offset = 0;
|
||||
uint16_t num_dmrs_res_per_symbol = nb_rb*(NR_NB_SC_PER_RB/2);
|
||||
|
||||
// Calculate index to dmrs seq array based on number of DMRS Subcarriers on this symbol
|
||||
index = get_index_for_dmrs_lowpapr_seq(num_dmrs_res_per_symbol);
|
||||
u = pusch_pdu->dfts_ofdm.low_papr_group_number;
|
||||
v = pusch_pdu->dfts_ofdm.low_papr_sequence_number;
|
||||
dmrs_seq = dmrs_lowpaprtype1_ul_ref_sig[u][v][index];
|
||||
|
||||
AssertFatal(index >= 0, "Num RBs not configured according to 3GPP 38.211 section 6.3.1.4. For PUSCH with transform precoding, num RBs cannot be multiple of any other primenumber other than 2,3,5\n");
|
||||
AssertFatal(dmrs_seq != NULL, "DMRS low PAPR seq not found, check if DMRS sequences are generated");
|
||||
|
||||
LOG_D(PHY,"Transform Precoding params. u: %d, v: %d, index for dmrsseq: %d\n", u, v, index);
|
||||
|
||||
for (l = start_symbol; l < start_symbol + number_of_symbols; l++) {
|
||||
|
||||
if((ul_dmrs_symb_pos >> l) & 0x01)
|
||||
/* In the symbol with DMRS no data would be transmitted CDM groups is 2*/
|
||||
continue;
|
||||
|
||||
nr_dft(&ulsch_ue->y[y_offset], &((int32_t*)tx_layers[0])[y_offset], nb_re_pusch);
|
||||
|
||||
y_offset = y_offset + nb_re_pusch;
|
||||
|
||||
LOG_D(PHY,"Transform precoding being done on data- symbol: %d, nb_re_pusch: %d, y_offset: %d\n", l, nb_re_pusch, y_offset);
|
||||
|
||||
#ifdef DEBUG_PUSCH_MAPPING
|
||||
printf("NR_ULSCH_UE: y_offset %d\t nb_re_pusch %d \t Symbol %d \t nb_rb %d \n",
|
||||
y_offset, nb_re_pusch, l, nb_rb);
|
||||
#endif
|
||||
beta_ptrs = 1; // temp value until power control is implemented
|
||||
|
||||
ulsch_ue->ptrs_symbols = 0;
|
||||
|
||||
set_ptrs_symb_idx(&ulsch_ue->ptrs_symbols,
|
||||
number_of_symbols,
|
||||
start_symbol,
|
||||
L_ptrs,
|
||||
ul_dmrs_symb_pos);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_DFT_IDFT
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/////////////////////////ULSCH layer mapping/////////////////////////
|
||||
///////////
|
||||
|
||||
nr_ue_layer_mapping(UE->ulsch[thread_id][gNB_id],
|
||||
Nl,
|
||||
available_bits/mod_order,
|
||||
tx_layers);
|
||||
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//////////////////////// ULSCH transform precoding ////////////////////////
|
||||
///////////
|
||||
|
||||
l_prime[0] = 0; // single symbol ap 0
|
||||
|
||||
uint16_t index;
|
||||
uint8_t u = 0, v = 0;
|
||||
int16_t *dmrs_seq = NULL;
|
||||
|
||||
if (pusch_pdu->transformPrecoder == transformPrecoder_enabled)
|
||||
{
|
||||
uint32_t nb_re_pusch=nb_rb * NR_NB_SC_PER_RB;
|
||||
uint32_t y_offset = 0;
|
||||
uint16_t num_dmrs_res_per_symbol = nb_rb*(NR_NB_SC_PER_RB/2);
|
||||
|
||||
// Calculate index to dmrs seq array based on number of DMRS Subcarriers on this symbol
|
||||
index = get_index_for_dmrs_lowpapr_seq(num_dmrs_res_per_symbol);
|
||||
u = pusch_pdu->dfts_ofdm.low_papr_group_number;
|
||||
v = pusch_pdu->dfts_ofdm.low_papr_sequence_number;
|
||||
dmrs_seq = dmrs_lowpaprtype1_ul_ref_sig[u][v][index];
|
||||
|
||||
AssertFatal(index >= 0, "Num RBs not configured according to 3GPP 38.211 section 6.3.1.4. For PUSCH with transform precoding, num RBs cannot be multiple of any other primenumber other than 2,3,5\n");
|
||||
AssertFatal(dmrs_seq != NULL, "DMRS low PAPR seq not found, check if DMRS sequences are generated");
|
||||
|
||||
LOG_D(PHY,"Transform Precoding params. u: %d, v: %d, index for dmrsseq: %d\n", u, v, index);
|
||||
|
||||
for (l = start_symbol; l < start_symbol + number_of_symbols; l++)
|
||||
{
|
||||
if((ul_dmrs_symb_pos >> l) & 0x01)
|
||||
/* In the symbol with DMRS no data would be transmitted CDM groups is 2*/
|
||||
continue;
|
||||
|
||||
nr_dft(&ulsch_ue->y[y_offset], &((int32_t*)tx_layers[0])[y_offset], nb_re_pusch);
|
||||
|
||||
y_offset = y_offset + nb_re_pusch;
|
||||
|
||||
LOG_D(PHY,"Transform precoding being done on data- symbol: %d, nb_re_pusch: %d, y_offset: %d\n", l, nb_re_pusch, y_offset);
|
||||
|
||||
#ifdef DEBUG_PUSCH_MAPPING
|
||||
printf("NR_ULSCH_UE: y_offset %d\t nb_re_pusch %d \t Symbol %d \t nb_rb %d \n",
|
||||
y_offset, nb_re_pusch, l, nb_rb);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef DEBUG_DFT_IDFT
|
||||
int32_t debug_symbols[MAX_NUM_NR_RE] __attribute__ ((aligned(16)));
|
||||
int offset = 0;
|
||||
printf("NR_ULSCH_UE: available_bits: %d, mod_order: %d", available_bits,mod_order);
|
||||
@@ -298,7 +296,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
}
|
||||
|
||||
printf("NR_ULSCH_UE: numSym: %d, num_dmrs_sym: %d", number_of_symbols,number_dmrs_symbols);
|
||||
for (int ll = 0; ll < (number_of_symbols-number_dmrs_symbols); ll++) {
|
||||
for (int ll = 0; ll < (number_of_symbols-number_dmrs_symbols); ll++) {
|
||||
|
||||
nr_idft(&debug_symbols[offset], nb_re_pusch);
|
||||
|
||||
@@ -309,160 +307,244 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
LOG_M("postDFT_all_symbols.m","UE_postDFT", ulsch_ue->y,number_of_symbols*nb_re_pusch,1,1);
|
||||
LOG_M("DEBUG_IDFT_SYMBOLS.m","UE_Debug_IDFT", debug_symbols,number_of_symbols*nb_re_pusch,1,1);
|
||||
LOG_M("UE_DMRS_SEQ.m","UE_DMRS_SEQ", dmrs_seq,nb_re_pusch,1,1);
|
||||
#endif
|
||||
|
||||
}
|
||||
else
|
||||
memcpy(ulsch_ue->y, tx_layers[0], (available_bits/mod_order)*sizeof(int32_t));
|
||||
|
||||
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
/////////////////////////ULSCH RE mapping/////////////////////////
|
||||
///////////
|
||||
|
||||
txdataF = UE->common_vars.txdataF;
|
||||
|
||||
for (ap=0; ap< Nl; ap++) {
|
||||
|
||||
uint8_t k_prime = 0;
|
||||
uint16_t m = 0;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#ifdef DEBUG_PUSCH_MAPPING
|
||||
/////////
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////ULSCH RE mapping/////////////////////////
|
||||
/////////
|
||||
|
||||
for (ap=0; ap< Nl; ap++)
|
||||
{
|
||||
uint8_t k_prime = 0;
|
||||
uint16_t m = 0;
|
||||
|
||||
#ifdef DEBUG_PUSCH_MAPPING
|
||||
printf("NR_ULSCH_UE: Value of CELL ID %d /t, u %d \n", frame_parms->Nid_cell, u);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// DMRS params for this ap
|
||||
get_Wt(Wt, ap, dmrs_type);
|
||||
get_Wf(Wf, ap, dmrs_type);
|
||||
delta = get_delta(ap, dmrs_type);
|
||||
|
||||
// DMRS params for this ap
|
||||
get_Wt(Wt, ap, dmrs_type);
|
||||
get_Wf(Wf, ap, dmrs_type);
|
||||
delta = get_delta(ap, dmrs_type);
|
||||
for (l=start_symbol; l<start_symbol+number_of_symbols; l++)
|
||||
{
|
||||
uint16_t k = start_sc;
|
||||
uint16_t n = 0;
|
||||
uint8_t is_dmrs_sym = 0;
|
||||
uint8_t is_ptrs_sym = 0;
|
||||
uint16_t dmrs_idx = 0, ptrs_idx = 0;
|
||||
|
||||
for (l=start_symbol; l<start_symbol+number_of_symbols; l++) {
|
||||
if ((ul_dmrs_symb_pos >> l) & 0x01)
|
||||
{
|
||||
is_dmrs_sym = 1;
|
||||
if (pusch_pdu->transformPrecoder == transformPrecoder_disabled)
|
||||
{
|
||||
if (dmrs_type == pusch_dmrs_type1)
|
||||
dmrs_idx = (pusch_pdu->bwp_start + start_rb)*6;
|
||||
else
|
||||
dmrs_idx = (pusch_pdu->bwp_start + start_rb)*4;
|
||||
|
||||
uint16_t k = start_sc;
|
||||
uint16_t n = 0;
|
||||
uint8_t is_dmrs_sym = 0;
|
||||
uint8_t is_ptrs_sym = 0;
|
||||
uint16_t dmrs_idx = 0, ptrs_idx = 0;
|
||||
// TODO: performance improvement, we can skip the modulation of DMRS symbols outside the bandwidth part
|
||||
// Perform this on gold sequence, not required when SC FDMA operation is done,
|
||||
LOG_D(PHY,"DMRS in symbol %d\n",l);
|
||||
nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
|
||||
}
|
||||
else
|
||||
{
|
||||
dmrs_idx = 0;
|
||||
}
|
||||
}
|
||||
else if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS)
|
||||
{
|
||||
AssertFatal(pusch_pdu->transformPrecoder == transformPrecoder_disabled, "PTRS NOT SUPPORTED IF TRANSFORM PRECODING IS ENABLED\n");
|
||||
|
||||
if ((ul_dmrs_symb_pos >> l) & 0x01) {
|
||||
is_dmrs_sym = 1;
|
||||
|
||||
// transform precoding disabled (value 1)
|
||||
if (pusch_pdu->transform_precoding == 1){
|
||||
|
||||
if (dmrs_type == pusch_dmrs_type1)
|
||||
dmrs_idx = (pusch_pdu->bwp_start + start_rb)*6;
|
||||
else
|
||||
dmrs_idx = (pusch_pdu->bwp_start + start_rb)*4;
|
||||
|
||||
// TODO: performance improvement, we can skip the modulation of DMRS symbols outside the bandwidth part
|
||||
// Perform this on gold sequence, not required when SC FDMA operation is done,
|
||||
LOG_D(PHY,"DMRS in symbol %d\n",l);
|
||||
nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
|
||||
|
||||
} else {
|
||||
dmrs_idx = 0;
|
||||
if(is_ptrs_symbol(l, ulsch_ue->ptrs_symbols))
|
||||
{
|
||||
is_ptrs_sym = 1;
|
||||
nr_modulation(pusch_dmrs[l][0], nb_rb, DMRS_MOD_ORDER, mod_ptrs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
|
||||
|
||||
AssertFatal(pusch_pdu->transform_precoding == 1, "PTRS NOT SUPPORTED IF TRANSFORM PRECODING IS ENABLED\n");
|
||||
for (i=0; i< nb_rb*NR_NB_SC_PER_RB; i++)
|
||||
{
|
||||
uint8_t is_dmrs = 0;
|
||||
uint8_t is_ptrs = 0;
|
||||
|
||||
if(is_ptrs_symbol(l, ulsch_ue->ptrs_symbols)) {
|
||||
is_ptrs_sym = 1;
|
||||
nr_modulation(pusch_dmrs[l][0], nb_rb, DMRS_MOD_ORDER, mod_ptrs);
|
||||
}
|
||||
}
|
||||
sample_offsetF = l*frame_parms->ofdm_symbol_size + k;
|
||||
|
||||
for (i=0; i< nb_rb*NR_NB_SC_PER_RB; i++) {
|
||||
|
||||
uint8_t is_dmrs = 0;
|
||||
uint8_t is_ptrs = 0;
|
||||
|
||||
sample_offsetF = l*frame_parms->ofdm_symbol_size + k;
|
||||
|
||||
if (is_dmrs_sym) {
|
||||
if (k == ((start_sc+get_dmrs_freq_idx_ul(n, k_prime, delta, dmrs_type))%frame_parms->ofdm_symbol_size))
|
||||
is_dmrs = 1;
|
||||
} else if (is_ptrs_sym) {
|
||||
if (is_dmrs_sym)
|
||||
{
|
||||
if (k == ((start_sc+get_dmrs_freq_idx_ul(n, k_prime, delta, dmrs_type))%frame_parms->ofdm_symbol_size))
|
||||
is_dmrs = 1;
|
||||
}
|
||||
else if (is_ptrs_sym)
|
||||
{
|
||||
is_ptrs = is_ptrs_subcarrier(k,
|
||||
rnti,
|
||||
ap,
|
||||
dmrs_type,
|
||||
K_ptrs,
|
||||
nb_rb,
|
||||
pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset,
|
||||
start_sc,
|
||||
frame_parms->ofdm_symbol_size);
|
||||
}
|
||||
rnti,
|
||||
ap,
|
||||
dmrs_type,
|
||||
K_ptrs,
|
||||
nb_rb,
|
||||
pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset,
|
||||
start_sc,
|
||||
frame_parms->ofdm_symbol_size);
|
||||
}
|
||||
|
||||
if (is_dmrs == 1) {
|
||||
// if transform precoding is enabled
|
||||
if (pusch_pdu->transform_precoding == 0) {
|
||||
if (is_dmrs == 1)
|
||||
{
|
||||
if (pusch_pdu->transformPrecoder == transformPrecoder_enabled)
|
||||
{
|
||||
((int16_t*)tx_precoding[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*dmrs_seq[2*dmrs_idx]) >> 15;
|
||||
((int16_t*)tx_precoding[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*dmrs_seq[(2*dmrs_idx) + 1]) >> 15;
|
||||
}
|
||||
else
|
||||
{
|
||||
((int16_t*)tx_precoding[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[dmrs_idx<<1]) >> 15;
|
||||
((int16_t*)tx_precoding[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_PUSCH_MAPPING
|
||||
printf("DMRS: Layer: %d\t, dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t dmrs: %d %d\n",
|
||||
ap, dmrs_idx, l, k, k_prime, n, ((int16_t*)tx_precoding[ap])[(sample_offsetF)<<1],
|
||||
((int16_t*)tx_precoding[ap])[((sample_offsetF)<<1) + 1]);
|
||||
#endif
|
||||
|
||||
dmrs_idx++;
|
||||
k_prime++;
|
||||
k_prime&=1;
|
||||
n+=(k_prime)?0:1;
|
||||
}
|
||||
else if (is_ptrs == 1)
|
||||
{
|
||||
((int16_t*)tx_precoding[ap])[(sample_offsetF)<<1] = (beta_ptrs*AMP*mod_ptrs[ptrs_idx<<1]) >> 15;
|
||||
((int16_t*)tx_precoding[ap])[((sample_offsetF)<<1) + 1] = (beta_ptrs*AMP*mod_ptrs[(ptrs_idx<<1) + 1]) >> 15;
|
||||
|
||||
ptrs_idx++;
|
||||
}
|
||||
else if (!is_dmrs_sym || allowed_xlsch_re_in_dmrs_symbol(k, start_sc, frame_parms->ofdm_symbol_size, cdm_grps_no_data, dmrs_type))
|
||||
{
|
||||
if (pusch_pdu->transformPrecoder == transformPrecoder_disabled)
|
||||
{
|
||||
((int16_t*)tx_precoding[ap])[(sample_offsetF)<<1] = ((int16_t *)tx_layers[ap])[m<<1];
|
||||
((int16_t*)tx_precoding[ap])[((sample_offsetF)<<1) + 1] = ((int16_t *)tx_layers[ap])[(m<<1) + 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
((int16_t*)tx_precoding[ap])[(sample_offsetF)<<1] = ((int16_t *) ulsch_ue->y)[m<<1];
|
||||
((int16_t*)tx_precoding[ap])[((sample_offsetF)<<1) + 1] = ((int16_t *) ulsch_ue->y)[(m<<1) + 1];
|
||||
}
|
||||
|
||||
#ifdef DEBUG_PUSCH_MAPPING
|
||||
printf("DATA: layer %d\t m %d\t l %d \t k %d \t txdataF: %d %d\n",
|
||||
ap, m, l, k, ((int16_t*)tx_precoding[ap])[(sample_offsetF)<<1],
|
||||
((int16_t*)tx_precoding[ap])[((sample_offsetF)<<1) + 1]);
|
||||
#endif
|
||||
|
||||
m++;
|
||||
}
|
||||
else
|
||||
{
|
||||
((int16_t*)tx_precoding[ap])[(sample_offsetF)<<1] = 0;
|
||||
((int16_t*)tx_precoding[ap])[((sample_offsetF)<<1) + 1] = 0;
|
||||
}
|
||||
|
||||
if (++k >= frame_parms->ofdm_symbol_size)
|
||||
{
|
||||
k -= frame_parms->ofdm_symbol_size;
|
||||
}
|
||||
} //for (i=0; i< nb_rb*NR_NB_SC_PER_RB; i++)
|
||||
}//for (l=start_symbol; l<start_symbol+number_of_symbols; l++)
|
||||
}//for (ap=0; ap< Nl; ap++)
|
||||
|
||||
/////////////////////////ULSCH precoding/////////////////////////
|
||||
///////////
|
||||
///Layer Precoding and Antenna port mapping
|
||||
// tx_layers 0-3 are mapped on antenna ports
|
||||
// The precoding info is supported by nfapi such as num_prgs, prg_size, prgs_list and pm_idx
|
||||
// The same precoding matrix is applied on prg_size RBs, Thus
|
||||
// pmi = prgs_list[rbidx/prg_size].pm_idx, rbidx =0,...,rbSize-1
|
||||
// The Precoding matrix:
|
||||
for (int ap=0; ap<frame_parms->nb_antennas_tx; ap++)
|
||||
{
|
||||
for (int l=start_symbol; l<start_symbol+number_of_symbols; l++)
|
||||
{
|
||||
uint16_t k = start_sc;
|
||||
|
||||
for (int rb=0; rb<nb_rb; rb++)
|
||||
{
|
||||
//get pmi info
|
||||
uint8_t pmi=pusch_pdu->Tpmi;
|
||||
|
||||
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*dmrs_seq[2*dmrs_idx]) >> 15;
|
||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*dmrs_seq[(2*dmrs_idx) + 1]) >> 15;
|
||||
|
||||
} else {
|
||||
|
||||
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[dmrs_idx<<1]) >> 15;
|
||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15;
|
||||
|
||||
if (pmi == 0) {//unitary Precoding
|
||||
if(ap< pusch_pdu->nrOfLayers)
|
||||
memcpy((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + k],
|
||||
(void*)&tx_precoding[ap][2*(l*frame_parms->ofdm_symbol_size + k)],
|
||||
NR_NB_SC_PER_RB*sizeof(int32_t));
|
||||
else
|
||||
memset((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + k],
|
||||
0,
|
||||
NR_NB_SC_PER_RB*sizeof(int32_t));
|
||||
|
||||
k += NR_NB_SC_PER_RB;
|
||||
if (k >= frame_parms->ofdm_symbol_size) {
|
||||
k -= frame_parms->ofdm_symbol_size;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//get the precoding matrix weights:
|
||||
char *W_prec;
|
||||
switch (frame_parms->nb_antennas_tx)
|
||||
{
|
||||
case 1://1 antenna port
|
||||
W_prec = nr_W_1l_2p[pmi][ap];
|
||||
break;
|
||||
case 2://2 antenna ports
|
||||
if (pusch_pdu->nrOfLayers == 1)//1 layer
|
||||
W_prec = nr_W_1l_2p[pmi][ap];
|
||||
else//2 layers
|
||||
W_prec = nr_W_2l_2p[pmi][ap];
|
||||
break;
|
||||
case 4://4 antenna ports
|
||||
if (pusch_pdu->nrOfLayers == 1)//1 layer
|
||||
W_prec = nr_W_1l_4p[pmi][ap];
|
||||
else if (pusch_pdu->nrOfLayers == 2)//2 layers
|
||||
W_prec = nr_W_2l_4p[pmi][ap];
|
||||
else if (pusch_pdu->nrOfLayers == 3)//3 layers
|
||||
W_prec = nr_W_3l_4p[pmi][ap];
|
||||
else//4 layers
|
||||
W_prec = nr_W_4l_4p[pmi][ap];
|
||||
break;
|
||||
default:
|
||||
LOG_D(PHY,"Precoding 1,2, or 4 antenna ports are currently supported\n");
|
||||
W_prec = nr_W_1l_2p[pmi][ap];
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_PUSCH_MAPPING
|
||||
printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t dmrs: %d %d\n",
|
||||
dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1],
|
||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]);
|
||||
#endif
|
||||
for (int i=0; i<NR_NB_SC_PER_RB; i++)
|
||||
{
|
||||
int32_t re_offset = l*frame_parms->ofdm_symbol_size + k;
|
||||
int32_t precodatatx_F = nr_layer_precoder(tx_precoding, W_prec, pusch_pdu->nrOfLayers, re_offset);
|
||||
((int16_t*)txdataF[ap])[(re_offset<<1)] = ((int16_t *) &precodatatx_F)[0];
|
||||
((int16_t*)txdataF[ap])[(re_offset<<1) + 1] = ((int16_t *) &precodatatx_F)[1];
|
||||
|
||||
if (++k >= frame_parms->ofdm_symbol_size)
|
||||
{
|
||||
k -= frame_parms->ofdm_symbol_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
} //RB loop
|
||||
} // symbol loop
|
||||
}// port loop
|
||||
|
||||
|
||||
dmrs_idx++;
|
||||
k_prime++;
|
||||
k_prime&=1;
|
||||
n+=(k_prime)?0:1;
|
||||
|
||||
} else if (is_ptrs == 1) {
|
||||
|
||||
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (beta_ptrs*AMP*mod_ptrs[ptrs_idx<<1]) >> 15;
|
||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (beta_ptrs*AMP*mod_ptrs[(ptrs_idx<<1) + 1]) >> 15;
|
||||
|
||||
ptrs_idx++;
|
||||
|
||||
} else if (!is_dmrs_sym || allowed_xlsch_re_in_dmrs_symbol(k, start_sc, frame_parms->ofdm_symbol_size, cdm_grps_no_data, dmrs_type)) {
|
||||
|
||||
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = ((int16_t *) ulsch_ue->y)[m<<1];
|
||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = ((int16_t *) ulsch_ue->y)[(m<<1) + 1];
|
||||
|
||||
#ifdef DEBUG_PUSCH_MAPPING
|
||||
printf("m %d\t l %d \t k %d \t txdataF: %d %d\n",
|
||||
m, l, k, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1],
|
||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]);
|
||||
#endif
|
||||
|
||||
m++;
|
||||
|
||||
} else {
|
||||
|
||||
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = 0;
|
||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = 0;
|
||||
|
||||
}
|
||||
|
||||
if (++k >= frame_parms->ofdm_symbol_size)
|
||||
k -= frame_parms->ofdm_symbol_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} //for (cwd_index = 0;cwd_index < num_of_codewords; cwd_index++)
|
||||
|
||||
NR_UL_UE_HARQ_t *harq_process_ulsch=NULL;
|
||||
harq_process_ulsch = UE->ulsch[thread_id][gNB_id][0]->harq_processes[harq_pid];
|
||||
|
||||
@@ -506,6 +506,10 @@ typedef struct {
|
||||
/// \brief llr values.
|
||||
/// - first index: ? [0..1179743] (hard coded)
|
||||
int16_t *llr;
|
||||
/// \brief llr values per layer.
|
||||
/// - first index: ? [0..3] (hard coded)
|
||||
/// - first index: ? [0..1179743] (hard coded)
|
||||
int16_t **llr_layers;
|
||||
/// DMRS symbol index, to be updated every DMRS symbol within a slot.
|
||||
uint8_t dmrs_symbol;
|
||||
// PTRS symbol index, to be updated every PTRS symbol within a slot.
|
||||
|
||||
@@ -233,6 +233,9 @@ typedef struct {
|
||||
typedef struct {
|
||||
/// TX buffers for multiple layers
|
||||
int32_t *txdataF_layers[NR_MAX_NB_LAYERS];
|
||||
|
||||
/// TX buffers for UE-spec transmission
|
||||
int32_t *txdataF_precoding[NR_MAX_NB_LAYERS];
|
||||
} NR_UE_PUSCH;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
#define NR_MAX_CSET_DURATION 3
|
||||
|
||||
#define NR_MAX_NB_RBG 18
|
||||
#define NR_MAX_NB_LAYERS 2 // 8 // SU-MIMO (3GPP TS 38.211 V15.4.0 section 7.3.1.3)
|
||||
#define NR_MAX_NB_LAYERS 4 // 8 // SU-MIMO (3GPP TS 38.211 V15.4.0 section 7.3.1.3)
|
||||
#define NR_MAX_NB_CODEWORDS 2
|
||||
#define NR_MAX_NB_HARQ_PROCESSES 16
|
||||
#define NR_MAX_PDSCH_ENCODED_LENGTH (NR_MAX_NB_RB*NR_SYMBOLS_PER_SLOT*NR_NB_SC_PER_RB*8*NR_MAX_NB_LAYERS) // 8 is the maximum modulation order (it was 950984 before !!)
|
||||
@@ -104,11 +104,11 @@
|
||||
#define MAX_NUM_NR_DLSCH_SEGMENTS (NR_MAX_NB_LAYERS*34)
|
||||
#define MAX_NR_DLSCH_PAYLOAD_BYTES (MAX_NUM_NR_DLSCH_SEGMENTS*1056)
|
||||
|
||||
#define MAX_NUM_NR_ULSCH_SEGMENTS 34
|
||||
#define MAX_NUM_NR_ULSCH_SEGMENTS (NR_MAX_NB_LAYERS*34)
|
||||
#define MAX_NR_ULSCH_PAYLOAD_BYTES (MAX_NUM_NR_ULSCH_SEGMENTS*1056)
|
||||
|
||||
#define MAX_NUM_NR_CHANNEL_BITS (14*273*12*8) // 14 symbols, 273 RB
|
||||
#define MAX_NUM_NR_RE (14*273*12)
|
||||
#define MAX_NUM_NR_CHANNEL_BITS (4*14*273*12*8) // 14 symbols, 273 RB
|
||||
#define MAX_NUM_NR_RE (4*14*273*12)
|
||||
#define NR_RX_NB_TH 1
|
||||
#define NR_NB_TH_SLOT 2
|
||||
|
||||
|
||||
@@ -333,6 +333,14 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
|
||||
number_dmrs_symbols, // number of dmrs symbols irrespective of single or double symbol dmrs
|
||||
pusch_pdu->qam_mod_order,
|
||||
pusch_pdu->nrOfLayers);
|
||||
|
||||
|
||||
nr_ulsch_layer_demapping(gNB->pusch_vars[ULSCH_id]->llr,
|
||||
pusch_pdu->nrOfLayers,
|
||||
pusch_pdu->qam_mod_order,
|
||||
G,
|
||||
gNB->pusch_vars[ULSCH_id]->llr_layers);
|
||||
|
||||
//----------------------------------------------------------
|
||||
//------------------- ULSCH unscrambling -------------------
|
||||
//----------------------------------------------------------
|
||||
|
||||
@@ -278,9 +278,12 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
|
||||
AssertFatal(ue->CC_id == 0, "Transmission on secondary CCs is not supported yet\n");
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX,VCD_FUNCTION_IN);
|
||||
|
||||
memset(ue->common_vars.txdataF[0], 0, sizeof(int)*14*ue->frame_parms.ofdm_symbol_size);
|
||||
|
||||
|
||||
for(int i=0; i< ue->frame_parms.nb_antennas_tx; ++i)
|
||||
{
|
||||
memset(ue->common_vars.txdataF[i], 0, sizeof(int)*14*ue->frame_parms.ofdm_symbol_size);
|
||||
}
|
||||
|
||||
LOG_D(PHY,"****** start TX-Chain for AbsSubframe %d.%d ******\n", frame_tx, slot_tx);
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
|
||||
@@ -137,6 +137,7 @@ int main(int argc, char **argv)
|
||||
uint16_t nb_symb_sch = 12;
|
||||
uint16_t nb_rb = 50;
|
||||
uint8_t Imcs = 9;
|
||||
uint8_t Nl = 1;
|
||||
|
||||
double DS_TDL = .03;
|
||||
|
||||
@@ -150,7 +151,7 @@ int main(int argc, char **argv)
|
||||
randominit(0);
|
||||
|
||||
//while ((c = getopt(argc, argv, "df:hpg:i:j:n:l:m:r:s:S:y:z:M:N:F:R:P:")) != -1) {
|
||||
while ((c = getopt(argc, argv, "hg:n:s:S:py:z:M:N:R:F:m:l:r:")) != -1) {
|
||||
while ((c = getopt(argc, argv, "hg:n:s:S:py:z:M:N:R:F:m:l:r:W:")) != -1) {
|
||||
switch (c) {
|
||||
/*case 'f':
|
||||
write_output_file = 1;
|
||||
@@ -251,7 +252,7 @@ int main(int argc, char **argv)
|
||||
case 'y':
|
||||
n_tx = atoi(optarg);
|
||||
|
||||
if ((n_tx == 0) || (n_tx > 2)) {
|
||||
if ((n_tx == 0) || (n_tx > 4)) {
|
||||
printf("Unsupported number of TX antennas %d. Exiting.\n", n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
@@ -261,7 +262,7 @@ int main(int argc, char **argv)
|
||||
case 'z':
|
||||
n_rx = atoi(optarg);
|
||||
|
||||
if ((n_rx == 0) || (n_rx > 2)) {
|
||||
if ((n_rx == 0) || (n_rx > 4)) {
|
||||
printf("Unsupported number of RX antennas %d. Exiting.\n", n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
@@ -299,6 +300,10 @@ int main(int argc, char **argv)
|
||||
printf("Illegal PBCH phase (0-3) got %d\n", pbch_phase);
|
||||
break;*/
|
||||
|
||||
case 'W':
|
||||
Nl = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
Imcs = atoi(optarg);
|
||||
#ifdef DEBUG_NR_ULSCHSIM
|
||||
@@ -335,13 +340,14 @@ int main(int argc, char **argv)
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
//printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
||||
//printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-W number of layer\n");
|
||||
printf("-M Multiple SSB positions in burst\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-R N_RB_UL\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
printf("-m\n");
|
||||
printf("-l\n");
|
||||
printf("-r\n");
|
||||
printf("-m MCS\n");
|
||||
printf("-l number of symbol\n");
|
||||
printf("-r number of RB\n");
|
||||
//printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
//printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n");
|
||||
//printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
|
||||
@@ -359,8 +365,8 @@ int main(int argc, char **argv)
|
||||
snr1 = snr0 + 10;
|
||||
|
||||
gNB2UE = new_channel_desc_scm(n_tx,
|
||||
n_rx,
|
||||
channel_model,
|
||||
n_rx,
|
||||
channel_model,
|
||||
61.44e6, //N_RB2sampling_rate(N_RB_DL),
|
||||
40e6, //N_RB2channel_bandwidth(N_RB_DL),
|
||||
DS_TDL,
|
||||
@@ -426,8 +432,7 @@ int main(int argc, char **argv)
|
||||
uint8_t length_dmrs = 1;
|
||||
uint8_t N_PRB_oh;
|
||||
uint16_t N_RE_prime,code_rate;
|
||||
unsigned char mod_order;
|
||||
uint8_t Nl = 1;
|
||||
unsigned char mod_order;
|
||||
uint8_t rvidx = 0;
|
||||
uint8_t UE_id = 0;
|
||||
|
||||
@@ -437,9 +442,14 @@ int main(int argc, char **argv)
|
||||
|
||||
NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[0][0][0];
|
||||
|
||||
if ((Nl==4)||(Nl==3))
|
||||
{
|
||||
nb_re_dmrs = nb_re_dmrs*2;
|
||||
}
|
||||
|
||||
mod_order = nr_get_Qm_ul(Imcs, 0);
|
||||
code_rate = nr_get_code_rate_ul(Imcs, 0);
|
||||
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, 1);
|
||||
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, Nl);
|
||||
TBS = nr_compute_tbs(mod_order,code_rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, 0, Nl);
|
||||
|
||||
printf("\nAvailable bits %u TBS %u mod_order %d\n", available_bits, TBS, mod_order);
|
||||
|
||||
@@ -240,8 +240,8 @@ openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
channel_desc_t *UE2gNB[NUMBER_OF_UE_MAX][NUMBER_OF_gNB_MAX];
|
||||
double s_re0[122880],s_im0[122880],r_re0[122880],r_im0[122880];
|
||||
double s_re1[122880],s_im1[122880],r_re1[122880],r_im1[122880];
|
||||
double r_re2[122880],r_im2[122880];
|
||||
double r_re3[122880],r_im3[122880];
|
||||
double s_re2[122880],s_im2[122880],r_re2[122880],r_im2[122880];
|
||||
double s_re3[122880],s_im3[122880],r_re3[122880],r_im3[122880];
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
@@ -249,13 +249,13 @@ int main(int argc, char **argv)
|
||||
char c;
|
||||
int i;
|
||||
double SNR, snr0 = -2.0, snr1 = 2.0;
|
||||
double sigma, sigma_dB;
|
||||
double sigma[4], sigma_dB[4];
|
||||
double snr_step = .2;
|
||||
uint8_t snr1set = 0;
|
||||
int slot = 8, frame = 1;
|
||||
FILE *output_fd = NULL;
|
||||
double *s_re[2]= {s_re0,s_re1};
|
||||
double *s_im[2]= {s_im0,s_im1};
|
||||
double *s_re[4]= {s_re0,s_re1,s_re2,s_re3};
|
||||
double *s_im[4]= {s_im0,s_im1,s_im2,s_im3};
|
||||
double *r_re[4]= {r_re0,r_re1,r_re2,r_re3};
|
||||
double *r_im[4]= {r_im0,r_im1,r_im2,r_im3};
|
||||
//uint8_t write_output_file = 0;
|
||||
@@ -285,7 +285,7 @@ int main(int argc, char **argv)
|
||||
int gNB_id = 0;
|
||||
int ap;
|
||||
int tx_offset;
|
||||
int32_t txlev=0;
|
||||
int32_t txlev, atxlev[4];
|
||||
int start_rb = 0;
|
||||
int UE_id =0; // [hna] only works for UE_id = 0 because NUMBER_OF_NR_UE_MAX is set to 1 (phy_init_nr_gNB causes segmentation fault)
|
||||
float target_error_rate = 0.01;
|
||||
@@ -308,7 +308,7 @@ int main(int argc, char **argv)
|
||||
uint16_t ptrsSymbPerSlot = 0;
|
||||
uint16_t ptrsRePerSymb = 0;
|
||||
|
||||
uint8_t transform_precoding = 1; // 0 - ENABLE, 1 - DISABLE
|
||||
uint8_t transformPrecoder = transformPrecoder_disabled; // 0 - ENABLE, 1 - DISABLE
|
||||
uint8_t num_dmrs_cdm_grps_no_data = 1;
|
||||
uint8_t mcs_table = 0;
|
||||
|
||||
@@ -330,7 +330,7 @@ int main(int argc, char **argv)
|
||||
/* initialize the sin-cos table */
|
||||
InitSinLUT();
|
||||
|
||||
while ((c = getopt(argc, argv, "a:b:c:d:ef:g:h:i:j:kl:m:n:p:r:s:y:z:F:G:H:M:N:PR:S:T:U:L:Z")) != -1) {
|
||||
while ((c = getopt(argc, argv, "a:b:c:d:ef:g:h:i:j:kl:m:n:p:r:s:y:z:F:G:H:M:N:PR:S:T:U:L:Z:W:")) != -1) {
|
||||
printf("handling optarg %c\n",c);
|
||||
switch (c) {
|
||||
|
||||
@@ -364,8 +364,8 @@ int main(int argc, char **argv)
|
||||
scg_fd = fopen(optarg, "r");
|
||||
|
||||
if (scg_fd == NULL) {
|
||||
printf("Error opening %s\n", optarg);
|
||||
exit(-1);
|
||||
printf("Error opening %s\n", optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -373,51 +373,51 @@ int main(int argc, char **argv)
|
||||
case 'g':
|
||||
switch ((char) *optarg) {
|
||||
case 'A':
|
||||
channel_model = SCM_A;
|
||||
break;
|
||||
|
||||
channel_model = SCM_A;
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
channel_model = SCM_B;
|
||||
break;
|
||||
|
||||
channel_model = SCM_B;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
channel_model = SCM_C;
|
||||
break;
|
||||
|
||||
channel_model = SCM_C;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
channel_model = SCM_D;
|
||||
break;
|
||||
|
||||
channel_model = SCM_D;
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
channel_model = EPA;
|
||||
break;
|
||||
|
||||
channel_model = EPA;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
channel_model = EVA;
|
||||
break;
|
||||
|
||||
channel_model = EVA;
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
channel_model = ETU;
|
||||
break;
|
||||
channel_model = ETU;
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
channel_model = TDL_C;
|
||||
DS_TDL = .030; // 30 ns
|
||||
break;
|
||||
DS_TDL = .030; // 30 ns
|
||||
break;
|
||||
|
||||
case 'I':
|
||||
channel_model = TDL_C;
|
||||
DS_TDL = .3; // 300ns
|
||||
channel_model = TDL_C;
|
||||
DS_TDL = .3; // 300ns
|
||||
break;
|
||||
|
||||
case 'J':
|
||||
channel_model=TDL_D;
|
||||
DS_TDL = .03;
|
||||
break;
|
||||
channel_model=TDL_D;
|
||||
DS_TDL = .03;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
printf("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -425,8 +425,8 @@ int main(int argc, char **argv)
|
||||
/*case 'i':
|
||||
interf1 = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'j':
|
||||
|
||||
case 'j':
|
||||
interf2 = atoi(optarg);
|
||||
break;*/
|
||||
|
||||
@@ -442,6 +442,10 @@ int main(int argc, char **argv)
|
||||
case 'm':
|
||||
Imcs = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'W':
|
||||
precod_nbr_layers = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
n_trials = atoi(optarg);
|
||||
@@ -466,13 +470,13 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
*/
|
||||
/*
|
||||
case 'r':
|
||||
ricean_factor = pow(10,-.1*atof(optarg));
|
||||
if (ricean_factor>1) {
|
||||
printf("Ricean factor must be between 0 and 1\n");
|
||||
exit(-1);
|
||||
}
|
||||
break;
|
||||
case 'r':
|
||||
ricean_factor = pow(10,-.1*atof(optarg));
|
||||
if (ricean_factor>1) {
|
||||
printf("Ricean factor must be between 0 and 1\n");
|
||||
exit(-1);
|
||||
}
|
||||
break;
|
||||
*/
|
||||
|
||||
/*case 'x':
|
||||
@@ -482,9 +486,9 @@ int main(int argc, char **argv)
|
||||
case 'y':
|
||||
n_tx = atoi(optarg);
|
||||
|
||||
if ((n_tx == 0) || (n_tx > 2)) {
|
||||
printf("Unsupported number of tx antennas %d\n", n_tx);
|
||||
exit(-1);
|
||||
if ((n_tx == 0) || (n_tx > 4)) {
|
||||
printf("Unsupported number of tx antennas %d\n", n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -492,9 +496,9 @@ int main(int argc, char **argv)
|
||||
case 'z':
|
||||
n_rx = atoi(optarg);
|
||||
|
||||
if ((n_rx == 0) || (n_rx > 2)) {
|
||||
printf("Unsupported number of rx antennas %d\n", n_rx);
|
||||
exit(-1);
|
||||
if ((n_rx == 0) || (n_rx > 4)) {
|
||||
printf("Unsupported number of rx antennas %d\n", n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -503,8 +507,8 @@ int main(int argc, char **argv)
|
||||
input_fd = fopen(optarg, "r");
|
||||
|
||||
if (input_fd == NULL) {
|
||||
printf("Problem with filename %s\n", optarg);
|
||||
exit(-1);
|
||||
printf("Problem with filename %s\n", optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -565,11 +569,11 @@ int main(int argc, char **argv)
|
||||
|
||||
case 'Z':
|
||||
|
||||
transform_precoding = 0; // enabled
|
||||
transformPrecoder = transformPrecoder_enabled;
|
||||
num_dmrs_cdm_grps_no_data = 2;
|
||||
mcs_table = 3;
|
||||
|
||||
printf("NOTE: TRANSFORM PRECODING (SC-FDMA) is ENABLED in UPLINK (0 - ENABLE, 1 - DISABLE) : %d \n", transform_precoding);
|
||||
printf("NOTE: TRANSFORM PRECODING (SC-FDMA) is ENABLED in UPLINK (0 - ENABLE, 1 - DISABLE) : %d \n", transformPrecoder);
|
||||
|
||||
break;
|
||||
|
||||
@@ -633,13 +637,13 @@ int main(int argc, char **argv)
|
||||
else if (N_RB_UL == 217) bandwidth = 80;
|
||||
else if (N_RB_UL == 106) bandwidth = 40;
|
||||
else { printf("Add N_RB_UL %d\n",N_RB_UL); exit(-1); }
|
||||
|
||||
|
||||
if (openair0_cfg[0].threequarter_fs == 1) sampling_frequency*=.75;
|
||||
|
||||
UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model,
|
||||
sampling_frequency,
|
||||
bandwidth,
|
||||
DS_TDL,
|
||||
DS_TDL,
|
||||
0, 0, 0, 0);
|
||||
|
||||
if (UE2gNB == NULL) {
|
||||
@@ -667,8 +671,8 @@ int main(int argc, char **argv)
|
||||
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
|
||||
|
||||
|
||||
//frame_parms->nb_antennas_tx = n_tx;
|
||||
//frame_parms->nb_antennas_rx = n_rx;
|
||||
frame_parms->nb_antennas_tx = n_tx;
|
||||
frame_parms->nb_antennas_rx = n_rx;
|
||||
frame_parms->N_RB_DL = N_RB_DL;
|
||||
frame_parms->N_RB_UL = N_RB_UL;
|
||||
frame_parms->Ncp = extended_prefix_flag ? EXTENDED : NORMAL;
|
||||
@@ -730,7 +734,8 @@ int main(int argc, char **argv)
|
||||
memcpy(&UE->frame_parms, frame_parms, sizeof(NR_DL_FRAME_PARMS));
|
||||
|
||||
//phy_init_nr_top(frame_parms);
|
||||
if (init_nr_ue_signal(UE, 1, 0) != 0) {
|
||||
if (init_nr_ue_signal(UE, 1, 0) != 0)
|
||||
{
|
||||
printf("Error at UE NR initialisation\n");
|
||||
exit(-1);
|
||||
}
|
||||
@@ -838,27 +843,32 @@ int main(int argc, char **argv)
|
||||
uint16_t l_prime_mask = get_l_prime(nb_symb_sch, mapping_type, add_pos, length_dmrs, start_symbol, NR_MIB__dmrs_TypeA_Position_pos2);
|
||||
uint16_t number_dmrs_symbols = get_dmrs_symbols_in_slot(l_prime_mask, nb_symb_sch);
|
||||
uint8_t nb_re_dmrs = (dmrs_config_type == pusch_dmrs_type1) ? 6 : 4;
|
||||
|
||||
// if transform precoding is enabled
|
||||
if (transform_precoding == 0) {
|
||||
|
||||
if ((frame_parms->nb_antennas_tx==4)&&(precod_nbr_layers==4))
|
||||
{
|
||||
num_dmrs_cdm_grps_no_data = 2;
|
||||
nb_re_dmrs = nb_re_dmrs * num_dmrs_cdm_grps_no_data;
|
||||
}
|
||||
|
||||
if (transformPrecoder == transformPrecoder_enabled) {
|
||||
|
||||
AssertFatal(enable_ptrs == 0, "PTRS NOT SUPPORTED IF TRANSFORM PRECODING IS ENABLED\n");
|
||||
|
||||
int8_t index = get_index_for_dmrs_lowpapr_seq((NR_NB_SC_PER_RB/2) * nb_rb);
|
||||
AssertFatal(index >= 0, "Num RBs not configured according to 3GPP 38.211 section 6.3.1.4. For PUSCH with transform precoding, num RBs cannot be multiple of any other primenumber other than 2,3,5\n");
|
||||
AssertFatal(index >= 0, "Num RBs not configured according to 3GPP 38.211 section 6.3.1.4. For PUSCH with transform precoding, num RBs cannot be multiple of any other primenumber other than 2,3,5\n");
|
||||
|
||||
dmrs_config_type = pusch_dmrs_type1;
|
||||
nb_re_dmrs = nb_re_dmrs * num_dmrs_cdm_grps_no_data;
|
||||
nb_re_dmrs = nb_re_dmrs * num_dmrs_cdm_grps_no_data;
|
||||
|
||||
printf("[ULSIM]: TRANSFORM PRECODING ENABLED. Num RBs: %d, index for DMRS_SEQ: %d\n", nb_rb, index);
|
||||
}
|
||||
|
||||
|
||||
unsigned int available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, number_dmrs_symbols, mod_order, 1);
|
||||
unsigned int available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, number_dmrs_symbols, mod_order, precod_nbr_layers);
|
||||
unsigned int TBS = nr_compute_tbs(mod_order, code_rate, nb_rb, nb_symb_sch, nb_re_dmrs * number_dmrs_symbols, 0, 0, precod_nbr_layers);
|
||||
|
||||
|
||||
printf("[ULSIM]: length_dmrs: %u, l_prime_mask: %u number_dmrs_symbols: %u, mapping_type: %u add_pos: %d \n", length_dmrs, l_prime_mask, number_dmrs_symbols, mapping_type, add_pos);
|
||||
printf("[ULSIM]: length_dmrs: %u, l_prime_mask: %u number_dmrs_symbols: %u, mapping_type: %u add_pos: %d \n", length_dmrs, l_prime_mask, number_dmrs_symbols, mapping_type, add_pos);
|
||||
printf("[ULSIM]: CDM groups: %u, dmrs_config_type: %d, num_rbs: %u, nb_symb_sch: %u\n", num_dmrs_cdm_grps_no_data, dmrs_config_type, nb_rb, nb_symb_sch);
|
||||
printf("[ULSIM]: MCS: %d, mod order: %u, code_rate: %u\n", Imcs, mod_order, code_rate);
|
||||
printf("[ULSIM]: VALUE OF G: %u, TBS: %u\n", available_bits, TBS);
|
||||
@@ -909,12 +919,14 @@ int main(int argc, char **argv)
|
||||
int slot_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0);
|
||||
int slot_length = slot_offset - frame_parms->get_samples_slot_timestamp(slot-1,frame_parms,0);
|
||||
|
||||
if (input_fd != NULL) {
|
||||
if (input_fd != NULL)
|
||||
{
|
||||
AssertFatal(frame_parms->nb_antennas_rx == 1, "nb_ant != 1\n");
|
||||
// 800 samples is N_TA_OFFSET for FR1 @ 30.72 Ms/s,
|
||||
AssertFatal(frame_parms->subcarrier_spacing==30000,"only 30 kHz for file input for now (%d)\n",frame_parms->subcarrier_spacing);
|
||||
|
||||
if (params_from_file) {
|
||||
if (params_from_file)
|
||||
{
|
||||
fseek(input_fd,file_offset*((slot_length<<2)+4000+16),SEEK_SET);
|
||||
read_errors+=fread((void*)&n_rnti,sizeof(int16_t),1,input_fd);
|
||||
printf("rnti %x\n",n_rnti);
|
||||
@@ -949,7 +961,8 @@ int main(int argc, char **argv)
|
||||
((int16_t*)&gNB->common_vars.rxdata[0][slot_offset])[1+i]);
|
||||
}
|
||||
|
||||
for (SNR = snr0; SNR < snr1; SNR += snr_step) {
|
||||
for (SNR = snr0; SNR < snr1; SNR += snr_step)
|
||||
{
|
||||
varArray_t *table_rx=initVarArray(1000,sizeof(double));
|
||||
int error_flag = 0;
|
||||
n_false_positive = 0;
|
||||
@@ -970,13 +983,16 @@ int main(int argc, char **argv)
|
||||
reset_meas(&gNB->ulsch_rbs_extraction_stats);
|
||||
|
||||
clear_pusch_stats(gNB);
|
||||
for (trial = 0; trial < n_trials; trial++) {
|
||||
for (trial = 0; trial < n_trials; trial++)
|
||||
{
|
||||
uint8_t round = 0;
|
||||
|
||||
crc_status = 1;
|
||||
errors_decoding = 0;
|
||||
memset((void*)roundStats,0,50*sizeof(roundStats[0]));
|
||||
while (round<max_rounds && crc_status) {
|
||||
|
||||
while (round<max_rounds && crc_status)
|
||||
{
|
||||
round_trials[round]++;
|
||||
ulsch_ue[0]->harq_processes[harq_pid]->round = round;
|
||||
gNB->ulsch[0][0]->harq_processes[harq_pid]->round = round;
|
||||
@@ -997,19 +1013,21 @@ int main(int argc, char **argv)
|
||||
int abwp_start = NRRIV2PRBOFFSET(ubwp->bwp_Common->genericParameters.locationAndBandwidth,275);
|
||||
int ibwp_size = ibwps;
|
||||
int ibwp_start = ibwp_rboffset;
|
||||
if (msg3_flag == 1) {
|
||||
if ((ibwp_start < abwp_start) || (ibwp_size > abwp_size))
|
||||
pusch_pdu->bwp_start = abwp_start;
|
||||
else
|
||||
pusch_pdu->bwp_start = ibwp_start;
|
||||
pusch_pdu->bwp_size = ibwp_size;
|
||||
start_rb = (ibwp_start - abwp_start);
|
||||
printf("msg3: ibwp_size %d, abwp_size %d, ibwp_start %d, abwp_start %d\n",
|
||||
ibwp_size,abwp_size,ibwp_start,abwp_start);
|
||||
if (msg3_flag == 1)
|
||||
{
|
||||
if ((ibwp_start < abwp_start) || (ibwp_size > abwp_size))
|
||||
pusch_pdu->bwp_start = abwp_start;
|
||||
else
|
||||
pusch_pdu->bwp_start = ibwp_start;
|
||||
pusch_pdu->bwp_size = ibwp_size;
|
||||
start_rb = (ibwp_start - abwp_start);
|
||||
printf("msg3: ibwp_size %d, abwp_size %d, ibwp_start %d, abwp_start %d\n",
|
||||
ibwp_size,abwp_size,ibwp_start,abwp_start);
|
||||
}
|
||||
else {
|
||||
pusch_pdu->bwp_start = abwp_start;
|
||||
pusch_pdu->bwp_size = abwp_size;
|
||||
else
|
||||
{
|
||||
pusch_pdu->bwp_start = abwp_start;
|
||||
pusch_pdu->bwp_size = abwp_size;
|
||||
}
|
||||
|
||||
pusch_pdu->pusch_data.tb_size = TBS/8;
|
||||
@@ -1019,15 +1037,16 @@ int main(int argc, char **argv)
|
||||
pusch_pdu->mcs_table = mcs_table;
|
||||
pusch_pdu->target_code_rate = code_rate;
|
||||
pusch_pdu->qam_mod_order = mod_order;
|
||||
pusch_pdu->transform_precoding = transform_precoding;
|
||||
pusch_pdu->transformPrecoder = transformPrecoder;
|
||||
pusch_pdu->data_scrambling_id = *scc->physCellId;
|
||||
pusch_pdu->nrOfLayers = 1;
|
||||
pusch_pdu->nrOfLayers = precod_nbr_layers;
|
||||
pusch_pdu->ul_dmrs_symb_pos = l_prime_mask;
|
||||
pusch_pdu->dmrs_config_type = dmrs_config_type;
|
||||
pusch_pdu->ul_dmrs_scrambling_id = *scc->physCellId;
|
||||
pusch_pdu->scid = 0;
|
||||
pusch_pdu->dmrs_ports = 1;
|
||||
pusch_pdu->num_dmrs_cdm_grps_no_data = msg3_flag == 0 ? 1 : 2;
|
||||
pusch_pdu->dmrs_ports = ((1<<precod_nbr_layers)-1);
|
||||
|
||||
pusch_pdu->num_dmrs_cdm_grps_no_data = msg3_flag == 0 ? num_dmrs_cdm_grps_no_data : 2;
|
||||
pusch_pdu->resource_alloc = 1;
|
||||
pusch_pdu->rb_start = start_rb;
|
||||
pusch_pdu->rb_size = nb_rb;
|
||||
@@ -1045,8 +1064,7 @@ int main(int argc, char **argv)
|
||||
pusch_pdu->pusch_ptrs.ptrs_ports_list = (nfapi_nr_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ptrs_ports_t));
|
||||
pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0;
|
||||
|
||||
// if transform precoding is enabled
|
||||
if (transform_precoding == 0) {
|
||||
if (transformPrecoder == transformPrecoder_enabled) {
|
||||
|
||||
pusch_pdu->dfts_ofdm.low_papr_group_number = *scc->physCellId % 30; // U as defined in 38.211 section 6.4.1.1.1.2
|
||||
pusch_pdu->dfts_ofdm.low_papr_sequence_number = 0; // V as defined in 38.211 section 6.4.1.1.1.2
|
||||
@@ -1090,7 +1108,8 @@ int main(int argc, char **argv)
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.dmrs_config_type = dmrs_config_type;
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.mcs_index = Imcs;
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.mcs_table = mcs_table;
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.num_dmrs_cdm_grps_no_data = msg3_flag == 0 ? 1 : 2;
|
||||
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.num_dmrs_cdm_grps_no_data = msg3_flag == 0 ? num_dmrs_cdm_grps_no_data : 2;
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.nrOfLayers = precod_nbr_layers;
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.absolute_delta_PUSCH = 0;
|
||||
|
||||
@@ -1104,10 +1123,9 @@ int main(int argc, char **argv)
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_ports_list = (nfapi_nr_ue_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ue_ptrs_ports_t));
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0;
|
||||
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.transform_precoding = transform_precoding;
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.transformPrecoder = transformPrecoder;
|
||||
|
||||
// if transform precoding is enabled
|
||||
if (transform_precoding == 0) {
|
||||
if (transformPrecoder == transformPrecoder_enabled) {
|
||||
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.dfts_ofdm.low_papr_group_number = *scc->physCellId % 30;// U as defined in 38.211 section 6.4.1.1.1.2
|
||||
ul_config.ul_config_list[0].pusch_config_pdu.dfts_ofdm.low_papr_sequence_number = 0;// V as defined in 38.211 section 6.4.1.1.1.2
|
||||
@@ -1124,8 +1142,7 @@ int main(int argc, char **argv)
|
||||
|
||||
// set FAPI parameters for UE, put them in the scheduled response and call
|
||||
nr_ue_scheduled_response(&scheduled_response);
|
||||
|
||||
|
||||
|
||||
/////////////////////////phy_procedures_nr_ue_TX///////////////////////
|
||||
///////////
|
||||
|
||||
@@ -1135,30 +1152,52 @@ int main(int argc, char **argv)
|
||||
LOG_D(PHY, "Sending Uplink data \n");
|
||||
nr_ue_pusch_common_procedures(UE,
|
||||
slot,
|
||||
&UE->frame_parms,1);
|
||||
&UE->frame_parms,frame_parms->nb_antennas_tx);
|
||||
|
||||
if (n_trials==1) {
|
||||
LOG_M("txsig0.m","txs0", UE->common_vars.txdata[0],frame_parms->samples_per_subframe*10,1,1);
|
||||
if (n_trials==1)
|
||||
{
|
||||
LOG_M("txsig0.m","txs0", &UE->common_vars.txdata[0][slot_offset],slot_length,1,1);
|
||||
LOG_M("txsig0F.m","txs0F", UE->common_vars.txdataF[0],frame_parms->ofdm_symbol_size*14,1,1);
|
||||
if (precod_nbr_layers > 1)
|
||||
{
|
||||
LOG_M("txsig1.m","txs1", &UE->common_vars.txdata[1][slot_offset],slot_length,1,1);
|
||||
LOG_M("txsig1F.m","txs1F", UE->common_vars.txdataF[1],frame_parms->ofdm_symbol_size*14,1,1);
|
||||
if (precod_nbr_layers==4)
|
||||
{
|
||||
LOG_M("txsig2.m","txs2", &UE->common_vars.txdata[2][slot_offset],slot_length,1,1);
|
||||
LOG_M("txsig3.m","txs3", &UE->common_vars.txdata[3][slot_offset],slot_length,1,1);
|
||||
|
||||
LOG_M("txsig2F.m","txs2F", UE->common_vars.txdataF[2],frame_parms->ofdm_symbol_size*14,1,1);
|
||||
LOG_M("txsig3F.m","txs3F", UE->common_vars.txdataF[3],frame_parms->ofdm_symbol_size*14,1,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
///////////
|
||||
////////////////////////////////////////////////////
|
||||
tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0);
|
||||
|
||||
txlev = signal_energy(&UE->common_vars.txdata[0][tx_offset + 5*frame_parms->ofdm_symbol_size + 4*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0],
|
||||
|
||||
for (int aa=0; aa<frame_parms->nb_antennas_tx; aa++)
|
||||
{
|
||||
atxlev[aa] = signal_energy(&UE->common_vars.txdata[aa][tx_offset + 5*frame_parms->ofdm_symbol_size + 4*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0],
|
||||
frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples);
|
||||
}
|
||||
else n_trials = 1;
|
||||
|
||||
if (input_fd == NULL ) {
|
||||
|
||||
sigma_dB = 10 * log10((double)txlev * ((double)frame_parms->ofdm_symbol_size/(12*nb_rb))) - SNR;;
|
||||
sigma = pow(10,sigma_dB/10);
|
||||
|
||||
|
||||
if(n_trials==1) printf("sigma %f (%f dB), txlev %f (factor %f)\n",sigma,sigma_dB,10*log10((double)txlev),(double)(double)
|
||||
frame_parms->ofdm_symbol_size/(12*nb_rb));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
n_trials = 1;
|
||||
}
|
||||
|
||||
if (input_fd == NULL )
|
||||
{
|
||||
for (int aa=0; aa<frame_parms->nb_antennas_tx; aa++)
|
||||
{
|
||||
double factor = (double)(frame_parms->ofdm_symbol_size/(12*nb_rb));
|
||||
txlev = atxlev[aa];
|
||||
sigma_dB[aa] = 10 * log10((double)txlev * factor ) - SNR;;
|
||||
sigma[aa] = pow(10,sigma_dB[aa]/10);
|
||||
|
||||
if(n_trials==1) printf("sigma %f (%f dB), txlev %f (factor %f)\n",sigma[aa],sigma_dB[aa],10*log10((double)txlev),factor);
|
||||
}
|
||||
for (i=0; i<slot_length; i++) {
|
||||
for (int aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||
s_re[aa][i] = ((double)(((short *)&UE->common_vars.txdata[aa][slot_offset]))[(i<<1)]);
|
||||
@@ -1167,15 +1206,26 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
|
||||
if (UE2gNB->max_Doppler == 0) {
|
||||
if (UE2gNB->max_Doppler == 0)
|
||||
{
|
||||
multipath_channel(UE2gNB, s_re, s_im, r_re, r_im, slot_length, 0, (n_trials==1)?1:0);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
multipath_tv_channel(UE2gNB, s_re, s_im, r_re, r_im, 2*slot_length, 0);
|
||||
}
|
||||
for (i=0; i<slot_length; i++) {
|
||||
for (ap=0; ap<frame_parms->nb_antennas_rx; ap++) {
|
||||
((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i) + (delay*2)] = (int16_t)((r_re[ap][i]) + (sqrt(sigma/2)*gaussdouble(0.0,1.0))); // convert to fixed point
|
||||
((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i)+1 + (delay*2)] = (int16_t)((r_im[ap][i]) + (sqrt(sigma/2)*gaussdouble(0.0,1.0)));
|
||||
for (i=0; i<slot_length; i++)
|
||||
{
|
||||
for (ap=0; ap<frame_parms->nb_antennas_rx; ap++)
|
||||
{
|
||||
((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i) + (delay*2)] = (int16_t)((r_re[ap][i]) + (sqrt(sigma[ap]/2)*gaussdouble(0.0,1.0))); // convert to fixed point
|
||||
((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i)+1 + (delay*2)] = (int16_t)((r_im[ap][i]) + (sqrt(sigma[ap]/2)*gaussdouble(0.0,1.0)));
|
||||
|
||||
#if 0
|
||||
((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i) ] = ((int16_t*) &UE->common_vars.txdata[ap][slot_offset])[(2*i) ]; // convert to fixed point
|
||||
((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i)+1] = ((int16_t*) &UE->common_vars.txdata[ap][slot_offset])[(2*i) ];
|
||||
#endif
|
||||
|
||||
/* Add phase noise if enabled */
|
||||
if (pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
|
||||
phase_noise(ts, &((int16_t*)&gNB->common_vars.rxdata[ap][slot_offset])[(2*i)],
|
||||
@@ -1187,7 +1237,8 @@ int main(int argc, char **argv)
|
||||
} /*End input_fd */
|
||||
|
||||
|
||||
if(pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
|
||||
if(pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS)
|
||||
{
|
||||
set_ptrs_symb_idx(&ptrsSymPos,
|
||||
pusch_pdu->nr_of_symbols,
|
||||
pusch_pdu->start_symbol_index,
|
||||
@@ -1197,82 +1248,222 @@ int main(int argc, char **argv)
|
||||
ptrsRePerSymb = ((pusch_pdu->rb_size + ptrs_freq_density - 1)/ptrs_freq_density);
|
||||
printf("[ULSIM] PTRS Symbols in a slot: %2u, RE per Symbol: %3u, RE in a slot %4d\n", ptrsSymbPerSlot,ptrsRePerSymb, ptrsSymbPerSlot*ptrsRePerSymb );
|
||||
}
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
//----------------------------------------------------------
|
||||
//------------------- gNB phy procedures -------------------
|
||||
//----------------------------------------------------------
|
||||
gNB->UL_INFO.rx_ind.number_of_pdus = 0;
|
||||
gNB->UL_INFO.crc_ind.number_crcs = 0;
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
//----------------------------------------------------------
|
||||
//------------------- gNB phy procedures -------------------
|
||||
//----------------------------------------------------------
|
||||
gNB->UL_INFO.rx_ind.number_of_pdus = 0;
|
||||
gNB->UL_INFO.crc_ind.number_crcs = 0;
|
||||
|
||||
#if 0
|
||||
for (ap=0; ap<frame_parms->nb_antennas_rx; ap++)
|
||||
{
|
||||
memcpy(&gNB->common_vars.rxdata[ap][slot_offset], &UE->common_vars.txdata[ap][slot_offset],slot_length*sizeof(int32_t));
|
||||
}
|
||||
#endif
|
||||
|
||||
memcpy(&gNB->common_vars.rxdata[0][slot_offset], &UE->common_vars.txdata[0][slot_offset],slot_length*sizeof(int32_t));
|
||||
|
||||
phy_procedures_gNB_common_RX(gNB, frame, slot);
|
||||
#if 1
|
||||
for (ap=1; ap<frame_parms->nb_antennas_rx; ap++)
|
||||
{
|
||||
memcpy(&gNB->common_vars.rxdata[ap][slot_offset], &UE->common_vars.txdata[ap][slot_offset],slot_length*sizeof(int32_t));
|
||||
}
|
||||
#endif
|
||||
|
||||
ul_proc_error = phy_procedures_gNB_uespec_RX(gNB, frame, slot);
|
||||
#if 0
|
||||
for (ap=1; ap<frame_parms->nb_antennas_rx; ap++)
|
||||
{
|
||||
memcpy(&gNB->common_vars.rxdata[ap][slot_offset], &gNB->common_vars.rxdata[0][slot_offset],slot_length*sizeof(int32_t));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (n_trials==1 && round==0) {
|
||||
LOG_M("rxsig0.m","rx0",&gNB->common_vars.rxdata[0][slot_offset],slot_length,1,1);
|
||||
phy_procedures_gNB_common_RX(gNB, frame, slot);
|
||||
|
||||
for (ap=0; ap<frame_parms->nb_antennas_rx; ap++)
|
||||
{
|
||||
#if 0
|
||||
memcpy(gNB->common_vars.rxdataF[ap], UE->common_vars.txdataF[ap],frame_parms->ofdm_symbol_size*14*sizeof(int32_t));
|
||||
#endif
|
||||
}
|
||||
|
||||
LOG_M("rxsigF0.m","rxsF0",gNB->common_vars.rxdataF[0]+start_symbol*frame_parms->ofdm_symbol_size,nb_symb_sch*frame_parms->ofdm_symbol_size,1,1);
|
||||
ul_proc_error = phy_procedures_gNB_uespec_RX(gNB, frame, slot);
|
||||
|
||||
}
|
||||
if (n_trials==1 && round==0)
|
||||
{
|
||||
LOG_M("rxsig0.m","rx0",&gNB->common_vars.rxdata[0][slot_offset],slot_length,1,1);
|
||||
LOG_M("rxsigF0.m","rxsF0",gNB->common_vars.rxdataF[0],14*frame_parms->ofdm_symbol_size,1,1);
|
||||
|
||||
if (precod_nbr_layers > 1)
|
||||
{
|
||||
LOG_M("rxsig1.m","rx1",&gNB->common_vars.rxdata[1][slot_offset],slot_length,1,1);
|
||||
LOG_M("rxsigF1.m","rxsF1",gNB->common_vars.rxdataF[1],14*frame_parms->ofdm_symbol_size,1,1);
|
||||
if (precod_nbr_layers==4)
|
||||
{
|
||||
LOG_M("rxsig2.m","rx2",&gNB->common_vars.rxdata[2][slot_offset],slot_length,1,1);
|
||||
LOG_M("rxsig3.m","rx3",&gNB->common_vars.rxdata[3][slot_offset],slot_length,1,1);
|
||||
|
||||
LOG_M("rxsigF2.m","rxsF2",gNB->common_vars.rxdataF[2],14*frame_parms->ofdm_symbol_size,1,1);
|
||||
LOG_M("rxsigF3.m","rxsF3",gNB->common_vars.rxdataF[3],14*frame_parms->ofdm_symbol_size,1,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (n_trials == 1 && round==0) {
|
||||
#ifdef __AVX2__
|
||||
int off = ((nb_rb&1) == 1)? 4:0;
|
||||
#else
|
||||
int off = 0;
|
||||
#endif
|
||||
if (n_trials == 1 && round==0)
|
||||
{
|
||||
#ifdef __AVX2__
|
||||
int off = ((nb_rb&1) == 1)? 4:0;
|
||||
#else
|
||||
int off = 0;
|
||||
#endif
|
||||
|
||||
LOG_M("rxsigF0_ext.m","rxsF0_ext",
|
||||
&gNB->pusch_vars[0]->rxdataF_ext[0][start_symbol*NR_NB_SC_PER_RB * pusch_pdu->rb_size],nb_symb_sch*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
LOG_M("chestF0.m","chF0",
|
||||
&gNB->pusch_vars[0]->ul_ch_estimates[0][start_symbol*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1);
|
||||
LOG_M("chestF0_ext.m","chF0_ext",
|
||||
&gNB->pusch_vars[0]->ul_ch_estimates_ext[0][(start_symbol+1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
|
||||
(nb_symb_sch-1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
LOG_M("rxsigF0_comp.m","rxsF0_comp",
|
||||
&gNB->pusch_vars[0]->rxdataF_comp[0][start_symbol*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))],nb_symb_sch*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
LOG_M("rxsigF0_llr.m","rxsF0_llr",
|
||||
&gNB->pusch_vars[0]->llr[0],(nb_symb_sch-1)*NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order,1,0);
|
||||
}
|
||||
LOG_M("rxsigF0_ext.m","rxsF0_ext",
|
||||
&gNB->pusch_vars[0]->rxdataF_ext[0][start_symbol*NR_NB_SC_PER_RB * pusch_pdu->rb_size],nb_symb_sch*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
|
||||
|
||||
LOG_M("chestF0.m","chF0",
|
||||
&gNB->pusch_vars[0]->ul_ch_estimates[0][start_symbol*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1);
|
||||
|
||||
LOG_M("chestF0_ext.m","chF0_ext",
|
||||
&gNB->pusch_vars[0]->ul_ch_estimates_ext[0][(start_symbol+1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
|
||||
(nb_symb_sch-1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
|
||||
|
||||
LOG_M("chestF1_ext.m","chF1_ext",
|
||||
&gNB->pusch_vars[0]->ul_ch_estimates_ext[1][(start_symbol+1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
|
||||
(nb_symb_sch-1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
|
||||
|
||||
LOG_M("rxsigF0_comp.m","rxsF0_comp",
|
||||
&gNB->pusch_vars[0]->rxdataF_comp[0][start_symbol*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))],nb_symb_sch*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
|
||||
LOG_M("rxsigF0_llrlayers0.m","rxsF0_llrlayers0",
|
||||
&gNB->pusch_vars[0]->llr_layers[0][0],(nb_symb_sch-1)*NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order,1,0);
|
||||
|
||||
if (precod_nbr_layers==2)
|
||||
{
|
||||
LOG_M("rxsigF1_ext.m","rxsF1_ext",
|
||||
&gNB->pusch_vars[0]->rxdataF_ext[1][start_symbol*NR_NB_SC_PER_RB * pusch_pdu->rb_size],nb_symb_sch*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
|
||||
LOG_M("chestF3.m","chF3",
|
||||
&gNB->pusch_vars[0]->ul_ch_estimates[3][start_symbol*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1);
|
||||
|
||||
LOG_M("chestF3_ext.m","chF3_ext",
|
||||
&gNB->pusch_vars[0]->ul_ch_estimates_ext[3][(start_symbol+1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
|
||||
(nb_symb_sch-1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
|
||||
LOG_M("rxsigF2_comp.m","rxsF2_comp",
|
||||
&gNB->pusch_vars[0]->rxdataF_comp[2][start_symbol*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))],nb_symb_sch*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
|
||||
LOG_M("rxsigF0_llrlayers1.m","rxsF0_llrlayers1",
|
||||
&gNB->pusch_vars[0]->llr_layers[1][0],(nb_symb_sch-1)*NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order,1,0);
|
||||
|
||||
}
|
||||
|
||||
if (precod_nbr_layers==4)
|
||||
{
|
||||
LOG_M("rxsigF1_ext.m","rxsF1_ext",
|
||||
&gNB->pusch_vars[0]->rxdataF_ext[1][start_symbol*NR_NB_SC_PER_RB * pusch_pdu->rb_size],nb_symb_sch*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
LOG_M("rxsigF2_ext.m","rxsF2_ext",
|
||||
&gNB->pusch_vars[0]->rxdataF_ext[2][start_symbol*NR_NB_SC_PER_RB * pusch_pdu->rb_size],nb_symb_sch*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
LOG_M("rxsigF3_ext.m","rxsF3_ext",
|
||||
&gNB->pusch_vars[0]->rxdataF_ext[3][start_symbol*NR_NB_SC_PER_RB * pusch_pdu->rb_size],nb_symb_sch*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
|
||||
LOG_M("chestF5.m","chF5",
|
||||
&gNB->pusch_vars[0]->ul_ch_estimates[5][start_symbol*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1);
|
||||
LOG_M("chestF10.m","chF10",
|
||||
&gNB->pusch_vars[0]->ul_ch_estimates[10][start_symbol*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1);
|
||||
LOG_M("chestF15.m","chF15",
|
||||
&gNB->pusch_vars[0]->ul_ch_estimates[15][start_symbol*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1);
|
||||
|
||||
|
||||
LOG_M("chestF5_ext.m","chF5_ext",
|
||||
&gNB->pusch_vars[0]->ul_ch_estimates_ext[5][(start_symbol+1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
|
||||
(nb_symb_sch-1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
LOG_M("chestF10_ext.m","chF10_ext",
|
||||
&gNB->pusch_vars[0]->ul_ch_estimates_ext[10][(start_symbol+1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
|
||||
(nb_symb_sch-1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
LOG_M("chestF15_ext.m","chF15_ext",
|
||||
&gNB->pusch_vars[0]->ul_ch_estimates_ext[15][(start_symbol+1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
|
||||
(nb_symb_sch-1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
|
||||
|
||||
//LOG_M("chestF3_ext.m","chF3_ext",
|
||||
//&gNB->pusch_vars[0]->ul_ch_estimates_ext[3][(start_symbol+1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
|
||||
//(nb_symb_sch-1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
//LOG_M("chestF4_ext.m","chF4_ext",
|
||||
//&gNB->pusch_vars[0]->ul_ch_estimates_ext[4][(start_symbol+1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
|
||||
//(nb_symb_sch-1)*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
|
||||
LOG_M("rxsigF4_comp.m","rxsF4_comp",
|
||||
&gNB->pusch_vars[0]->rxdataF_comp[4][start_symbol*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))],nb_symb_sch*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
LOG_M("rxsigF8_comp.m","rxsF8_comp",
|
||||
&gNB->pusch_vars[0]->rxdataF_comp[8][start_symbol*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))],nb_symb_sch*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
LOG_M("rxsigF12_comp.m","rxsF12_comp",
|
||||
&gNB->pusch_vars[0]->rxdataF_comp[12][start_symbol*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))],nb_symb_sch*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
//LOG_M("rxsigF13_comp.m","rxsF13_comp",
|
||||
//&gNB->pusch_vars[0]->rxdataF_comp[13][start_symbol*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))],nb_symb_sch*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
//LOG_M("rxsigF15_comp.m","rxsF15_comp",
|
||||
//&gNB->pusch_vars[0]->rxdataF_comp[15][start_symbol*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size))],nb_symb_sch*(off+(NR_NB_SC_PER_RB * pusch_pdu->rb_size)),1,1);
|
||||
|
||||
LOG_M("rxsigF0_llrlayers1.m","rxsF0_llrlayers1",
|
||||
&gNB->pusch_vars[0]->llr_layers[1][0],(nb_symb_sch-1)*NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order,1,0);
|
||||
LOG_M("rxsigF0_llrlayers2.m","rxsF0_llrlayers2",
|
||||
&gNB->pusch_vars[0]->llr_layers[2][0],(nb_symb_sch-1)*NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order,1,0);
|
||||
LOG_M("rxsigF0_llrlayers3.m","rxsF0_llrlayers3",
|
||||
&gNB->pusch_vars[0]->llr_layers[3][0],(nb_symb_sch-1)*NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order,1,0);
|
||||
}
|
||||
|
||||
|
||||
LOG_M("rxsigF0_llr.m","rxsF0_llr",
|
||||
&gNB->pusch_vars[0]->llr[0],precod_nbr_layers*(nb_symb_sch-1)*NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order,1,0);
|
||||
}
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
if ((gNB->ulsch[0][0]->last_iteration_cnt >=
|
||||
gNB->ulsch[0][0]->max_ldpc_iterations+1) || ul_proc_error == 1) {
|
||||
error_flag = 1;
|
||||
n_errors[round]++;
|
||||
crc_status = 1;
|
||||
} else {
|
||||
crc_status = 0;
|
||||
}
|
||||
if(n_trials==1) printf("end of round %d rv_index %d\n",round, rv_index);
|
||||
if ((gNB->ulsch[0][0]->last_iteration_cnt >=
|
||||
gNB->ulsch[0][0]->max_ldpc_iterations+1) || ul_proc_error == 1)
|
||||
{
|
||||
error_flag = 1;
|
||||
n_errors[round]++;
|
||||
crc_status = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
crc_status = 0;
|
||||
}
|
||||
if(n_trials==1) printf("end of round %d rv_index %d\n",round, rv_index);
|
||||
|
||||
//----------------------------------------------------------
|
||||
//----------------- count and print errors -----------------
|
||||
//----------------------------------------------------------
|
||||
//----------------------------------------------------------
|
||||
//----------------- count and print errors -----------------
|
||||
//----------------------------------------------------------
|
||||
|
||||
if ((pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) && (SNR==snr0) && (trial==0) && (round==0)) {
|
||||
ptrs_symbols = 0;
|
||||
for (int i = pusch_pdu->start_symbol_index; i < pusch_pdu->start_symbol_index + pusch_pdu->nr_of_symbols; i++){
|
||||
ptrs_symbols += ((gNB->pusch_vars[UE_id]->ptrs_symbols) >> i) & 1;
|
||||
}
|
||||
/* 2*5*(50/2), for RB = 50,K = 2 for 5 OFDM PTRS symbols */
|
||||
available_bits -= 2 * ptrs_symbols * ((nb_rb + ptrs_freq_density - 1) /ptrs_freq_density);
|
||||
printf("[ULSIM][PTRS] Available bits are: %5u, removed PTRS bits are: %5d \n",available_bits, (ptrsSymbPerSlot * ptrsRePerSymb * 2) );
|
||||
if ((pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) && (SNR==snr0) && (trial==0) && (round==0))
|
||||
{
|
||||
ptrs_symbols = 0;
|
||||
for (int i = pusch_pdu->start_symbol_index; i < pusch_pdu->start_symbol_index + pusch_pdu->nr_of_symbols; i++)
|
||||
{
|
||||
ptrs_symbols += ((gNB->pusch_vars[UE_id]->ptrs_symbols) >> i) & 1;
|
||||
}
|
||||
|
||||
/* 2*5*(50/2), for RB = 50,K = 2 for 5 OFDM PTRS symbols */
|
||||
available_bits -= 2 * ptrs_symbols * ((nb_rb + ptrs_freq_density - 1) /ptrs_freq_density);
|
||||
printf("[ULSIM][PTRS] Available bits are: %5u, removed PTRS bits are: %5d \n",available_bits, (ptrsSymbPerSlot * ptrsRePerSymb * 2) );
|
||||
}
|
||||
|
||||
for (i = 0; i < available_bits; i++) {
|
||||
|
||||
if(((ulsch_ue[0]->g[i] == 0) && (gNB->pusch_vars[UE_id]->llr[i] <= 0)) ||
|
||||
((ulsch_ue[0]->g[i] == 1) && (gNB->pusch_vars[UE_id]->llr[i] >= 0)))
|
||||
{
|
||||
/*if(errors_scrambling == 0)
|
||||
printf("\x1B[34m" "[frame %d][trial %d]\t1st bit in error in unscrambling = %d\n" "\x1B[0m", frame, trial, i);*/
|
||||
errors_scrambling[round]++;
|
||||
}
|
||||
}
|
||||
round++;
|
||||
for (i = 0; i < available_bits; i++)
|
||||
{
|
||||
|
||||
if(((ulsch_ue[0]->g[i] == 0) && (gNB->pusch_vars[UE_id]->llr[i] <= 0)) ||
|
||||
((ulsch_ue[0]->g[i] == 1) && (gNB->pusch_vars[UE_id]->llr[i] >= 0)))
|
||||
{
|
||||
/*if(errors_scrambling == 0)
|
||||
printf("\x1B[34m" "[frame %d][trial %d]\t1st bit in error in unscrambling = %d\n" "\x1B[0m", frame, trial, i);*/
|
||||
errors_scrambling[round]++;
|
||||
}
|
||||
}
|
||||
round++;
|
||||
|
||||
} // round
|
||||
|
||||
@@ -1286,25 +1477,25 @@ int main(int argc, char **argv)
|
||||
test_input_bit[i] = (ulsch_ue[0]->harq_processes[harq_pid]->b[i/8] & (1 << (i & 7))) >> (i & 7);
|
||||
|
||||
if (estimated_output_bit[i] != test_input_bit[i]) {
|
||||
/*if(errors_decoding == 0)
|
||||
printf("\x1B[34m""[frame %d][trial %d]\t1st bit in error in decoding = %d\n" "\x1B[0m", frame, trial, i);*/
|
||||
errors_decoding++;
|
||||
/*if(errors_decoding == 0)
|
||||
printf("\x1B[34m""[frame %d][trial %d]\t1st bit in error in decoding = %d\n" "\x1B[0m", frame, trial, i);*/
|
||||
errors_decoding++;
|
||||
}
|
||||
}
|
||||
if (n_trials == 1) {
|
||||
for (int r=0;r<ulsch_ue[0]->harq_processes[harq_pid]->C;r++)
|
||||
for (int i=0;i<ulsch_ue[0]->harq_processes[harq_pid]->K>>3;i++) {
|
||||
/*if ((ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]) != 0) printf("************");
|
||||
printf("r %d: in[%d] %x, out[%d] %x (%x)\n",r,
|
||||
i,ulsch_ue[0]->harq_processes[harq_pid]->c[r][i],
|
||||
i,ulsch_gNB->harq_processes[harq_pid]->c[r][i],
|
||||
ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]);*/
|
||||
}
|
||||
for (int i=0;i<ulsch_ue[0]->harq_processes[harq_pid]->K>>3;i++) {
|
||||
/*if ((ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]) != 0) printf("************");
|
||||
printf("r %d: in[%d] %x, out[%d] %x (%x)\n",r,
|
||||
i,ulsch_ue[0]->harq_processes[harq_pid]->c[r][i],
|
||||
i,ulsch_gNB->harq_processes[harq_pid]->c[r][i],
|
||||
ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]);*/
|
||||
}
|
||||
}
|
||||
if (errors_decoding > 0 && error_flag == 0) {
|
||||
n_false_positive++;
|
||||
if (n_trials==1)
|
||||
printf("\x1B[31m""[frame %d][trial %d]\tnumber of errors in decoding = %u\n" "\x1B[0m", frame, trial, errors_decoding);
|
||||
printf("\x1B[31m""[frame %d][trial %d]\tnumber of errors in decoding = %u\n" "\x1B[0m", frame, trial, errors_decoding);
|
||||
}
|
||||
roundStats[snrRun] += ((float)round);
|
||||
if (!crc_status) effRate += ((float)TBS)/round;
|
||||
@@ -1317,16 +1508,16 @@ int main(int argc, char **argv)
|
||||
printf("SNR %f: n_errors (%d/%d,%d/%d,%d/%d,%d/%d) (negative CRC), false_positive %d/%d, errors_scrambling (%u/%u,%u/%u,%u/%u,%u/%u\n", SNR, n_errors[0], round_trials[0],n_errors[1], round_trials[1],n_errors[2], round_trials[2],n_errors[3], round_trials[3], n_false_positive, n_trials, errors_scrambling[0],available_bits*n_trials,errors_scrambling[1],available_bits*n_trials,errors_scrambling[2],available_bits*n_trials,errors_scrambling[3],available_bits*n_trials);
|
||||
printf("\n");
|
||||
printf("SNR %f: Channel BLER (%e,%e,%e,%e), Channel BER (%e,%e,%e,%e) Avg round %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n",
|
||||
SNR,
|
||||
(double)n_errors[0]/round_trials[0],
|
||||
(double)n_errors[1]/round_trials[0],
|
||||
(double)n_errors[2]/round_trials[0],
|
||||
(double)n_errors[3]/round_trials[0],
|
||||
(double)errors_scrambling[0]/available_bits/round_trials[0],
|
||||
(double)errors_scrambling[1]/available_bits/round_trials[0],
|
||||
(double)errors_scrambling[2]/available_bits/round_trials[0],
|
||||
(double)errors_scrambling[3]/available_bits/round_trials[0],
|
||||
roundStats[snrRun],effRate,effRate/TBS*100,TBS);
|
||||
SNR,
|
||||
(double)n_errors[0]/round_trials[0],
|
||||
(double)n_errors[1]/round_trials[0],
|
||||
(double)n_errors[2]/round_trials[0],
|
||||
(double)n_errors[3]/round_trials[0],
|
||||
(double)errors_scrambling[0]/available_bits/round_trials[0],
|
||||
(double)errors_scrambling[1]/available_bits/round_trials[0],
|
||||
(double)errors_scrambling[2]/available_bits/round_trials[0],
|
||||
(double)errors_scrambling[3]/available_bits/round_trials[0],
|
||||
roundStats[snrRun],effRate,effRate/TBS*100,TBS);
|
||||
|
||||
FILE *fd=fopen("nr_ulsim.log","w");
|
||||
dump_pusch_stats(fd,gNB);
|
||||
|
||||
@@ -101,10 +101,10 @@ long get_k2(NR_UE_MAC_INST_t *mac, uint8_t time_domain_ind) {
|
||||
pusch_TimeDomainAllocationList = pusch_config->pusch_TimeDomainAllocationList->choice.setup;
|
||||
}
|
||||
else if (mac->ULbwp[0] &&
|
||||
mac->ULbwp[0]->bwp_Common&&
|
||||
mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon&&
|
||||
mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup &&
|
||||
mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) {
|
||||
mac->ULbwp[0]->bwp_Common&&
|
||||
mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon&&
|
||||
mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup &&
|
||||
mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) {
|
||||
pusch_TimeDomainAllocationList = mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
||||
}
|
||||
else if (mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList)
|
||||
@@ -166,7 +166,7 @@ void ul_layers_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_con
|
||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||
NR_PUSCH_Config_t *pusch_Config = mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup;
|
||||
|
||||
long transformPrecoder;
|
||||
long transformPrecoder;
|
||||
if (pusch_Config->transformPrecoder)
|
||||
transformPrecoder = *pusch_Config->transformPrecoder;
|
||||
else {
|
||||
@@ -175,7 +175,7 @@ void ul_layers_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_con
|
||||
else
|
||||
transformPrecoder = NR_PUSCH_Config__transformPrecoder_disabled;
|
||||
}
|
||||
|
||||
pusch_config_pdu->transformPrecoder = transformPrecoder;
|
||||
|
||||
/* PRECOD_NBR_LAYERS */
|
||||
if ((*pusch_Config->txConfig == NR_PUSCH_Config__txConfig_nonCodebook));
|
||||
@@ -197,17 +197,17 @@ void ul_layers_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_con
|
||||
|
||||
if (*pusch_Config->codebookSubset == NR_PUSCH_Config__codebookSubset_fullyAndPartialAndNonCoherent) {
|
||||
pusch_config_pdu->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][0];
|
||||
pusch_config_pdu->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][1];
|
||||
pusch_config_pdu->Tpmi = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][1];
|
||||
}
|
||||
|
||||
if (*pusch_Config->codebookSubset == NR_PUSCH_Config__codebookSubset_partialAndNonCoherent){
|
||||
pusch_config_pdu->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][2];
|
||||
pusch_config_pdu->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][3];
|
||||
pusch_config_pdu->Tpmi = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][3];
|
||||
}
|
||||
|
||||
if (*pusch_Config->codebookSubset == NR_PUSCH_Config__codebookSubset_nonCoherent){
|
||||
pusch_config_pdu->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][4];
|
||||
pusch_config_pdu->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][5];
|
||||
pusch_config_pdu->Tpmi = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][5];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,17 +218,17 @@ void ul_layers_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_con
|
||||
|
||||
if (*pusch_Config->codebookSubset == NR_PUSCH_Config__codebookSubset_fullyAndPartialAndNonCoherent) {
|
||||
pusch_config_pdu->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][6];
|
||||
pusch_config_pdu->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][7];
|
||||
pusch_config_pdu->Tpmi = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][7];
|
||||
}
|
||||
|
||||
if (*pusch_Config->codebookSubset == NR_PUSCH_Config__codebookSubset_partialAndNonCoherent){
|
||||
pusch_config_pdu->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][8];
|
||||
pusch_config_pdu->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][9];
|
||||
pusch_config_pdu->Tpmi = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][9];
|
||||
}
|
||||
|
||||
if (*pusch_Config->codebookSubset == NR_PUSCH_Config__codebookSubset_nonCoherent){
|
||||
pusch_config_pdu->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][10];
|
||||
pusch_config_pdu->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][11];
|
||||
pusch_config_pdu->Tpmi = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][11];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -239,12 +239,12 @@ void ul_layers_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_con
|
||||
|
||||
if (*pusch_Config->codebookSubset == NR_PUSCH_Config__codebookSubset_fullyAndPartialAndNonCoherent) {
|
||||
pusch_config_pdu->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][12];
|
||||
pusch_config_pdu->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][13];
|
||||
pusch_config_pdu->Tpmi = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][13];
|
||||
}
|
||||
|
||||
if (*pusch_Config->codebookSubset == NR_PUSCH_Config__codebookSubset_nonCoherent){
|
||||
pusch_config_pdu->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][14];
|
||||
pusch_config_pdu->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][15];
|
||||
pusch_config_pdu->Tpmi = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][15];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -256,12 +256,12 @@ void ul_layers_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_con
|
||||
|
||||
if (*pusch_Config->codebookSubset == NR_PUSCH_Config__codebookSubset_fullyAndPartialAndNonCoherent) {
|
||||
pusch_config_pdu->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][16];
|
||||
pusch_config_pdu->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][17];
|
||||
pusch_config_pdu->Tpmi = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][17];
|
||||
}
|
||||
|
||||
if (*pusch_Config->codebookSubset == NR_PUSCH_Config__codebookSubset_nonCoherent){
|
||||
pusch_config_pdu->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][18];
|
||||
pusch_config_pdu->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][19];
|
||||
pusch_config_pdu->Tpmi = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][19];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -270,9 +270,9 @@ void ul_layers_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_con
|
||||
|
||||
/*-------------------- Changed to enable Transform precoding in RF SIM------------------------------------------------*/
|
||||
|
||||
/*if (pusch_config_pdu->transform_precoding == transform_precoder_enabled) {
|
||||
/*if (pusch_config_pdu->transformPrecoder == transformPrecoder_enabled) {
|
||||
|
||||
pusch_config_dedicated->transform_precoder = transform_precoder_enabled;
|
||||
pusch_config_dedicated->transform_precoder = transformPrecoder_enabled;
|
||||
|
||||
if(pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA != NULL) {
|
||||
|
||||
@@ -294,7 +294,7 @@ void ul_layers_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_con
|
||||
|
||||
}
|
||||
} else
|
||||
pusch_config_dedicated->transform_precoder = transform_precoder_disabled;*/
|
||||
pusch_config_dedicated->transform_precoder = ttransformPrecoder_disabled;*/
|
||||
}
|
||||
|
||||
// todo: this function shall be reviewed completely because of the many comments left by the author
|
||||
@@ -306,7 +306,7 @@ void ul_ports_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_conf
|
||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||
NR_PUSCH_Config_t *pusch_Config = mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup;
|
||||
|
||||
long transformPrecoder;
|
||||
long transformPrecoder;
|
||||
if (pusch_Config->transformPrecoder)
|
||||
transformPrecoder = *pusch_Config->transformPrecoder;
|
||||
else {
|
||||
@@ -345,32 +345,23 @@ void ul_ports_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_conf
|
||||
(dmrs_type == NULL) && (max_length == NULL)) { // tables 7.3.1.1.2-8/9/10/11
|
||||
|
||||
if (rank == 1) {
|
||||
pusch_config_pdu->num_dmrs_cdm_grps_no_data = (dci->antenna_ports.val > 1)?2:1; //TBC
|
||||
pusch_config_pdu->dmrs_ports = (dci->antenna_ports.val > 1)?(dci->antenna_ports.val-2):(dci->antenna_ports.val); //TBC
|
||||
pusch_config_pdu->num_dmrs_cdm_grps_no_data = (dci->antenna_ports.val > 1)?2:1;
|
||||
pusch_config_pdu->dmrs_ports =1<<((dci->antenna_ports.val > 1)?(dci->antenna_ports.val-2):(dci->antenna_ports.val));
|
||||
}
|
||||
|
||||
if (rank == 2){
|
||||
pusch_config_pdu->num_dmrs_cdm_grps_no_data = (dci->antenna_ports.val > 0)?2:1; //TBC
|
||||
pusch_config_pdu->dmrs_ports = 0; //FIXME
|
||||
//pusch_config_pdu->dmrs_ports[0] = (dci->antenna_ports > 1)?(dci->antenna_ports > 2 ?0:2):0;
|
||||
//pusch_config_pdu->dmrs_ports[1] = (dci->antenna_ports > 1)?(dci->antenna_ports > 2 ?2:3):1;
|
||||
pusch_config_pdu->num_dmrs_cdm_grps_no_data = (dci->antenna_ports.val > 0)?2:1;
|
||||
pusch_config_pdu->dmrs_ports = (dci->antenna_ports.val > 1)?((dci->antenna_ports.val> 2)?0x5:0xc):0x3;
|
||||
}
|
||||
|
||||
if (rank == 3){
|
||||
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2; //TBC
|
||||
pusch_config_pdu->dmrs_ports = 0; //FIXME
|
||||
//pusch_config_pdu->dmrs_ports[0] = 0;
|
||||
//pusch_config_pdu->dmrs_ports[1] = 1;
|
||||
//pusch_config_pdu->dmrs_ports[2] = 2;
|
||||
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2;
|
||||
pusch_config_pdu->dmrs_ports = ((1<<rank)-1);
|
||||
}
|
||||
|
||||
if (rank == 4){
|
||||
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2; //TBC
|
||||
pusch_config_pdu->dmrs_ports = 0; //FIXME
|
||||
//pusch_config_pdu->dmrs_ports[0] = 0;
|
||||
//pusch_config_pdu->dmrs_ports[1] = 1;
|
||||
//pusch_config_pdu->dmrs_ports[2] = 2;
|
||||
//pusch_config_pdu->dmrs_ports[3] = 3;
|
||||
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2;
|
||||
pusch_config_pdu->dmrs_ports = ((1<<rank)-1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -514,6 +505,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
pusch_config_pdu->dmrs_config_type = pusch_dmrs_type1;
|
||||
pusch_config_pdu->pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA;
|
||||
pusch_config_pdu->nrOfLayers = 1;
|
||||
pusch_config_pdu->Tpmi = 0;
|
||||
pusch_config_pdu->rnti = rnti;
|
||||
NR_BWP_UplinkCommon_t *initialUplinkBWP;
|
||||
if (mac->scc) initialUplinkBWP = mac->scc->uplinkConfigCommon->initialUplinkBWP;
|
||||
@@ -606,7 +598,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
pusch_config_pdu->scid = 0;
|
||||
|
||||
// Transform precoding according to 6.1.3 UE procedure for applying transform precoding on PUSCH in 38.214
|
||||
pusch_config_pdu->transform_precoding = get_transformPrecoding(initialUplinkBWP, pusch_Config, NULL, NULL, NR_RNTI_TC, 0); // TBR fix rnti and take out
|
||||
pusch_config_pdu->transformPrecoder = get_transformPrecoding(initialUplinkBWP, pusch_Config, NULL, NULL, NR_RNTI_TC, 0); // TBR fix rnti and take out
|
||||
|
||||
// Resource allocation in frequency domain according to 6.1.2.2 in TS 38.214
|
||||
pusch_config_pdu->resource_alloc = (mac->cg) ? pusch_Config->resourceAllocation : 1;
|
||||
@@ -651,7 +643,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
/* Transform precoding */
|
||||
if (rnti_type != NR_RNTI_CS || (rnti_type == NR_RNTI_CS && dci->ndi == 1)) {
|
||||
pusch_config_pdu->transform_precoding = get_transformPrecoding(initialUplinkBWP, pusch_Config, NULL, dci_format, rnti_type, 0);
|
||||
pusch_config_pdu->transformPrecoder = get_transformPrecoding(initialUplinkBWP, pusch_Config, NULL, dci_format, rnti_type, 0);
|
||||
}
|
||||
|
||||
/*DCI format-related configuration*/
|
||||
@@ -703,7 +695,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
/* TRANSFORM PRECODING ------------------------------------------------------------------------------------------*/
|
||||
|
||||
if (pusch_config_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_enabled) {
|
||||
if (pusch_config_pdu->transformPrecoder == NR_PUSCH_Config__transformPrecoder_enabled) {
|
||||
|
||||
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2;
|
||||
|
||||
@@ -748,7 +740,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
pusch_config_pdu->mcs_index = dci->mcs;
|
||||
|
||||
/* MCS TABLE */
|
||||
if (pusch_config_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_disabled) {
|
||||
if (pusch_config_pdu->transformPrecoder == NR_PUSCH_Config__transformPrecoder_disabled) {
|
||||
pusch_config_pdu->mcs_table = get_pusch_mcs_table(pusch_Config ? pusch_Config->mcs_Table : NULL, 0, *dci_format, rnti_type, target_ss, false);
|
||||
} else {
|
||||
pusch_config_pdu->mcs_table = get_pusch_mcs_table(pusch_Config ? pusch_Config->mcs_TableTransformPrecoder : NULL, 1, *dci_format, rnti_type, target_ss, false);
|
||||
@@ -785,9 +777,9 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
mappingtype, add_pos, dmrslength,
|
||||
pusch_config_pdu->start_symbol_index,
|
||||
mac->scc ? mac->scc->dmrs_TypeA_Position : mac->mib->dmrs_TypeA_Position);
|
||||
if ((mac->ULbwp[0] && pusch_config_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_disabled))
|
||||
if ((mac->ULbwp[0] && pusch_config_pdu->transformPrecoder == NR_PUSCH_Config__transformPrecoder_disabled))
|
||||
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 1;
|
||||
else if (*dci_format == NR_UL_DCI_FORMAT_0_0 || (mac->ULbwp[0] && pusch_config_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_enabled))
|
||||
else if (*dci_format == NR_UL_DCI_FORMAT_0_0 || (mac->ULbwp[0] && pusch_config_pdu->transformPrecoder == NR_PUSCH_Config__transformPrecoder_enabled))
|
||||
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2;
|
||||
|
||||
// Num PRB Overhead from PUSCH-ServingCellConfig
|
||||
@@ -803,12 +795,12 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
/* PTRS */
|
||||
if (mac->ULbwp[0] &&
|
||||
mac->ULbwp[0]->bwp_Dedicated &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pusch_Config &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS) {
|
||||
if (pusch_config_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_disabled) {
|
||||
mac->ULbwp[0]->bwp_Dedicated &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pusch_Config &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS) {
|
||||
if (pusch_config_pdu->transformPrecoder == NR_PUSCH_Config__transformPrecoder_disabled) {
|
||||
nfapi_nr_ue_ptrs_ports_t ptrs_ports_list;
|
||||
pusch_config_pdu->pusch_ptrs.ptrs_ports_list = &ptrs_ports_list;
|
||||
valid_ptrs_setup = set_ul_ptrs_values(mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup,
|
||||
@@ -927,33 +919,33 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
||||
dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.rnti,
|
||||
dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.N_RB_BWP);
|
||||
*/
|
||||
NR_SearchSpace_t *ss0 = mac->search_space_zero;
|
||||
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15;
|
||||
NR_SearchSpace_t *ss0 = mac->search_space_zero;
|
||||
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15;
|
||||
|
||||
|
||||
if( mac->scc == NULL && mac->scc_SIB == NULL && (rx_frame%2 == mac->type0_PDCCH_CSS_config.sfn_c) && (rx_slot == mac->type0_PDCCH_CSS_config.n_0) ){
|
||||
rel15->num_dci_options = 1;
|
||||
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
|
||||
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_SI, -1);
|
||||
fill_dci_search_candidates(ss0, rel15);
|
||||
dl_config->number_pdus = 1;
|
||||
LOG_D(NR_MAC,"Calling fill_scheduled_response, type0_pdcch, num_pdus %d\n",dl_config->number_pdus);
|
||||
fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->thread_id);
|
||||
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL)
|
||||
mac->if_module->scheduled_response(&scheduled_response);
|
||||
}
|
||||
// this is for Msg2/Msg4
|
||||
if (mac->ra.ra_state >= WAIT_RAR) {
|
||||
rel15->num_dci_options = 1;
|
||||
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
|
||||
config_dci_pdu(mac, rel15, dl_config, mac->ra.ra_state == WAIT_RAR ? NR_RNTI_RA : NR_RNTI_TC , -1);
|
||||
fill_dci_search_candidates(ss0, rel15);
|
||||
dl_config->number_pdus = 1;
|
||||
LOG_D(NR_MAC,"mac->cg %p: Calling fill_scheduled_response rnti %x, type0_pdcch, num_pdus %d\n",mac->cg,rel15->rnti,dl_config->number_pdus);
|
||||
fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->thread_id);
|
||||
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL)
|
||||
mac->if_module->scheduled_response(&scheduled_response);
|
||||
}
|
||||
if( mac->scc == NULL && mac->scc_SIB == NULL && (rx_frame%2 == mac->type0_PDCCH_CSS_config.sfn_c) && (rx_slot == mac->type0_PDCCH_CSS_config.n_0) ){
|
||||
rel15->num_dci_options = 1;
|
||||
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
|
||||
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_SI, -1);
|
||||
fill_dci_search_candidates(ss0, rel15);
|
||||
dl_config->number_pdus = 1;
|
||||
LOG_D(NR_MAC,"Calling fill_scheduled_response, type0_pdcch, num_pdus %d\n",dl_config->number_pdus);
|
||||
fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->thread_id);
|
||||
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL)
|
||||
mac->if_module->scheduled_response(&scheduled_response);
|
||||
}
|
||||
// this is for Msg2/Msg4
|
||||
if (mac->ra.ra_state >= WAIT_RAR) {
|
||||
rel15->num_dci_options = 1;
|
||||
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
|
||||
config_dci_pdu(mac, rel15, dl_config, mac->ra.ra_state == WAIT_RAR ? NR_RNTI_RA : NR_RNTI_TC , -1);
|
||||
fill_dci_search_candidates(ss0, rel15);
|
||||
dl_config->number_pdus = 1;
|
||||
LOG_D(NR_MAC,"mac->cg %p: Calling fill_scheduled_response rnti %x, type0_pdcch, num_pdus %d\n",mac->cg,rel15->rnti,dl_config->number_pdus);
|
||||
fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->thread_id);
|
||||
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL)
|
||||
mac->if_module->scheduled_response(&scheduled_response);
|
||||
}
|
||||
}
|
||||
} else { // we have a Master or Secondary CellGroupConfig
|
||||
|
||||
@@ -1031,7 +1023,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
||||
}
|
||||
LOG_D(NR_MAC,"Flipping NDI for harq_id %d (Msg3)\n",ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator);
|
||||
mac->UL_ndi[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] = ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator;
|
||||
mac->first_ul_tx[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] = 0;
|
||||
mac->first_ul_tx[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] = 0;
|
||||
} else {
|
||||
|
||||
if ( (mac->UL_ndi[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] != ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator ||
|
||||
@@ -1654,8 +1646,8 @@ static void map_ssb_to_ro(NR_UE_MAC_INST_t *mac) {
|
||||
for (ssb_idx=0; ssb_idx<MAX_NB_SSB; ssb_idx++) {
|
||||
uint8_t nb_mapped_ro_in_association_period=0; // Reset the nb of mapped ROs for the new SSB index
|
||||
|
||||
LOG_D(NR_MAC,"Checking ssb_idx %d => %d\n",
|
||||
ssb_idx,ssb_list.tx_ssb[ssb_idx].transmitted);
|
||||
LOG_D(NR_MAC,"Checking ssb_idx %d => %d\n",
|
||||
ssb_idx,ssb_list.tx_ssb[ssb_idx].transmitted);
|
||||
|
||||
// Map only the transmitted ssb_idx
|
||||
if (true == ssb_list.tx_ssb[ssb_idx].transmitted) {
|
||||
@@ -2084,21 +2076,21 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
for (lcid = UL_SCH_LCID_SRB1;
|
||||
lcid < MAX_LCID; lcid++) {
|
||||
while ( (sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,
|
||||
mac->crnti,
|
||||
eNB_index,
|
||||
frameP,
|
||||
ENB_FLAG_NO,
|
||||
MBMS_FLAG_NO,
|
||||
lcid,
|
||||
buflen_remain-MAX_RLC_SDU_SUBHEADER_SIZE*2,
|
||||
//Fixme: Laurent I removed MAX_RLC_SDU_SUBHEADER_SIZE*2 because else we get out the buffer silently
|
||||
// the interface with nr_generate_ulsch_pdu() looks over complex and not CPU optimized
|
||||
current_ulsch_ptr , 0,
|
||||
0)) > 0 ) {
|
||||
|
||||
mac->crnti,
|
||||
eNB_index,
|
||||
frameP,
|
||||
ENB_FLAG_NO,
|
||||
MBMS_FLAG_NO,
|
||||
lcid,
|
||||
buflen_remain-MAX_RLC_SDU_SUBHEADER_SIZE*2,
|
||||
//Fixme: Laurent I removed MAX_RLC_SDU_SUBHEADER_SIZE*2 because else we get out the buffer silently
|
||||
// the interface with nr_generate_ulsch_pdu() looks over complex and not CPU optimized
|
||||
current_ulsch_ptr , 0,
|
||||
0)) > 0 ) {
|
||||
|
||||
AssertFatal(buflen_remain >= sdu_lengths[num_sdus],
|
||||
"LCID=%d RLC has segmented %d bytes but MAC has max=%d\n",
|
||||
lcid, sdu_lengths[num_sdus], buflen_remain);
|
||||
"LCID=%d RLC has segmented %d bytes but MAC has max=%d\n",
|
||||
lcid, sdu_lengths[num_sdus], buflen_remain);
|
||||
AssertFatal(current_ulsch_ptr < (char*)ulsch_sdus+MAX_ULSCH_PAYLOAD_BYTES, "");
|
||||
|
||||
current_ulsch_ptr += sdu_lengths[num_sdus];
|
||||
@@ -2112,17 +2104,17 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
// Generate ULSCH PDU
|
||||
if (num_sdus>0) {
|
||||
payload_offset = nr_generate_ulsch_pdu(ulsch_sdus,
|
||||
ulsch_buffer, // mac header
|
||||
num_sdus, // num sdus
|
||||
sdu_lengths, // sdu length
|
||||
sdu_lcids, // sdu lcid
|
||||
0, // power_headroom
|
||||
mac->crnti, // crnti
|
||||
0, // truncated_bsr
|
||||
0, // short_bsr
|
||||
0, // long_bsr
|
||||
0, // post_padding
|
||||
buflen); // TBS in bytes
|
||||
ulsch_buffer, // mac header
|
||||
num_sdus, // num sdus
|
||||
sdu_lengths, // sdu length
|
||||
sdu_lcids, // sdu lcid
|
||||
0, // power_headroom
|
||||
mac->crnti, // crnti
|
||||
0, // truncated_bsr
|
||||
0, // short_bsr
|
||||
0, // long_bsr
|
||||
0, // post_padding
|
||||
buflen); // TBS in bytes
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -856,9 +856,9 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
|
||||
pusch_pdu->target_code_rate = nr_get_code_rate_ul(pusch_pdu->mcs_index,pusch_pdu->mcs_table);
|
||||
pusch_pdu->qam_mod_order = nr_get_Qm_ul(pusch_pdu->mcs_index,pusch_pdu->mcs_table);
|
||||
if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder == NULL)
|
||||
pusch_pdu->transform_precoding = 1;
|
||||
pusch_pdu->transformPrecoder = 1;
|
||||
else
|
||||
pusch_pdu->transform_precoding = 0;
|
||||
pusch_pdu->transformPrecoder = 0;
|
||||
pusch_pdu->data_scrambling_id = *scc->physCellId;
|
||||
pusch_pdu->nrOfLayers = 1;
|
||||
|
||||
|
||||
@@ -326,11 +326,11 @@ void nr_set_pusch_semi_static(const NR_ServingCellConfigCommon_t *scc,
|
||||
|
||||
ps->pusch_Config = ubwp?ubwp->bwp_Dedicated->pusch_Config->choice.setup:NULL;
|
||||
if (ps->pusch_Config == NULL || !ps->pusch_Config->transformPrecoder)
|
||||
ps->transform_precoding = !scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder;
|
||||
ps->transformPrecoder = !scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder;
|
||||
else
|
||||
ps->transform_precoding = *ps->pusch_Config->transformPrecoder;
|
||||
ps->transformPrecoder = *ps->pusch_Config->transformPrecoder;
|
||||
const int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
|
||||
if (ps->transform_precoding)
|
||||
if (ps->transformPrecoder)
|
||||
ps->mcs_table = get_pusch_mcs_table(ps->pusch_Config ? ps->pusch_Config->mcs_Table : NULL,
|
||||
0,
|
||||
ps->dci_format,
|
||||
|
||||
@@ -1458,7 +1458,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
pusch_pdu->qam_mod_order = sched_pusch->Qm;
|
||||
pusch_pdu->mcs_index = sched_pusch->mcs;
|
||||
pusch_pdu->mcs_table = ps->mcs_table;
|
||||
pusch_pdu->transform_precoding = ps->transform_precoding;
|
||||
pusch_pdu->transformPrecoder = ps->transformPrecoder;
|
||||
if (ps->pusch_Config &&
|
||||
ps->pusch_Config->dataScramblingIdentityPUSCH)
|
||||
pusch_pdu->data_scrambling_id = *ps->pusch_Config->dataScramblingIdentityPUSCH;
|
||||
@@ -1469,7 +1469,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
/* FAPI: DMRS */
|
||||
pusch_pdu->ul_dmrs_symb_pos = ps->ul_dmrs_symb_pos;
|
||||
pusch_pdu->dmrs_config_type = ps->dmrs_config_type;
|
||||
if (pusch_pdu->transform_precoding) { // transform precoding disabled
|
||||
if (pusch_pdu->transformPrecoder) { // transform precoding disabled
|
||||
long *scramblingid=NULL;
|
||||
if (ps->NR_DMRS_UplinkConfig && pusch_pdu->scid == 0)
|
||||
scramblingid = ps->NR_DMRS_UplinkConfig->transformPrecodingDisabled->scramblingID0;
|
||||
@@ -1514,7 +1514,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
|
||||
/* TRANSFORM PRECODING --------------------------------------------------------*/
|
||||
|
||||
if (pusch_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_enabled){
|
||||
if (pusch_pdu->transformPrecoder == NR_PUSCH_Config__transformPrecoder_enabled){
|
||||
|
||||
// U as specified in section 6.4.1.1.1.2 in 38.211, if sequence hopping and group hopping are disabled
|
||||
pusch_pdu->dfts_ofdm.low_papr_group_number = pusch_pdu->pusch_identity % 30;
|
||||
|
||||
@@ -319,7 +319,7 @@ typedef struct NR_pusch_semi_static_t {
|
||||
int nrOfSymbols;
|
||||
|
||||
NR_PUSCH_Config_t *pusch_Config;
|
||||
uint8_t transform_precoding;
|
||||
uint8_t transformPrecoder;
|
||||
uint8_t mcs_table;
|
||||
|
||||
long mapping_type;
|
||||
|
||||
@@ -831,7 +831,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
||||
|
||||
/*------------------------------TRANSFORM PRECODING- -----------------------------------------------------------------------*/
|
||||
|
||||
uint8_t transform_precoding = NR_PUSCH_Config__transformPrecoder_disabled;
|
||||
uint8_t transformPrecoder = NR_PUSCH_Config__transformPrecoder_disabled;
|
||||
|
||||
// TBD: configure this from .conf file, Dedicated params cannot yet be configured in .conf file.
|
||||
// Enable this to test transform precoding enabled from dedicated config.
|
||||
@@ -843,13 +843,13 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
|
||||
|
||||
if (pusch_Config->transformPrecoder == NULL) {
|
||||
if (servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder != NULL)
|
||||
transform_precoding = NR_PUSCH_Config__transformPrecoder_enabled;
|
||||
transformPrecoder = NR_PUSCH_Config__transformPrecoder_enabled;
|
||||
}
|
||||
else
|
||||
transform_precoding = *pusch_Config->transformPrecoder;
|
||||
transformPrecoder = *pusch_Config->transformPrecoder;
|
||||
|
||||
|
||||
if (transform_precoding == NR_PUSCH_Config__transformPrecoder_enabled ) {
|
||||
if (transformPrecoder == NR_PUSCH_Config__transformPrecoder_enabled ) {
|
||||
/* Enable DMRS uplink config for transform precoding enabled */
|
||||
NR_DMRS_UplinkConfig->transformPrecodingEnabled = calloc(1,sizeof(*NR_DMRS_UplinkConfig->transformPrecodingEnabled));
|
||||
NR_DMRS_UplinkConfig->transformPrecodingEnabled->nPUSCH_Identity = NULL;
|
||||
|
||||
Reference in New Issue
Block a user