Commit 51ffa4f6 authored by Hongzhi Wang's avatar Hongzhi Wang

ue removing logs

parent d091e846
...@@ -107,11 +107,8 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -107,11 +107,8 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
ue->high_speed_flag, ue->high_speed_flag,
frame_mod4); frame_mod4);
if ((pbch_tx_ant>0) && (pbch_tx_ant<=2)) {
pbch_decoded = 1; pbch_decoded = 1;
// break; // break;
}
//} //}
...@@ -129,43 +126,6 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -129,43 +126,6 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
// ue->pbch_vars[0]->decoded_output[0] = ue->pbch_vars[0]->decoded_output[2]; // ue->pbch_vars[0]->decoded_output[0] = ue->pbch_vars[0]->decoded_output[2];
// ue->pbch_vars[0]->decoded_output[2] = dummy; // ue->pbch_vars[0]->decoded_output[2] = dummy;
// now check for Bandwidth of Cell
dummy = (ue->pbch_vars[0]->decoded_output[2]>>5)&7;
switch (dummy) {
case 0 :
frame_parms->N_RB_DL = 6;
break;
case 1 :
frame_parms->N_RB_DL = 15;
break;
case 2 :
frame_parms->N_RB_DL = 25;
break;
case 3 :
frame_parms->N_RB_DL = 50;
break;
case 4 :
frame_parms->N_RB_DL = 75;
break;
case 5:
frame_parms->N_RB_DL = 100;
break;
default:
LOG_E(PHY,"[UE%d] Initial sync: PBCH decoding: Unknown N_RB_DL\n",ue->Mod_id);
return -1;
break;
}
for(int i=0; i<RX_NB_TH;i++) for(int i=0; i<RX_NB_TH;i++)
{ {
ue->proc.proc_rxtx[i].frame_rx = (((ue->pbch_vars[0]->decoded_output[2]&3)<<6) + (ue->pbch_vars[0]->decoded_output[1]>>2))<<2; ue->proc.proc_rxtx[i].frame_rx = (((ue->pbch_vars[0]->decoded_output[2]&3)<<6) + (ue->pbch_vars[0]->decoded_output[1]>>2))<<2;
...@@ -178,14 +138,11 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -178,14 +138,11 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
ue->proc.proc_rxtx[i].frame_tx = ue->proc.proc_rxtx[0].frame_rx; ue->proc.proc_rxtx[i].frame_tx = ue->proc.proc_rxtx[0].frame_rx;
} }
#ifdef DEBUG_INITIAL_SYNCH #ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"[UE%d] Initial sync: pbch decoded sucessfully mode1_flag %d, tx_ant %d, frame %d, N_RB_DL %d, phich_duration %d, phich_resource %s!\n", LOG_I(PHY,"[UE%d] Initial sync: pbch decoded sucessfully mode1_flag %d, tx_ant %d, frame %d\n",
ue->Mod_id, ue->Mod_id,
frame_parms->mode1_flag, frame_parms->mode1_flag,
pbch_tx_ant, pbch_tx_ant,
ue->proc.proc_rxtx[0].frame_rx, ue->proc.proc_rxtx[0].frame_rx,);
frame_parms->N_RB_DL,
frame_parms->phich_config_common.phich_duration,
phich_resource); //frame_parms->phich_config_common.phich_resource);
#endif #endif
return(0); return(0);
} else { } else {
...@@ -194,7 +151,6 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -194,7 +151,6 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
} }
char phich_string[13][4] = {"","1/6","","1/2","","","one","","","","","","two"};
char duplex_string[2][4] = {"FDD","TDD"}; char duplex_string[2][4] = {"FDD","TDD"};
char prefix_string[2][9] = {"NORMAL","EXTENDED"}; char prefix_string[2][9] = {"NORMAL","EXTENDED"};
...@@ -325,10 +281,6 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -325,10 +281,6 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
} }
#endif #endif
generate_pcfich_reg_mapping(frame_parms);
generate_phich_reg_mapping(frame_parms);
ue->pbch_vars[0]->pdu_errors_conseq=0; ue->pbch_vars[0]->pdu_errors_conseq=0;
} }
......
...@@ -394,21 +394,20 @@ void nr_pbch_unscrambling(NR_DL_FRAME_PARMS *frame_parms, ...@@ -394,21 +394,20 @@ void nr_pbch_unscrambling(NR_DL_FRAME_PARMS *frame_parms,
uint8_t reset; uint8_t reset;
uint32_t x1, x2, s=0; uint32_t x1, x2, s=0;
printf("unscramb nid_cell %d\n",frame_parms->Nid_cell); //printf("unscramb nid_cell %d\n",frame_parms->Nid_cell);
reset = 1; reset = 1;
// x1 is set in first call to lte_gold_generic // x1 is set in first call to lte_gold_generic
x2 = frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.6.1 x2 = frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.6.1
// msg("pbch_unscrambling: Nid_cell = %d\n",x2);
for (i=0; i<length; i++) { for (i=0; i<length; i++) {
if (i%32==0) { if (i%32==0) {
s = lte_gold_generic(&x1, &x2, reset); s = lte_gold_generic(&x1, &x2, reset);
printf("lte_gold[%d]=%x\n",i,s); //printf("lte_gold[%d]=%x\n",i,s);
reset = 0; reset = 0;
} }
printf("s = %d\n",((s>>(i%32))&1) ); //printf("s = %d\n",((s>>(i%32))&1) );
if (((s>>(i%32))&1)==1) if (((s>>(i%32))&1)==1)
pbch_a[i] = 1-pbch_a[i]; pbch_a[i] = 1-pbch_a[i];
} }
...@@ -503,15 +502,10 @@ uint16_t nr_rx_pbch( PHY_VARS_NR_UE *ue, ...@@ -503,15 +502,10 @@ uint16_t nr_rx_pbch( PHY_VARS_NR_UE *ue,
int8_t decoderState=0; int8_t decoderState=0;
uint8_t decoderListSize = 8, pathMetricAppr = 0; uint8_t decoderListSize = 8, pathMetricAppr = 0;
double aPrioriArray[frame_parms->pbch_polar_params.payloadBits]; // assume no a priori knowledge available about the payload. double aPrioriArray[frame_parms->pbch_polar_params.payloadBits]; // assume no a priori knowledge available about the payload.
double *channelOutput = malloc (sizeof(double) * 864); //add noise
uint8_t *estimatedOutput = malloc(sizeof(uint8_t) * 32); //decoder output
memset(&channelOutput[0], 0, sizeof(double) * 864);
memset(&estimatedOutput[0], 0, sizeof(uint8_t) * 32);
memset(&pbch_a[0], 0, sizeof(uint8_t) * 32); memset(&pbch_a[0], 0, sizeof(uint8_t) * NR_POLAR_PBCH_PAYLOAD_BITS);
frame_parms->Nid_cell = 100;
printf("nr_pbch_ue nid_cell %d\n",frame_parms->Nid_cell); //printf("nr_pbch_ue nid_cell %d\n",frame_parms->Nid_cell);
for (int i=0; i<frame_parms->pbch_polar_params.payloadBits; i++) aPrioriArray[i] = NAN; for (int i=0; i<frame_parms->pbch_polar_params.payloadBits; i++) aPrioriArray[i] = NAN;
...@@ -597,57 +591,37 @@ uint16_t nr_rx_pbch( PHY_VARS_NR_UE *ue, ...@@ -597,57 +591,37 @@ uint16_t nr_rx_pbch( PHY_VARS_NR_UE *ue,
printf("pbch rx llr %d rxdata_comp %d addr %p\n",*(pbch_e_rx+cnt), p[cnt], &p[0]); printf("pbch rx llr %d rxdata_comp %d addr %p\n",*(pbch_e_rx+cnt), p[cnt], &p[0]);
//#endif //#endif
for (int i=0; i<NR_POLAR_PBCH_E/2; i++){ for (i=0; i<NR_POLAR_PBCH_E/2; i++){
idx_demod = (sign(pbch_e_rx[i<<1])&1) ^ ((sign(pbch_e_rx[(i<<1)+1])&1)<<1); idx_demod = (sign(pbch_e_rx[i<<1])&1) ^ ((sign(pbch_e_rx[(i<<1)+1])&1)<<1);
demod_pbch_e[i<<1] = nr_demod_table[(idx_demod)<<1]; demod_pbch_e[i<<1] = nr_demod_table[(idx_demod)<<1];
demod_pbch_e[(i<<1)+1] = nr_demod_table[((idx_demod)<<1)+1]; demod_pbch_e[(i<<1)+1] = nr_demod_table[((idx_demod)<<1)+1];
#ifdef DEBUG_PBCH
if (i<16){ if (i<16){
printf("idx[%d]= %d\n", i , idx_demod); printf("idx[%d]= %d\n", i , idx_demod);
printf("sign[%d]= %d sign[%d]= %d\n", i<<1 , sign(pbch_e_rx[i<<1]), (i<<1)+1 , sign(pbch_e_rx[(i<<1)+1])); printf("sign[%d]= %d sign[%d]= %d\n", i<<1 , sign(pbch_e_rx[i<<1]), (i<<1)+1 , sign(pbch_e_rx[(i<<1)+1]));
printf("demod_pbch_e2[%d] r = %2.3f i = %2.3f\n", i<<1 , demod_pbch_e[i<<1], demod_pbch_e[(i<<1)+1]);} printf("demod_pbch_e2[%d] r = %2.3f i = %2.3f\n", i<<1 , demod_pbch_e[i<<1], demod_pbch_e[(i<<1)+1]);}
#endif
} }
//polar decoding de-rate matching //polar decoding de-rate matching
decoderState = polar_decoder(demod_pbch_e, pbch_a, &frame_parms->pbch_polar_params, decoderListSize, aPrioriArray, pathMetricAppr); decoderState = polar_decoder(demod_pbch_e, pbch_a, &frame_parms->pbch_polar_params, decoderListSize, aPrioriArray, pathMetricAppr);
for (i=0; i<32 /*(NR_POLAR_PBCH_PAYLOAD_BITS>>3)*/; i++) //for (i=0; i<NR_POLAR_PBCH_PAYLOAD_BITS; i++)
printf("pbch_a[%d] = %u \n", i,pbch_a[i]); //printf("pbch_a[%d] = %u \n", i,pbch_a[i]);
//un-scrambling //un-scrambling
nr_pbch_unscrambling(frame_parms,pbch_a,NR_POLAR_PBCH_PAYLOAD_BITS); nr_pbch_unscrambling(frame_parms,pbch_a,NR_POLAR_PBCH_PAYLOAD_BITS);
for (i=0; i<32 /*(NR_POLAR_PBCH_PAYLOAD_BITS>>3)*/; i++)
printf("after unscrambling pbch_a[%d] = %d \n", i,pbch_a[i]);
// Fix byte endian // Fix byte endian
//for (i=0; i<32 /*(NR_POLAR_PBCH_PAYLOAD_BITS>>3)*/; i++) for (i=0; i<(NR_POLAR_PBCH_PAYLOAD_BITS); i++)
// printf("estimated output[%d] = %d \n", i,estimatedOutput[i]); decoded_output[(NR_POLAR_PBCH_PAYLOAD_BITS)-i-1] = pbch_a[i];
//decoded_output[(NR_POLAR_PBCH_PAYLOAD_BITS>>3)-i-1] = pbch_a[i];
//#ifdef DEBUG_PBCH
// for (i=0; i<2; i++)
// printf("[PBCH] pbch_a[%d] = %x\n",i,decoded_output[i]);
//#endif
#ifdef DEBUG_PBCH #ifdef DEBUG_PBCH
msg("PBCH CRC %x : %x\n", for (i=0; i<(NR_POLAR_PBCH_PAYLOAD_BITS); i++)
crc16(pbch_a,PBCH_A), printf("unscrambling pbch_a[%d] = %d \n", i,pbch_a[i]);
((uint16_t)pbch_a[PBCH_A>>3]<<8)+pbch_a[(PBCH_A>>3)+1]); for (i=0; i<NR_POLAR_PBCH_PAYLOAD_BITS; i++)
printf("[PBCH] decoder_output[%d] = %x\n",i,decoded_output[i]);
#endif #endif
crc = (crc16(pbch_a,PBCH_A)>>16) ^
(((uint16_t)pbch_a[PBCH_A>>3]<<8)+pbch_a[(PBCH_A>>3)+1]);
if (crc == 0x0000)
return(1);
else if (crc == 0xffff)
return(2);
else if (crc == 0x5555)
return(4);
else
return(-1);
} }
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