Merge remote-tracking branch 'origin/311-encapsulate-lte_gold_generic-functionality' into develop
This commit is contained in:
@@ -1097,6 +1097,7 @@ set(PHY_SRC_COMMON
|
||||
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/prach_common.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pucch_common.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_scrambling.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_gold_generic.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/srs_modulation.c
|
||||
${OPENAIR1_DIR}/PHY/MODULATION/ofdm_mod.c
|
||||
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_time.c
|
||||
|
||||
@@ -44,7 +44,6 @@ N_{ID}^{cell = 0..503
|
||||
|
||||
void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14],uint16_t Nid_cell)
|
||||
{
|
||||
|
||||
unsigned char ns,l,Ncp=1-frame_parms->Ncp;
|
||||
unsigned int n,x1,x2;//,x1tmp,x2tmp;
|
||||
|
||||
@@ -54,7 +53,7 @@ void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14]
|
||||
|
||||
x2 = Ncp +
|
||||
(Nid_cell<<1) +
|
||||
(((1+(Nid_cell<<1))*(1 + (((frame_parms->Ncp==0)?4:3)*l) + (7*(1+ns))))<<10); //cinit
|
||||
(((1+(Nid_cell<<1))*(1 + (((frame_parms->Ncp==0)?4:3)*l) + (7*(1+ns))))<<10); //cinit
|
||||
//x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit
|
||||
//n = 0
|
||||
x1 = 1+ (1<<31);
|
||||
@@ -81,7 +80,7 @@ void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14]
|
||||
}
|
||||
}
|
||||
|
||||
void lte_gold_ue_spec(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_uespec_table[2][20][2][21],uint16_t Nid_cell, uint16_t *n_idDMRS)
|
||||
void lte_gold_ue_spec(uint32_t lte_gold_uespec_table[2][20][2][21],uint16_t Nid_cell, uint16_t *n_idDMRS)
|
||||
{
|
||||
|
||||
unsigned char ns,l;
|
||||
@@ -169,41 +168,6 @@ void lte_gold_ue_spec_port5(uint32_t lte_gold_uespec_port5_table[20][38],uint16_
|
||||
}
|
||||
}
|
||||
|
||||
/*! \brief gold sequenquence generator
|
||||
\param x1
|
||||
\param x2 this should be set to c_init if reset=1
|
||||
\param reset resets the generator
|
||||
\return 32 bits of the gold sequence
|
||||
*/
|
||||
unsigned int lte_gold_generic(unsigned int *x1, unsigned int *x2, unsigned char reset)
|
||||
{
|
||||
int n;
|
||||
|
||||
if (reset) {
|
||||
*x1 = 1+ (1<<31);
|
||||
*x2=*x2 ^ ((*x2 ^ (*x2>>1) ^ (*x2>>2) ^ (*x2>>3))<<31);
|
||||
|
||||
// skip first 50 double words (1600 bits)
|
||||
// printf("n=0 : x1 %x, x2 %x\n",x1,x2);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
*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);
|
||||
return(*x1^*x2);
|
||||
// printf("n=%d : c %x\n",n,x1^x2);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef LTE_GOLD_MAIN
|
||||
main()
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
\param reset resets the generator
|
||||
\return 32 bits of the gold sequence
|
||||
*/
|
||||
unsigned int lte_gold_generic(unsigned int *x1, unsigned int *x2, unsigned char reset);
|
||||
uint32_t lte_gold_generic(uint32_t *x1, uint32_t *x2, uint8_t reset);
|
||||
|
||||
|
||||
/*!\brief This function generates the LTE Gold sequence (36-211, Sec 7.2), specifically for DL reference signals.
|
||||
@@ -45,8 +45,7 @@ unsigned int lte_gold_generic(unsigned int *x1, unsigned int *x2, unsigned char
|
||||
@param Nid_cell Cell Id (to compute sequences for local and adjacent cells) */
|
||||
|
||||
void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14],uint16_t Nid_cell);
|
||||
|
||||
void lte_gold_ue_spec(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_uespec_table[2][20][2][21],uint16_t Nid_cell, uint16_t *n_idDMRS);
|
||||
void lte_gold_ue_spec(uint32_t lte_gold_uespec_table[2][20][2][21],uint16_t Nid_cell, uint16_t *n_idDMRS);
|
||||
|
||||
void lte_gold_ue_spec_port5(uint32_t lte_gold_uespec_port5_table[20][38],uint16_t Nid_cell, uint16_t n_rnti);
|
||||
|
||||
|
||||
@@ -34,47 +34,20 @@
|
||||
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
#include "PHY/CODING/coding_extern.h"
|
||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||
#include "transport_eNB.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
|
||||
static inline unsigned int lte_gold_scram(unsigned int *x1, unsigned int *x2, unsigned char reset) __attribute__((always_inline));
|
||||
static inline unsigned int lte_gold_scram(unsigned int *x1, unsigned int *x2, unsigned char reset)
|
||||
{
|
||||
int n;
|
||||
|
||||
if (reset) {
|
||||
*x1 = 1+ (1<<31);
|
||||
*x2=*x2 ^ ((*x2 ^ (*x2>>1) ^ (*x2>>2) ^ (*x2>>3))<<31);
|
||||
|
||||
// skip first 50 double words (1600 bits)
|
||||
// printf("n=0 : x1 %x, x2 %x\n",x1,x2);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
*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);
|
||||
return(*x1^*x2);
|
||||
// printf("n=%d : c %x\n",n,x1^x2);
|
||||
|
||||
}
|
||||
|
||||
void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
int mbsfn_flag,
|
||||
LTE_eNB_DLSCH_t *dlsch,
|
||||
int harq_pid,
|
||||
int harq_pid,
|
||||
int G,
|
||||
uint8_t q,
|
||||
uint16_t frame,
|
||||
uint16_t frame,
|
||||
uint8_t Ns)
|
||||
{
|
||||
|
||||
@@ -148,7 +121,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
printf("scrambling: rnti %x, q %d, Ns %d, Nid_cell %d, G %d x2 %x\n",dlsch->rnti,q,Ns,frame_parms->Nid_cell, G, x2);
|
||||
#endif
|
||||
#endif
|
||||
s = lte_gold_scram(&x1, &x2, 1);
|
||||
s = lte_gold_generic(&x1, &x2, 1);
|
||||
|
||||
for (n=0; n<(1+(G>>5)); n++) {
|
||||
|
||||
@@ -197,7 +170,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
|
||||
|
||||
s = lte_gold_scram(&x1, &x2, 0);
|
||||
s = lte_gold_generic(&x1, &x2, 0);
|
||||
e += 32;
|
||||
}
|
||||
|
||||
@@ -243,7 +216,7 @@ void dlsch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
#ifdef DEBUG_SCRAMBLING
|
||||
printf("unscrambling: rnti %x, q %d, Ns %d, Nid_cell %d G %d, x2 %x\n",dlsch->rnti,q,Ns,frame_parms->Nid_cell,G,x2);
|
||||
#endif
|
||||
s = lte_gold_scram(&x1, &x2, 1);
|
||||
s = lte_gold_generic(&x1, &x2, 1);
|
||||
|
||||
for (i=0; i<(1+(G>>5)); i++) {
|
||||
for (j=0; j<32; j++,k++) {
|
||||
@@ -256,7 +229,7 @@ void dlsch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
#endif
|
||||
}
|
||||
|
||||
s = lte_gold_scram(&x1, &x2, 0);
|
||||
s = lte_gold_generic(&x1, &x2, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include "PHY/types.h"
|
||||
|
||||
/**
|
||||
\brief Gold Sequence Generation defined in 3x.211
|
||||
\param x1 x1 shift register
|
||||
\param x2 x2 shift register / cinit if reset is set
|
||||
\param reset Reset flag / reinitialize the generator
|
||||
\return c 32 bits of gold output
|
||||
*/
|
||||
extern inline uint32_t lte_gold_generic(uint32_t *x1, uint32_t *x2, uint8_t reset)
|
||||
{
|
||||
int32_t n;
|
||||
|
||||
// 3GPP 3x.211
|
||||
// Nc = 1600
|
||||
// c(n) = [x1(n+Nc) + x2(n+Nc)]mod2
|
||||
// x1(n+31) = [x1(n+3) + x1(n)]mod2
|
||||
// x2(n+31) = [x2(n+3) + x2(n+2) + x2(n+1) + x2(n)]mod2
|
||||
if (reset)
|
||||
{
|
||||
// Init value for x1: x1(0) = 1, x1(n) = 0, n=1,2,...,30
|
||||
// x1(31) = [x1(3) + x1(0)]mod2 = 1
|
||||
*x1 = 1 + (1<<31);
|
||||
// Init value for x2: cinit = sum_{i=0}^30 x2*2^i
|
||||
// x2(31) = [x2(3) + x2(2) + x2(1) + x2(0)]mod2
|
||||
// = (*x2>>3) ^ (*x2>>2) + (*x2>>1) + *x2
|
||||
*x2 = *x2 ^ ((*x2 ^ (*x2>>1) ^ (*x2>>2) ^ (*x2>>3))<<31);
|
||||
|
||||
// x1 and x2 contain bits n = 0,1,...,31
|
||||
|
||||
// Nc = 1600 bits are skipped at the beginning
|
||||
// i.e., 1600 / 32 = 50 32bit words
|
||||
|
||||
for (n = 1; n < 50; n++)
|
||||
{
|
||||
// Compute x1(0),...,x1(27)
|
||||
*x1 = (*x1>>1) ^ (*x1>>4);
|
||||
// Compute x1(28),..,x1(31) and xor
|
||||
*x1 = *x1 ^ (*x1<<31) ^ (*x1<<28);
|
||||
// Compute x2(0),...,x2(27)
|
||||
*x2 = (*x2>>1) ^ (*x2>>2) ^ (*x2>>3) ^ (*x2>>4);
|
||||
// Compute x2(28),..,x2(31) and xor
|
||||
*x2 = *x2 ^ (*x2<<31) ^ (*x2<<30) ^ (*x2<<29) ^ (*x2<<28);
|
||||
}
|
||||
}
|
||||
|
||||
*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);
|
||||
|
||||
// c(n) = [x1(n+Nc) + x2(n+Nc)]mod2
|
||||
return(*x1^*x2);
|
||||
}
|
||||
@@ -72,13 +72,11 @@
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include "targets/ARCH/COMMON/common_lib.h"
|
||||
#include "targets/COMMON/openairinterface5g_limits.h"
|
||||
|
||||
#include "types.h"
|
||||
#include "nfapi_interface.h"
|
||||
//#include "defs.h"
|
||||
#include "openair2/COMMON/platform_types.h"
|
||||
|
||||
#define RX_NB_TH_MAX 2
|
||||
#define RX_NB_TH 2
|
||||
|
||||
Reference in New Issue
Block a user