Commit 556346dd authored by knopp's avatar knopp

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5351 818b1a75-f10b-46b9-bf7c-635c3b92a50f

parent a897eada
...@@ -6,7 +6,7 @@ CPUFLAGS = -mmmx -msse -msse2 -mssse3 -msse4 ...@@ -6,7 +6,7 @@ CPUFLAGS = -mmmx -msse -msse2 -mssse3 -msse4
#CPUFLAGS += $(shell if [ -z $(SSE3PROC)]; then echo "" ; else echo "-mssse3"; fi) #CPUFLAGS += $(shell if [ -z $(SSE3PROC)]; then echo "" ; else echo "-mssse3"; fi)
#CPUFLAGS += $(shell if [ -z $(SSE4PROC)]; then echo "" ; else echo "-msse4"; fi) #CPUFLAGS += $(shell if [ -z $(SSE4PROC)]; then echo "" ; else echo "-msse4"; fi)
COMMON_UTILS_DIR = $(OPENAIR_HOME)/common/utils
TOP_DIR = $(OPENAIR1_DIR) TOP_DIR = $(OPENAIR1_DIR)
OPENAIR1_TOP = $(OPENAIR1_DIR) OPENAIR1_TOP = $(OPENAIR1_DIR)
OPENAIR2_TOP = $(OPENAIR2_DIR) OPENAIR2_TOP = $(OPENAIR2_DIR)
...@@ -40,6 +40,7 @@ ifeq "$(GCCVERSION)" "4.6.1" ...@@ -40,6 +40,7 @@ ifeq "$(GCCVERSION)" "4.6.1"
CFLAGS += -Wno-packed-bitfield-compat CFLAGS += -Wno-packed-bitfield-compat
endif endif
include $(COMMON_UTILS_DIR)/Makefile.inc
include $(TOP_DIR)/PHY/Makefile.inc include $(TOP_DIR)/PHY/Makefile.inc
#include $(TOP_DIR)/SCHED/Makefile.inc #include $(TOP_DIR)/SCHED/Makefile.inc
SCHED_OBJS = $(TOP_DIR)/SCHED/phy_procedures_lte_common.o SCHED_OBJS = $(TOP_DIR)/SCHED/phy_procedures_lte_common.o
...@@ -53,7 +54,7 @@ LAYER2_OBJ = $(OPENAIR2_DIR)/LAYER2/MAC/lte_transport_init.o ...@@ -53,7 +54,7 @@ LAYER2_OBJ = $(OPENAIR2_DIR)/LAYER2/MAC/lte_transport_init.o
OBJ = $(PHY_OBJS) $(SIMULATION_OBJS) $(TOOLS_OBJS) $(SCHED_OBJS) $(LAYER2_OBJ) $(LOG_OBJS) #$(ASN1_MSG_OBJS) OBJ = $(PHY_OBJS) $(SIMULATION_OBJS) $(TOOLS_OBJS) $(SCHED_OBJS) $(LAYER2_OBJ) $(LOG_OBJS) #$(ASN1_MSG_OBJS)
CFLAGS += -I$(TOP_DIR) $(L2_incl) -I$(ASN1_MSG_INC) -I$(OPENAIR3) $(UTIL_incl) CFLAGS += -I$(TOP_DIR) $(L2_incl) -I$(ASN1_MSG_INC) -I$(OPENAIR3) $(UTIL_incl) $(UTILS_incl)
CFLAGS += -DNO_RRM CFLAGS += -DNO_RRM
all: ltetest all: ltetest
......
...@@ -143,8 +143,6 @@ char quantize(double D,double x,unsigned char B) { ...@@ -143,8 +143,6 @@ char quantize(double D,double x,unsigned char B) {
} }
#define MAX_BLOCK_LENGTH 6000 #define MAX_BLOCK_LENGTH 6000
static char channel_output[2*MAX_BLOCK_LENGTH]__attribute__ ((aligned(16)));
static unsigned char decoded_output[MAX_BLOCK_LENGTH/8];
int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB, int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB,
LTE_UE_DLSCH_t *dlsch_ue, LTE_UE_DLSCH_t *dlsch_ue,
...@@ -163,8 +161,6 @@ int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB, ...@@ -163,8 +161,6 @@ int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB,
unsigned int subframe) { unsigned int subframe) {
unsigned char test_input[block_length+1]; unsigned char test_input[block_length+1];
//_declspec(align(16)) char channel_output[512];
//_declspec(align(16)) unsigned char output[512],decoded_output[16], *inPtr, *outPtr;
short *channel_output; short *channel_output;
...@@ -186,7 +182,7 @@ int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB, ...@@ -186,7 +182,7 @@ int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB,
// printf("dlsch_eNB->TBS= %d\n",dlsch_eNB->harq_processes[0]->TBS); // printf("dlsch_eNB->TBS= %d, block_length %d\n",dlsch_eNB->harq_processes[0]->TBS,block_length);
while (trial++ < ntrials) { while (trial++ < ntrials) {
...@@ -201,6 +197,7 @@ int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB, ...@@ -201,6 +197,7 @@ int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB,
&PHY_vars_eNB->lte_frame_parms, &PHY_vars_eNB->lte_frame_parms,
num_pdcch_symbols, num_pdcch_symbols,
PHY_vars_eNB->dlsch_eNB[0][0], PHY_vars_eNB->dlsch_eNB[0][0],
0,
subframe, subframe,
&PHY_vars_eNB->dlsch_rate_matching_stats, &PHY_vars_eNB->dlsch_rate_matching_stats,
&PHY_vars_eNB->dlsch_turbo_encoding_stats, &PHY_vars_eNB->dlsch_turbo_encoding_stats,
...@@ -216,6 +213,8 @@ int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB, ...@@ -216,6 +213,8 @@ int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB,
printf("%d.",PHY_vars_eNB->dlsch_eNB[0][0]->e[i]); printf("%d.",PHY_vars_eNB->dlsch_eNB[0][0]->e[i]);
#endif #endif
channel_output[i] = (short)quantize(sigma/4.0,(2.0*PHY_vars_eNB->dlsch_eNB[0][0]->e[i]) - 1.0 + sigma*gaussdouble(0.0,1.0),qbits); channel_output[i] = (short)quantize(sigma/4.0,(2.0*PHY_vars_eNB->dlsch_eNB[0][0]->e[i]) - 1.0 + sigma*gaussdouble(0.0,1.0),qbits);
// printf("input %d, output %f\n",(2*PHY_vars_eNB->dlsch_eNB[0][0]->e[i]) - 1,
// (2.0*PHY_vars_eNB->dlsch_eNB[0][0]->e[i]) - 1.0 + sigma*gaussdouble(0.0,1.0));
} }
#ifdef DEBUG_CODER #ifdef DEBUG_CODER
printf("\n"); printf("\n");
...@@ -223,13 +222,15 @@ int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB, ...@@ -223,13 +222,15 @@ int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB,
#endif #endif
// memset(decoded_output,0,16);
// printf("decoding %d\n",trial); PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->G = coded_bits;
ret = dlsch_decoding(PHY_vars_UE, ret = dlsch_decoding(PHY_vars_UE,
channel_output, channel_output,
&PHY_vars_UE->lte_frame_parms, &PHY_vars_UE->lte_frame_parms,
PHY_vars_UE->dlsch_ue[0][0], PHY_vars_UE->dlsch_ue[0][0],
PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid],
subframe, subframe,
PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid,
num_pdcch_symbols,1); num_pdcch_symbols,1);
/* int diffs = 0,puncts=0; /* int diffs = 0,puncts=0;
...@@ -246,15 +247,15 @@ int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB, ...@@ -246,15 +247,15 @@ int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB,
printf("%d same (%d,%d)\n",i,dlsch_ue->harq_processes[0]->d[0][96+i],dlsch_eNb->harq_processes[0]->d[0][96+i]); printf("%d same (%d,%d)\n",i,dlsch_ue->harq_processes[0]->d[0][96+i],dlsch_eNb->harq_processes[0]->d[0][96+i]);
} }
printf("diffs %d puncts %d(%d,%d,%d,%d,%d)\n",diffs,puncts,dlsch_ue->harq_processes[0]->F,coded_bits,3*(block_length<<3),3*dlsch_ue->harq_processes[0]->Kplus,3*dlsch_ue->harq_processes[0]->F+3*(block_length<<3)-coded_bits); printf("diffs %d puncts %d(%d,%d,%d,%d,%d)\n",diffs,puncts,dlsch_ue->harq_processes[0]->F,coded_bits,3*(block_length<<3),3*dlsch_ue->harq_processes[0]->Kplus,3*dlsch_ue->harq_processes[0]->F+3*(block_length<<3)-coded_bits);
*/
// printf("ret %d\n",ret);
// printf("trial %d : i %d/%d : Input %x, Output %x (%x, F %d)\n",trial,0,block_length,test_input[0],
// dlsch_ue->harq_processes[0]->b[0],
// dlsch_ue->harq_processes[0]->c[0][0],
// (dlsch_ue->harq_processes[0]->F>>3));
if (ret < MAX_TURBO_ITERATIONS+1) {
printf("ret %d (max %d)\n",ret,dlsch_ue->max_turbo_iterations);
printf("trial %d : i %d/%d : Input %x, Output %x (%x, F %d)\n",trial,0,block_length,test_input[0],
dlsch_ue->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->b[0],
dlsch_ue->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->c[0][0],
(dlsch_ue->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->F>>3));
*/
if (ret < dlsch_ue->max_turbo_iterations+1) {
*iterations = (*iterations) + ret; *iterations = (*iterations) + ret;
// if (ret>1) // if (ret>1)
// printf("ret %d\n",ret); // printf("ret %d\n",ret);
...@@ -267,20 +268,21 @@ int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB, ...@@ -267,20 +268,21 @@ int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB,
for (i=0;i<block_length;i++) { for (i=0;i<block_length;i++) {
if (dlsch_ue->harq_processes[0]->b[i] != test_input[i]) { if (dlsch_ue->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->c[0][i] != test_input[i]) {
/* /*
printf("i %d/%d : Input %x, Output %x (%x, F %d)\n",i,block_length,test_input[i], printf("i %d/%d : Input %x, Output %x (%x, F %d)\n",i,block_length,test_input[i],
dlsch_ue->harq_processes[0]->b[i], dlsch_ue->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->b[i],
dlsch_ue->harq_processes[0]->c[0][i], dlsch_ue->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->c[0][i],
(dlsch_ue->harq_processes[0]->F>>3)); (dlsch_ue->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->F>>3));
*/ */
*errors = (*errors) + 1; *errors = (*errors) + 1;
// printf("*%d, ret %d\n",*errors,ret); // printf("*%d, ret %d\n",*errors,ret);
if (ret < MAX_TURBO_ITERATIONS+1) if (ret < dlsch_ue->max_turbo_iterations+1)
*crc_misses = (*crc_misses)+1; *crc_misses = (*crc_misses)+1;
break; break;
} }
...@@ -288,10 +290,12 @@ int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB, ...@@ -288,10 +290,12 @@ int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB,
} }
if (ret == MAX_TURBO_ITERATIONS+1) { if (ret == dlsch_ue->max_turbo_iterations+1) {
// exit(-1); // exit(-1);
} }
/* /*
else {
for (i=0;i<block_length;i++) { for (i=0;i<block_length;i++) {
if (dlsch_ue->harq_processes[0]->b[i] != test_input[i]) { if (dlsch_ue->harq_processes[0]->b[i] != test_input[i]) {
...@@ -303,10 +307,10 @@ int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB, ...@@ -303,10 +307,10 @@ int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB,
} }
} }
} }*/
*/
if (*errors == 100) { if (*errors == 100) {
//printf("\n"); printf("trials %d\n",trial);
break; break;
} }
} }
...@@ -316,7 +320,7 @@ int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB, ...@@ -316,7 +320,7 @@ int test_logmap8(LTE_eNB_DLSCH_t *dlsch_eNB,
return(0); return(0);
} }
#define NTRIALS 1000 #define NTRIALS 10000
#define DLSCH_RB_ALLOC 0x1fff//0x1fbf // igore DC component,RB13 #define DLSCH_RB_ALLOC 0x1fff//0x1fbf // igore DC component,RB13
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
...@@ -340,10 +344,10 @@ int main(int argc, char *argv[]) { ...@@ -340,10 +344,10 @@ int main(int argc, char *argv[]) {
logInit(); logInit();
lte_param_init(1,1,1,0,0,3); lte_param_init(1,1,1,0,0,3);
PHY_vars_eNB->dlsch_eNB[0][0] = new_eNB_dlsch(1,8,0); PHY_vars_eNB->dlsch_eNB[0][0] = new_eNB_dlsch(1,8,NB_RB,0);
PHY_vars_UE->dlsch_ue[0][0] = new_ue_dlsch(1,8,0); PHY_vars_UE->dlsch_ue[0][0] = new_ue_dlsch(1,8,4,NB_RB,0);
PHY_vars_eNB->dlsch_eNB[0][1] = new_eNB_dlsch(1,8,0); PHY_vars_eNB->dlsch_eNB[0][1] = new_eNB_dlsch(1,8,NB_RB,0);
PHY_vars_UE->dlsch_ue[0][1] = new_ue_dlsch(1,8,0); PHY_vars_UE->dlsch_ue[0][1] = new_ue_dlsch(1,8,4,NB_RB,0);
if (argc>1) if (argc>1)
mcs = atoi(argv[1]); mcs = atoi(argv[1]);
...@@ -390,8 +394,14 @@ int main(int argc, char *argv[]) { ...@@ -390,8 +394,14 @@ int main(int argc, char *argv[]) {
0, 0,
P_RNTI); P_RNTI);
coded_bits = get_G(&PHY_vars_eNB->lte_frame_parms,NB_RB,PHY_vars_eNB->dlsch_eNB[0][0]->rb_alloc, coded_bits = get_G(&PHY_vars_eNB->lte_frame_parms,
get_Qm(mcs),num_pdcch_symbols,subframe); PHY_vars_eNB->dlsch_eNB[0][0]->nb_rb,
PHY_vars_eNB->dlsch_eNB[0][0]->rb_alloc,
get_Qm(mcs),
1,
num_pdcch_symbols,
0,
subframe);
printf("Coded_bits (G) = %d\n",coded_bits); printf("Coded_bits (G) = %d\n",coded_bits);
...@@ -400,22 +410,13 @@ int main(int argc, char *argv[]) { ...@@ -400,22 +410,13 @@ int main(int argc, char *argv[]) {
dlsch_tbs25[get_I_TBS(mcs)][NB_RB-1],(double)dlsch_tbs25[get_I_TBS(mcs)][NB_RB-1]/coded_bits, dlsch_tbs25[get_I_TBS(mcs)][NB_RB-1],(double)dlsch_tbs25[get_I_TBS(mcs)][NB_RB-1]/coded_bits,
mcs,get_I_TBS(mcs),PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->F,NB_RB); mcs,get_I_TBS(mcs),PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->F,NB_RB);
// Test Openair0 3GPP encoder
/*
test_encoder(block_length,
f1f2mat[(block_length-5)*2], // f1 (see 36121-820, page 14)
f1f2mat[((block_length-5)*2)+1], // f2 (see 36121-820, page 14)
3);
*/ // exit(0);
for (SNR=-5;SNR<5;SNR+=.1) { for (SNR=-5;SNR<5;SNR+=.1) {
// printf("\n\nSNR %f dB\n",SNR);
sigma = pow(10.0,-.05*SNR); sigma = pow(10.0,-.05*SNR);
printf("\n\nSNR %f dB => sigma %f\n",SNR,sigma);
errors=0; errors=0;
crc_misses=0; crc_misses=0;
...@@ -445,49 +446,11 @@ int main(int argc, char *argv[]) { ...@@ -445,49 +446,11 @@ int main(int argc, char *argv[]) {
subframe); subframe);
if (ret>=0) if (ret>=0)
// printf("ref: Errors %d (%f), Uerrors %d (%f), CRC Misses %d (%f), Avg iterations %f\n",errors,(double)errors/trials,uerrors,(double)uerrors/trials,crc_misses,(double)crc_misses/trials,(double)iterations/trials);
printf("%f,%f,%f,%f\n",SNR,(double)errors/trials,(double)crc_misses/trials,(double)iterations/trials); printf("%f,%f,%f,%f\n",SNR,(double)errors/trials,(double)crc_misses/trials,(double)iterations/trials);
if (((double)errors/trials) < 1e-2) if (((double)errors/trials) < 1e-2)
done0=1; done0=1;
} }
/*
if (done1 == 0) {
printf("exmimo\n");
ret = test_logmapexmimo(rate, // code rate
sigma, // noise standard deviation
qbits,
block_length, // block length bytes
f1f2mat[iind*2], // f1 (see 36121-820, page 14)
f1f2mat[(iind*2)+1], // f2 (see 36121-820, page 14)
3,
NTRIALS,
&errors3,
&trials3);
if (ret>=0)
printf("exmimo : Errors %d (%f)\n",errors3,(double)errors3/trials3);
if (((double)errors3/trials3) < 1e-3)
done1=1;
}
if (done2 == 0) {
printf("Viterbi ...\n");
ret2 = test_viterbi(sigma,
8*block_length,
NTRIALS,
&errors2,
&trials2,
rate);
if (ret2>=0)
printf("viterbi : Errors %d (%f)\n",errors2,(double)errors2/trials2);
if (((double)errors2/trials2) < 1e-3)
done2=1;
}
*/
if ((done0==1) && (done1==1) && (done2==1)) { if ((done0==1) && (done1==1) && (done2==1)) {
printf("done\n"); printf("done\n");
break; break;
......
...@@ -691,8 +691,7 @@ int lte_rate_matching_turbo_rx(uint32_t RTC, ...@@ -691,8 +691,7 @@ int lte_rate_matching_turbo_rx(uint32_t RTC,
if (clear==1) if (clear==1)
memset(w,0,Ncb*sizeof(int16_t)); memset(w,0,Ncb*sizeof(int16_t));
//soft_input2 = soft_input + (r*E); soft_input2 = soft_input;// + (r*E);
soft_input2 = soft_input; // navid
k=0; k=0;
for (;(ind<Ncb)&&(k<E);ind++) { for (;(ind<Ncb)&&(k<E);ind++) {
...@@ -719,7 +718,7 @@ int lte_rate_matching_turbo_rx(uint32_t RTC, ...@@ -719,7 +718,7 @@ int lte_rate_matching_turbo_rx(uint32_t RTC,
else { else {
printf("RM_RX Ind: %d NULL %d\n",ind,nulled); printf("RM_RX Ind: %d NULL %d\n",ind,nulled);
nulled++; nulled++;
} }
#endif #endif
} }
} }
......
...@@ -24,6 +24,13 @@ unsigned int lte_gold_generic(unsigned int *x1, unsigned int *x2, unsigned char ...@@ -24,6 +24,13 @@ unsigned int lte_gold_generic(unsigned int *x1, unsigned int *x2, unsigned char
void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14],uint16_t Nid_cell); void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14],uint16_t Nid_cell);
/*!\brief This function generates the LTE Gold sequence (36-211, Sec 7.2), specifically for DL UE-specific reference signals for antenna ports 7..14.
@param frame_parms LTE DL Frame parameters
@param lte_gold_uespec_table pointer to table where sequences are stored
@param Nid_cell Cell Id (to compute sequences for local and adjacent cells)
@param n_idDMRS Scrambling identity for TM10*/
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_mbsfn(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_mbsfn_table[10][3][42],uint16_t Nid_MBSFN); void lte_gold_mbsfn(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_mbsfn_table[10][3][42],uint16_t Nid_MBSFN);
...@@ -44,6 +51,22 @@ int lte_dl_cell_spec(PHY_VARS_eNB *phy_vars_eNB, ...@@ -44,6 +51,22 @@ int lte_dl_cell_spec(PHY_VARS_eNB *phy_vars_eNB,
unsigned char l, unsigned char l,
unsigned char p); unsigned char p);
/*! \brief This function generates the UE-specific reference signal sequence (36-211, Sec 6.10.3.2)
@param phy_vars_eNB Pointer to eNB variables
@param output Output vector for OFDM symbol (Frequency Domain)
@param amp Q15 amplitude
@param Ns Slot number (0..19)
@param p antenna index
@param SS_flag Flag to indicate special subframe
*/
int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB,
uint8_t UE_id,
mod_sym_t *output,
short amp,
uint8_t Ns,
uint8_t p,
int SS_flag );
/*! \brief This function generates the MBSFN reference signal sequence (36-211, Sec 6.10.1.2) /*! \brief This function generates the MBSFN reference signal sequence (36-211, Sec 6.10.1.2)
@param phy_vars_eNB Pointer to eNB variables @param phy_vars_eNB Pointer to eNB variables
@param output Output vector for OFDM symbol (Frequency Domain) @param output Output vector for OFDM symbol (Frequency Domain)
......
...@@ -23,36 +23,16 @@ int lte_dl_cell_spec_SS(PHY_VARS_eNB *phy_vars_eNB, ...@@ -23,36 +23,16 @@ int lte_dl_cell_spec_SS(PHY_VARS_eNB *phy_vars_eNB,
unsigned short k,a; unsigned short k,a;
mod_sym_t qpsk[4]; mod_sym_t qpsk[4];
#ifdef IFFT_FPGA
// new mod table
qpsk[0] = 1;
qpsk[1] = 3;
qpsk[2] = 2;
qpsk[3] = 4;
/* old mod table
qpsk[0] = 4;
qpsk[1] = 2;
qpsk[2] = 3;
qpsk[3] = 1;
*/
#else
a = (amp*ONE_OVER_SQRT2_Q15)>>15; a = (amp*ONE_OVER_SQRT2_Q15)>>15;
((short *)&qpsk[0])[0] = a; ((short *)&qpsk[0])[0] = a;
((short *)&qpsk[0])[1] = a; ((short *)&qpsk[0])[1] = a;
// new mod table
((short *)&qpsk[1])[0] = -a; ((short *)&qpsk[1])[0] = -a;
((short *)&qpsk[1])[1] = a; ((short *)&qpsk[1])[1] = a;
((short *)&qpsk[2])[0] = a; ((short *)&qpsk[2])[0] = a;
((short *)&qpsk[2])[1] = -a; ((short *)&qpsk[2])[1] = -a;
/* old mod table
((short *)&qpsk[1])[0] = a;
((short *)&qpsk[1])[1] = -a;
((short *)&qpsk[2])[0] = -a;
((short *)&qpsk[2])[1] = a;
*/
((short *)&qpsk[3])[0] = -a; ((short *)&qpsk[3])[0] = -a;
((short *)&qpsk[3])[1] = -a; ((short *)&qpsk[3])[1] = -a;
#endif
if ((p==0) && (l==0) ) if ((p==0) && (l==0) )
nu = 0; nu = 0;
...@@ -73,12 +53,9 @@ int lte_dl_cell_spec_SS(PHY_VARS_eNB *phy_vars_eNB, ...@@ -73,12 +53,9 @@ int lte_dl_cell_spec_SS(PHY_VARS_eNB *phy_vars_eNB,
if (k > 6)//b if (k > 6)//b
k -=6;//b k -=6;//b
#ifdef IFFT_FPGA
k+=phy_vars_eNB->lte_frame_parms.N_RB_DL*6;
#else
k+=phy_vars_eNB->lte_frame_parms.first_carrier_offset; k+=phy_vars_eNB->lte_frame_parms.first_carrier_offset;
#endif
for (m=0;m<phy_vars_eNB->lte_frame_parms.N_RB_DL<<1;m++) { for (m=0;m<phy_vars_eNB->lte_frame_parms.N_RB_DL<<1;m++) { // loop over pilots in one slot/symbol, 2*N_RB_DL pilots
mprime_dword = mprime>>4; mprime_dword = mprime>>4;
mprime_qpsk_symb = mprime&0xf; mprime_qpsk_symb = mprime&0xf;
...@@ -98,16 +75,10 @@ int lte_dl_cell_spec_SS(PHY_VARS_eNB *phy_vars_eNB, ...@@ -98,16 +75,10 @@ int lte_dl_cell_spec_SS(PHY_VARS_eNB *phy_vars_eNB,
printf("Ns %d, l %d output[%d] = (%d,%d)\n",Ns,l,k,((short *)&output[k])[0],((short *)&output[k])[1]); printf("Ns %d, l %d output[%d] = (%d,%d)\n",Ns,l,k,((short *)&output[k])[0],((short *)&output[k])[1]);
#endif #endif
k+=6;//b k+=6;//b
#ifdef IFFT_FPGA
if (k >= phy_vars_eNB->lte_frame_parms.N_RB_DL*12) {
k-=phy_vars_eNB->lte_frame_parms.N_RB_DL*12;
}
#else
if (k >= phy_vars_eNB->lte_frame_parms.ofdm_symbol_size) { if (k >= phy_vars_eNB->lte_frame_parms.ofdm_symbol_size) {
k++; // skip DC carrier k++; // skip DC carrier
k-=phy_vars_eNB->lte_frame_parms.ofdm_symbol_size; k-=phy_vars_eNB->lte_frame_parms.ofdm_symbol_size;
} }
#endif
// printf("** k %d\n",k); // printf("** k %d\n",k);
} }
return(0); return(0);
...@@ -125,36 +96,15 @@ int lte_dl_cell_spec(PHY_VARS_eNB *phy_vars_eNB, ...@@ -125,36 +96,15 @@ int lte_dl_cell_spec(PHY_VARS_eNB *phy_vars_eNB,
unsigned short k,a; unsigned short k,a;
mod_sym_t qpsk[4]; mod_sym_t qpsk[4];
#ifdef IFFT_FPGA
// new mod table
qpsk[0] = 1;
qpsk[1] = 3;
qpsk[2] = 2;
qpsk[3] = 4;
/* old mod table
qpsk[0] = 4;
qpsk[1] = 2;
qpsk[2] = 3;
qpsk[3] = 1;
*/
#else
a = (amp*ONE_OVER_SQRT2_Q15)>>15; a = (amp*ONE_OVER_SQRT2_Q15)>>15;
((short *)&qpsk[0])[0] = a; ((short *)&qpsk[0])[0] = a;
((short *)&qpsk[0])[1] = a; ((short *)&qpsk[0])[1] = a;
// new mod table
((short *)&qpsk[1])[0] = -a; ((short *)&qpsk[1])[0] = -a;
((short *)&qpsk[1])[1] = a; ((short *)&qpsk[1])[1] = a;
((short *)&qpsk[2])[0] = a; ((short *)&qpsk[2])[0] = a;
((short *)&qpsk[2])[1] = -a; ((short *)&qpsk[2])[1] = -a;
/* old mod table
((short *)&qpsk[1])[0] = a;
((short *)&qpsk[1])[1] = -a;
((short *)&qpsk[2])[0] = -a;
((short *)&qpsk[2])[1] = a;
*/
((short *)&qpsk[3])[0] = -a; ((short *)&qpsk[3])[0] = -a;
((short *)&qpsk[3])[1] = -a; ((short *)&qpsk[3])[1] = -a;
#endif
if ((p==0) && (l==0) ) if ((p==0) && (l==0) )
nu = 0; nu = 0;
...@@ -175,11 +125,8 @@ int lte_dl_cell_spec(PHY_VARS_eNB *phy_vars_eNB, ...@@ -175,11 +125,8 @@ int lte_dl_cell_spec(PHY_VARS_eNB *phy_vars_eNB,
if (k > 5) if (k > 5)
k -=6; k -=6;
#ifdef IFFT_FPGA
k+=phy_vars_eNB->lte_frame_parms.N_RB_DL*6;
#else
k+=phy_vars_eNB->lte_frame_parms.first_carrier_offset; k+=phy_vars_eNB->lte_frame_parms.first_carrier_offset;
#endif
for (m=0;m<phy_vars_eNB->lte_frame_parms.N_RB_DL<<1;m++) { for (m=0;m<phy_vars_eNB->lte_frame_parms.N_RB_DL<<1;m++) {
mprime_dword = mprime>>4; mprime_dword = mprime>>4;
...@@ -200,16 +147,11 @@ int lte_dl_cell_spec(PHY_VARS_eNB *phy_vars_eNB, ...@@ -200,16 +147,11 @@ int lte_dl_cell_spec(PHY_VARS_eNB *phy_vars_eNB,
printf("Ns %d, l %d output[%d] = (%d,%d)\n",Ns,l,k,((short *)&output[k])[0],((short *)&output[k])[1]); printf("Ns %d, l %d output[%d] = (%d,%d)\n",Ns,l,k,((short *)&output[k])[0],((short *)&output[k])[1]);
#endif #endif
k+=6; k+=6;
#ifdef IFFT_FPGA
if (k >= phy_vars_eNB->lte_frame_parms.N_RB_DL*12) {
k-=phy_vars_eNB->lte_frame_parms.N_RB_DL*12;
}
#else
if (k >= phy_vars_eNB->lte_frame_parms.ofdm_symbol_size) { if (k >= phy_vars_eNB->lte_frame_parms.ofdm_symbol_size) {
k++; // skip DC carrier k++; // skip DC carrier
k-=phy_vars_eNB->lte_frame_parms.ofdm_symbol_size; k-=phy_vars_eNB->lte_frame_parms.ofdm_symbol_size;
} }
#endif
// printf("** k %d\n",k); // printf("** k %d\n",k);
} }
return(0); return(0);
......
...@@ -61,6 +61,52 @@ void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14] ...@@ -61,6 +61,52 @@ 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) {
unsigned char ns,l;
unsigned int n,x1,x2;//,x1tmp,x2tmp;
int nscid;
int nid;
for (nscid=0;nscid<2;nscid++) {
if (n_idDMRS)
nid = n_idDMRS[nscid];
else
nid = Nid_cell;
for (ns=0;ns<20;ns++) {
for (l=0;l<2;l++) {
x2 = ((((ns>>1)+1)*((nid<<1)+1))<<16) + nscid;
//x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit
//n = 0
// printf("cinit (ns %d, l %d) => %d\n",ns,l,x2);
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);
// printf("x1 : %x, x2 : %x\n",x1,x2);
}
for (n=0;n<14;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);
lte_gold_uespec_table[nscid][ns][l][n] = x1^x2;
// printf("n=%d : c %x\n",n,x1^x2);
}
}
}
}
}
/*! \brief gold sequenquence generator /*! \brief gold sequenquence generator
\param x1 \param x1
\param x2 this should be set to c_init if reset=1 \param x2 this should be set to c_init if reset=1
......
...@@ -1954,7 +1954,7 @@ uint8_t get_num_pdcch_symbols(uint8_t num_dci, ...@@ -1954,7 +1954,7 @@ uint8_t get_num_pdcch_symbols(uint8_t num_dci,
// check pdcch duration imposed by PHICH duration (Section 6.9 of 36-211) // check pdcch duration imposed by PHICH duration (Section 6.9 of 36-211)