Commit 669c8eb9 authored by knopp's avatar knopp

Additions for TM3 in eNB and partially in UE - RK

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6182 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent c753e7bc
...@@ -661,7 +661,8 @@ int lte_rate_matching_turbo_rx(uint32_t RTC, ...@@ -661,7 +661,8 @@ int lte_rate_matching_turbo_rx(uint32_t RTC,
int nulled=0; int nulled=0;
#endif #endif
if (Kmimo==0 || Mdlharq==0 || C==0 || Qm==0 || Nl==0) { if (Kmimo==0 || Mdlharq==0 || C==0 || Qm==0 || Nl==0) {
msg("lte_rate_matching.c: invalid paramters\n"); msg("lte_rate_matching.c: invalid parameters (Kmimo %d, Mdlharq %d, C %d, Qm %d, Nl %d\n",
Kmimo,Mdlharq,C,Qm,Nl);
return(-1); return(-1);
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -109,10 +109,22 @@ typedef struct { ...@@ -109,10 +109,22 @@ typedef struct {
uint8_t rvidx; uint8_t rvidx;
/// MIMO mode for this DLSCH /// MIMO mode for this DLSCH
MIMO_mode_t mimo_mode; MIMO_mode_t mimo_mode;
/// Number of layers for this PDSCH transmission /// Current RB allocation
uint8_t Nlayers; uint32_t rb_alloc[4];
/// First layer for this PSCH transmission /// Current subband PMI allocation
uint8_t first_layer; uint16_t pmi_alloc;
/// Current subband RI allocation
uint32_t ri_alloc;
/// Current subband CQI1 allocation
uint32_t cqi_alloc1;
/// Current subband CQI2 allocation
uint32_t cqi_alloc2;
/// Current Number of RBs
uint16_t nb_rb;
/// downlink power offset field
uint8_t dl_power_off;
/// Concatenated "e"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18)
uint8_t e[MAX_NUM_CHANNEL_BITS];
/// Turbo-code outputs (36-212 V8.6 2009-03, p.12 /// Turbo-code outputs (36-212 V8.6 2009-03, p.12
uint8_t d[MAX_NUM_DLSCH_SEGMENTS][(96+3+(3*6144))]; uint8_t d[MAX_NUM_DLSCH_SEGMENTS][(96+3+(3*6144))];
/// Sub-block interleaver outputs (36-212 V8.6 2009-03, p.16-17) /// Sub-block interleaver outputs (36-212 V8.6 2009-03, p.16-17)
...@@ -129,8 +141,12 @@ typedef struct { ...@@ -129,8 +141,12 @@ typedef struct {
uint32_t Kplus; uint32_t Kplus;
/// Number of "Filler" bits (for definition see 36-212 V8.6 2009-03, p.10) /// Number of "Filler" bits (for definition see 36-212 V8.6 2009-03, p.10)
uint32_t F; uint32_t F;
/// Number of MIMO layers (streams) (for definition see 36-212 V8.6 2009-03, p.17) /// Number of MIMO layers (streams) (for definition see 36-212 V8.6 2009-03, p.17, TM3-4)
uint8_t Nl; uint8_t Nl;
/// Number of layers for this PDSCH transmission (TM8-10)
uint8_t Nlayers;
/// First layer for this PSCH transmission
uint8_t first_layer;
} LTE_DL_eNB_HARQ_t; } LTE_DL_eNB_HARQ_t;
typedef struct { typedef struct {
...@@ -221,34 +237,16 @@ typedef struct { ...@@ -221,34 +237,16 @@ typedef struct {
uint8_t ra_window_size; uint8_t ra_window_size;
/// First-round error threshold for fine-grain rate adaptation /// First-round error threshold for fine-grain rate adaptation
uint8_t error_threshold; uint8_t error_threshold;
/// Current RB allocation
uint32_t rb_alloc[4];
/// Current subband PMI allocation
uint16_t pmi_alloc;
/// Current subband RI allocation
uint32_t ri_alloc;
/// Current subband CQI1 allocation
uint32_t cqi_alloc1;
/// Current subband CQI2 allocation
uint32_t cqi_alloc2;
/// Current Number of RBs
uint16_t nb_rb;
/// Pointers to 8 HARQ processes for the DLSCH /// Pointers to 8 HARQ processes for the DLSCH
LTE_DL_eNB_HARQ_t *harq_processes[8]; LTE_DL_eNB_HARQ_t *harq_processes[8];
/// Number of soft channel bits /// Number of soft channel bits
uint32_t G; uint32_t G;
/// Layer index for this dlsch (0,1)
uint8_t layer_index;
/// Codebook index for this dlsch (0,1,2,3) /// Codebook index for this dlsch (0,1,2,3)
uint8_t codebook_index; uint8_t codebook_index;
/// Concatenated "e"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18)
uint8_t e[MAX_NUM_CHANNEL_BITS];
/// Maximum number of HARQ rounds (for definition see 36-212 V8.6 2009-03, p.17) /// Maximum number of HARQ rounds (for definition see 36-212 V8.6 2009-03, p.17)
uint8_t Mdlharq; uint8_t Mdlharq;
/// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17) /// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17)
uint8_t Kmimo; uint8_t Kmimo;
/// downlink power offset field
uint8_t dl_power_off;
/// amplitude of PDSCH (compared to RS) in symbols without pilots /// amplitude of PDSCH (compared to RS) in symbols without pilots
int16_t sqrt_rho_a; int16_t sqrt_rho_a;
/// amplitude of PDSCH (compared to RS) in symbols containing pilots /// amplitude of PDSCH (compared to RS) in symbols containing pilots
...@@ -637,8 +635,6 @@ typedef struct { ...@@ -637,8 +635,6 @@ typedef struct {
harq_status_t harq_ack[10]; harq_status_t harq_ack[10];
/// Pointers to up to 8 HARQ processes /// Pointers to up to 8 HARQ processes
LTE_DL_UE_HARQ_t *harq_processes[8]; LTE_DL_UE_HARQ_t *harq_processes[8];
/// Layer index for this DLSCH
uint8_t layer_index;
/// Maximum number of HARQ rounds (for definition see 36-212 V8.6 2009-03, p.17 /// Maximum number of HARQ rounds (for definition see 36-212 V8.6 2009-03, p.17
uint8_t Mdlharq; uint8_t Mdlharq;
/// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17) /// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17)
...@@ -650,7 +646,6 @@ typedef struct { ...@@ -650,7 +646,6 @@ typedef struct {
typedef enum {format0, typedef enum {format0,
format1, format1,
format1A, format1A,
format1A_RA,
format1B, format1B,
format1C, format1C,
format1D, format1D,
......
...@@ -230,8 +230,9 @@ int dlsch_encoding(unsigned char *a, ...@@ -230,8 +230,9 @@ int dlsch_encoding(unsigned char *a,
unsigned int G; unsigned int G;
unsigned int crc=1; unsigned int crc=1;
unsigned short iind; unsigned short iind;
unsigned short nb_rb = dlsch->nb_rb;
unsigned char harq_pid = dlsch->current_harq_pid; unsigned char harq_pid = dlsch->current_harq_pid;
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
unsigned int A; unsigned int A;
unsigned char mod_order; unsigned char mod_order;
unsigned int Kr=0,Kr_bytes,r,r_offset=0; unsigned int Kr=0,Kr_bytes,r,r_offset=0;
...@@ -243,7 +244,7 @@ int dlsch_encoding(unsigned char *a, ...@@ -243,7 +244,7 @@ int dlsch_encoding(unsigned char *a,
// printf("Encoder: A: %d\n",A); // printf("Encoder: A: %d\n",A);
mod_order = get_Qm(dlsch->harq_processes[harq_pid]->mcs); mod_order = get_Qm(dlsch->harq_processes[harq_pid]->mcs);
G = get_G(frame_parms,nb_rb,dlsch->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe); G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe);
// if (dlsch->harq_processes[harq_pid]->Ndi == 1) { // this is a new packet // if (dlsch->harq_processes[harq_pid]->Ndi == 1) { // this is a new packet
...@@ -353,7 +354,7 @@ int dlsch_encoding(unsigned char *a, ...@@ -353,7 +354,7 @@ int dlsch_encoding(unsigned char *a,
r_offset += lte_rate_matching_turbo(dlsch->harq_processes[harq_pid]->RTC[r], r_offset += lte_rate_matching_turbo(dlsch->harq_processes[harq_pid]->RTC[r],
G, //G G, //G
dlsch->harq_processes[harq_pid]->w[r], dlsch->harq_processes[harq_pid]->w[r],
dlsch->e+r_offset, dlsch->harq_processes[harq_pid]->e+r_offset,
dlsch->harq_processes[harq_pid]->C, // C dlsch->harq_processes[harq_pid]->C, // C
NSOFT, // Nsoft, NSOFT, // Nsoft,
dlsch->Mdlharq, dlsch->Mdlharq,
...@@ -367,7 +368,7 @@ int dlsch_encoding(unsigned char *a, ...@@ -367,7 +368,7 @@ int dlsch_encoding(unsigned char *a,
stop_meas(rm_stats); stop_meas(rm_stats);
#ifdef DEBUG_DLSCH_CODING #ifdef DEBUG_DLSCH_CODING
if (r==dlsch->harq_processes[harq_pid]->C-1) if (r==dlsch->harq_processes[harq_pid]->C-1)
write_output("enc_output.m","enc",dlsch->e,r_offset,1,4); write_output("enc_output.m","enc",dlsch->harq_processes[harq_pid]->e,r_offset,1,4);
#endif #endif
} }
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
......
...@@ -291,12 +291,13 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, ...@@ -291,12 +291,13 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
(r==0) ? harq_process->F : 0); (r==0) ? harq_process->F : 0);
#ifdef DEBUG_DLSCH_DECODING #ifdef DEBUG_DLSCH_DECODING
msg("HARQ_PID %d Rate Matching Segment %d (coded bits %d,unpunctured/repeated bits %d, mod_order %d, nb_rb %d, Nl %d)...\n", msg("HARQ_PID %d Rate Matching Segment %d (coded bits %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d)...\n",
harq_pid,r, G, harq_pid,r, G,
Kr*3, Kr*3,
get_Qm(harq_process->mcs), harq_process->TBS,
harq_process->nb_rb, get_Qm(harq_process->mcs),
harq_process->Nl); harq_process->nb_rb,
harq_process->Nl);
#endif #endif
...@@ -675,7 +676,7 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue, ...@@ -675,7 +676,7 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
if (dlsch_abstraction_MIESM(phy_vars_ue->sinr_dB, if (dlsch_abstraction_MIESM(phy_vars_ue->sinr_dB,
phy_vars_ue->transmission_mode[eNB_id], phy_vars_ue->transmission_mode[eNB_id],
dlsch_eNB->rb_alloc, dlsch_eNB->harq_processes[harq_pid]->rb_alloc,
dlsch_eNB->harq_processes[harq_pid]->mcs, dlsch_eNB->harq_processes[harq_pid]->mcs,
PHY_vars_eNB_g[eNB_id][CC_id]->mu_mimo_mode[ue_id].dl_pow_off) == 1) { PHY_vars_eNB_g[eNB_id][CC_id]->mu_mimo_mode[ue_id].dl_pow_off) == 1) {
// reset HARQ // reset HARQ
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -1063,7 +1063,7 @@ length = number of resource elements ...@@ -1063,7 +1063,7 @@ length = number of resource elements
xmm0 = _mm_xor_si128(xmm0,xmm0); // ZERO xmm0 = _mm_xor_si128(xmm0,xmm0); // ZERO
// 1 term for nominator of LLR // 1 term for numerator of LLR
xmm3 = _mm_subs_epi16(y1r_over2,rho_rpi); xmm3 = _mm_subs_epi16(y1r_over2,rho_rpi);
A = _mm_abs_epi16(xmm3); // A = |y1r/2 - rho/sqrt(8)| A = _mm_abs_epi16(xmm3); // A = |y1r/2 - rho/sqrt(8)|
xmm2 = _mm_adds_epi16(A,y0i_over2); // = |y1r/2 - rho/sqrt(8)| + y0i/2 xmm2 = _mm_adds_epi16(A,y0i_over2); // = |y1r/2 - rho/sqrt(8)| + y0i/2
...@@ -1071,7 +1071,7 @@ length = number of resource elements ...@@ -1071,7 +1071,7 @@ length = number of resource elements
B = _mm_abs_epi16(xmm3); // B = |y1i/2 - rho*/sqrt(8)| B = _mm_abs_epi16(xmm3); // B = |y1i/2 - rho*/sqrt(8)|
logmax_num_re0 = _mm_adds_epi16(B,xmm2); // = |y1r/2 - rho/sqrt(8)|+|y1i/2 - rho*/sqrt(8)| + y0i/2 logmax_num_re0 = _mm_adds_epi16(B,xmm2); // = |y1r/2 - rho/sqrt(8)|+|y1i/2 - rho*/sqrt(8)| + y0i/2
// 2 term for nominator of LLR // 2 term for numerator of LLR
xmm3 = _mm_subs_epi16(y1r_over2,rho_rmi); xmm3 = _mm_subs_epi16(y1r_over2,rho_rmi);
C = _mm_abs_epi16(xmm3); // C = |y1r/2 - rho*/4| C = _mm_abs_epi16(xmm3); // C = |y1r/2 - rho*/4|
xmm2 = _mm_subs_epi16(C,y0i_over2); // = |y1r/2 - rho*/4| - y0i/2 xmm2 = _mm_subs_epi16(C,y0i_over2); // = |y1r/2 - rho*/4| - y0i/2
......
...@@ -58,7 +58,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -58,7 +58,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
int i,j,k=0; int i,j,k=0;
// uint8_t reset; // uint8_t reset;
uint32_t x1, x2, s=0; uint32_t x1, x2, s=0;
uint8_t *e=dlsch->e; uint8_t *e=dlsch->harq_processes[dlsch->current_harq_pid]->e;
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_SCRAMBLING, VCD_FUNCTION_IN); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_SCRAMBLING, VCD_FUNCTION_IN);
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#include "gain_control.h" #include "gain_control.h"
#endif #endif
//#define DEBUG_INITIAL_SYNCH #define DEBUG_INITIAL_SYNCH
int pbch_detection(PHY_VARS_UE *phy_vars_ue, runmode_t mode) { int pbch_detection(PHY_VARS_UE *phy_vars_ue, runmode_t mode) {
...@@ -111,6 +111,7 @@ int pbch_detection(PHY_VARS_UE *phy_vars_ue, runmode_t mode) { ...@@ -111,6 +111,7 @@ int pbch_detection(PHY_VARS_UE *phy_vars_ue, runmode_t mode) {
frame_parms, frame_parms,
0, 0,
SISO, SISO,
phy_vars_ue->high_speed_flag,
frame_mod4); frame_mod4);
if ((pbch_tx_ant>0) && (pbch_tx_ant<=2)) { if ((pbch_tx_ant>0) && (pbch_tx_ant<=2)) {
pbch_decoded = 1; pbch_decoded = 1;
...@@ -122,6 +123,7 @@ int pbch_detection(PHY_VARS_UE *phy_vars_ue, runmode_t mode) { ...@@ -122,6 +123,7 @@ int pbch_detection(PHY_VARS_UE *phy_vars_ue, runmode_t mode) {
frame_parms, frame_parms,
0, 0,
ALAMOUTI, ALAMOUTI,
phy_vars_ue->high_speed_flag,
frame_mod4); frame_mod4);
if ((pbch_tx_ant>0) && (pbch_tx_ant<=2)) { if ((pbch_tx_ant>0) && (pbch_tx_ant<=2)) {
pbch_decoded = 1; pbch_decoded = 1;
......
...@@ -70,6 +70,98 @@ extern __m128i zero; ...@@ -70,6 +70,98 @@ extern __m128i zero;
#define PBCH_A 24 #define PBCH_A 24
int allocate_pbch_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
mod_sym_t **txdataF,
uint32_t *jj,
uint16_t re_offset,
uint32_t symbol_offset,
uint8_t *x0,
uint8_t pilots,
int16_t amp,
uint32_t *re_allocated) {
MIMO_mode_t mimo_mode = (frame_parms->mode1_flag==1)?SISO:ALAMOUTI;
uint32_t tti_offset,aa;
uint8_t re;
int16_t gain_lin_QPSK;
int16_t re_off=re_offset;
uint8_t first_re,last_re;
int32_t tmp_sample1,tmp_sample2;
gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15)>>15);
first_re=0;
last_re=12;
for (re=first_re;re<last_re;re++) {
tti_offset = symbol_offset + re_off + re;
// check that RE is not from Cell-specific RS
if (is_not_pilot(pilots,re,frame_parms->nushift,0)==1) {
// printf("re %d (jj %d)\n",re,*jj);
if (mimo_mode == SISO) { //SISO mapping
*re_allocated = *re_allocated + 1;
// printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
}
*jj = *jj + 1;
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t*)&txdataF[aa][tti_offset])[1] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1}
}
*jj = *jj + 1;
}
else if (mimo_mode == ALAMOUTI){
*re_allocated = *re_allocated + 1;
((int16_t*)&tmp_sample1)[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
// second antenna position n -> -x1*
((int16_t*)&tmp_sample2)[0] = (x0[*jj]==1) ? (gain_lin_QPSK) : -gain_lin_QPSK;
*jj=*jj+1;
((int16_t*)&tmp_sample2)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj=*jj+1;
// normalization for 2 tx antennas
((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15)>>15);
// fill in the rest of the ALAMOUTI precoding
if (is_not_pilot(pilots,re + 1,frame_parms->nushift,0)==1) {
((int16_t *)&txdataF[0][tti_offset+1])[0] += -((int16_t *)&txdataF[1][tti_offset])[0]; //x1
((int16_t *)&txdataF[0][tti_offset+1])[1] += ((int16_t *)&txdataF[1][tti_offset])[1];
((int16_t *)&txdataF[1][tti_offset+1])[0] += ((int16_t *)&txdataF[0][tti_offset])[0]; //x0*
((int16_t *)&txdataF[1][tti_offset+1])[1] += -((int16_t *)&txdataF[0][tti_offset])[1];
}
else {
((int16_t *)&txdataF[0][tti_offset+2])[0] += -((int16_t *)&txdataF[1][tti_offset])[0]; //x1
((int16_t *)&txdataF[0][tti_offset+2])[1] += ((int16_t *)&txdataF[1][tti_offset])[1];
((int16_t *)&txdataF[1][tti_offset+2])[0] += ((int16_t *)&txdataF[0][tti_offset])[0]; //x0*
((int16_t *)&txdataF[1][tti_offset+2])[1] += -((int16_t *)&txdataF[0][tti_offset])[1];
}
re++; // adjacent carriers are taken care of by precoding
*re_allocated = *re_allocated + 1;
if (is_not_pilot(pilots,re,frame_parms->nushift,0)==0) { // skip pilots
re++;
*re_allocated = *re_allocated + 1;
}
}
}
}
return(0);
}
//uint8_t pbch_d[96+(3*(16+PBCH_A))], pbch_w[3*3*(16+PBCH_A)],pbch_e[1920]; //one bit per byte //uint8_t pbch_d[96+(3*(16+PBCH_A))], pbch_w[3*3*(16+PBCH_A)],pbch_e[1920]; //one bit per byte
int generate_pbch(LTE_eNB_PBCH *eNB_pbch, int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
mod_sym_t **txdataF, mod_sym_t **txdataF,
...@@ -260,62 +352,51 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch, ...@@ -260,62 +352,51 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
#endif #endif
#ifdef IFFT_FPGA
re_offset = frame_parms->N_RB_DL*12-3*12;
symbol_offset = frame_parms->N_RB_DL*12*l;
#else
re_offset = frame_parms->ofdm_symbol_size-3*12; re_offset = frame_parms->ofdm_symbol_size-3*12;
symbol_offset = frame_parms->ofdm_symbol_size*l; symbol_offset = frame_parms->ofdm_symbol_size*l;
#endif
for (rb=0;rb<6;rb++) { for (rb=0;rb<6;rb++) {
#ifdef DEBUG_PBCH #ifdef DEBUG_PBCH
msg("RB %d, jj %d, re_offset %d, symbol_offset %d, pilots %d, nushift %d\n",rb,jj,re_offset, symbol_offset, pilots,frame_parms->nushift); msg("RB %d, jj %d, re_offset %d, symbol_offset %d, pilots %d, nushift %d\n",rb,jj,re_offset, symbol_offset, pilots,frame_parms->nushift);
#endif #endif
allocate_REs_in_RB(txdataF, allocate_pbch_REs_in_RB(frame_parms,
&jj, txdataF,
re_offset, &jj,
symbol_offset, re_offset,
&eNB_pbch->pbch_e[frame_mod4*(pbch_E>>2)], symbol_offset,
(frame_parms->mode1_flag == 1) ? SISO : ALAMOUTI, &eNB_pbch->pbch_e[frame_mod4*(pbch_E>>2)],
0, pilots,
pilots,
2,
0,
#ifdef INTERFERENCE_MITIGATION #ifdef INTERFERENCE_MITIGATION
(pilots_2==1)?(amp/3):amp, (pilots_2==1)?(amp/3):amp,
#else #else
amp, amp,
#endif #endif
NULL, &re_allocated);
&re_allocated,
0,
0,
0,
1,
0,
frame_parms);
re_offset+=12; // go to next RB re_offset+=12; // go to next RB
// check if we crossed the symbol boundary and skip DC // check if we crossed the symbol boundary and skip DC
#ifdef IFFT_FPGA
if (re_offset >= frame_parms->N_RB_DL*12)
re_offset = 0;
#else
if (re_offset >= frame_parms->ofdm_symbol_size) if (re_offset >= frame_parms->ofdm_symbol_size)
re_offset=1; re_offset=1;
#endif
} }
// } // }
} }
#ifdef DEBUG_PBCH #ifdef DEBUG_PBCH
msg("[PBCH] txdataF=\n"); printf("[PBCH] txdataF=\n");
for (i=0;i<frame_parms->ofdm_symbol_size;i++) for (i=0;i<frame_parms->ofdm_symbol_size;i++) {
msg("%d=>(%d,%d)\n",i,((short*)&txdataF[0][frame_parms->ofdm_symbol_size*(nsymb>>1)+i])[0], printf("%d=>(%d,%d)",i,((short*)&txdataF[0][frame_parms->ofdm_symbol_size*(nsymb>>1)+i])[0],
((short*)&txdataF[0][frame_parms->ofdm_symbol_size*(nsymb>>1)+i])[1]); ((short*)&txdataF[0][frame_parms->ofdm_symbol_size*(nsymb>>1)+i])[1]);
if (frame_parms->mode1_flag==0) {
printf("(%d,%d)\n",((short*)&txdataF[1][frame_parms->ofdm_symbol_size*(nsymb>>1)+i])[0],
((short*)&txdataF[1][frame_parms->ofdm_symbol_size*(nsymb>>1)+i])[1]);
}
else {
printf("\n");
}
}
#endif #endif
...@@ -332,11 +413,12 @@ int32_t generate_pbch_emul(PHY_VARS_eNB *phy_vars_eNB,uint8_t *pbch_pdu) { ...@@ -332,11 +413,12 @@ int32_t generate_pbch_emul(PHY_VARS_eNB *phy_vars_eNB,uint8_t *pbch_pdu) {
} }
uint16_t pbch_extract(int **rxdataF, uint16_t pbch_extract(int **rxdataF,
int **dl_ch_estimates, int **dl_ch_estimates,
int **rxdataF_ext, int **rxdataF_ext,
int **dl_ch_estimates_ext, int **dl_ch_estimates_ext,
uint32_t symbol, uint32_t symbol,
LTE_DL_FRAME_PARMS *frame_parms) { uint32_t high_speed_flag,
LTE_DL_FRAME_PARMS *frame_parms) {
uint16_t rb,nb_rb=6; uint16_t rb,nb_rb=6;
...@@ -356,21 +438,14 @@ uint16_t pbch_extract(int **rxdataF, ...@@ -356,21 +438,14 @@ uint16_t pbch_extract(int **rxdataF,
(rx_offset + (symbol*(frame_parms->ofdm_symbol_size)))*2, (rx_offset + (symbol*(frame_parms->ofdm_symbol_size)))*2,
LTE_CE_OFFSET+ch_offset+(symbol_mod*(frame_parms->ofdm_symbol_size))); LTE_CE_OFFSET+ch_offset+(symbol_mod*(frame_parms->ofdm_symbol_size)));
*/ */
#ifndef NEW_FFT
rxF = &rxdataF[aarx][(rx_offset + (symbol*(frame_parms->ofdm_symbol_size)))*2];
#else
rxF = &rxdataF[aarx][(rx_offset + (symbol*(frame_parms->ofdm_symbol_size)))]; rxF = &rxdataF[aarx][(rx_offset + (symbol*(frame_parms->ofdm_symbol_size)))];
#endif
rxF_ext = &rxdataF_ext[aarx][symbol_mod*(6*12)]; rxF_ext = &rxdataF_ext[aarx][symbol_mod*(6*12)];
for (rb=0; rb<nb_rb; rb++) { for (rb=0; rb<nb_rb; rb++) {
// skip DC carrier // skip DC carrier
if (rb==3) { if (rb==3) {
#ifndef NEW_FFT
rxF = &rxdataF[aarx][(1 + (symbol*(frame_parms->ofdm_symbol_size)))*2];
#else
rxF = &rxdataF[aarx][(1 + (symbol*(frame_parms->ofdm_symbol_size)))]; rxF = &rxdataF[aarx][(1 + (symbol*(frame_parms->ofdm_symbol_size)))];
#endif
} }
if ((symbol_mod==0) || (symbol_mod==1)) { if ((symbol_mod==0) || (symbol_mod==1)) {
j=0; j=0;
...@@ -379,39 +454,26 @@ uint16_t pbch_extract(int **rxdataF, ...@@ -379,39 +454,26 @@ uint16_t pbch_extract(int **rxdataF,
(i!=(nushiftmod3+3)) && (i!=(nushiftmod3+3)) &&
(i!=(nushiftmod3+6)) && (i!=(nushiftmod3+6)) &&
(i!=(nushiftmod3+9))) { (i!=(nushiftmod3+9))) {
#ifndef NEW_FFT
rxF_ext[j++]=rxF[i<<1];
#else
rxF_ext[j++]=rxF[i]; rxF_ext[j++]=rxF[i];
#endif
} }
} }
#ifndef NEW_FFT
rxF+=24;
#else
rxF+=12; rxF+=12;
#endif
rxF_ext+=8; rxF_ext+=8;
} }
else { else {
for (i=0;i<12;i++) { for (i=0;i<12;i++) {
#ifndef NEW_FFT
rxF_ext[i]=rxF[i<<1];
#else
rxF_ext[i]=rxF[i]; rxF_ext[i]=rxF[i];
#endif
} }
#ifndef NEW_FFT
rxF+=24;
#else
rxF+=12; rxF+=12;
#endif
rxF_ext+=12; rxF_ext+=12;
} }
} }
for (aatx=0;aatx<4;aatx++) {//frame_parms->nb_antennas_tx_eNB;aatx++) { for (aatx=0;aatx<4;aatx++) {//frame_parms->nb_antennas_tx_eNB;aatx++) {
dl_ch0 = &dl_ch_estimates[(aatx<<1)+aarx][LTE_CE_OFFSET+ch_offset+(symbol*(frame_parms->ofdm_symbol_size))]; if (high_speed_flag == 1)
dl_ch0 = &dl_ch_estimates[(aatx<<1)+aarx][LTE_CE_OFFSET+ch_offset+(symbol*(frame_parms->ofdm_symbol_size))];
else
dl_ch0 = &dl_ch_estimates[(aatx<<1)+aarx][LTE_CE_OFFSET+ch_offset];
dl_ch0_ext = &dl_ch_estimates_ext[(aatx<<1)+aarx][symbol_mod*(6*12)]; dl_ch0_ext = &dl_ch_estimates_ext[(aatx<<1)+aarx][symbol_mod*(6*12)];
for (rb=0; rb<nb_rb; rb++) { for (rb=0; rb<nb_rb; rb++) {
...@@ -737,11 +799,12 @@ static int8_t pbch_w_rx[3*3*(16+PBCH_A)],pbch_d_rx[96+(3*(16+PBCH_A))]; ...@@ -737,11 +799,12 @@ static int8_t pbch_w_rx[3*3*(16+PBCH_A)],pbch_d_rx[96+(3*(16+PBCH_A))];
uint16_t rx_pbch(LTE_UE_COMMON *lte_ue_common_vars, uint16_t rx_pbch(LTE_UE_COMMON *lte_ue_common_vars,
LTE_UE_PBCH *lte_ue_pbch_vars, LTE_UE_PBCH *lte_ue_pbch_vars,
LTE_DL_FRAME_PARMS *frame_parms, LTE_DL_FRAME_PARMS *frame_parms,
uint8_t eNB_id, uint8_t eNB_id,
MIMO_mode_t mimo_mode, MIMO_mode_t mimo_mode,
uint8_t frame_mod4) { uint32_t high_speed_flag,
uint8_t frame_mod4) {
uint8_t log2_maxh;//,aatx,aarx; uint8_t log2_maxh;//,aatx,aarx;
int max_h=0; int max_h=0;
...@@ -778,6 +841,7 @@ uint16_t rx_pbch(LTE_UE_COMMON *lte_ue_common_vars, ...@@ -778,6 +841,7 @@ uint16_t rx_pbch(LTE_UE_COMMON *lte_ue_common_vars,
lte_ue_pbch_vars->rxdataF_ext, lte_ue_pbch_vars->rxdataF_ext,
lte_ue_pbch_vars->dl_ch_estimates_ext, lte_ue_pbch_vars->dl_ch_estimates_ext,
symbol, symbol,
high_speed_flag,
frame_parms); frame_parms);
#ifdef DEBUG_PBCH #ifdef DEBUG_PBCH
msg("[PHY] PBCH Symbol %d\n",symbol); msg("[PHY] PBCH Symbol %d\n",symbol);
...@@ -811,7 +875,7 @@ uint16_t rx_pbch(LTE_UE_COMMON *lte_ue_common_vars, ...@@ -811,7 +875,7 @@ uint16_t rx_pbch(LTE_UE_COMMON *lte_ue_common_vars,
// msg("[PBCH][RX] Alamouti receiver not yet implemented!\n"); // msg("[PBCH][RX] Alamouti receiver not yet implemented!\n");
// return(-1); // return(-1);
} }
else if ((mimo_mode != ANTCYCLING) && (mimo_mode != SISO)) { else if (mimo_mode != SISO) {
msg("[PBCH][RX] Unsupported MIMO mode\n"); msg("[PBCH][RX] Unsupported MIMO mode\n");
return(-1); return(-1);