Commit 69cc0767 authored by hardy's avatar hardy

Merge remote-tracking branch 'origin/ldpc_short_codeword_fixes' into integration_2020_wk51_2

parents 4d762882 4626d507
...@@ -1098,7 +1098,9 @@ ...@@ -1098,7 +1098,9 @@
(Test13: HARQ test 50% TP (2 rounds), (Test13: HARQ test 50% TP (2 rounds),
(Test14: 3 PTRS, 8 Interpolated Symbols), (Test14: 3 PTRS, 8 Interpolated Symbols),
(Test15: 6 PTRS, 5 Interpolated Symbols), (Test15: 6 PTRS, 5 Interpolated Symbols),
(Test16: 11 PTRS, 0 Interpolated Symbols)</desc> (Test16: 11 PTRS, 0 Interpolated Symbols),
(Test17: 2 DMRS Symbols),
(Test18: 3 DMRS Symbols)</desc>
<pre_compile_prog></pre_compile_prog> <pre_compile_prog></pre_compile_prog>
<compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog> <compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog>
<compile_prog_args> --phy_simulators -c </compile_prog_args> <compile_prog_args> --phy_simulators -c </compile_prog_args>
...@@ -1120,8 +1122,10 @@ ...@@ -1120,8 +1122,10 @@
-n100 -s1 -t50 -n100 -s1 -t50
-n100 -s5 -T 2 2 2 -n100 -s5 -T 2 2 2
-n100 -s5 -T 2 1 2 -n100 -s5 -T 2 1 2
-n100 -s5 -T 2 0 4</main_exec_args> -n100 -s5 -T 2 0 4
<tags>nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10 nr_dlsim.test11 nr_dlsim.test12 nr_dlsim.test13 nr_dlsim.test14 nr_dlsim.test15 nr_dlsim.test16</tags> -n100 -s2 -U 2 0 1
-n100 -s2 -U 2 0 2</main_exec_args>
<tags>nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10 nr_dlsim.test11 nr_dlsim.test12 nr_dlsim.test13 nr_dlsim.test14 nr_dlsim.test15 nr_dlsim.test16 nr_dlsim.test17 nr_dlsim.test18</tags>
<search_expr_true>PDSCH test OK</search_expr_true> <search_expr_true>PDSCH test OK</search_expr_true>
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false> <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
<nruns>3</nruns> <nruns>3</nruns>
......
...@@ -460,32 +460,13 @@ void UE_processing(void *arg) { ...@@ -460,32 +460,13 @@ void UE_processing(void *arg) {
processingData_t *rxtxD = (processingData_t *) arg; processingData_t *rxtxD = (processingData_t *) arg;
UE_nr_rxtx_proc_t *proc = &rxtxD->proc; UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
PHY_VARS_NR_UE *UE = rxtxD->UE; PHY_VARS_NR_UE *UE = rxtxD->UE;
int slot_tx = proc->nr_slot_tx;
int frame_tx = proc->frame_tx;
processSlotRX(UE, proc); processSlotRX(UE, proc);
processSlotTX(UE, proc); processSlotTX(UE, proc);
ue_ta_procedures(UE, slot_tx, frame_tx);
/* UL time alignment
// If the current tx frame and slot match the TA configuration in ul_time_alignment
// then timing advance is processed and set to be applied in the next UL transmission */
if (UE->mac_enabled == 1) {
uint8_t gNB_id = 0;
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment = &UE->ul_time_alignment[gNB_id];
int slot_tx = proc->nr_slot_tx;
int frame_tx = proc->frame_tx;
if (frame_tx == ul_time_alignment->ta_frame && slot_tx == ul_time_alignment->ta_slot) {
uint8_t numerology = UE->frame_parms.numerology_index;
uint16_t bwp_ul_NB_RB = UE->frame_parms.N_RB_UL;
LOG_D(PHY,"Applying timing advance -- frame %d -- slot %d\n", frame_tx, slot_tx);
//if (nfapi_mode!=3){
nr_process_timing_advance(UE->Mod_id, UE->CC_id, ul_time_alignment->ta_command, numerology, bwp_ul_NB_RB);
ul_time_alignment->ta_frame = -1;
ul_time_alignment->ta_slot = -1;
//}
}
}
} }
void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockSize) { void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockSize) {
...@@ -597,7 +578,7 @@ void *UE_thread(void *arg) { ...@@ -597,7 +578,7 @@ void *UE_thread(void *arg) {
//this thread should be over the processing thread to keep in real time //this thread should be over the processing thread to keep in real time
PHY_VARS_NR_UE *UE = (PHY_VARS_NR_UE *) arg; PHY_VARS_NR_UE *UE = (PHY_VARS_NR_UE *) arg;
// int tx_enabled = 0; // int tx_enabled = 0;
openair0_timestamp timestamp; openair0_timestamp timestamp, writeTimestamp;
void *rxp[NB_ANTENNAS_RX], *txp[NB_ANTENNAS_TX]; void *rxp[NB_ANTENNAS_RX], *txp[NB_ANTENNAS_TX];
int start_rx_stream = 0; int start_rx_stream = 0;
AssertFatal(0== openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]), ""); AssertFatal(0== openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]), "");
...@@ -728,11 +709,6 @@ void *UE_thread(void *arg) { ...@@ -728,11 +709,6 @@ void *UE_thread(void *arg) {
UE->rx_offset_diff; UE->rx_offset_diff;
} }
if (UE->timing_advance != timing_advance) {
writeBlockSize -= UE->timing_advance - timing_advance;
timing_advance = UE->timing_advance;
}
AssertFatal(readBlockSize == AssertFatal(readBlockSize ==
UE->rfdevice.trx_read_func(&UE->rfdevice, UE->rfdevice.trx_read_func(&UE->rfdevice,
&timestamp, &timestamp,
...@@ -780,12 +756,19 @@ void *UE_thread(void *arg) { ...@@ -780,12 +756,19 @@ void *UE_thread(void *arg) {
LOG_E(PHY,"Decoded frame index (%d) is not compatible with current context (%d), UE should go back to synch mode\n", LOG_E(PHY,"Decoded frame index (%d) is not compatible with current context (%d), UE should go back to synch mode\n",
decoded_frame_rx, curMsg->proc.frame_rx ); decoded_frame_rx, curMsg->proc.frame_rx );
// use previous timing_advance value to compute writeTimestamp
writeTimestamp = timestamp + UE->frame_parms.get_samples_slot_timestamp(slot_nr, &UE->frame_parms,DURATION_RX_TO_TX - RX_NB_TH) -
firstSymSamp - openair0_cfg[0].tx_sample_advance - UE->N_TA_offset - timing_advance;
// but use current UE->timing_advance value to compute writeBlockSize
if (UE->timing_advance != timing_advance) {
writeBlockSize -= UE->timing_advance - timing_advance;
timing_advance = UE->timing_advance;
}
AssertFatal( writeBlockSize == AssertFatal( writeBlockSize ==
UE->rfdevice.trx_write_func(&UE->rfdevice, UE->rfdevice.trx_write_func(&UE->rfdevice,
timestamp+ writeTimestamp,
UE->frame_parms.get_samples_slot_timestamp(slot_nr,
&UE->frame_parms,DURATION_RX_TO_TX - RX_NB_TH) - firstSymSamp -
openair0_cfg[0].tx_sample_advance - UE->N_TA_offset - UE->timing_advance,
txp, txp,
writeBlockSize, writeBlockSize,
UE->frame_parms.nb_antennas_tx, UE->frame_parms.nb_antennas_tx,
......
...@@ -151,6 +151,7 @@ double cpuf; ...@@ -151,6 +151,7 @@ double cpuf;
runmode_t mode = normal_txrx; runmode_t mode = normal_txrx;
int UE_scan = 0; int UE_scan = 0;
int chain_offset = 0; int chain_offset = 0;
int card_offset = 0;
uint64_t num_missed_slots = 0; // counter for the number of missed slots uint64_t num_missed_slots = 0; // counter for the number of missed slots
int transmission_mode = 1; int transmission_mode = 1;
int numerology = 0; int numerology = 0;
...@@ -306,6 +307,9 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){ ...@@ -306,6 +307,9 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){
UE->rx_total_gain_dB = (int)rx_gain[CC_id][0] + rx_gain_off; UE->rx_total_gain_dB = (int)rx_gain[CC_id][0] + rx_gain_off;
UE->tx_total_gain_dB = (int)tx_gain[CC_id][0]; UE->tx_total_gain_dB = (int)tx_gain[CC_id][0];
UE->tx_power_max_dBm = tx_max_power[CC_id]; UE->tx_power_max_dBm = tx_max_power[CC_id];
UE->rf_map.card = card_offset;
UE->rf_map.chain = CC_id + chain_offset;
UE->timing_advance = timing_advance;
LOG_I(PHY,"Set UE mode %d, UE_fo_compensation %d, UE_scan %d, UE_scan_carrier %d, UE_no_timing_correction %d \n", mode, UE_fo_compensation, UE_scan, UE_scan_carrier, UE_no_timing_correction); LOG_I(PHY,"Set UE mode %d, UE_fo_compensation %d, UE_scan %d, UE_scan_carrier %d, UE_no_timing_correction %d \n", mode, UE_fo_compensation, UE_scan, UE_scan_carrier, UE_no_timing_correction);
...@@ -575,12 +579,6 @@ int main( int argc, char **argv ) { ...@@ -575,12 +579,6 @@ int main( int argc, char **argv ) {
load_softscope("nr",PHY_vars_UE_g[0][0]); load_softscope("nr",PHY_vars_UE_g[0][0]);
} }
for(int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
PHY_vars_UE_g[0][CC_id]->rf_map.card=0;
PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+chain_offset;
PHY_vars_UE_g[0][CC_id]->timing_advance = timing_advance;
}
init_NR_UE_threads(1); init_NR_UE_threads(1);
printf("UE threads created by %ld\n", gettid()); printf("UE threads created by %ld\n", gettid());
......
...@@ -474,6 +474,10 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, ...@@ -474,6 +474,10 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
ue->total_TBS_last[eNB_id] = 0; ue->total_TBS_last[eNB_id] = 0;
ue->bitrate[eNB_id] = 0; ue->bitrate[eNB_id] = 0;
ue->total_received_bits[eNB_id] = 0; ue->total_received_bits[eNB_id] = 0;
ue->ul_time_alignment[eNB_id].apply_ta = 0;
ue->ul_time_alignment[eNB_id].ta_frame = -1;
ue->ul_time_alignment[eNB_id].ta_slot = -1;
} }
// init NR modulation lookup tables // init NR modulation lookup tables
nr_generate_modulation_table(); nr_generate_modulation_table();
......
...@@ -107,9 +107,10 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue, ...@@ -107,9 +107,10 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue,
} }
void nr_gold_pdsch(PHY_VARS_NR_UE* ue, void nr_gold_pdsch(PHY_VARS_NR_UE* ue,
unsigned char ns,
unsigned short *n_idDMRS) unsigned short *n_idDMRS)
{ {
unsigned char ns,l; unsigned char l;
unsigned int n,x1,x2,x2tmp0; unsigned int n,x1,x2,x2tmp0;
int nscid; int nscid;
unsigned int nid; unsigned int nid;
...@@ -122,40 +123,35 @@ void nr_gold_pdsch(PHY_VARS_NR_UE* ue, ...@@ -122,40 +123,35 @@ void nr_gold_pdsch(PHY_VARS_NR_UE* ue,
nid = n_idDMRS[nscid]; nid = n_idDMRS[nscid];
else else
nid = ue->frame_parms.Nid_cell; nid = ue->frame_parms.Nid_cell;
//printf("gold pdsch nid %d lbar %d\n",nid,lbar);
for (ns=0; ns<20; ns++) {
for (l=0; l<14; l++) { //printf("gold pdsch nid %d lbar %d\n",nid,lbar);
x2tmp0 = ((14*ns+l+1)*((nid<<1)+1))<<17; for (l=0; l<14; l++) {
x2 = (x2tmp0+(nid<<1)+nscid)%(1<<31); //cinit x2tmp0 = ((14*ns+l+1)*((nid<<1)+1))<<17;
LOG_D(PHY,"UE DMRS slot %d, symb %d, x2 %x, nscid %d\n",ns,l,x2,nscid); x2 = (x2tmp0+(nid<<1)+nscid)%(1<<31); //cinit
//printf("ns %d gold pdsch x2 %d\n",ns,x2); LOG_D(PHY,"UE DMRS slot %d, symb %d, x2 %x, nscid %d\n",ns,l,x2,nscid);
//printf("ns %d gold pdsch x2 %d\n",ns,x2);
x1 = 1+ (1<<31); x1 = 1+ (1<<31);
x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31);
// skip first 50 double words (1600 bits)
for (n=1; n<50; n++) {
x1 = (x1>>1) ^ (x1>>4);
x1 = x1 ^ (x1<<31) ^ (x1<<28);
x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4);
x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28);
//printf("x1 : %x, x2 : %x\n",x1,x2);
}
for (n=0; n<NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD; n++) { // skip first 50 double words (1600 bits)
x1 = (x1>>1) ^ (x1>>4); for (n=1; n<50; n++) {
x1 = x1 ^ (x1<<31) ^ (x1<<28); x1 = (x1>>1) ^ (x1>>4);
x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4); x1 = x1 ^ (x1<<31) ^ (x1<<28);
x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28); x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4);
ue->nr_gold_pdsch[nscid][ns][l][n] = x1^x2; x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28);
// if ((ns==2)&&(l==0)) //printf("x1 : %x, x2 : %x\n",x1,x2);
//printf("n=%d : c %x\n",n,x1^x2); }
}
for (n=0; n<NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD; n++) {
x1 = (x1>>1) ^ (x1>>4);
x1 = x1 ^ (x1<<31) ^ (x1<<28);
x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4);
x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28);
ue->nr_gold_pdsch[nscid][ns][l][n] = x1^x2;
// if ((ns==2)&&(l==0))
//printf("n=%d : c %x\n",n,x1^x2);
} }
} }
} }
......
...@@ -61,6 +61,7 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue, ...@@ -61,6 +61,7 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue,
unsigned short length_dmrs); unsigned short length_dmrs);
void nr_gold_pdsch(PHY_VARS_NR_UE* ue, void nr_gold_pdsch(PHY_VARS_NR_UE* ue,
unsigned char ns,
unsigned short *n_idDMRS); unsigned short *n_idDMRS);
void nr_init_pusch_dmrs(PHY_VARS_NR_UE* ue, void nr_init_pusch_dmrs(PHY_VARS_NR_UE* ue,
......
...@@ -292,7 +292,7 @@ void nr_processULSegment(void* arg) { ...@@ -292,7 +292,7 @@ void nr_processULSegment(void* arg) {
int no_iteration_ldpc; int no_iteration_ldpc;
int Kr; int Kr;
int Kr_bytes; int Kr_bytes;
int K_bytes_F; int K_bits_F;
uint8_t crc_type; uint8_t crc_type;
int i; int i;
int j; int j;
...@@ -318,8 +318,7 @@ void nr_processULSegment(void* arg) { ...@@ -318,8 +318,7 @@ void nr_processULSegment(void* arg) {
Kr = ulsch_harq->K; Kr = ulsch_harq->K;
Kr_bytes = Kr>>3; Kr_bytes = Kr>>3;
K_bits_F = Kr-ulsch_harq->F;
K_bytes_F = Kr_bytes-(ulsch_harq->F>>3);
t_nrLDPC_time_stats procTime; t_nrLDPC_time_stats procTime;
t_nrLDPC_time_stats* p_procTime = &procTime ; t_nrLDPC_time_stats* p_procTime = &procTime ;
...@@ -402,23 +401,19 @@ void nr_processULSegment(void* arg) { ...@@ -402,23 +401,19 @@ void nr_processULSegment(void* arg) {
//start_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats); //start_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats);
memset(pv,0,2*ulsch_harq->Z*sizeof(int16_t)); //set first 2*Z_c bits to zeros
memset((pv+K_bytes_F),127,ulsch_harq->F*sizeof(int16_t)); memset(&z[0],0,2*ulsch_harq->Z*sizeof(int16_t));
//set Filler bits
for (i=((2*p_decoderParms->Z)>>3), j = 0; i < K_bytes_F; i++, j++) { memset((&z[0]+K_bits_F),127,ulsch_harq->F*sizeof(int16_t));
pv[i]= _mm_loadu_si128((__m128i*)(&ulsch_harq->d[r][8*j])); //Move coded bits before filler bits
} memcpy((&z[0]+2*ulsch_harq->Z),ulsch_harq->d[r],(K_bits_F-2*ulsch_harq->Z)*sizeof(int16_t));
//skip filler bits
AssertFatal(kc!=255,""); memcpy((&z[0]+Kr),ulsch_harq->d[r]+(Kr-2*ulsch_harq->Z),(kc*ulsch_harq->Z-Kr)*sizeof(int16_t));
j+=(ulsch_harq->F>>3); //Saturate coded bits before decoding into 8 bits values
for (i=Kr_bytes; i < ((kc*p_decoderParms->Z)>>3); i++, j++) { for (i=0, j=0; j < ((kc*ulsch_harq->Z)>>4)+1; i+=2, j++)
pv[i]= _mm_loadu_si128((__m128i*)(&ulsch_harq->d[r][8*j])); {
}
for (i=0, j=0; j < ((kc*p_decoderParms->Z)>>4); i+=2, j++) {
pl[j] = _mm_packs_epi16(pv[i],pv[i+1]); pl[j] = _mm_packs_epi16(pv[i],pv[i+1]);
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
...@@ -523,31 +518,27 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -523,31 +518,27 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25){ if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25){
p_decParams->BG = 2; p_decParams->BG = 2;
kc = 52;
if (Coderate < 0.3333) { if (Coderate < 0.3333) {
p_decParams->R = 15; p_decParams->R = 15;
kc = 52;
} }
else if (Coderate <0.6667) { else if (Coderate <0.6667) {
p_decParams->R = 13; p_decParams->R = 13;
kc = 32;
} }
else { else {
p_decParams->R = 23; p_decParams->R = 23;
kc = 17;
} }
} else { } else {
p_decParams->BG = 1; p_decParams->BG = 1;
kc = 68;
if (Coderate < 0.6667) { if (Coderate < 0.6667) {
p_decParams->R = 13; p_decParams->R = 13;
kc = 68;
} }
else if (Coderate <0.8889) { else if (Coderate <0.8889) {
p_decParams->R = 23; p_decParams->R = 23;
kc = 35;
} }
else { else {
p_decParams->R = 89; p_decParams->R = 89;
kc = 27;
} }
} }
......
...@@ -27,7 +27,7 @@ void ...@@ -27,7 +27,7 @@ void
phy_adjust_gain_nr (PHY_VARS_NR_UE *ue, uint32_t rx_power_fil_dB, uint8_t eNB_id) phy_adjust_gain_nr (PHY_VARS_NR_UE *ue, uint32_t rx_power_fil_dB, uint8_t eNB_id)
{ {
LOG_I(PHY,"Gain control: rssi %d (%d,%d)\n", LOG_D(PHY,"Gain control: rssi %d (%d,%d)\n",
rx_power_fil_dB, rx_power_fil_dB,
ue->measurements.rssi, ue->measurements.rssi,
ue->measurements.rx_power_avg_dB[eNB_id] ue->measurements.rx_power_avg_dB[eNB_id]
...@@ -61,7 +61,7 @@ phy_adjust_gain_nr (PHY_VARS_NR_UE *ue, uint32_t rx_power_fil_dB, uint8_t eNB_id ...@@ -61,7 +61,7 @@ phy_adjust_gain_nr (PHY_VARS_NR_UE *ue, uint32_t rx_power_fil_dB, uint8_t eNB_id
ue->rx_total_gain_dB = MIN_RF_GAIN; ue->rx_total_gain_dB = MIN_RF_GAIN;
} }
LOG_I(PHY,"Gain control: rx_total_gain_dB = %d TARGET_RX_POWER %d (max %d,rxpf %d)\n",ue->rx_total_gain_dB,TARGET_RX_POWER,MAX_RF_GAIN,rx_power_fil_dB); LOG_D(PHY,"Gain control: rx_total_gain_dB = %d TARGET_RX_POWER %d (max %d,rxpf %d)\n",ue->rx_total_gain_dB,TARGET_RX_POWER,MAX_RF_GAIN,rx_power_fil_dB);
#ifdef DEBUG_PHY #ifdef DEBUG_PHY
/* if ((ue->frame%100==0) || (ue->frame < 10)) /* if ((ue->frame%100==0) || (ue->frame < 10))
......
...@@ -86,17 +86,17 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms, ...@@ -86,17 +86,17 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
void nr_ue_measurements(PHY_VARS_NR_UE *ue, void nr_ue_measurements(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,
unsigned int subframe_offset, uint8_t slot);
unsigned char N0_symbol,
unsigned char abstraction_flag,
unsigned char rank_adaptation,
uint8_t subframe);
void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue, void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,
uint8_t slot, uint8_t slot,
uint8_t abstraction_flag); uint8_t abstraction_flag);
void nr_ue_rrc_measurements(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
uint8_t slot);
void phy_adjust_gain_nr(PHY_VARS_NR_UE *ue, void phy_adjust_gain_nr(PHY_VARS_NR_UE *ue,
uint32_t rx_power_fil_dB, uint32_t rx_power_fil_dB,
uint8_t eNB_id); uint8_t eNB_id);
......
...@@ -154,9 +154,11 @@ void nr_pdcch_demapping_deinterleaving(uint32_t *llr, ...@@ -154,9 +154,11 @@ void nr_pdcch_demapping_deinterleaving(uint32_t *llr,
for (int i=0; i<9; i++) { for (int i=0; i<9; i++) {
z[index_z + i] = llr[index_llr + i]; z[index_z + i] = llr[index_llr + i];
#ifdef NR_PDCCH_DCI_DEBUG
LOG_D(PHY,"[reg=%d,bundle_j=%d] z[%d]=(%d,%d) <-> \t[f_reg=%d,fbundle_j=%d] llr[%d]=(%d,%d) \n", LOG_D(PHY,"[reg=%d,bundle_j=%d] z[%d]=(%d,%d) <-> \t[f_reg=%d,fbundle_j=%d] llr[%d]=(%d,%d) \n",
reg,bundle_j,(index_z + i),*(int16_t *) &z[index_z + i],*(1 + (int16_t *) &z[index_z + i]), reg,bundle_j,(index_z + i),*(int16_t *) &z[index_z + i],*(1 + (int16_t *) &z[index_z + i]),
f_reg,f_bundle_j,(index_llr + i),*(int16_t *) &llr[index_llr + i], *(1 + (int16_t *) &llr[index_llr + i])); f_reg,f_bundle_j,(index_llr + i),*(int16_t *) &llr[index_llr + i], *(1 + (int16_t *) &llr[index_llr + i]));
#endif
} }
if ((reg%reg_bundle_size_L) == 0) r++; if ((reg%reg_bundle_size_L) == 0) r++;
......
...@@ -241,7 +241,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -241,7 +241,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
uint32_t G; uint32_t G;
uint32_t ret,offset; uint32_t ret,offset;
int32_t no_iteration_ldpc, length_dec; int32_t no_iteration_ldpc, length_dec;
uint32_t r,r_offset=0,Kr=8424,Kr_bytes,K_bytes_F,err_flag=0; uint32_t r,r_offset=0,Kr=8424,Kr_bytes,K_bits_F,err_flag=0;
uint8_t crc_type; uint8_t crc_type;
int8_t llrProcBuf[NR_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32))); int8_t llrProcBuf[NR_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32)));
t_nrLDPC_dec_params decParams; t_nrLDPC_dec_params decParams;
...@@ -349,32 +349,28 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -349,32 +349,28 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25) if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25)
{ {
p_decParams->BG = 2; p_decParams->BG = 2;
kc = 52;
if (Coderate < 0.3333){ if (Coderate < 0.3333){
p_decParams->R = 15; p_decParams->R = 15;
kc = 52;
} }
else if (Coderate <0.6667){ else if (Coderate <0.6667){
p_decParams->R = 13; p_decParams->R = 13;
kc = 32;
} }
else { else {
p_decParams->R = 23; p_decParams->R = 23;
kc = 17;
} }
} }
else{ else{
p_decParams->BG = 1; p_decParams->BG = 1;
kc = 68;
if (Coderate < 0.6667){ if (Coderate < 0.6667){
p_decParams->R = 13; p_decParams->R = 13;
kc = 68;
} }
else if (Coderate <0.8889){ else if (Coderate <0.8889){
p_decParams->R = 23; p_decParams->R = 23;
kc = 35;
} }
else { else {
p_decParams->R = 89; p_decParams->R = 89;
kc = 27;
} }
} }
...@@ -434,8 +430,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -434,8 +430,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
Kr = harq_process->K; // [hna] overwrites this line "Kr = p_decParams->Z*kb" Kr = harq_process->K; // [hna] overwrites this line "Kr = p_decParams->Z*kb"
Kr_bytes = Kr>>3; Kr_bytes = Kr>>3;
K_bits_F = Kr-harq_process->F;
K_bytes_F = Kr_bytes-(harq_process->F>>3);
for (r=0; r<harq_process->C; r++) { for (r=0; r<harq_process->C; r++) {
...@@ -558,24 +553,16 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -558,24 +553,16 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
//printf("harq process dr iteration %d\n", p_decParams->numMaxIter); //printf("harq process dr iteration %d\n", p_decParams->numMaxIter);
memset(pv,0,2*harq_process->Z*sizeof(int16_t)); //set first 2*Z_c bits to zeros
//memset(pl,0,2*p_decParams->Z*sizeof(int8_t)); memset(&z[0],0,2*harq_process->Z*sizeof(int16_t));
memset((pv+K_bytes_F),127,harq_process->F*sizeof(int16_t)); //set Filler bits
memset((&z[0]+K_bits_F),127,harq_process->F*sizeof(int16_t));
//Move coded bits before filler bits
for (i=((2*p_decParams->Z)>>3), j = 0; i < K_bytes_F; i++, j++) memcpy((&z[0]+2*harq_process->Z),harq_process->d[r],(K_bits_F-2*harq_process->Z)*sizeof(int16_t));
{ //skip filler bits
pv[i]= _mm_loadu_si128((__m128i*)(&harq_process->d[r][8*j])); memcpy((&z[0]+Kr),harq_process->d[r]+(Kr-2*harq_process->Z),(kc*harq_process->Z-Kr)*sizeof(int16_t));
} //Saturate coded bits before decoding into 8 bits values
// Kbytes_F = Kr_bytes - F>>3 for (i=0, j=0; j < ((kc*harq_process->Z)>>4)+1; i+=2, j++)
j+=(harq_process->F>>3);
// for (i=Kr_bytes,j=K_bytes_F-((2*p_decParams->Z)>>3); i < ((kc*p_decParams->Z)>>3); i++, j++)
for (i=Kr_bytes; i < ((kc*p_decParams->Z)>>3); i++,j++)
{
pv[i]= _mm_loadu_si128((__m128i*)(&harq_process->d[r][8*j]));
}
for (i=0, j=0; j < ((kc*p_decParams->Z)>>4); i+=2, j++)
{ {
pl[j] = _mm_packs_epi16(pv[i],pv[i+1]); pl[j] = _mm_packs_epi16(pv[i],pv[i+1]);
} }
...@@ -776,7 +763,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -776,7 +763,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
uint32_t A,E; uint32_t A,E;
uint32_t G; uint32_t G;
uint32_t ret,offset; uint32_t ret,offset;
uint32_t r,r_offset=0,Kr=8424,Kr_bytes,err_flag=0,K_bytes_F; uint32_t r,r_offset=0,Kr=8424,Kr_bytes,err_flag=0,K_bits_F;
uint8_t crc_type; uint8_t crc_type;
//UE_rxtx_proc_t *proc = &phy_vars_ue->proc; //UE_rxtx_proc_t *proc = &phy_vars_ue->proc;
int32_t no_iteration_ldpc,length_dec; int32_t no_iteration_ldpc,length_dec;
...@@ -895,32 +882,28 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -895,32 +882,28 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25) if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25)
{ {
p_decParams->BG = 2; p_decParams->BG = 2;
kc = 52;
if (Coderate < 0.3333){ if (Coderate < 0.3333){
p_decParams->R = 15; p_decParams->R = 15;
kc = 52;
} }
else if (Coderate <0.6667){ else if (Coderate <0.6667){
p_decParams->R = 13; p_decParams->R = 13;
kc = 32;
} }
else { else {
p_decParams->R = 23; p_decParams->R = 23;
kc = 17;
} }
} }
else{ else{
p_decParams->BG = 1; p_decParams->BG = 1;
kc = 68;
if (Coderate < 0.6667){ if (Coderate < 0.6667){
p_decParams->R = 13; p_decParams->R = 13;
kc = 68;
} }
else if (Coderate <0.8889){ else if (Coderate <0.8889){
p_decParams->R = 23; p_decParams->R = 23;
kc = 35;
} }
else { else {
p_decParams->R = 89; p_decParams->R = 89;
kc = 27;
} }
} }
...@@ -1020,7 +1003,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -1020,7 +1003,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
Kr = harq_process->K; Kr = harq_process->K;
Kr_bytes = Kr>>3; Kr_bytes = Kr>>3;
K_bytes_F = Kr_bytes-(harq_process->F>>3); K_bits_F = Kr-harq_process->F;
E = nr_get_E(G, harq_process->C, harq_process->Qm, harq_process->Nl, r); E = nr_get_E(G, harq_process->C, harq_process->Qm, harq_process->Nl, r);
...@@ -1152,24 +1135,16 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -1152,24 +1135,16 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
inv_d[cnt] = (1)*harq_process->d[r][cnt]; inv_d[cnt] = (1)*harq_process->d[r][cnt];
}*/ }*/
memset(pv,0,2*p_decParams->Z*sizeof(int16_t)); //set first 2*Z_c bits to zeros
//memset(pl,0,2*p_decParams->Z*sizeof(int8_t)); memset(&z[0],0,2*harq_process->Z*sizeof(int16_t));
memset((pv+K_bytes_F),127,harq_process->F*sizeof(int16_t)); //set Filler bits
memset((&z[0]+K_bits_F),127,harq_process->F*sizeof(int16_t));
//Move coded bits before filler bits
for (i=((2*p_decParams->Z)>>3), j = 0; i < K_bytes_F; i++, j++) memcpy((&z[0]+2*harq_process->Z),harq_process->d[r],(K_bits_F-2*harq_process->Z)*sizeof(int16_t));
{ //skip filler bits
pv[i]= _mm_loadu_si128((__m128i*)(&harq_process->d[r][8*j])); memcpy((&z[0]+Kr),harq_process->d[r]+(Kr-2*harq_process->Z),(kc*harq_process->Z-Kr)*sizeof(int16_t));
} //Saturate coded bits before decoding into 8 bits values
for (i=0, j=0; j < ((kc*harq_process->Z)>>4)+1; i+=2, j++)
j+=(harq_process->F>>3);
// for (i=Kr_bytes,j=K_bytes_F-((2*p_decParams->Z)>>3); i < ((kc*p_decParams->Z)>>3); i++, j++)
for (i=Kr_bytes; i < ((kc*p_decParams->Z)>>3); i++,j++)
{
pv[i]= _mm_loadu_si128((__m128i*)(&harq_process->d[r][8*j]));
}
for (i=0, j=0; j < ((kc*p_decParams->Z)>>4); i+=2, j++)
{ {
pl[j] = _mm_packs_epi16(pv[i],pv[i+1]); pl[j] = _mm_packs_epi16(pv[i],pv[i+1]);
} }
...@@ -1395,7 +1370,7 @@ void nr_dlsch_decoding_process(void *arg) ...@@ -1395,7 +1370,7 @@ void nr_dlsch_decoding_process(void *arg)
uint32_t A,E; uint32_t A,E;
uint32_t G; uint32_t G;
uint32_t ret,offset; uint32_t ret,offset;
uint32_t r,r_offset=0,Kr,Kr_bytes,err_flag=0,K_bytes_F; uint32_t r,r_offset=0,Kr,Kr_bytes,err_flag=0,K_bits_F;
uint8_t crc_type; uint8_t crc_type;
uint8_t C,Cprime; uint8_t C,Cprime;
uint8_t Qm; uint8_t Qm;
...@@ -1457,32 +1432,28 @@ void nr_dlsch_decoding_process(void *arg) ...@@ -1457,32 +1432,28 @@ void nr_dlsch_decoding_process(void *arg)
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25) if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25)
{ {
p_decParams->BG = 2; p_decParams->BG = 2;
kc = 52;
if (Coderate < 0.3333){ if (Coderate < 0.3333){
p_decParams->R = 15; p_decParams->R = 15;
kc = 52;
} }
else if (Coderate <0.6667){ else if (Coderate <0.6667){
p_decParams->R = 13; p_decParams->R = 13;
kc = 32;
} }
else { else {
p_decParams->R = 23; p_decParams->R = 23;
kc = 17;
} }
} }
else{ else{
p_decParams->BG = 1; p_decParams->BG = 1;
kc = 68;
if (Coderate < 0.6667){ if (Coderate < 0.6667){
p_decParams->R = 13; p_decParams->R = 13;
kc = 68;
} }
else if (Coderate <0.8889){ else if (Coderate <0.8889){
p_decParams->R = 23; p_decParams->R = 23;
kc = 35;
} }
else { else {
p_decParams->R = 89; p_decParams->R = 89;
kc = 27;
} }
} }
...@@ -1561,7 +1532,7 @@ void nr_dlsch_decoding_process(void *arg) ...@@ -1561,7 +1532,7 @@ void nr_dlsch_decoding_process(void *arg)
Kr = harq_process->K; Kr = harq_process->K;
Kr_bytes = Kr>>3; Kr_bytes = Kr>>3;
K_bytes_F = Kr_bytes-(harq_process->F>>3); K_bits_F = Kr-harq_process->F;
E = nr_get_E(G, harq_process->C, harq_process->Qm, harq_process->Nl, r); E = nr_get_E(G, harq_process->C, harq_process->Qm, harq_process->Nl, r);
...@@ -1681,23 +1652,16 @@ void nr_dlsch_decoding_process(void *arg) ...@@ -1681,23 +1652,16 @@ void nr_dlsch_decoding_process(void *arg)
} }
*/ */
memset(pv,0,2*p_decParams->Z*sizeof(int16_t)); //set first 2*Z_c bits to zeros
//memset(pl,0,2*p_decParams->Z*sizeof(int8_t)); memset(&z[0],0,2*harq_process->Z*sizeof(int16_t));
memset((pv+K_bytes_F),127,harq_process->F*sizeof(int16_t)); //set Filler bits
memset((&z[0]+K_bits_F),127,harq_process->F*sizeof(int16_t));
for (i=((2*p_decParams->Z)>>3), j = 0; i < K_bytes_F; i++, j++) //Move coded bits before filler bits
{ memcpy((&z[0]+2*harq_process->Z),harq_process->d[r],(K_bits_F-2*harq_process->Z)*sizeof(int16_t));
pv[i]= _mm_loadu_si128((__m128i*)(&harq_process->d[r][8*j])); //skip filler bits
} memcpy((&z[0]+Kr),harq_process->d[r]+(Kr-2*harq_process->Z),(kc*harq_process->Z-Kr)*sizeof(int16_t));
//Saturate coded bits before decoding into 8 bits values
j+=(harq_process->F>>3); for (i=0, j=0; j < ((kc*harq_process->Z)>>4)+1; i+=2, j++)
// for (i=Kr_bytes,j=K_bytes_F-((2*p_decParams->Z)>>3); i < ((kc*p_decParams->Z)>>3); i++, j++)
for (i=Kr_bytes; i < ((kc*p_decParams->Z)>>3); i++,j++)
{
pv[i]= _mm_loadu_si128((__m128i*)(&harq_process->d[r][8*j]));
}
for (i=0, j=0; j < ((kc*p_decParams->Z)>>4); i+=2, j++)
{ {
pl[j] = _mm_packs_epi16(pv[i],pv[i+1]); pl[j] = _mm_packs_epi16(pv[i],pv[i+1]);
} }
......
...@@ -626,32 +626,33 @@ typedef struct { ...@@ -626,32 +626,33 @@ typedef struct {
short n0_subband_power_tot_dB[275]; short n0_subband_power_tot_dB[275];
//! estimated avg noise power per RB (dBm) //! estimated avg noise power per RB (dBm)
short n0_subband_power_tot_dBm[275]; short n0_subband_power_tot_dBm[275];
// gNB measurements (per user) // gNB measurements (per user)
//! estimated received spatial signal power (linear) //! estimated received spatial signal power (linear)
unsigned int rx_spatial_power[NUMBER_OF_NR_DLSCH_MAX][2][2]; unsigned int rx_spatial_power[NUMBER_OF_NR_ULSCH_MAX][NB_ANTENNAS_TX][NB_ANTENNAS_RX];
//! estimated received spatial signal power (dB) //! estimated received spatial signal power (dB)
unsigned short rx_spatial_power_dB[NUMBER_OF_NR_DLSCH_MAX][2][2]; unsigned short rx_spatial_power_dB[NUMBER_OF_NR_ULSCH_MAX][NB_ANTENNAS_TX][NB_ANTENNAS_RX];
//! estimated rssi (dBm) //! estimated rssi (dBm)
short rx_rssi_dBm[NUMBER_OF_NR_DLSCH_MAX]; short rx_rssi_dBm[NUMBER_OF_NR_ULSCH_MAX];
//! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation) //! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
int rx_correlation[NUMBER_OF_NR_DLSCH_MAX][2]; int rx_correlation[NUMBER_OF_NR_ULSCH_MAX][2];
//! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation) //! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation)
int rx_correlation_dB[NUMBER_OF_NR_DLSCH_MAX][2]; int rx_correlation_dB[NUMBER_OF_NR_ULSCH_MAX][2];
/// Wideband CQI (= SINR) /// Wideband CQI (= SINR)
int wideband_cqi[NUMBER_OF_NR_DLSCH_MAX][MAX_NUM_RU_PER_gNB]; int wideband_cqi[NUMBER_OF_NR_ULSCH_MAX][MAX_NUM_RU_PER_gNB];
/// Wideband CQI in dB (= SINR dB) /// Wideband CQI in dB (= SINR dB)
int wideband_cqi_dB[NUMBER_OF_NR_DLSCH_MAX][MAX_NUM_RU_PER_gNB]; int wideband_cqi_dB[NUMBER_OF_NR_ULSCH_MAX][MAX_NUM_RU_PER_gNB];
/// Wideband CQI (sum of all RX antennas, in dB) /// Wideband CQI (sum of all RX antennas, in dB)
char wideband_cqi_tot[NUMBER_OF_NR_DLSCH_MAX]; char wideband_cqi_tot[NUMBER_OF_NR_ULSCH_MAX];
/// Subband CQI per RX antenna and RB (= SINR) /// Subband CQI per RX antenna and RB (= SINR)
int subband_cqi[NUMBER_OF_NR_DLSCH_MAX][MAX_NUM_RU_PER_gNB][275]; int subband_cqi[NUMBER_OF_NR_ULSCH_MAX][MAX_NUM_RU_PER_gNB][275];
/// Total Subband CQI and RB (= SINR) /// Total Subband CQI and RB (= SINR)
int subband_cqi_tot[NUMBER_OF_NR_DLSCH_MAX][275]; int subband_cqi_tot[NUMBER_OF_NR_ULSCH_MAX][275];
/// Subband CQI in dB and RB (= SINR dB) /// Subband CQI in dB and RB (= SINR dB)
int subband_cqi_dB[NUMBER_OF_NR_DLSCH_MAX][MAX_NUM_RU_PER_gNB][275]; int subband_cqi_dB[NUMBER_OF_NR_ULSCH_MAX][MAX_NUM_RU_PER_gNB][275];
/// Total Subband CQI and RB /// Total Subband CQI and RB
int subband_cqi_tot_dB[NUMBER_OF_NR_DLSCH_MAX][275]; int subband_cqi_tot_dB[NUMBER_OF_NR_ULSCH_MAX][275];
/// PRACH background noise level /// PRACH background noise level
int prach_I0; int prach_I0;
} PHY_MEASUREMENTS_gNB; } PHY_MEASUREMENTS_gNB;
......
...@@ -212,10 +212,8 @@ typedef struct { ...@@ -212,10 +212,8 @@ typedef struct {
unsigned short rx_spatial_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][2][2]; unsigned short rx_spatial_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][2][2];
/// estimated received signal power (sum over all TX antennas) /// estimated received signal power (sum over all TX antennas)
//int wideband_cqi[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
int rx_power[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX]; int rx_power[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
/// estimated received signal power (sum over all TX antennas) /// estimated received signal power (sum over all TX antennas)
//int wideband_cqi_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
unsigned short rx_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX]; unsigned short rx_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
/// estimated received signal power (sum over all TX/RX antennas) /// estimated received signal power (sum over all TX/RX antennas)
......
...@@ -296,6 +296,13 @@ uint16_t nr_get_Np(uint8_t N_RB_DL,uint8_t nCCE,uint8_t plus1); ...@@ -296,6 +296,13 @@ uint16_t nr_get_Np(uint8_t N_RB_DL,uint8_t nCCE,uint8_t plus1);
int8_t nr_find_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB); int8_t nr_find_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
/*! \brief UL time alignment procedures for TA application
@param PHY_VARS_NR_UE ue
@param int slot_tx
@param int frame_tx
*/
void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx);
/*! \brief Compute the timing adjustment at UE side from the old TA offset and the new received TA command /*! \brief Compute the timing adjustment at UE side from the old TA offset and the new received TA command
@param Mod_id Local UE index on which to act @param Mod_id Local UE index on which to act
@param CC_id Component Carrier Index @param CC_id Component Carrier Index
......
...@@ -61,13 +61,14 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ ...@@ -61,13 +61,14 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
if(scheduled_response->dl_config != NULL){ if(scheduled_response->dl_config != NULL){
fapi_nr_dl_config_request_t *dl_config = scheduled_response->dl_config; fapi_nr_dl_config_request_t *dl_config = scheduled_response->dl_config;
LOG_D(PHY,"Received %d DL pdus\n",dl_config->number_pdus); LOG_D(PHY,"Received %d DL pdus:\n",dl_config->number_pdus);
pdcch_vars->nb_search_space = 0; pdcch_vars->nb_search_space = 0;
for (i = 0; i < dl_config->number_pdus; ++i){ for (i = 0; i < dl_config->number_pdus; ++i){
if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_DCI) { if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_DCI) {
LOG_D(PHY,"FAPI_NR_DL_CONFIG_TYPE_DCI\n");
fapi_nr_dl_config_dci_dl_pdu_rel15_t *pdcch_config = &dl_config->dl_config_list[i].dci_config_pdu.dci_config_rel15; fapi_nr_dl_config_dci_dl_pdu_rel15_t *pdcch_config = &dl_config->dl_config_list[i].dci_config_pdu.dci_config_rel15;
memcpy((void*)&pdcch_vars->pdcch_config[pdcch_vars->nb_search_space],(void*)pdcch_config,sizeof(*pdcch_config)); memcpy((void*)&pdcch_vars->pdcch_config[pdcch_vars->nb_search_space],(void*)pdcch_config,sizeof(*pdcch_config));
pdcch_vars->nb_search_space = pdcch_vars->nb_search_space + 1; pdcch_vars->nb_search_space = pdcch_vars->nb_search_space + 1;
...@@ -76,9 +77,11 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ ...@@ -76,9 +77,11 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
} else { } else {
if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_DLSCH){ if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_DLSCH){
LOG_D(PHY,"FAPI_NR_DL_CONFIG_TYPE_DLSCH\n");
dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch[thread_id][0][0]; dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch[thread_id][0][0];
} }
else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH){ else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH){
LOG_D(PHY,"FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH\n");
dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_ra[0]; dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_ra[0];
} }
...@@ -91,6 +94,8 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ ...@@ -91,6 +94,8 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
dlsch0->rnti = dl_config->dl_config_list[i].dlsch_config_pdu.rnti; dlsch0->rnti = dl_config->dl_config_list[i].dlsch_config_pdu.rnti;
dlsch0_harq = dlsch0->harq_processes[current_harq_pid]; dlsch0_harq = dlsch0->harq_processes[current_harq_pid];
LOG_D(PHY,"current_harq_pid = %d\n", current_harq_pid);
if (dlsch0_harq){ if (dlsch0_harq){
dlsch0_harq->BWPStart = dlsch_config_pdu->BWPStart; dlsch0_harq->BWPStart = dlsch_config_pdu->BWPStart;
...@@ -118,8 +123,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ ...@@ -118,8 +123,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
dlsch0_harq->nEpreRatioOfPDSCHToPTRS = dlsch_config_pdu->nEpreRatioOfPDSCHToPTRS; dlsch0_harq->nEpreRatioOfPDSCHToPTRS = dlsch_config_pdu->nEpreRatioOfPDSCHToPTRS;
dlsch0_harq->PTRSReOffset = dlsch_config_pdu->PTRSReOffset; dlsch0_harq->PTRSReOffset = dlsch_config_pdu->PTRSReOffset;
dlsch0_harq->pduBitmap = dlsch_config_pdu->pduBitmap; dlsch0_harq->pduBitmap = dlsch_config_pdu->pduBitmap;
LOG_D(MAC, ">>>> \tdlsch0->g_pucch = %d\tdlsch0_harq.mcs = %d\n", dlsch0->g_pucch, dlsch0_harq->mcs); LOG_D(MAC, ">>>> \tdlsch0->g_pucch = %d\tdlsch0_harq.mcs = %d\tpdsch_to_harq_feedback_time_ind = %d\tslot_for_feedback_ack = %d\n", dlsch0->g_pucch, dlsch0_harq->mcs, dlsch_config_pdu->pdsch_to_harq_feedback_time_ind, dlsch0_harq->harq_ack.slot_for_feedback_ack);
} }
} }
} }
......
...@@ -302,7 +302,7 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u ...@@ -302,7 +302,7 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u
result_harq = NEW_TRANSMISSION_HARQ; result_harq = NEW_TRANSMISSION_HARQ;
NR_TST_PHY_PRINTF("[HARQ-UL-PUSCH harqId : %d] first new transmission \n", harq_pid); LOG_D(PHY, "[HARQ-UL-PUSCH harqId : %d] first new transmission \n", harq_pid);
} }
/* 38.321 5.4.2.1 2> if the received grant was not addressed to a Temporary C-RNTI on PDCCH, and the NDI provided in the associated HARQ */ /* 38.321 5.4.2.1 2> if the received grant was not addressed to a Temporary C-RNTI on PDCCH, and the NDI provided in the associated HARQ */
/* information has been toggled compared to the value in the previous transmission of this TB of this HARQ process */ /* information has been toggled compared to the value in the previous transmission of this TB of this HARQ process */
...@@ -313,7 +313,7 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u ...@@ -313,7 +313,7 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u
result_harq = NEW_TRANSMISSION_HARQ; result_harq = NEW_TRANSMISSION_HARQ;
NR_TST_PHY_PRINTF("[HARQ-UL-PUSCH harqId : %d] new transmission due to toogle of ndi \n", harq_pid); LOG_D(PHY, "[HARQ-UL-PUSCH harqId : %d] new transmission due to toogle of ndi \n", harq_pid);
} }
/* 38.321 5.4.2.1 2> else (i.e. retransmission): */ /* 38.321 5.4.2.1 2> else (i.e. retransmission): */
else { else {
...@@ -322,7 +322,7 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u ...@@ -322,7 +322,7 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u
result_harq = RETRANSMISSION_HARQ; result_harq = RETRANSMISSION_HARQ;
NR_TST_PHY_PRINTF("[HARQ-UL-PUSCH harqId : %d] retransmission \n", harq_pid); LOG_D(PHY, "[HARQ-UL-PUSCH harqId : %d] retransmission \n", harq_pid);
} }
return (result_harq); return (result_harq);
...@@ -476,7 +476,7 @@ harq_result_t downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int ...@@ -476,7 +476,7 @@ harq_result_t downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int
result_harq = NEW_TRANSMISSION_HARQ; result_harq = NEW_TRANSMISSION_HARQ;
NR_TST_PHY_PRINTF("[HARQ-DL-PDSCH harqId : %d] first new reception \n", harq_pid); LOG_D(PHY, "[HARQ-DL-PDSCH harqId : %d] first new reception \n", harq_pid);
} }
else if (dl_harq->DCINdi != ndi) { else if (dl_harq->DCINdi != ndi) {
dl_harq->round = 0; dl_harq->round = 0;
...@@ -485,7 +485,7 @@ harq_result_t downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int ...@@ -485,7 +485,7 @@ harq_result_t downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int
result_harq = NEW_TRANSMISSION_HARQ; result_harq = NEW_TRANSMISSION_HARQ;
NR_TST_PHY_PRINTF("[HARQ-DL-PDSCH harqId : %d] new reception due to toogle of ndi \n", harq_pid); LOG_D(PHY, "[HARQ-DL-PDSCH harqId : %d] new reception due to toogle of ndi \n", harq_pid);
} }
else { else {
...@@ -495,7 +495,7 @@ harq_result_t downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int ...@@ -495,7 +495,7 @@ harq_result_t downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int
result_harq = RETRANSMISSION_HARQ; result_harq = RETRANSMISSION_HARQ;
NR_TST_PHY_PRINTF("[HARQ-DL-PDSCH harqId : %d] reception of a retransmission \n", harq_pid); LOG_D(PHY, "[HARQ-DL-PDSCH harqId : %d] reception of a retransmission \n", harq_pid);
} }
return (result_harq); return (result_harq);
......
...@@ -134,10 +134,10 @@ UE_MODE_t get_nrUE_mode(uint8_t Mod_id,uint8_t CC_id,uint8_t gNB_id){ ...@@ -134,10 +134,10 @@ UE_MODE_t get_nrUE_mode(uint8_t Mod_id,uint8_t CC_id,uint8_t gNB_id){
return(PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[gNB_id]); return(PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[gNB_id]);
} }
uint16_t get_bw_scaling(uint16_t bwp_ul_NB_RB){ // scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size
uint16_t get_bw_scaling(uint16_t nb_rb){
uint16_t bw_scaling; uint16_t bw_scaling;
// scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size switch (nb_rb) {
switch (bwp_ul_NB_RB) {
case 32: bw_scaling = 4; break; case 32: bw_scaling = 4; break;
case 66: bw_scaling = 8; break; case 66: bw_scaling = 8; break;
case 106: bw_scaling = 16; break; case 106: bw_scaling = 16; break;
...@@ -149,6 +149,32 @@ uint16_t get_bw_scaling(uint16_t bwp_ul_NB_RB){ ...@@ -149,6 +149,32 @@ uint16_t get_bw_scaling(uint16_t bwp_ul_NB_RB){
return bw_scaling; return bw_scaling;
} }
/* UL time alignment
// If the current tx frame and slot match the TA configuration in ul_time_alignment
// then timing advance is processed and set to be applied in the next UL transmission */
void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx){
if (ue->mac_enabled == 1) {
uint8_t gNB_id = 0;
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment = &ue->ul_time_alignment[gNB_id];
if (frame_tx == ul_time_alignment->ta_frame && slot_tx == ul_time_alignment->ta_slot) {
uint8_t numerology = ue->frame_parms.numerology_index;
uint16_t bwp_ul_NB_RB = ue->frame_parms.N_RB_UL;
LOG_D(PHY, "In %s: applying timing advance -- frame %d -- slot %d\n", __FUNCTION__, frame_tx, slot_tx);
nr_process_timing_advance(ue->Mod_id, ue->CC_id, ul_time_alignment->ta_command, numerology, bwp_ul_NB_RB);
ul_time_alignment->ta_frame = -1;
ul_time_alignment->ta_slot = -1;
}
}
}
void nr_process_timing_advance(module_id_t Mod_id, uint8_t CC_id, uint8_t ta_command, uint8_t mu, uint16_t bwp_ul_NB_RB){ void nr_process_timing_advance(module_id_t Mod_id, uint8_t CC_id, uint8_t ta_command, uint8_t mu, uint16_t bwp_ul_NB_RB){
// 3GPP TS 38.213 p4.2 // 3GPP TS 38.213 p4.2
...@@ -178,10 +204,8 @@ void nr_process_timing_advance_rar(PHY_VARS_NR_UE *ue, int frame_rx, int nr_slot ...@@ -178,10 +204,8 @@ void nr_process_timing_advance_rar(PHY_VARS_NR_UE *ue, int frame_rx, int nr_slot
void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,
uint8_t gNB_id) { uint8_t gNB_id) {
//int32_t ulsch_start=0;
int slot_tx = proc->nr_slot_tx; int slot_tx = proc->nr_slot_tx;
int frame_tx = proc->frame_tx; int frame_tx = proc->frame_tx;
uint8_t harq_pid = 0;
runmode_t mode = normal_txrx; runmode_t mode = normal_txrx;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX,VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX,VCD_FUNCTION_IN);
...@@ -196,16 +220,18 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, ...@@ -196,16 +220,18 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
if (ue->UE_mode[gNB_id] <= PUSCH){ if (ue->UE_mode[gNB_id] <= PUSCH){
if (ue->ulsch[proc->thread_id][gNB_id][0]->harq_processes[harq_pid]->status == ACTIVE) for (uint8_t harq_pid = 0; harq_pid < ue->ulsch[proc->thread_id][gNB_id][0]->number_harq_processes_for_pusch; harq_pid++) {
nr_ue_ulsch_procedures(ue, harq_pid, frame_tx, slot_tx, proc->thread_id, gNB_id); if (ue->ulsch[proc->thread_id][gNB_id][0]->harq_processes[harq_pid]->status == ACTIVE)
nr_ue_ulsch_procedures(ue, harq_pid, frame_tx, slot_tx, proc->thread_id, gNB_id);
}
if (get_softmodem_params()->usim_test==0) { if (get_softmodem_params()->usim_test==0) {
LOG_D(PHY, "Generating PUCCH\n"); LOG_D(PHY, "Generating PUCCH\n");
pucch_procedures_ue_nr(ue, pucch_procedures_ue_nr(ue,
gNB_id, gNB_id,
proc, proc,
FALSE); FALSE);
} }
LOG_D(PHY, "Sending Uplink data \n"); LOG_D(PHY, "Sending Uplink data \n");
nr_ue_pusch_common_procedures(ue, nr_ue_pusch_common_procedures(ue,
...@@ -230,14 +256,12 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, ...@@ -230,14 +256,12 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
} }
void nr_ue_measurement_procedures(uint16_t l, // symbol index of each slot [0..6] void nr_ue_measurement_procedures(uint16_t l,
PHY_VARS_NR_UE *ue, PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,
uint8_t eNB_id, uint8_t eNB_id,
uint16_t slot, // slot index of each radio frame [0..19] uint16_t slot,
runmode_t mode) runmode_t mode){
{
LOG_D(PHY,"ue_measurement_procedures l %u Ncp %d\n",l,ue->frame_parms.Ncp);
NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
int frame_rx = proc->frame_rx; int frame_rx = proc->frame_rx;
...@@ -245,18 +269,14 @@ void nr_ue_measurement_procedures(uint16_t l, // symbol index of each slot [0 ...@@ -245,18 +269,14 @@ void nr_ue_measurement_procedures(uint16_t l, // symbol index of each slot [0
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_MEASUREMENT_PROCEDURES, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_MEASUREMENT_PROCEDURES, VCD_FUNCTION_IN);
if (l==2) { if (l==2) {
// UE measurements on symbol 0
LOG_D(PHY,"Calling measurements nr_slot_rx %d, rxdata %p\n",nr_slot_rx,ue->common_vars.rxdata); LOG_D(PHY,"Doing UE measurement procedures in symbol l %u Ncp %d nr_slot_rx %d, rxdata %p\n",
/* l,
nr_ue_measurements(ue, ue->frame_parms.Ncp,
proc, nr_slot_rx,
0, ue->common_vars.rxdata);
0,
0, nr_ue_measurements(ue, proc, nr_slot_rx);
0,
nr_slot_rx);
*/
//(nr_slot_rx*frame_parms->samples_per_slot+ue->rx_offset) % frame_parms->samples_per_frame
#if T_TRACER #if T_TRACER
if(slot == 0) if(slot == 0)
...@@ -270,21 +290,6 @@ void nr_ue_measurement_procedures(uint16_t l, // symbol index of each slot [0 ...@@ -270,21 +290,6 @@ void nr_ue_measurement_procedures(uint16_t l, // symbol index of each slot [0
T_INT((int)ue->common_vars.freq_offset)); T_INT((int)ue->common_vars.freq_offset));
#endif #endif
} }
#if 0
if (l==(6-ue->frame_parms.Ncp)) {
// make sure we have signal from PSS/SSS for N0 measurement
// LOG_I(PHY," l==(6-ue->frame_parms.Ncp) ue_rrc_measurements\n");
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_RRC_MEASUREMENTS, VCD_FUNCTION_IN);
ue_rrc_measurements(ue,
slot,
abstraction_flag);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_RRC_MEASUREMENTS, VCD_FUNCTION_OUT);
}
#endif
// accumulate and filter timing offset estimation every subframe (instead of every frame) // accumulate and filter timing offset estimation every subframe (instead of every frame)
if (( slot == 2) && (l==(2-frame_parms->Ncp))) { if (( slot == 2) && (l==(2-frame_parms->Ncp))) {
...@@ -945,7 +950,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -945,7 +950,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
uint16_t ofdm_symbol_size = ue->frame_parms.ofdm_symbol_size; uint16_t ofdm_symbol_size = ue->frame_parms.ofdm_symbol_size;
uint16_t nb_prefix_samples = ue->frame_parms.nb_prefix_samples; uint16_t nb_prefix_samples = ue->frame_parms.nb_prefix_samples;
uint32_t t_subframe = 1; // subframe duration of 1 msec uint32_t t_subframe = 1; // subframe duration of 1 msec
uint16_t bw_scaling, start_symbol; uint16_t start_symbol;
float tc_factor; float tc_factor;
is_cw0_active = dlsch0->harq_processes[harq_pid]->status; is_cw0_active = dlsch0->harq_processes[harq_pid]->status;
...@@ -1256,16 +1261,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -1256,16 +1261,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
if (ue->mac_enabled == 1) { if (ue->mac_enabled == 1) {
// scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size uint16_t bw_scaling = get_bw_scaling(ue->frame_parms.N_RB_DL);
switch (ue->frame_parms.N_RB_DL) {
case 32: bw_scaling = 4; break;
case 66: bw_scaling = 8; break;
case 106: bw_scaling = 16; break;
case 217: bw_scaling = 32; break;
case 245: bw_scaling = 32; break;
case 273: bw_scaling = 32; break;
default: abort();
}
/* Time Alignment procedure /* Time Alignment procedure
// - UE processing capability 1 // - UE processing capability 1
...@@ -1716,8 +1712,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -1716,8 +1712,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
uint8_t nb_symb_pdcch = pdcch_vars->nb_search_space > 0 ? pdcch_vars->pdcch_config[0].coreset.duration : 0; uint8_t nb_symb_pdcch = pdcch_vars->nb_search_space > 0 ? pdcch_vars->pdcch_config[0].coreset.duration : 0;
uint8_t dci_cnt = 0; uint8_t dci_cnt = 0;
NR_DL_FRAME_PARMS *fp = &ue->frame_parms; NR_DL_FRAME_PARMS *fp = &ue->frame_parms;
//NR_UE_MAC_INST_t *mac = get_mac_inst(0);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN);
...@@ -1777,6 +1771,9 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -1777,6 +1771,9 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
0, 0,
16384); 16384);
} }
LOG_D(PHY, "Doing N0 measurements in %s\n", __FUNCTION__);
nr_ue_rrc_measurements(ue, proc, nr_slot_rx);
} }
} }
...@@ -1791,7 +1788,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -1791,7 +1788,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
LOG_D(PHY," ------ --> PDCCH ChannelComp/LLR Frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx); LOG_D(PHY," ------ --> PDCCH ChannelComp/LLR Frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx);
for (uint16_t l=0; l<nb_symb_pdcch; l++) { for (uint16_t l=0; l<nb_symb_pdcch; l++) {
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
start_meas(&ue->ofdm_demod_stats); start_meas(&ue->ofdm_demod_stats);
#endif #endif
...@@ -1850,8 +1847,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -1850,8 +1847,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
for (int i=0;i<4;i++) if (((1<<i)&dlsch0_harq->dlDmrsSymbPos) > 0) {symb_dmrs=i;break;} for (int i=0;i<4;i++) if (((1<<i)&dlsch0_harq->dlDmrsSymbPos) > 0) {symb_dmrs=i;break;}
AssertFatal(symb_dmrs>=0,"no dmrs in 0..3\n"); AssertFatal(symb_dmrs>=0,"no dmrs in 0..3\n");
LOG_D(PHY,"Initializing dmrs for symb %d DMRS mask %x\n",symb_dmrs,dlsch0_harq->dlDmrsSymbPos); LOG_D(PHY,"Initializing dmrs for slot %d DMRS mask %x\n", nr_slot_rx, dlsch0_harq->dlDmrsSymbPos);
nr_gold_pdsch(ue,0); nr_gold_pdsch(ue, nr_slot_rx, 0);
for (uint16_t m=start_symb_sch;m<(nb_symb_sch+start_symb_sch) ; m++){ for (uint16_t m=start_symb_sch;m<(nb_symb_sch+start_symb_sch) ; m++){
nr_slot_fep(ue, nr_slot_fep(ue,
...@@ -1882,19 +1879,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -1882,19 +1879,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
ue->dlsch[proc->thread_id][gNB_id][0], ue->dlsch[proc->thread_id][gNB_id][0],
NULL); NULL);
//printf("phy procedure pdsch start measurement\n"); nr_ue_measurement_procedures(2, ue, proc, gNB_id, nr_slot_rx, mode);
nr_ue_measurement_procedures(2,ue,proc,gNB_id,nr_slot_rx,mode);
/*
write_output("rxF.m","rxF",&ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF[0][0],fp->ofdm_symbol_size*14,1,1);
write_output("rxF_ch.m","rxFch",&ue->pdsch_vars[proc->thread_id][gNB_id]->dl_ch_estimates[0][0],fp->ofdm_symbol_size*14,1,1);
write_output("rxF_ch_ext.m","rxFche",&ue->pdsch_vars[proc->thread_id][gNB_id]->dl_ch_estimates_ext[0][2*50*12],50*12,1,1);
write_output("rxF_ext.m","rxFe",&ue->pdsch_vars[proc->thread_id][gNB_id]->rxdataF_ext[0][0],50*12*14,1,1);
write_output("rxF_comp.m","rxFc",&ue->pdsch_vars[proc->thread_id][gNB_id]->rxdataF_comp0[0][0],fp->N_RB_DL*12*14,1,1);
write_output("rxF_llr.m","rxFllr",ue->pdsch_vars[proc->thread_id][gNB_id]->llr[0],(nb_symb_sch-1)*50*12+50*6,1,0);
*/
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT);
} }
// do procedures for SI-RNTI // do procedures for SI-RNTI
......
...@@ -98,7 +98,7 @@ int16_t get_pucch_tx_power_ue(PHY_VARS_NR_UE *ue, ...@@ -98,7 +98,7 @@ int16_t get_pucch_tx_power_ue(PHY_VARS_NR_UE *ue,
} }
else { else {
G_b_f_c = ue->dlsch[proc->thread_id][gNB_id][0]->g_pucch; G_b_f_c = ue->dlsch[proc->thread_id][gNB_id][0]->g_pucch;
LOG_W(PHY,"PUCCH Transmit power control command not yet implemented for NR : at line %d in function %s of file %s \n", LINE_FILE , __func__, __FILE__); LOG_D(PHY,"PUCCH Transmit power control command not yet implemented for NR : at line %d in function %s of file %s \n", LINE_FILE , __func__, __FILE__);
return (PUCCH_POWER_DEFAULT); return (PUCCH_POWER_DEFAULT);
} }
......
...@@ -247,6 +247,8 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ ...@@ -247,6 +247,8 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
pucch_resource_indicator = ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[dl_harq_pid]->harq_ack.pucch_resource_indicator; pucch_resource_indicator = ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[dl_harq_pid]->harq_ack.pucch_resource_indicator;
} }
LOG_D(PHY, "PUCCH: %d.%d dl_harq_pid = %d, pucch_resource_indicator = %d\n", frame_tx, nr_slot_tx, dl_harq_pid, pucch_resource_indicator);
/* Part - I /* Part - I
* Collect feedback that should be transmitted at this nr_slot_tx : * Collect feedback that should be transmitted at this nr_slot_tx :
* - ACK/NACK, SR, CSI (CQI, RI, ...) * - ACK/NACK, SR, CSI (CQI, RI, ...)
......
...@@ -2131,6 +2131,10 @@ int get_num_dmrs(uint16_t dmrs_mask ) { ...@@ -2131,6 +2131,10 @@ int get_num_dmrs(uint16_t dmrs_mask ) {
for (int i=0;i<16;i++) num_dmrs+=((dmrs_mask>>i)&1); for (int i=0;i<16;i++) num_dmrs+=((dmrs_mask>>i)&1);
return(num_dmrs); return(num_dmrs);
} }
/* returns the total DMRS symbols in a slot*/
uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols){
return get_num_dmrs(fill_dmrs_mask(pdsch_Config,dmrs_TypeA_Position,NrOfSymbols));
}
// Table 5.1.2.2.1-1 38.214 // Table 5.1.2.2.1-1 38.214
uint8_t getRBGSize(uint16_t bwp_size, long rbg_size_config) { uint8_t getRBGSize(uint16_t bwp_size, long rbg_size_config) {
......
...@@ -191,4 +191,7 @@ bool set_dl_ptrs_values(NR_PTRS_DownlinkConfig_t *ptrs_config, ...@@ -191,4 +191,7 @@ bool set_dl_ptrs_values(NR_PTRS_DownlinkConfig_t *ptrs_config,
uint8_t *K_ptrs, uint8_t *L_ptrs,uint8_t *portIndex, uint8_t *K_ptrs, uint8_t *L_ptrs,uint8_t *portIndex,
uint8_t *nERatio,uint8_t *reOffset, uint8_t *nERatio,uint8_t *reOffset,
uint8_t NrOfSymbols); uint8_t NrOfSymbols);
uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols);
#endif #endif
...@@ -171,8 +171,8 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t ...@@ -171,8 +171,8 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
rel15->BWPSize, rel15->BWPSize,
rel15->BWPStart, rel15->BWPStart,
rel15->SubcarrierSpacing, rel15->SubcarrierSpacing,
rel15->dci_format, rel15->dci_format_options[0],
rel15->dci_length, rel15->dci_length_options[0],
sps, sps,
monitoringSymbolsWithinSlot); monitoringSymbolsWithinSlot);
#endif #endif
...@@ -213,9 +213,9 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl ...@@ -213,9 +213,9 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
// check available SS IDs // check available SS IDs
if (pdcch_ConfigCommon->choice.setup->ra_SearchSpace){ if (pdcch_ConfigCommon->choice.setup->ra_SearchSpace){
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->ra_SearchSpace){ if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->ra_SearchSpace){
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space\n");
switch(mac->ra_state){ switch(mac->ra_state){
case WAIT_RAR: case WAIT_RAR:
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space\n");
rel15->num_dci_options = 1; rel15->num_dci_options = 1;
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0; rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, ss_id); config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, ss_id);
......
...@@ -1060,7 +1060,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id, ...@@ -1060,7 +1060,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
num_rbs = table_38213_13_4_c2[index_4msb]; num_rbs = table_38213_13_4_c2[index_4msb];
num_symbols = table_38213_13_4_c3[index_4msb]; num_symbols = table_38213_13_4_c3[index_4msb];
rb_offset = table_38213_13_4_c4[index_4msb]; rb_offset = table_38213_13_4_c4[index_4msb];
LOG_I(MAC,"<<<<<<<<<index_4msb %d num_rbs %d num_symb %d rb_offset %d\n",index_4msb,num_rbs,num_symbols,rb_offset ); LOG_D(MAC,"<<<<<<<<<index_4msb %d num_rbs %d num_symb %d rb_offset %d\n",index_4msb,num_rbs,num_symbols,rb_offset );
}else if(min_channel_bw & bw_40MHz){ }else if(min_channel_bw & bw_40MHz){
AssertFatal(index_4msb < 10, "38.213 Table 13-6 4 MSB out of range\n"); AssertFatal(index_4msb < 10, "38.213 Table 13-6 4 MSB out of range\n");
mac->type0_pdcch_ss_mux_pattern = 1; mac->type0_pdcch_ss_mux_pattern = 1;
...@@ -1420,6 +1420,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in ...@@ -1420,6 +1420,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
// check type0 from 38.213 13 if we have no CellGroupConfig // check type0 from 38.213 13 if we have no CellGroupConfig
// TODO: implementation to be completed // TODO: implementation to be completed
if (mac->scg == NULL) { if (mac->scg == NULL) {
if(dl_info->ssb_index != -1){ if(dl_info->ssb_index != -1){
if(mac->type0_pdcch_ss_mux_pattern == 1){ if(mac->type0_pdcch_ss_mux_pattern == 1){
...@@ -5156,9 +5157,6 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, ...@@ -5156,9 +5157,6 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
module_idP, frameP, subframe, buflen); module_idP, frameP, subframe, buflen);
AssertFatal(CC_id == 0, AssertFatal(CC_id == 0,
"Transmission on secondary CCs is not supported yet\n"); "Transmission on secondary CCs is not supported yet\n");
#if UE_TIMING_TRACE
start_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu);
#endif
// Check for DCCH first // Check for DCCH first
// TO DO: Multiplex in the order defined by the logical channel prioritization // TO DO: Multiplex in the order defined by the logical channel prioritization
......
...@@ -505,6 +505,9 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id, ...@@ -505,6 +505,9 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id,
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData); getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData);
int nrOfSymbols = getNrOfSymbols(sched_ctrl->active_bwp, int nrOfSymbols = getNrOfSymbols(sched_ctrl->active_bwp,
sched_ctrl->time_domain_allocation); sched_ctrl->time_domain_allocation);
uint8_t N_DMRS_SLOT = get_num_dmrs_symbols(sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup,
RC.nrmac[module_id]->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position ,
nrOfSymbols);
int rbSize = 0; int rbSize = 0;
const int oh = 2 + (sched_ctrl->num_total_bytes >= 256) const int oh = 2 + (sched_ctrl->num_total_bytes >= 256)
...@@ -516,8 +519,7 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id, ...@@ -516,8 +519,7 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id,
nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx), nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
rbSize, rbSize,
nrOfSymbols, nrOfSymbols,
N_PRB_DMRS, // FIXME // This should be multiplied by the N_PRB_DMRS * N_DMRS_SLOT,
// number of dmrs symbols
0 /* N_PRB_oh, 0 for initialBWP */, 0 /* N_PRB_oh, 0 for initialBWP */,
0 /* tb_scaling */, 0 /* tb_scaling */,
1 /* nrOfLayers */) 1 /* nrOfLayers */)
...@@ -577,13 +579,16 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -577,13 +579,16 @@ void nr_schedule_ue_spec(module_id_t module_id,
uint8_t N_PRB_DMRS = uint8_t N_PRB_DMRS =
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData); getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData);
uint8_t N_DMRS_SLOT = get_num_dmrs_symbols(sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup,
RC.nrmac[module_id]->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position ,
nrOfSymbols);
const uint32_t TBS = const uint32_t TBS =
nr_compute_tbs(nr_get_Qm_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx), nr_compute_tbs(nr_get_Qm_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx), nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
sched_ctrl->rbSize, sched_ctrl->rbSize,
nrOfSymbols, nrOfSymbols,
N_PRB_DMRS, // FIXME // This should be multiplied by the N_PRB_DMRS * N_DMRS_SLOT,
// number of dmrs symbols
0 /* N_PRB_oh, 0 for initialBWP */, 0 /* N_PRB_oh, 0 for initialBWP */,
0 /* tb_scaling */, 0 /* tb_scaling */,
1 /* nrOfLayers */) 1 /* nrOfLayers */)
......
...@@ -108,8 +108,8 @@ int generate_CG_Config(gNB_RRC_INST *rrc, ...@@ -108,8 +108,8 @@ int generate_CG_Config(gNB_RRC_INST *rrc,
fd = fopen("reconfig.raw","w"); fd = fopen("reconfig.raw","w");
if (fd != NULL) { if (fd != NULL) {
fwrite((void *)buffer,1,(size_t)((enc_rval.encoded+7)>>3),fd); fwrite((void *)buffer,1,(size_t)((enc_rval.encoded+7)>>3),fd);
fclose(fd);
} }
fclose(fd);
} }
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_RadioBearerConfig, NULL, (void *)rbconfig, buffer, 1024); enc_rval = uper_encode_to_buffer(&asn_DEF_NR_RadioBearerConfig, NULL, (void *)rbconfig, buffer, 1024);
...@@ -134,8 +134,8 @@ int generate_CG_Config(gNB_RRC_INST *rrc, ...@@ -134,8 +134,8 @@ int generate_CG_Config(gNB_RRC_INST *rrc,
fd = fopen("rbconfig.raw","w"); fd = fopen("rbconfig.raw","w");
if (fd != NULL) { if (fd != NULL) {
fwrite((void *)buffer,1,(size_t)((enc_rval.encoded+7)>>3),fd); fwrite((void *)buffer,1,(size_t)((enc_rval.encoded+7)>>3),fd);
fclose(fd);
} }
fclose(fd);
} }
total_size = total_size + ((enc_rval.encoded+7)>>3); total_size = total_size + ((enc_rval.encoded+7)>>3);
......
...@@ -59,6 +59,29 @@ The RF simulator is using the configuration module, and its parameters are defin ...@@ -59,6 +59,29 @@ The RF simulator is using the configuration module, and its parameters are defin
Setting the env variable RFSIMULATOR can be used instead of using the serveraddr parameter; it is to preserve compatibility with previous version. Setting the env variable RFSIMULATOR can be used instead of using the serveraddr parameter; it is to preserve compatibility with previous version.
## How to use the RF simulator options
Add the following options to the command line to enable the channel model and the IQ samples saving for future replay:
```bash
--rfsimulator.options chanmod,saviq
```
or just:
```bash
--rfsimulator.options chanmod
```
to enable the channel model.
set the model with:
```bash
--rfsimulator.modelname AWGN
```
Example run:
```bash
sudo RFSIMULATOR=server ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf --parallel-config PARALLEL_SINGLE_THREAD --rfsim --phy-test --rfsimulator.options chanmod --rfsimulator.modelname AWGN
```
## 4G case ## 4G case
For the UE, it should be set to the IP address of the eNB. For example: For the UE, it should be set to the IP address of the eNB. For example:
...@@ -165,5 +188,50 @@ Only the input noise can be changed on command line with the `-s` parameter. ...@@ -165,5 +188,50 @@ Only the input noise can be changed on command line with the `-s` parameter.
With path loss = 0 set `-s 5` to see a little noise. `-s` is a shortcut to `channelmod.s`. It is expected to enhance the channel modelization flexibility by the addition of more parameters in the channelmod section. With path loss = 0 set `-s 5` to see a little noise. `-s` is a shortcut to `channelmod.s`. It is expected to enhance the channel modelization flexibility by the addition of more parameters in the channelmod section.
Example to add a very small noise:
```bash
-s 30
```
to add a lot of noise:
```bash
-s 5
```
Example run commands:
```bash
sudo RFSIMULATOR=server ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf --parallel-config PARALLEL_SINGLE_THREAD --rfsim --phy-test --rfsimulator.options chanmod --rfsimulator.modelname AWGN
```
# Real time control and monitoring
Add the `--telnetsrv` option to the command line. Then in a new shell, connect to the telnet server, example:
```bash
telnet 127.0.0.1 9090
```
once connected it is possible to monitor the current status:
```bash
channelmod show current
```
see the available channel models:
```bash
channelmod show predef
```
or modify the channel model, for example setting a new model:
```bash
rfsimu setmodel AWGN
```
setting the pathloss, etc...:
```bash
channelmod modify <channelid> <param> <value>
channelmod modify 0 ploss 15
```
where:
```bash
<param name> can be one of "riceanf", "aoa", "randaoa", "ploss", "offset", "forgetf"
```
# Caveats # Caveats
Still issues in power control: txgain, rxgain are not used. Still issues in power control: txgain, rxgain are not used.
...@@ -555,7 +555,7 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi ...@@ -555,7 +555,7 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi
memset(b->circularBuf, 0, sampleToByte(CirSize,1)); memset(b->circularBuf, 0, sampleToByte(CirSize,1));
} }
if (b->lastReceivedTS != 0 && b->th.timestamp-b->lastReceivedTS > 50 ) if (b->lastReceivedTS != 0 && b->th.timestamp-b->lastReceivedTS < 1000)
LOG_W(HW,"UEsock: %d gap of: %ld in reception\n", fd, b->th.timestamp-b->lastReceivedTS ); LOG_W(HW,"UEsock: %d gap of: %ld in reception\n", fd, b->th.timestamp-b->lastReceivedTS );
b->lastReceivedTS=b->th.timestamp; b->lastReceivedTS=b->th.timestamp;
...@@ -628,7 +628,7 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo ...@@ -628,7 +628,7 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo
t->nextTimestamp+=nsamps; t->nextTimestamp+=nsamps;
if ( ((t->nextTimestamp/nsamps)%100) == 0) if ( ((t->nextTimestamp/nsamps)%100) == 0)
LOG_W(HW,"No UE, Generated void samples for Rx: %ld\n", t->nextTimestamp); LOG_D(HW,"No UE, Generated void samples for Rx: %ld\n", t->nextTimestamp);
*ptimestamp = t->nextTimestamp-nsamps; *ptimestamp = t->nextTimestamp-nsamps;
return nsamps; return nsamps;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment