Commit 6c4d2cbd authored by Elena_Lukashova's avatar Elena_Lukashova

Full Support for TM4 HARQ, excpept for PUSCH precoder at this moment.

parent 80b80f1b
......@@ -44,6 +44,7 @@
#include "PHY/vars.h"
#endif
#include "assertions.h"
//#define DEBUG_HARQ
//#define DEBUG_DCI
......@@ -1525,7 +1526,9 @@ int generate_eNB_dlsch_params_from_dci(int frame,
dlsch1_harq->status = ACTIVE;
dlsch0_harq->codeword=0;
dlsch1_harq->codeword=1;
#ifdef DEBUG_HARQ
printf("\n ENB: BOTH ACTIVE\n");
#endif
}
else if (TB0_active && TB1_active && tbswap==1) {
dlsch0=dlsch[0];
......@@ -1564,7 +1567,9 @@ int generate_eNB_dlsch_params_from_dci(int frame,
dlsch1_harq->codeword = 0;
dlsch0=NULL;
dlsch0_harq = NULL;
#ifdef DEBUG_HARQ
printf("\n ENB: TB0 is deactivated, retransmit TB1 transmit in TM6\n");
#endif
}
if (dlsch0 != NULL){
......@@ -2800,8 +2805,15 @@ int generate_eNB_dlsch_params_from_dci(int frame,
#endif
// compute DL power control parameters
if (dlsch0 != NULL){
computeRhoA_eNB(pdsch_config_dedicated, dlsch[0],dlsch0_harq->dl_power_off, frame_parms->nb_antennas_tx_eNB);
computeRhoB_eNB(pdsch_config_dedicated,&(frame_parms->pdsch_config_common),frame_parms->nb_antennas_tx_eNB,dlsch[0],dlsch0_harq->dl_power_off);
}
if (dlsch1 != NULL){
computeRhoA_eNB(pdsch_config_dedicated, dlsch[1],dlsch1_harq->dl_power_off, frame_parms->nb_antennas_tx_eNB);
computeRhoB_eNB(pdsch_config_dedicated,&(frame_parms->pdsch_config_common),frame_parms->nb_antennas_tx_eNB,dlsch[1],dlsch1_harq->dl_power_off);
}
return(0);
}
......@@ -4879,6 +4891,9 @@ int generate_ue_dlsch_params_from_dci(int frame,
if ((rv2 == 1) && (mcs2 == 0)) {
TB1_active=0;
}
#ifdef DEBUG_HARQ
printf("[DCI UE]: TB0 status %d , TB1 status %d\n", TB0_active, TB1_active);
#endif
//printf("RV TB0 = %d\n", rv1);
......@@ -4898,7 +4913,9 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch1_harq->status = ACTIVE;
dlsch0_harq->codeword=0;
dlsch1_harq->codeword=1;
//printf("\n UE: BOTH ACTIVE\n");
#ifdef DEBUG_HARQ
printf("[DCI UE]: BOTH ACTIVE\n");
#endif
}
else if (TB0_active && TB1_active && tbswap==1) {
dlsch0=dlsch[0];
......@@ -4937,7 +4954,9 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch1_harq->codeword = 0;
dlsch0=NULL;
dlsch0_harq = NULL;
//printf("\n UE: TB0 is deactivated, retransmit TB1 transmit in TM6\n");
#ifdef DEBUG_HARQ
printf("[DCI UE]: TB0 is deactivated, retransmit TB1 transmit in TM6\n");
#endif
}
......@@ -4990,7 +5009,9 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch1_harq->rb_alloc_odd[1]= dlsch1_harq->rb_alloc_even[1];
dlsch1_harq->rb_alloc_odd[2]= dlsch1_harq->rb_alloc_even[2];
dlsch1_harq->rb_alloc_odd[3]= dlsch1_harq->rb_alloc_even[3];
dlsch1_harq->nb_rb = dlsch0_harq->nb_rb;
dlsch1_harq->nb_rb = conv_nprb(rah,
rballoc,
frame_parms->N_RB_DL);
}
......@@ -5010,6 +5031,9 @@ int generate_ue_dlsch_params_from_dci(int frame,
if (dlsch1_harq != NULL)
dlsch1_harq->Nl = 1;
#ifdef DEBUG_HARQ
printf ("[DCI UE] tpmi = %d\n", tpmi);
#endif
if ((dlsch0 != NULL) && (dlsch1 != NULL)){ //two CW active
......@@ -5112,7 +5136,10 @@ int generate_ue_dlsch_params_from_dci(int frame,
break;
}
}
#ifdef DEBUG_HARQ
printf("[DCI UE] harq1 MIMO mode = %d\n", dlsch1_harq->mimo_mode);
#endif
//printf(" UE DCI harq0 MIMO mode = %d\n", dlsch0_harq->mimo_mode);
if ((frame_parms->mode1_flag == 1) && (dlsch0_harq != NULL))
dlsch0_harq->mimo_mode = SISO;
......@@ -5196,6 +5223,12 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch1->rnti = rnti;
}
#ifdef DEBUG_HARQ
if (dlsch0 != NULL)
printf("[DCI UE] dlsch0_harq status = %d, dlsch1_harq status = %d\n", dlsch0_harq->status, dlsch1_harq->status);
else
printf("[DCI UE] dlsch1_harq status = %d\n", dlsch1_harq->status);
#endif
break;
......@@ -5869,11 +5902,19 @@ int generate_ue_dlsch_params_from_dci(int frame,
}
#endif
dlsch[0]->active=1;
//dlsch[0]->active=1;
// compute DL power control parameters
computeRhoA_UE(pdsch_config_dedicated, dlsch[0],dlsch0_harq->dl_power_off, frame_parms->nb_antennas_tx_eNB);
computeRhoB_UE(pdsch_config_dedicated,&(frame_parms->pdsch_config_common),frame_parms->nb_antennas_tx_eNB,dlsch[0],dlsch0_harq->dl_power_off);
if (dlsch0_harq != NULL){
computeRhoA_UE(pdsch_config_dedicated, dlsch[0],dlsch0_harq->dl_power_off, frame_parms->nb_antennas_tx_eNB);
computeRhoB_UE(pdsch_config_dedicated,&(frame_parms->pdsch_config_common),frame_parms->nb_antennas_tx_eNB,dlsch[0],dlsch0_harq->dl_power_off);
}
if (dlsch1_harq != NULL) {
computeRhoA_UE(pdsch_config_dedicated, dlsch[1],dlsch1_harq->dl_power_off, frame_parms->nb_antennas_tx_eNB);
computeRhoB_UE(pdsch_config_dedicated,&(frame_parms->pdsch_config_common),frame_parms->nb_antennas_tx_eNB,dlsch[1],dlsch1_harq->dl_power_off);
}
return(0);
}
......
This diff is collapsed.
......@@ -156,7 +156,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t *x0 = NULL; //dlsch0_harq->e;
MIMO_mode_t mimo_mode = dlsch0_harq->mimo_mode;
MIMO_mode_t mimo_mode;//= dlsch0_harq->mimo_mode;
int first_layer0; //= dlsch0_harq->first_layer;
int Nlayers0; // = dlsch0_harq->Nlayers;
......@@ -1411,8 +1411,13 @@ int dlsch_modulation(int32_t **txdataF,
nsymb = (frame_parms->Ncp==0) ? 14:12;
if (dlsch0 != NULL){
amp_rho_a = (int16_t)(((int32_t)amp*dlsch0->sqrt_rho_a)>>13); //amp=512 in full scale; dlsch0->sqrt_rho_a=8192in Q2.13, 1 in full scale
amp_rho_b = (int16_t)(((int32_t)amp*dlsch0->sqrt_rho_b)>>13);
} else{
amp_rho_a = (int16_t)(((int32_t)amp*dlsch1->sqrt_rho_a)>>13);
amp_rho_b = (int16_t)(((int32_t)amp*dlsch1->sqrt_rho_b)>>13);
}
if (mod_order0 == 4)
for (i=0; i<4; i++) {
......@@ -1445,6 +1450,7 @@ int dlsch_modulation(int32_t **txdataF,
// printf("num_pdcch_symbols %d, nsymb %d\n",num_pdcch_symbols,nsymb);
for (l=num_pdcch_symbols; l<nsymb; l++) {
if (dlsch0 != NULL ) {
#ifdef DEBUG_DLSCH_MODULATION
printf("Generating DLSCH (harq_pid %d,mimo %d, pmi_alloc0 %lx, mod0 %d, mod1 %d, rb_alloc[0] %d) in %d\n",
harq_pid,
......@@ -1455,6 +1461,7 @@ int dlsch_modulation(int32_t **txdataF,
rb_alloc[0],
len);
#endif
}
if (frame_parms->Ncp==0) { // normal prefix
if ((l==4)||(l==11))
......@@ -1611,9 +1618,11 @@ int dlsch_modulation(int32_t **txdataF,
}
}
if (dlsch0_harq->Nlayers>1) {
msg("Nlayers %d: re_offset %d, symbol %d offset %d\n",dlsch0_harq->Nlayers,re_offset,l,symbol_offset);
return(-1);
if (dlsch0) {
if (dlsch0_harq->Nlayers>1) {
msg("Nlayers %d: re_offset %d, symbol %d offset %d\n",dlsch0_harq->Nlayers,re_offset,l,symbol_offset);
return(-1);
}
}
if (dlsch1) {
......@@ -1639,6 +1648,17 @@ int dlsch_modulation(int32_t **txdataF,
if (rb_alloc_ind > 0) {
// printf("Allocated rb %d/symbol %d, skip_half %d, subframe_offset %d, symbol_offset %d, re_offset %d, jj %d\n",rb,l,skip_half,subframe_offset,symbol_offset,re_offset,jj);
if (dlsch0 != NULL) {
get_pmi_temp = get_pmi(frame_parms->N_RB_DL,
dlsch0->harq_processes[harq_pid]->mimo_mode,
dlsch0->harq_processes[harq_pid]->pmi_alloc,
rb);
} else
get_pmi_temp = get_pmi(frame_parms->N_RB_DL,
dlsch1->harq_processes[harq_pid]->mimo_mode,
dlsch1->harq_processes[harq_pid]->pmi_alloc,
rb);
allocate_REs_in_RB(frame_parms,
txdataF,
......@@ -1646,11 +1666,11 @@ int dlsch_modulation(int32_t **txdataF,
&jj2,
re_offset,
symbol_offset,
dlsch0->harq_processes[harq_pid],
(dlsch1==NULL) ? NULL : dlsch1->harq_processes[harq_pid],
(dlsch0 == NULL) ? NULL : dlsch0->harq_processes[harq_pid],
(dlsch1 == NULL) ? NULL : dlsch1->harq_processes[harq_pid],
pilots,
((pilots) ? amp_rho_b : amp_rho_a),
get_pmi(frame_parms->N_RB_DL,dlsch0->harq_processes[harq_pid]->mimo_mode,dlsch0->harq_processes[harq_pid]->pmi_alloc,rb),
get_pmi_temp,
qam_table_s0,
qam_table_s1,
&re_allocated,
......@@ -1672,7 +1692,11 @@ int dlsch_modulation(int32_t **txdataF,
}
#ifdef DEBUG_DLSCH_MODULATION
msg("generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch0_harq->nb_rb,dlsch0_harq->rb_alloc,mod_order0,Nl0,2,0,subframe_offset));
if (dlsch0 != NULL){
msg("generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch0_harq->nb_rb,dlsch0_harq->rb_alloc,mod_order0,Nl0,2,0,subframe_offset));
}else{
msg("generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch1_harq->nb_rb,dlsch1_harq->rb_alloc,mod_order1,Nl1,2,0,subframe_offset));
}
#endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_MODULATION, VCD_FUNCTION_OUT);
......
......@@ -34,9 +34,9 @@
double ratioPB[2][4]={{ 1.0,4.0/5.0,3.0/5.0,2.0/5.0},
{ 5.0/4.0,1.0,3.0/4.0,1.0/2.0}};
*/
double ratioPB[2][4]={{ 0.00000, -0.96910, -2.21849, -3.97940}, //in db
{ 0.96910, 0.00000, -1.24939, -3.01030}};
{ 0.96910, 0.00000, -1.24939, -3.01030}};
double pa_values[8]={-6.0,-4.77,-3.0,-1.77,0.0,1.0,2.0,3.0}; //reported by higher layers
......@@ -45,21 +45,21 @@ double get_pa_dB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated)
return(pa_values[pdsch_config_dedicated->p_a]);
}
double computeRhoA_eNB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
LTE_eNB_DLSCH_t *dlsch_eNB,int dl_power_off, uint8_t n_antenna_port){
double computeRhoA_eNB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
LTE_eNB_DLSCH_t *dlsch_eNB, int dl_power_off, uint8_t n_antenna_port){
double rho_a_dB;
double sqrt_rho_a_lin;
rho_a_dB = pa_values[ pdsch_config_dedicated->p_a];
if(!dl_power_off) //if dl_power_offset is 0, this is for MU-interference, TM5
rho_a_dB-=10*log10(2);
if(n_antenna_port==4) // see TS 36.213 Section 5.2
rho_a_dB=+10*log10(2);
sqrt_rho_a_lin= pow(10,(0.05*rho_a_dB));
sqrt_rho_a_lin= pow(10,(0.05*rho_a_dB));
dlsch_eNB->sqrt_rho_a= (short) (sqrt_rho_a_lin*pow(2,13));
#if DEBUG_PC
......@@ -78,9 +78,9 @@ double computeRhoB_eNB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
double rho_a_dB, rho_b_dB;
double sqrt_rho_b_lin;
rho_a_dB= computeRhoA_eNB(pdsch_config_dedicated,dlsch_eNB,dl_power_off, n_antenna_port);
if(n_antenna_port>1)
rho_b_dB= ratioPB[1][pdsch_config_common->p_b] + rho_a_dB;
else
......@@ -99,24 +99,24 @@ double computeRhoB_eNB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
double computeRhoA_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
LTE_UE_DLSCH_t *dlsch_ue,
unsigned char dl_power_off,
uint8_t n_antenna_port
){
unsigned char dl_power_off,
uint8_t n_antenna_port
){
double rho_a_dB;
double sqrt_rho_a_lin;
rho_a_dB = pa_values[ pdsch_config_dedicated->p_a];
if(!dl_power_off)
rho_a_dB-=10*log10(2);
if(!dl_power_off)
rho_a_dB-=10*log10(2);
//if dl_power_offset is 0, this is for MU-interference, TM5. But in practice UE may assume 16 or 64QAM TM4 as multiuser
if(n_antenna_port==4) // see TS 36.213 Section 5.2
rho_a_dB=+10*log10(2);
sqrt_rho_a_lin= pow(10,(0.05*rho_a_dB));
sqrt_rho_a_lin= pow(10,(0.05*rho_a_dB));
dlsch_ue->sqrt_rho_a= (short) (sqrt_rho_a_lin*pow(2,13));
#ifdef DEBUG_PC
......@@ -135,9 +135,9 @@ double computeRhoB_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
double rho_a_dB, rho_b_dB;
double sqrt_rho_b_lin;
rho_a_dB= computeRhoA_UE(pdsch_config_dedicated,dlsch_ue,dl_power_off, n_antenna_port);
if(n_antenna_port>1)
rho_b_dB= ratioPB[1][pdsch_config_common->p_b] + rho_a_dB;
else
......
This diff is collapsed.
......@@ -387,7 +387,7 @@ typedef struct PHY_VARS_eNB_s {
#ifdef LOCALIZATION
/// time state for localization
time_stats_t localization_stats;
#endif
#endif
int32_t pucch1_stats_cnt[NUMBER_OF_UE_MAX][10];
int32_t pucch1_stats[NUMBER_OF_UE_MAX][10*1024];
......
......@@ -793,7 +793,7 @@ typedef struct {
/// - first index: ? [0..7] (hard coded) accessed via \c harq_pid
/// - second index: ? [0..7] (hard coded) accessed via \c round
/// - third index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - fourth index: ? [0..168*N_RB_DL[
/// - fourth index: ? [0..168*N_RB_DL[
int32_t **rxdataF_comp1[8][8];
/// \brief Downlink channel estimates extracted in PRBS.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
......
This diff is collapsed.
This diff is collapsed.
......@@ -46,7 +46,7 @@ static unsigned int seed, iy, ir[98];
#define a 1664525lu
#define mod 4294967296.0 /* is 2**32 */
#if 1
void randominit(unsigned seed_init)
{
int i;
......@@ -69,17 +69,18 @@ void randominit(unsigned seed_init)
}
iy=1;
}
}
#endif
/*void randominit(unsigned seed_init)
#if 0
void randominit(unsigned seed_init)
{
int i;
// this need to be integrated with the existing rng, like taus: navid
msg("Initializing random number generator, seed %x\n",seed_init);
seed_init = 62110;
if (seed_init == 0) {
srand((unsigned)time(NULL));
......@@ -90,14 +91,14 @@ void randominit(unsigned seed_init)
if (seed % 2 == 0) seed += 1; /* seed and mod are relative prime */
// for (i=1; i<=97; i++) {
// seed = a*seed; /* mod 2**32 */
// ir[i]= seed; /* initialize the shuffle table */
// }
// iy=1;
//}
for (i=1; i<=97; i++) {
seed = a*seed; /* mod 2**32 */
ir[i]= seed; /* initialize the shuffle table */
}
iy=1;
}
#endif
/*!\brief Uniform linear congruential random number generator on \f$[0,1)\f$. Returns a double-precision floating-point number.*/
double uniformrandom(void)
......
......@@ -58,7 +58,7 @@ unsigned int taus(void)
s2 = (((s2 & 0xFFFFFFF0) << 17)^ b);
return s0 ^ s1 ^ s2;
}
#if 1
void set_taus_seed(unsigned int seed_init)
{
......@@ -87,9 +87,11 @@ void set_taus_seed(unsigned int seed_init)
s2 = result;
#endif
}
}
/* void set_taus_seed(unsigned int seed_init)
}
#endif
#if 0
void set_taus_seed(unsigned int seed_init)
{
#ifdef USER_MODE
......@@ -113,18 +115,17 @@ void set_taus_seed(unsigned int seed_init)
s2 = (unsigned int)0xfe1a133e;
#else
// Use reentrant version of rand48 to ensure that no conflicts with other generators occur */
// srand48_r((long int)seed_init, &buffer);
// mrand48_r(&buffer, (long int *)&result);
// s0 = result;
// mrand48_r(&buffer, (long int *)&result);
// s1 = result;
// mrand48_r(&buffer, (long int *)&result);
// s2 = result;
//#endif
// }
//}
srand48_r((long int)seed_init, &buffer);
mrand48_r(&buffer, (long int *)&result);
s0 = result;
mrand48_r(&buffer, (long int *)&result);
s1 = result;
mrand48_r(&buffer, (long int *)&result);
s2 = result;
#endif
}
}
#endif
#ifdef MAIN
......
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