ue add nr pbch unscrambling
This commit is contained in:
@@ -95,6 +95,8 @@ int pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
|
||||
|
||||
pbch_decoded = 0;
|
||||
|
||||
printf("pbch_detection nid_cell %d\n",frame_parms->Nid_cell);
|
||||
|
||||
//for (frame_mod4=0; frame_mod4<4; frame_mod4++) {
|
||||
pbch_tx_ant = nr_rx_pbch(ue,
|
||||
&ue->proc.proc_rxtx[0],
|
||||
@@ -265,6 +267,7 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
|
||||
|
||||
nr_gold_pbch(ue);
|
||||
ret = pbch_detection(ue,mode);
|
||||
ret = -1;
|
||||
// write_output("rxdata2.m","rxd2",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
|
||||
|
||||
#ifdef DEBUG_INITIAL_SYNCH
|
||||
|
||||
@@ -394,6 +394,8 @@ void nr_pbch_unscrambling(NR_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t reset;
|
||||
uint32_t x1, x2, s=0;
|
||||
|
||||
printf("unscramb nid_cell %d\n",frame_parms->Nid_cell);
|
||||
|
||||
reset = 1;
|
||||
// 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
|
||||
@@ -402,12 +404,13 @@ void nr_pbch_unscrambling(NR_DL_FRAME_PARMS *frame_parms,
|
||||
for (i=0; i<length; i++) {
|
||||
if (i%32==0) {
|
||||
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;
|
||||
}
|
||||
|
||||
if (((s>>(i%32))&1)==0)
|
||||
pbch_a[i] = -pbch_a[i];
|
||||
printf("s = %d\n",((s>>(i%32))&1) );
|
||||
if (((s>>(i%32))&1)==1)
|
||||
pbch_a[i] = 1-pbch_a[i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,7 +452,7 @@ void nr_pbch_alamouti(NR_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
}
|
||||
|
||||
void nr_pbch_quantize(int16_t *pbch_llr16,
|
||||
void nr_pbch_quantize(int8_t *pbch_llr8,
|
||||
int16_t *pbch_llr,
|
||||
uint16_t len)
|
||||
{
|
||||
@@ -462,7 +465,7 @@ void nr_pbch_quantize(int16_t *pbch_llr16,
|
||||
else if (pbch_llr[i]<-8)
|
||||
pbch_llr8[i]=-8;
|
||||
else*/
|
||||
pbch_llr16[i] = (char)(pbch_llr[i]);
|
||||
pbch_llr8[i] = (char)(pbch_llr[i]);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -487,9 +490,10 @@ uint16_t nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
||||
int max_h=0;
|
||||
|
||||
int symbol,i;
|
||||
uint8_t pbch_a[64];
|
||||
//uint8_t pbch_a[64];
|
||||
uint8_t *pbch_a = malloc(sizeof(uint8_t) * 32); ;
|
||||
|
||||
int16_t *pbch_e_rx;
|
||||
int8_t *pbch_e_rx;
|
||||
uint8_t *decoded_output = nr_ue_pbch_vars->decoded_output;
|
||||
uint16_t crc;
|
||||
//short nr_demod_table[8] = {0,0,0,1,1,0,1,1};
|
||||
@@ -504,6 +508,11 @@ uint16_t nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
||||
memset(&channelOutput[0], 0, sizeof(double) * 864);
|
||||
memset(&estimatedOutput[0], 0, sizeof(uint8_t) * 32);
|
||||
|
||||
memset(&pbch_a[0], 0, sizeof(uint8_t) * 32);
|
||||
frame_parms->Nid_cell = 100;
|
||||
|
||||
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;
|
||||
|
||||
int subframe_rx = proc->subframe_rx;
|
||||
@@ -600,17 +609,20 @@ uint16_t nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
||||
|
||||
|
||||
//polar decoding de-rate matching
|
||||
decoderState = polar_decoder(demod_pbch_e, estimatedOutput, &frame_parms->pbch_polar_params, decoderListSize, aPrioriArray, pathMetricAppr);
|
||||
decoderState = polar_decoder(demod_pbch_e, pbch_a, &frame_parms->pbch_polar_params, decoderListSize, aPrioriArray, pathMetricAppr);
|
||||
|
||||
//memset(pbch_a,0,((16+NR_POLAR_PBCH_PAYLOAD_BITS)>>3));
|
||||
for (i=0; i<32 /*(NR_POLAR_PBCH_PAYLOAD_BITS>>3)*/; i++)
|
||||
printf("pbch_a[%d] = %d \n", i,pbch_a[i]);
|
||||
|
||||
//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
|
||||
for (i=0; i<32 /*(NR_POLAR_PBCH_PAYLOAD_BITS>>3)*/; i++)
|
||||
printf("estimated output[%d] = %d \n", i,estimatedOutput[i]);
|
||||
//for (i=0; i<32 /*(NR_POLAR_PBCH_PAYLOAD_BITS>>3)*/; i++)
|
||||
// printf("estimated output[%d] = %d \n", i,estimatedOutput[i]);
|
||||
//decoded_output[(NR_POLAR_PBCH_PAYLOAD_BITS>>3)-i-1] = pbch_a[i];
|
||||
|
||||
//#ifdef DEBUG_PBCH
|
||||
|
||||
@@ -61,6 +61,8 @@
|
||||
#include "T.h"
|
||||
|
||||
extern double cpuf;
|
||||
static nfapi_config_request_t config_t;
|
||||
static nfapi_config_request_t* config =&config_t;
|
||||
|
||||
#define FRAME_PERIOD 100000000ULL
|
||||
#define DAQ_PERIOD 66667ULL
|
||||
@@ -413,7 +415,7 @@ static void *UE_thread_synch(void *arg) {
|
||||
//UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]);
|
||||
//UE->rfdevice.trx_stop_func(&UE->rfdevice);
|
||||
// sleep(1);
|
||||
nr_init_frame_parms_ue(&UE->frame_parms);
|
||||
nr_init_frame_parms_ue(config,&UE->frame_parms);
|
||||
/*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
|
||||
LOG_E(HW,"Could not start the device\n");
|
||||
oai_exit=1;
|
||||
|
||||
Reference in New Issue
Block a user