end2end functional again (sort of).
This commit is contained in:
@@ -88,8 +88,14 @@ void dump_nr_I0_stats(FILE *fd,PHY_VARS_gNB *gNB) {
|
||||
if (i%25 == 24) fprintf(fd,"\n");
|
||||
}
|
||||
fprintf(fd,"\n");
|
||||
fprintf(fd,"max_IO = %d (%d), min_I0 = %d (%d), avg_I0 = %d dB\n",max_I0,amax,min_I0,amin,gNB->measurements.n0_subband_power_avg_dB);
|
||||
fprintf(fd,"PRACH I0 = %d.%d dB\n",gNB->measurements.prach_I0/10,gNB->measurements.prach_I0%10);
|
||||
fprintf(fd,"max_IO = %d (%d), min_I0 = %d (%d), avg_I0 = %d dB",max_I0,amax,min_I0,amin,gNB->measurements.n0_subband_power_avg_dB);
|
||||
if (gNB->frame_parms.nb_antennas_rx>1) {
|
||||
fprintf(fd,"(");
|
||||
for (int aarx=0;aarx<gNB->frame_parms.nb_antennas_rx;aarx++)
|
||||
fprintf(fd,"%d.",gNB->measurements.n0_subband_power_avg_perANT_dB[aarx]);
|
||||
fprintf(fd,")");
|
||||
}
|
||||
fprintf(fd,"\nPRACH I0 = %d.%d dB\n",gNB->measurements.prach_I0/10,gNB->measurements.prach_I0%10);
|
||||
|
||||
|
||||
}
|
||||
@@ -101,46 +107,64 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb
|
||||
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
||||
NR_gNB_COMMON *common_vars = &gNB->common_vars;
|
||||
PHY_MEASUREMENTS_gNB *measurements = &gNB->measurements;
|
||||
uint32_t *rb_mask = gNB->rb_mask_ul;
|
||||
int rb, offset, offset0, nb_rb, len;
|
||||
int rb, offset, offset0, nb_symb[275], len;
|
||||
int32_t *ul_ch;
|
||||
int32_t n0_power_tot;
|
||||
int64_t n0_power_tot2;
|
||||
int32_t n0_power_tot[275];
|
||||
|
||||
nb_rb = 0;
|
||||
n0_power_tot2=0;
|
||||
for (rb=0; rb<frame_parms->N_RB_UL; rb++) {
|
||||
n0_power_tot=0;
|
||||
offset0 = (slot&3)*(frame_parms->symbols_per_slot * frame_parms->ofdm_symbol_size) + (frame_parms->first_carrier_offset + (rb*12))%frame_parms->ofdm_symbol_size;
|
||||
if ((rb_mask[rb>>5]&(1<<(rb&31))) == 0) { // check that rb was not used in this subframe
|
||||
nb_rb++;
|
||||
for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||
measurements->n0_subband_power[aarx][rb]=0;
|
||||
for (int s=first_symb;s<(first_symb+num_symb);s++) {
|
||||
for (int s=first_symb;s<(first_symb+num_symb);s++) {
|
||||
for (rb=0; rb<frame_parms->N_RB_UL; rb++) {
|
||||
|
||||
offset = offset0 + (s*frame_parms->ofdm_symbol_size);
|
||||
ul_ch = &common_vars->rxdataF[aarx][offset];
|
||||
len = 12;
|
||||
if (((frame_parms->N_RB_UL&1) == 1) &&
|
||||
(rb==(frame_parms->N_RB_UL>>1))) {
|
||||
len=6;
|
||||
}
|
||||
AssertFatal(ul_ch, "RX signal buffer (freq) problem\n");
|
||||
measurements->n0_subband_power[aarx][rb] += signal_energy_nodc(ul_ch,len);
|
||||
} // symbol
|
||||
measurements->n0_subband_power[aarx][rb]/=num_symb;
|
||||
if (s==first_symb) {
|
||||
n0_power_tot[rb]=0;
|
||||
nb_symb[rb]=0;
|
||||
}
|
||||
offset0 = (slot&3)*(frame_parms->symbols_per_slot * frame_parms->ofdm_symbol_size) + (frame_parms->first_carrier_offset + (rb*12))%frame_parms->ofdm_symbol_size;
|
||||
if ((gNB->rb_mask_ul[s][rb>>5]&(1<<(rb&31))) == 0) { // check that rb was not used in this subframe
|
||||
nb_symb[rb]++;
|
||||
for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||
if (s==first_symb) measurements->n0_subband_power[aarx][rb]=0;
|
||||
offset = offset0 + (s*frame_parms->ofdm_symbol_size);
|
||||
ul_ch = &common_vars->rxdataF[aarx][offset];
|
||||
len = 12;
|
||||
if (((frame_parms->N_RB_UL&1) == 1) &&
|
||||
(rb==(frame_parms->N_RB_UL>>1))) {
|
||||
len=6;
|
||||
}
|
||||
AssertFatal(ul_ch, "RX signal buffer (freq) problem\n");
|
||||
measurements->n0_subband_power[aarx][rb] += signal_energy_nodc(ul_ch,len);
|
||||
measurements->n0_subband_power_dB[aarx][rb] = dB_fixed(measurements->n0_subband_power[aarx][rb]);
|
||||
n0_power_tot += measurements->n0_subband_power[aarx][rb];
|
||||
} //antenna
|
||||
n0_power_tot/=frame_parms->nb_antennas_rx;
|
||||
n0_power_tot2 += n0_power_tot;
|
||||
measurements->n0_subband_power_tot_dB[rb] = dB_fixed(n0_power_tot);
|
||||
} //antenna
|
||||
}
|
||||
} //rb
|
||||
} // symb
|
||||
int nb_rb=0;
|
||||
int32_t n0_subband_tot=0;
|
||||
int32_t n0_subband_tot_perPRB=0;
|
||||
int32_t n0_subband_tot_perANT[1+frame_parms->nb_antennas_rx];
|
||||
|
||||
for (int rb = 0 ; rb<frame_parms->N_RB_UL;rb++) {
|
||||
n0_subband_tot_perPRB=0;
|
||||
if (nb_symb[rb] > 0) {
|
||||
for (int aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++) {
|
||||
measurements->n0_subband_power[aarx][rb]/=nb_symb[rb];
|
||||
n0_subband_tot_perPRB+=measurements->n0_subband_power[aarx][rb];
|
||||
if (rb==0) n0_subband_tot_perANT[aarx]=measurements->n0_subband_power[aarx][rb];
|
||||
else n0_subband_tot_perANT[aarx]+=measurements->n0_subband_power[aarx][rb];
|
||||
}
|
||||
n0_subband_tot_perPRB/=frame_parms->nb_antennas_rx;
|
||||
measurements->n0_subband_power_tot_dB[rb] = dB_fixed(n0_subband_tot_perPRB);
|
||||
measurements->n0_subband_power_tot_dBm[rb] = measurements->n0_subband_power_tot_dB[rb] - gNB->rx_total_gain_dB - dB_fixed(frame_parms->N_RB_UL);
|
||||
//printf("n0_subband_power_tot_dB[%d] => %d, over %d symbols\n",rb,measurements->n0_subband_power_tot_dB[rb],nb_symb[rb]);
|
||||
n0_subband_tot += n0_subband_tot_perPRB;
|
||||
nb_rb++;
|
||||
}
|
||||
} //rb
|
||||
|
||||
if (nb_rb>0) measurements->n0_subband_power_avg_dB = dB_fixed(n0_power_tot2/nb_rb);
|
||||
|
||||
}
|
||||
if (nb_rb>0) {
|
||||
measurements->n0_subband_power_avg_dB = dB_fixed(n0_subband_tot/nb_rb);
|
||||
for (int aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++) {
|
||||
measurements->n0_subband_power_avg_perANT_dB[aarx] = dB_fixed(n0_subband_tot_perANT[aarx]/nb_rb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -79,8 +79,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
|
||||
uint16_t nb_rb_pusch = pusch_pdu->rb_size;
|
||||
|
||||
//#ifdef DEBUG_CH
|
||||
LOG_I(PHY, "In %s: ch_offset %d, soffset %d, symbol_offset %d OFDM size %d, Ns = %d, k = %d symbol %d\n",
|
||||
LOG_D(PHY, "In %s: ch_offset %d, soffset %d, symbol_offset %d OFDM size %d, Ns = %d, k = %d symbol %d\n",
|
||||
__FUNCTION__,
|
||||
ch_offset, soffset,
|
||||
symbol_offset,
|
||||
@@ -88,7 +87,6 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
Ns,
|
||||
k,
|
||||
symbol);
|
||||
//#endif
|
||||
|
||||
switch (nushift) {
|
||||
case 0:
|
||||
|
||||
@@ -1176,8 +1176,8 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
gNB->pusch_vars[ulsch_id]->cl_done = 0;
|
||||
|
||||
bwp_start_subcarrier = ((rel15_ul->rb_start + rel15_ul->bwp_start)*NR_NB_SC_PER_RB + frame_parms->first_carrier_offset) % frame_parms->ofdm_symbol_size;
|
||||
LOG_I(PHY,"pusch %d.%d : bwp_start_subcarrier %d, rb_start %d, first_carrier_offset %d\n", frame,slot,bwp_start_subcarrier, rel15_ul->rb_start, frame_parms->first_carrier_offset);
|
||||
LOG_I(PHY,"pusch %d.%d : ul_dmrs_symb_pos %x\n",frame,slot,rel15_ul->ul_dmrs_symb_pos);
|
||||
LOG_D(PHY,"pusch %d.%d : bwp_start_subcarrier %d, rb_start %d, first_carrier_offset %d\n", frame,slot,bwp_start_subcarrier, rel15_ul->rb_start, frame_parms->first_carrier_offset);
|
||||
LOG_D(PHY,"pusch %d.%d : ul_dmrs_symb_pos %x\n",frame,slot,rel15_ul->ul_dmrs_symb_pos);
|
||||
|
||||
//----------------------------------------------------------
|
||||
//--------------------- Channel estimation ---------------------
|
||||
@@ -1296,7 +1296,7 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
//--------------------- Channel Compensation ---------------
|
||||
//----------------------------------------------------------
|
||||
start_meas(&gNB->ulsch_channel_compensation_stats);
|
||||
LOG_I(PHY,"Doing channel compensations log2_maxh %d, avgs %d (%d,%d)\n",gNB->pusch_vars[ulsch_id]->log2_maxh,avgs,avg[0],avg[1]);
|
||||
LOG_D(PHY,"Doing channel compensations log2_maxh %d, avgs %d (%d,%d)\n",gNB->pusch_vars[ulsch_id]->log2_maxh,avgs,avg[0],avg[1]);
|
||||
nr_ulsch_channel_compensation(gNB->pusch_vars[ulsch_id]->rxdataF_ext,
|
||||
gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext,
|
||||
gNB->pusch_vars[ulsch_id]->ul_ch_mag0,
|
||||
|
||||
@@ -204,7 +204,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
nr_sequences=8>>(1-pucch_pdu->sr_flag);
|
||||
}
|
||||
|
||||
LOG_I(PHY,"pucch0: nr_symbols %d, start_symbol %d, prb_start %d, second_hop_prb %d, group_hop_flag %d, sequence_hop_flag %d, O_ACK %d, O_SR %d, mcs %d initial_cyclic_shift %d\n",pucch_pdu->nr_of_symbols,pucch_pdu->start_symbol_index,pucch_pdu->prb_start,pucch_pdu->second_hop_prb,pucch_pdu->group_hop_flag,pucch_pdu->sequence_hop_flag,pucch_pdu->bit_len_harq,pucch_pdu->sr_flag,mcs[0],pucch_pdu->initial_cyclic_shift);
|
||||
LOG_D(PHY,"pucch0: nr_symbols %d, start_symbol %d, prb_start %d, second_hop_prb %d, group_hop_flag %d, sequence_hop_flag %d, O_ACK %d, O_SR %d, mcs %d initial_cyclic_shift %d\n",pucch_pdu->nr_of_symbols,pucch_pdu->start_symbol_index,pucch_pdu->prb_start,pucch_pdu->second_hop_prb,pucch_pdu->group_hop_flag,pucch_pdu->sequence_hop_flag,pucch_pdu->bit_len_harq,pucch_pdu->sr_flag,mcs[0],pucch_pdu->initial_cyclic_shift);
|
||||
|
||||
int cs_ind = get_pucch0_cs_lut_index(gNB,pucch_pdu);
|
||||
/*
|
||||
@@ -240,12 +240,12 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
int prb_offset[2] = {pucch_pdu->bwp_start+pucch_pdu->prb_start, pucch_pdu->bwp_start+pucch_pdu->prb_start};
|
||||
|
||||
nr_group_sequence_hopping(pucch_GroupHopping,pucch_pdu->hopping_id,0,slot,&u[0],&v[0]); // calculating u and v value first hop
|
||||
LOG_I(PHY,"pucch0: u %d, v %d\n",u[0],v[0]);
|
||||
LOG_D(PHY,"pucch0: u %d, v %d\n",u[0],v[0]);
|
||||
|
||||
|
||||
if (pucch_pdu->freq_hop_flag == 1) {
|
||||
nr_group_sequence_hopping(pucch_GroupHopping,pucch_pdu->hopping_id,1,slot,&u[1],&v[1]); // calculating u and v value second hop
|
||||
LOG_I(PHY,"pucch0 second hop: u %d, v %d\n",u[1],v[1]);
|
||||
LOG_D(PHY,"pucch0 second hop: u %d, v %d\n",u[1],v[1]);
|
||||
prb_offset[1] = pucch_pdu->bwp_start+pucch_pdu->second_hop_prb;
|
||||
}
|
||||
|
||||
@@ -291,13 +291,10 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
|
||||
int32_t corr_re[2];
|
||||
int32_t corr_im[2];
|
||||
int32_t corr_reb[2];
|
||||
int32_t corr_imb[2];
|
||||
//int32_t no_corr = 0;
|
||||
int seq_index;
|
||||
int64_t temp;
|
||||
int64_t av_corr=0;
|
||||
int seq_index2;
|
||||
|
||||
for(i=0;i<nr_sequences;i++){
|
||||
for (l=0;l<pucch_pdu->nr_of_symbols;l++) {
|
||||
@@ -310,24 +307,17 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
printf("PUCCH symbol %d seq %d, seq_index %d, mcs %d\n",l,i,seq_index,mcs[i]);
|
||||
#endif
|
||||
n2=0;
|
||||
seq_index2 = ((pucch_pdu->initial_cyclic_shift==0 ? 3 : -3 )+
|
||||
mcs[i]+
|
||||
gNB->pucch0_lut.lut[cs_ind][slot][l+pucch_pdu->start_symbol_index])%12;
|
||||
|
||||
for (n=0;n<12;n++,n2+=2) {
|
||||
corr_re[l]+=(xr[l][n2]*idft12_re[seq_index][n]+xr[l][n2+1]*idft12_im[seq_index][n])>>15;
|
||||
corr_im[l]+=(xr[l][n2]*idft12_im[seq_index][n]-xr[l][n2+1]*idft12_re[seq_index][n])>>15;
|
||||
corr_reb[l]+=(xr[l][n2]*idft12_re[seq_index2][n]+xr[l][n2+1]*idft12_im[seq_index2][n])>>15;
|
||||
corr_imb[l]+=(xr[l][n2]*idft12_im[seq_index2][n]-xr[l][n2+1]*idft12_re[seq_index2][n])>>15;
|
||||
}
|
||||
}
|
||||
|
||||
//#ifdef DEBUG_NR_PUCCH_RX
|
||||
#ifdef DEBUG_NR_PUCCH_RX
|
||||
LOG_I(PHY,"PUCCH IDFT = (%d,%d)=>%f\n",corr_re[0],corr_im[0],10*log10((double)corr_re[0]*corr_re[0] + (double)corr_im[0]*corr_im[0]));
|
||||
if (l>1) LOG_I(PHY,"PUCCH 2nd symbol IDFT[%d/%d] = (%d,%d)=>%f\n",mcs[i],seq_index,corr_re[1],corr_im[1],10*log10((double)corr_re[1]*corr_re[1] + (double)corr_im[1]*corr_im[1]));
|
||||
//#endif
|
||||
LOG_I(PHY,"PUCCH IDFT2 = (%d,%d)=>%f\n",corr_reb[0],corr_imb[0],10*log10((double)corr_reb[0]*corr_reb[0] + (double)corr_imb[0]*corr_imb[0]));
|
||||
if (l>1) LOG_I(PHY,"PUCCH 2nd symbol IDFT[%d/%d] = (%d,%d)=>%f\n",mcs[i],seq_index2,corr_reb[1],corr_imb[1],10*log10((double)corr_reb[1]*corr_reb[1] + (double)corr_imb[1]*corr_imb[1]));
|
||||
#endif
|
||||
if (pucch_pdu->freq_hop_flag == 0 && l==1) // non-coherent correlation
|
||||
temp=(int64_t)corr_re[0]*corr_re[0] + (int64_t)corr_im[0]*corr_im[0];
|
||||
else if (pucch_pdu->freq_hop_flag == 0 && l==2) {
|
||||
@@ -406,8 +396,9 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
uci_pdu->harq->harq_confidence_level = no_conf ? 1 : 0;
|
||||
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1);
|
||||
uci_pdu->harq->harq_list[0].harq_value = index&0x01;
|
||||
LOG_I(PHY, "Slot %d HARQ value %d with confidence level (0 is good, 1 is bad) %d xrt_mag %d n0 %d pucch0_thres %d\n",
|
||||
LOG_D(PHY, "Slot %d HARQ value %d with confidence level (0 is good, 1 is bad) %d xrt_mag %d n0 %d pucch0_thres %d\n",
|
||||
slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dB,max_n0,uci_stats->pucch0_thres);
|
||||
|
||||
if (pucch_pdu->sr_flag == 1) {
|
||||
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
||||
uci_pdu->sr->sr_indication = (index>1) ? 1 : 0;
|
||||
|
||||
@@ -667,6 +667,8 @@ typedef struct {
|
||||
unsigned short n0_subband_power_dB[MAX_NUM_RU_PER_gNB][275];
|
||||
//! estimated avg subband noise power (dB)
|
||||
unsigned short n0_subband_power_avg_dB;
|
||||
//! estimated avg subband noise power per antenna (dB)
|
||||
unsigned short n0_subband_power_avg_perANT_dB[NB_ANTENNAS_RX];
|
||||
//! estimated avg noise power per RB (dB)
|
||||
short n0_subband_power_tot_dB[275];
|
||||
//! estimated avg noise power per RB (dBm)
|
||||
@@ -799,8 +801,7 @@ typedef struct PHY_VARS_gNB_s {
|
||||
uint32_t ****nr_gold_pusch_dmrs;
|
||||
|
||||
// Mask of occupied RBs
|
||||
uint32_t rb_mask_ul[9];
|
||||
int ulmask_symb;
|
||||
uint32_t rb_mask_ul[14][9];
|
||||
|
||||
/// CSI RS sequence
|
||||
uint32_t ***nr_gold_csi_rs;
|
||||
|
||||
@@ -257,10 +257,10 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) {
|
||||
ulsch_harq->round = 0;
|
||||
ulsch->harq_mask &= ~(1 << rdata->harq_pid);
|
||||
|
||||
LOG_I(PHY, "ULSCH received ok \n");
|
||||
LOG_D(PHY, "ULSCH received ok \n");
|
||||
nr_fill_indication(gNB,ulsch_harq->frame, ulsch_harq->slot, rdata->ulsch_id, rdata->harq_pid, 0);
|
||||
} else {
|
||||
LOG_I(PHY,"[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d) r %d\n",
|
||||
LOG_D(PHY,"[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d) r %d\n",
|
||||
gNB->Mod_id, ulsch_harq->frame, ulsch_harq->slot,
|
||||
rdata->harq_pid,ulsch_harq->status, ulsch_harq->round,ulsch_harq->TBS,r);
|
||||
if (ulsch_harq->round >= ulsch->Mlimit) {
|
||||
@@ -414,21 +414,21 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
|
||||
if (timing_advance_update < 0) timing_advance_update = 0;
|
||||
if (timing_advance_update > 63) timing_advance_update = 63;
|
||||
|
||||
LOG_I(PHY, "%d.%d : Estimated timing advance PUSCH is = %d, timing_advance_update is %d \n", frame,slot_rx,sync_pos,timing_advance_update);
|
||||
LOG_D(PHY, "%d.%d : Estimated timing advance PUSCH is = %d, timing_advance_update is %d \n", frame,slot_rx,sync_pos,timing_advance_update);
|
||||
|
||||
// estimate UL_CQI for MAC
|
||||
|
||||
int SNRtimes10 = dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot) -
|
||||
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot);
|
||||
|
||||
LOG_I(PHY, "Estimated SNR for PUSCH is = %f dB (ulsch_power %f, noise %f)\n", SNRtimes10/10.0,dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot)/10.0,dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot)/10.0);
|
||||
LOG_D(PHY, "Estimated SNR for PUSCH is = %f dB (ulsch_power %f, noise %f)\n", SNRtimes10/10.0,dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot)/10.0,dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot)/10.0);
|
||||
|
||||
if (SNRtimes10 < -640) cqi=0;
|
||||
else if (SNRtimes10 > 635) cqi=255;
|
||||
else cqi=(640+SNRtimes10)/5;
|
||||
|
||||
|
||||
if (pusch_pdu->mcs_index == 9) {
|
||||
if (0/*pusch_pdu->mcs_index == 9*/) {
|
||||
#ifdef __AVX2__
|
||||
int off = ((pusch_pdu->rb_size&1) == 1)? 4:0;
|
||||
#else
|
||||
@@ -507,64 +507,59 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
|
||||
void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
|
||||
|
||||
int rb2, rb, nb_rb;
|
||||
for (int symbol=0;symbol<14;symbol++) {
|
||||
if (gNB->gNB_config.tdd_table.max_tdd_periodicity_list[slot_rx].max_num_of_symbol_per_slot_list[symbol].slot_config.value==1){
|
||||
nb_rb = 0;
|
||||
for (int m=0;m<9;m++) gNB->rb_mask_ul[m] = 0;
|
||||
gNB->ulmask_symb = -1;
|
||||
if (1/*(gNB->gNB_config.tdd_table.max_tdd_periodicity_list[slot_rx].max_num_of_symbol_per_slot_list[symbol].slot_config.value==1*/){
|
||||
nb_rb = 0;
|
||||
for (int symbol=0;symbol<14;symbol++)
|
||||
for (int m=0;m<9;m++) gNB->rb_mask_ul[symbol][m] = 0;
|
||||
|
||||
for (int i=0;i<NUMBER_OF_NR_PUCCH_MAX;i++){
|
||||
NR_gNB_PUCCH_t *pucch = gNB->pucch[i];
|
||||
if (pucch) {
|
||||
if ((pucch->active == 1) &&
|
||||
(pucch->frame == frame_rx) &&
|
||||
(pucch->slot == slot_rx) ) {
|
||||
gNB->ulmask_symb = symbol;
|
||||
nfapi_nr_pucch_pdu_t *pucch_pdu = &pucch->pucch_pdu;
|
||||
if ((symbol>=pucch_pdu->start_symbol_index) &&
|
||||
(symbol<(pucch_pdu->start_symbol_index + pucch_pdu->nr_of_symbols))){
|
||||
for (rb=0; rb<pucch_pdu->prb_size; rb++) {
|
||||
rb2 = rb+pucch_pdu->prb_start+pucch_pdu->bwp_start;
|
||||
gNB->rb_mask_ul[rb2>>5] |= (1<<(rb2&31));
|
||||
}
|
||||
nb_rb+=pucch_pdu->prb_size;
|
||||
for (int i=0;i<NUMBER_OF_NR_PUCCH_MAX;i++){
|
||||
NR_gNB_PUCCH_t *pucch = gNB->pucch[i];
|
||||
if (pucch) {
|
||||
if ((pucch->active == 1) &&
|
||||
(pucch->frame == frame_rx) &&
|
||||
(pucch->slot == slot_rx) ) {
|
||||
nfapi_nr_pucch_pdu_t *pucch_pdu = &pucch->pucch_pdu;
|
||||
for (int symbol=pucch_pdu->start_symbol_index ; symbol<(pucch_pdu->start_symbol_index+pucch_pdu->nr_of_symbols);symbol++) {
|
||||
for (rb=0; rb<pucch_pdu->prb_size; rb++) {
|
||||
rb2 = rb+pucch_pdu->prb_start+pucch_pdu->bwp_start;
|
||||
gNB->rb_mask_ul[symbol][rb2>>5] |= (1<<(rb2&31));
|
||||
}
|
||||
if (symbol==pucch_pdu->start_symbol_index) nb_rb+=pucch_pdu->prb_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int ULSCH_id=0;ULSCH_id<gNB->number_of_nr_ulsch_max;ULSCH_id++) {
|
||||
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0];
|
||||
int harq_pid;
|
||||
NR_UL_gNB_HARQ_t *ulsch_harq;
|
||||
|
||||
if ((ulsch) &&
|
||||
(ulsch->rnti > 0)) {
|
||||
for (harq_pid=0;harq_pid<NR_MAX_ULSCH_HARQ_PROCESSES;harq_pid++) {
|
||||
ulsch_harq = ulsch->harq_processes[harq_pid];
|
||||
AssertFatal(ulsch_harq!=NULL,"harq_pid %d is not allocated\n",harq_pid);
|
||||
if ((ulsch_harq->status == NR_ACTIVE) &&
|
||||
(ulsch_harq->frame == frame_rx) &&
|
||||
(ulsch_harq->slot == slot_rx) &&
|
||||
(ulsch_harq->handled == 0)){
|
||||
uint8_t symbol_start = ulsch_harq->ulsch_pdu.start_symbol_index;
|
||||
uint8_t symbol_end = symbol_start + ulsch_harq->ulsch_pdu.nr_of_symbols;
|
||||
gNB->ulmask_symb = symbol;
|
||||
if ((symbol>=symbol_start) &&
|
||||
(symbol<symbol_end)){
|
||||
for (rb=0; rb<ulsch_harq->ulsch_pdu.rb_size; rb++) {
|
||||
rb2 = rb+ulsch_harq->ulsch_pdu.rb_start+ulsch_harq->ulsch_pdu.bwp_start;
|
||||
gNB->rb_mask_ul[rb2>>5] |= (1<<(rb2&31));
|
||||
}
|
||||
nb_rb+=ulsch_harq->ulsch_pdu.rb_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//TODO Add check for PRACH as well?
|
||||
}
|
||||
if (nb_rb<gNB->frame_parms.N_RB_UL)
|
||||
return;
|
||||
}
|
||||
for (int ULSCH_id=0;ULSCH_id<gNB->number_of_nr_ulsch_max;ULSCH_id++) {
|
||||
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0];
|
||||
int harq_pid;
|
||||
NR_UL_gNB_HARQ_t *ulsch_harq;
|
||||
|
||||
if ((ulsch) &&
|
||||
(ulsch->rnti > 0)) {
|
||||
for (harq_pid=0;harq_pid<NR_MAX_ULSCH_HARQ_PROCESSES;harq_pid++) {
|
||||
ulsch_harq = ulsch->harq_processes[harq_pid];
|
||||
AssertFatal(ulsch_harq!=NULL,"harq_pid %d is not allocated\n",harq_pid);
|
||||
if ((ulsch_harq->status == NR_ACTIVE) &&
|
||||
(ulsch_harq->frame == frame_rx) &&
|
||||
(ulsch_harq->slot == slot_rx) &&
|
||||
(ulsch_harq->handled == 0)){
|
||||
uint8_t symbol_start = ulsch_harq->ulsch_pdu.start_symbol_index;
|
||||
uint8_t symbol_end = symbol_start + ulsch_harq->ulsch_pdu.nr_of_symbols;
|
||||
for (int symbol=symbol_start ; symbol<symbol_end ; symbol++) {
|
||||
LOG_D(PHY,"symbol %d Filling rb_mask_ul rb_size %d\n",symbol,ulsch_harq->ulsch_pdu.rb_size);
|
||||
for (rb=0; rb<ulsch_harq->ulsch_pdu.rb_size; rb++) {
|
||||
rb2 = rb+ulsch_harq->ulsch_pdu.rb_start+ulsch_harq->ulsch_pdu.bwp_start;
|
||||
gNB->rb_mask_ul[symbol][rb2>>5] |= (1<<(rb2&31));
|
||||
}
|
||||
if (symbol==symbol_start) nb_rb+=ulsch_harq->ulsch_pdu.rb_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//TODO Add check for PRACH as well?
|
||||
if (nb_rb<gNB->frame_parms.N_RB_UL)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -646,7 +641,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
|
||||
|
||||
offset = pucch_pdu->start_symbol_index*gNB->frame_parms.ofdm_symbol_size + (gNB->frame_parms.first_carrier_offset+pucch_pdu->prb_start*12);
|
||||
power_rxF = signal_energy_nodc(&gNB->common_vars.rxdataF[0][offset],12);
|
||||
LOG_I(PHY,"frame %d, slot %d: PUCCH signal energy %d\n",frame_rx,slot_rx,power_rxF);
|
||||
LOG_D(PHY,"frame %d, slot %d: PUCCH signal energy %d\n",frame_rx,slot_rx,power_rxF);
|
||||
|
||||
nr_decode_pucch0(gNB,
|
||||
frame_rx,
|
||||
@@ -746,7 +741,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
|
||||
gNB->pusch_vars[ULSCH_id]->ulsch_noise_power[aarx]/=num_dmrs;
|
||||
gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot += gNB->pusch_vars[ULSCH_id]->ulsch_noise_power[aarx];
|
||||
}
|
||||
/*if (dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot) <
|
||||
if (dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot) <
|
||||
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot) + gNB->pusch_thres) {
|
||||
NR_gNB_SCH_STATS_t *stats=get_ulsch_stats(gNB,ulsch);
|
||||
|
||||
@@ -758,7 +753,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
|
||||
gNB->pusch_vars[ULSCH_id]->DTX=1;
|
||||
if (stats) stats->DTX++;
|
||||
return 1;
|
||||
} else*/ gNB->pusch_vars[ULSCH_id]->DTX=0;
|
||||
} else gNB->pusch_vars[ULSCH_id]->DTX=0;
|
||||
|
||||
stop_meas(&gNB->rx_pusch_stats);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH,0);
|
||||
|
||||
@@ -107,9 +107,9 @@
|
||||
#define MACRLC_LOCAL_S_PORTD_IDX 15
|
||||
#define MACRLC_REMOTE_S_PORTD_IDX 16
|
||||
#define MACRLC_ULSCH_MAX_SLOTS_INACTIVITY 17
|
||||
#define MACRLC_PUSCHTARGETSNRX10_IDX 17
|
||||
#define MACRLC_PUCCHTARGETSNRX10_IDX 18
|
||||
#define MACRLC_PUCCHFAILURETHRES_IDX 19
|
||||
#define MACRLC_PUSCHFAILURETHRES_IDX 20
|
||||
#define MACRLC_PUSCHTARGETSNRX10_IDX 18
|
||||
#define MACRLC_PUCCHTARGETSNRX10_IDX 19
|
||||
#define MACRLC_PUCCHFAILURETHRES_IDX 20
|
||||
#define MACRLC_PUSCHFAILURETHRES_IDX 21
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
@@ -678,7 +678,12 @@ void RCconfig_nr_macrlc() {
|
||||
RC.nrmac[j]->pucch_target_snrx10 = *(MacRLC_ParamList.paramarray[j][MACRLC_PUCCHTARGETSNRX10_IDX].iptr);
|
||||
RC.nrmac[j]->pucch_failure_thres = *(MacRLC_ParamList.paramarray[j][MACRLC_PUCCHFAILURETHRES_IDX].iptr);
|
||||
RC.nrmac[j]->pusch_failure_thres = *(MacRLC_ParamList.paramarray[j][MACRLC_PUSCHFAILURETHRES_IDX].iptr);
|
||||
|
||||
|
||||
LOG_I(NR_MAC,"PUSCH Target %d, PUCCH Target %d, PUCCH Failure %d, PUSCH Failure %d\n",
|
||||
RC.nrmac[j]->pusch_target_snrx10,
|
||||
RC.nrmac[j]->pucch_target_snrx10,
|
||||
RC.nrmac[j]->pucch_failure_thres,
|
||||
RC.nrmac[j]->pusch_failure_thres);
|
||||
if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_RRC") == 0) {
|
||||
// check number of instances is same as RRC/PDCP
|
||||
|
||||
|
||||
@@ -648,7 +648,7 @@ void config_uldci(const NR_BWP_Uplink_t *ubwp,
|
||||
AssertFatal(0, "Valid UL formats are 0_0 and 0_1\n");
|
||||
}
|
||||
|
||||
LOG_I(NR_MAC,
|
||||
LOG_D(NR_MAC,
|
||||
"%s() ULDCI type 0 payload: freq_alloc %d, time_alloc %d, freq_hop_flag %d, mcs %d tpc %d ndi %d rv %d\n",
|
||||
__func__,
|
||||
dci_pdu_rel15->frequency_domain_assignment.val,
|
||||
@@ -1331,7 +1331,7 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc,
|
||||
case NR_UL_DCI_FORMAT_0_0:
|
||||
switch (rnti_type) {
|
||||
case NR_RNTI_C:
|
||||
LOG_I(NR_MAC,"Filling format 0_0 DCI for CRNTI (size %d bits)\n",dci_size);
|
||||
LOG_D(NR_MAC,"Filling format 0_0 DCI for CRNTI (size %d bits)\n",dci_size);
|
||||
// indicating a UL DCI format 1bit
|
||||
pos=1;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->format_indicator & 1) << (dci_size - pos);
|
||||
|
||||
@@ -164,7 +164,7 @@ void calculate_preferred_ul_tda(module_id_t module_id, const NR_BWP_Uplink_t *ub
|
||||
nrmac->preferred_ul_tda[bwp_id][slot] = 0;
|
||||
else if (tdd && nr_mix_slots && sched_slot % nr_slots_period == tdd->nrofDownlinkSlots)
|
||||
nrmac->preferred_ul_tda[bwp_id][slot] = tdaMi;
|
||||
LOG_I(MAC, "DL slot %d UL slot %d preferred_ul_tda %d\n", slot, sched_slot, nrmac->preferred_ul_tda[bwp_id][slot]);
|
||||
LOG_D(MAC, "DL slot %d UL slot %d preferred_ul_tda %d\n", slot, sched_slot, nrmac->preferred_ul_tda[bwp_id][slot]);
|
||||
}
|
||||
|
||||
if (k2 < tdd->nrofUplinkSlots)
|
||||
@@ -1110,7 +1110,7 @@ void pf_ul(module_id_t module_id,
|
||||
LOG_D(NR_MAC, "%4d.%2d no free CCE for UL DCI UE %04x\n", frame, slot, UE_info->rnti[UE_id]);
|
||||
continue;
|
||||
}
|
||||
else LOG_I(NR_MAC, "%4d.%2d free CCE for UL DCI UE %04x\n",frame,slot, UE_info->rnti[UE_id]);
|
||||
else LOG_D(NR_MAC, "%4d.%2d free CCE for UL DCI UE %04x\n",frame,slot, UE_info->rnti[UE_id]);
|
||||
|
||||
/* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */
|
||||
max_num_ue--;
|
||||
@@ -1135,7 +1135,7 @@ void pf_ul(module_id_t module_id,
|
||||
UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize);
|
||||
return;
|
||||
}
|
||||
else LOG_I(NR_MAC,"allocating UL data for UE %d/RNTI %04x (rbStsart %d, min_rb %d, bwpSize %d\n",UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize);
|
||||
else LOG_D(NR_MAC,"allocating UL data for UE %d/RNTI %04x (rbStsart %d, min_rb %d, bwpSize %d\n",UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize);
|
||||
|
||||
/* Save PUSCH field */
|
||||
/* we want to avoid a lengthy deduction of DMRS and other parameters in
|
||||
@@ -1165,7 +1165,7 @@ void pf_ul(module_id_t module_id,
|
||||
&rbSize);
|
||||
sched_pusch->rbSize = rbSize;
|
||||
sched_pusch->tb_size = TBS;
|
||||
LOG_I(NR_MAC,"rbSize %d, TBS %d, est buf %d, sched_ul %d, B %d, CCE %d\n",
|
||||
LOG_D(NR_MAC,"rbSize %d, TBS %d, est buf %d, sched_ul %d, B %d, CCE %d\n",
|
||||
rbSize, sched_pusch->tb_size, sched_ctrl->estimated_ul_buffer, sched_ctrl->sched_ul_bytes, B,sched_ctrl->cce_index);
|
||||
|
||||
/* Mark the corresponding RBs as used */
|
||||
@@ -1397,7 +1397,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
sched_ctrl->last_ul_frame = sched_pusch->frame;
|
||||
sched_ctrl->last_ul_slot = sched_pusch->slot;
|
||||
|
||||
LOG_I(NR_MAC,
|
||||
LOG_D(NR_MAC,
|
||||
"%4d.%2d RNTI %04x UL sched %4d.%2d start %2d RBS %3d startSymbol %2d nb_symbol %2d dmrs_pos %x MCS %2d TBS %4d HARQ PID %2d round %d RV %d NDI %d est %6d sched %6d est BSR %6d\n",
|
||||
frame,
|
||||
slot,
|
||||
@@ -1563,7 +1563,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
pdcch_pdu_bwp_coreset[bwpid][coresetid] = pdcch_pdu;
|
||||
}
|
||||
|
||||
LOG_I(NR_MAC,"Configuring ULDCI/PDCCH in %d.%d at CCE %d, rnti %x\n", frame,slot,sched_ctrl->cce_index,rnti);
|
||||
LOG_D(NR_MAC,"Configuring ULDCI/PDCCH in %d.%d at CCE %d, rnti %x\n", frame,slot,sched_ctrl->cce_index,rnti);
|
||||
|
||||
/* Fill PDCCH DL DCI PDU */
|
||||
nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu->dci_pdu[pdcch_pdu->numDlDci];
|
||||
|
||||
Reference in New Issue
Block a user