Commit 1bd84bf1 authored by Hongzhi Wang's avatar Hongzhi Wang

update nr ue gold to simplified version

parent e7edc37b
...@@ -26,6 +26,7 @@ void nr_gold_pbch(PHY_VARS_NR_UE* ue) ...@@ -26,6 +26,7 @@ void nr_gold_pbch(PHY_VARS_NR_UE* ue)
unsigned int n, x1, x2; unsigned int n, x1, x2;
unsigned int Nid, i_ssb, i_ssb2; unsigned int Nid, i_ssb, i_ssb2;
unsigned char Lmax, l, n_hf, N_hf; unsigned char Lmax, l, n_hf, N_hf;
uint8_t reset;
Nid = ue->frame_parms.Nid_cell; Nid = ue->frame_parms.Nid_cell;
Lmax = ue->frame_parms.Lmax; Lmax = ue->frame_parms.Lmax;
...@@ -37,24 +38,13 @@ void nr_gold_pbch(PHY_VARS_NR_UE* ue) ...@@ -37,24 +38,13 @@ void nr_gold_pbch(PHY_VARS_NR_UE* ue)
i_ssb = l & (Lmax-1); i_ssb = l & (Lmax-1);
i_ssb2 = i_ssb + (n_hf<<2); i_ssb2 = i_ssb + (n_hf<<2);
x1 = 1 + (1<<31); reset = 1;
x2 = (1<<11) * (i_ssb2 + 1) * ((Nid>>2) + 1) + (1<<6) * (i_ssb2 + 1) + (Nid&3); x2 = (1<<11) * (i_ssb2 + 1) * ((Nid>>2) + 1) + (1<<6) * (i_ssb2 + 1) + (Nid&3);
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);
}
for (n=0; n<NR_PBCH_DMRS_LENGTH_DWORD; n++) { for (n=0; n<NR_PBCH_DMRS_LENGTH_DWORD; n++) {
x1 = (x1>>1) ^ (x1>>4); ue->nr_gold_pbch[n_hf][l][n] = lte_gold_generic(&x1, &x2, reset);
x1 = x1 ^ (x1<<31) ^ (x1<<28); reset = 0;
x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4);
x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28);
ue->nr_gold_pbch[n_hf][l][n] = x1 ^ x2;
} }
} }
...@@ -69,6 +59,7 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue, ...@@ -69,6 +59,7 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue,
unsigned char ns,l; unsigned char ns,l;
unsigned int n,x1,x2,x2tmp0; unsigned int n,x1,x2,x2tmp0;
unsigned int nid; unsigned int nid;
uint8_t reset;
if (n_idDMRS) if (n_idDMRS)
nid = n_idDMRS; nid = n_idDMRS;
...@@ -79,27 +70,13 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue, ...@@ -79,27 +70,13 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue,
for (l=0; l<length_dmrs; l++) { for (l=0; l<length_dmrs; l++) {
x2tmp0 = ((14*ns+l+1)*((nid<<1)+1))<<17; reset = 1;
x2tmp0 = ((ue->frame_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17;
x2 = (x2tmp0+(nid<<1))%(1<<31); //cinit x2 = (x2tmp0+(nid<<1))%(1<<31); //cinit
x1 = 1+ (1<<31); for (n=0; n<NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD; n++) {
x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); ue->nr_gold_pdcch[0][ns][l][n] = lte_gold_generic(&x1, &x2, reset);
reset = 0;
// 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<52; 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_pdcch[0][ns][l][n] = x1^x2;
// if (ns==1 && l==0) printf("n=%d : c %x\n",n,x1^x2);
} }
} }
} }
...@@ -112,6 +89,7 @@ void nr_gold_pdsch(PHY_VARS_NR_UE* ue, ...@@ -112,6 +89,7 @@ void nr_gold_pdsch(PHY_VARS_NR_UE* ue,
unsigned int n,x1,x2,x2tmp0; unsigned int n,x1,x2,x2tmp0;
int nscid; int nscid;
unsigned int nid; unsigned int nid;
uint8_t reset;
/// to be updated from higher layer /// to be updated from higher layer
//unsigned short lbar = 0; //unsigned short lbar = 0;
...@@ -126,33 +104,16 @@ void nr_gold_pdsch(PHY_VARS_NR_UE* ue, ...@@ -126,33 +104,16 @@ void nr_gold_pdsch(PHY_VARS_NR_UE* ue,
for (ns=0; ns<ue->frame_parms.slots_per_frame; ns++) { for (ns=0; ns<ue->frame_parms.slots_per_frame; ns++) {
for (l=0; l<14; l++) { for (l=0; l<ue->frame_parms.symbols_per_slot; l++) {
x2tmp0 = ((14*ns+l+1)*((nid<<1)+1))<<17; reset = 1;
x2tmp0 = ((ue->frame_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17;
x2 = (x2tmp0+(nid<<1)+nscid)%(1<<31); //cinit x2 = (x2tmp0+(nid<<1)+nscid)%(1<<31); //cinit
LOG_D(PHY,"UE DMRS slot %d, symb %d, x2 %x, nscid %d\n",ns,l,x2,nscid); 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);
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++) { for (n=0; n<NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD; n++) {
x1 = (x1>>1) ^ (x1>>4); ue->nr_gold_pdsch[0][ns][l][nscid][n] = lte_gold_generic(&x1, &x2, reset);
x1 = x1 ^ (x1<<31) ^ (x1<<28); reset = 0;
x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4);
x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28);
ue->nr_gold_pdsch[0][ns][l][nscid][n] = x1^x2;
// if ((ns==2)&&(l==0))
//printf("n=%d : c %x\n",n,x1^x2);
} }
} }
} }
......
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