Commit d092a130 authored by Raymond Knopp's avatar Raymond Knopp

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5927 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent d704453e
......@@ -4673,85 +4673,85 @@ int generate_eNB_ulsch_params_from_dci(void *dci_pdu,
if (cqi_req == 1) {
ulsch->O_RI = 1; //we only support 2 antenna ports, so this is always 1 according to 3GPP 36.213 Table
ulsch->harq_processes[harq_pid]->O_RI = 1; //we only support 2 antenna ports, so this is always 1 according to 3GPP 36.213 Table
switch(transmission_mode){
// The aperiodic CQI reporting mode is fixed for every transmission mode instead of being configured by higher layer signaling
case 1:
if ((rnti >= cba_rnti) && (rnti < p_rnti)){
ulsch->Or2 = 0;
ulsch->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_5MHz;
ulsch->uci_format = HLC_subband_cqi_mcs_CBA;
ulsch->harq_processes[harq_pid]->Or2 = 0;
ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_5MHz;
ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_mcs_CBA;
}
else {
ulsch->Or2 = 0;
ulsch->Or1 = sizeof_HLC_subband_cqi_nopmi_5MHz;
ulsch->uci_format = HLC_subband_cqi_nopmi;
ulsch->harq_processes[harq_pid]->Or2 = 0;
ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_nopmi_5MHz;
ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_nopmi;
}
break;
case 2:
if ((rnti >= cba_rnti) && (rnti < p_rnti)){
ulsch->Or2 = 0;
ulsch->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_5MHz;
ulsch->uci_format = HLC_subband_cqi_mcs_CBA;
ulsch->harq_processes[harq_pid]->Or2 = 0;
ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_5MHz;
ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_mcs_CBA;
}
else {
ulsch->Or2 = 0;
ulsch->Or1 = sizeof_HLC_subband_cqi_nopmi_5MHz;
ulsch->uci_format = HLC_subband_cqi_nopmi;
ulsch->harq_processes[harq_pid]->Or2 = 0;
ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_nopmi_5MHz;
ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_nopmi;
}
break;
case 3:
if ((rnti >= cba_rnti) && (rnti < p_rnti)){
ulsch->Or2 = 0;
ulsch->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_5MHz;
ulsch->uci_format = HLC_subband_cqi_mcs_CBA;
ulsch->harq_processes[harq_pid]->Or2 = 0;
ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_5MHz;
ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_mcs_CBA;
}
else {
ulsch->Or2 = 0;
ulsch->Or1 = sizeof_HLC_subband_cqi_nopmi_5MHz;
ulsch->uci_format = HLC_subband_cqi_nopmi;
ulsch->harq_processes[harq_pid]->Or2 = 0;
ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_nopmi_5MHz;
ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_nopmi;
}
break;
case 4:
if ((rnti >= cba_rnti) && (rnti < p_rnti)){
ulsch->Or2 = 0;
ulsch->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_5MHz;
ulsch->uci_format = HLC_subband_cqi_mcs_CBA;
ulsch->harq_processes[harq_pid]->Or2 = 0;
ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_5MHz;
ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_mcs_CBA;
}
else {
ulsch->Or2 = sizeof_wideband_cqi_rank2_2A_5MHz;
ulsch->Or1 = sizeof_wideband_cqi_rank1_2A_5MHz;
ulsch->uci_format = wideband_cqi_rank1_2A;
ulsch->harq_processes[harq_pid]->Or2 = sizeof_wideband_cqi_rank2_2A_5MHz;
ulsch->harq_processes[harq_pid]->Or1 = sizeof_wideband_cqi_rank1_2A_5MHz;
ulsch->harq_processes[harq_pid]->uci_format = wideband_cqi_rank1_2A;
}
break;
case 5:
if ((rnti >= cba_rnti) && (rnti < p_rnti)){
ulsch->Or2 = 0;
ulsch->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_5MHz;
ulsch->uci_format = HLC_subband_cqi_mcs_CBA;
ulsch->harq_processes[harq_pid]->Or2 = 0;
ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_5MHz;
ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_mcs_CBA;
}
else {
ulsch->Or2 = sizeof_wideband_cqi_rank2_2A_5MHz;
ulsch->Or1 = sizeof_wideband_cqi_rank1_2A_5MHz;
ulsch->uci_format = wideband_cqi_rank1_2A;
ulsch->harq_processes[harq_pid]->Or2 = sizeof_wideband_cqi_rank2_2A_5MHz;
ulsch->harq_processes[harq_pid]->Or1 = sizeof_wideband_cqi_rank1_2A_5MHz;
ulsch->harq_processes[harq_pid]->uci_format = wideband_cqi_rank1_2A;
}
break;
case 6:
if ((rnti >= cba_rnti) && (rnti < p_rnti)){
ulsch->Or2 = 0;
ulsch->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_5MHz;
ulsch->uci_format = HLC_subband_cqi_mcs_CBA;
ulsch->harq_processes[harq_pid]->Or2 = 0;
ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_mcs_CBA_5MHz;
ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_mcs_CBA;
}
else {
ulsch->Or2 = sizeof_wideband_cqi_rank2_2A_5MHz;
ulsch->Or1 = sizeof_wideband_cqi_rank1_2A_5MHz;
ulsch->uci_format = wideband_cqi_rank1_2A;
ulsch->harq_processes[harq_pid]->Or2 = sizeof_wideband_cqi_rank2_2A_5MHz;
ulsch->harq_processes[harq_pid]->Or1 = sizeof_wideband_cqi_rank1_2A_5MHz;
ulsch->harq_processes[harq_pid]->uci_format = wideband_cqi_rank1_2A;
}
break;
case 7:
ulsch->Or2 = 0;
ulsch->Or1 = sizeof_HLC_subband_cqi_nopmi_5MHz;
ulsch->uci_format = HLC_subband_cqi_nopmi;
ulsch->harq_processes[harq_pid]->Or2 = 0;
ulsch->harq_processes[harq_pid]->Or1 = sizeof_HLC_subband_cqi_nopmi_5MHz;
ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_nopmi;
break;
default:
LOG_E(PHY,"Incorrect Transmission Mode \n");
......@@ -4759,10 +4759,10 @@ int generate_eNB_ulsch_params_from_dci(void *dci_pdu,
}
}
else {
ulsch->O_RI = 0;//1;
ulsch->Or2 = 0;
ulsch->Or1 = 0;//sizeof_HLC_subband_cqi_nopmi_5MHz;
ulsch->uci_format = HLC_subband_cqi_nopmi;
ulsch->harq_processes[harq_pid]->O_RI = 0;//1;
ulsch->harq_processes[harq_pid]->Or2 = 0;
ulsch->harq_processes[harq_pid]->Or1 = 0;//sizeof_HLC_subband_cqi_nopmi_5MHz;
ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_nopmi;
}
if (frame_parms->frame_type == FDD) {
......@@ -4786,8 +4786,8 @@ int generate_eNB_ulsch_params_from_dci(void *dci_pdu,
ulsch->beta_offset_ri_times8 = beta_ri[phy_vars_eNB->pusch_config_dedicated[UE_id].betaOffset_RI_Index];//10;
ulsch->beta_offset_harqack_times8 = beta_ack[phy_vars_eNB->pusch_config_dedicated[UE_id].betaOffset_ACK_Index];//16;
ulsch->Nsymb_pusch = 12-(frame_parms->Ncp<<1)-(use_srs==0?0:1);
ulsch->srs_active = use_srs;
ulsch->harq_processes[harq_pid]->Nsymb_pusch = 12-(frame_parms->Ncp<<1)-(use_srs==0?0:1);
ulsch->harq_processes[harq_pid]->srs_active = use_srs;
ulsch->bundling = 1-AckNackFBMode;
//Mapping of cyclic shift field in DCI format0 to n_DMRS2 (3GPP 36.211, Table 5.5.2.1.1-1)
if(cshift == 0)
......@@ -4832,7 +4832,7 @@ int generate_eNB_ulsch_params_from_dci(void *dci_pdu,
ulsch->harq_processes[harq_pid]->TBS = TBStable[get_I_TBS_UL(ulsch->harq_processes[harq_pid]->mcs)][ulsch->harq_processes[harq_pid]->nb_rb-1];
ulsch->harq_processes[harq_pid]->Msc_initial = 12*ulsch->harq_processes[harq_pid]->nb_rb;
ulsch->harq_processes[harq_pid]->Nsymb_initial = ulsch->Nsymb_pusch;
ulsch->harq_processes[harq_pid]->Nsymb_initial = ulsch->harq_processes[harq_pid]->Nsymb_pusch;
ulsch->harq_processes[harq_pid]->round = 0;
}
else {
......@@ -4858,8 +4858,8 @@ int generate_eNB_ulsch_params_from_dci(void *dci_pdu,
msg("ulsch (eNB): round %d\n",ulsch->harq_processes[harq_pid]->round);
msg("ulsch (eNB): TBS %d\n",ulsch->harq_processes[harq_pid]->TBS);
msg("ulsch (eNB): mcs %d\n",ulsch->harq_processes[harq_pid]->mcs);
msg("ulsch (eNB): Or1 %d\n",ulsch->Or1);
msg("ulsch (eNB): Nsymb_pusch %d\n",ulsch->Nsymb_pusch);
msg("ulsch (eNB): Or1 %d\n",ulsch->harq_processes[harq_pid]->Or1);
msg("ulsch (eNB): Nsymb_pusch %d\n",ulsch->harq_processes[harq_pid]->Nsymb_pusch);
msg("ulsch (eNB): cshift %d\n",ulsch->harq_processes[harq_pid]->n_DMRS2);
#else
UNUSED_VARIABLE(dai);
......
......@@ -355,16 +355,52 @@ typedef struct {
uint32_t TBS;
/// The payload + CRC size in bits
uint32_t B;
/// CQI CRC status
uint8_t cqi_crc_status;
/// Pointer to CQI data
uint8_t o[MAX_CQI_BYTES];
/// Format of CQI data
UCI_format_t uci_format;
/// Length of CQI data under RI=1 assumption(bits)
uint8_t Or1;
/// Length of CQI data under RI=2 assumption(bits)
uint8_t Or2;
/// Rank information
uint8_t o_RI[2];
/// Length of rank information (bits)
uint8_t O_RI;
/// Pointer to ACK
uint8_t o_ACK[4];
/// Length of ACK information (bits)
uint8_t O_ACK;
/// The value of DAI in DCI format 0
uint8_t V_UL_DAI;
/// "q" sequences for CQI/PMI (for definition see 36-212 V8.6 2009-03, p.27)
int8_t q[MAX_CQI_PAYLOAD];
/// number of coded CQI bits after interleaving
uint8_t o_RCC;
/// coded and interleaved CQI bits
int8_t o_w[(MAX_CQI_BITS+8)*3];
/// coded CQI bits
int8_t o_d[96+((MAX_CQI_BITS+8)*3)];
/// coded ACK bits
int16_t q_ACK[MAX_ACK_PAYLOAD];
/// coded RI bits
int16_t q_RI[MAX_RI_PAYLOAD];
/// Concatenated "e"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18)
int16_t e[MAX_NUM_CHANNEL_BITS];
/// Temporary h sequence to flag PUSCH_x/PUSCH_y symbols which are not scrambled
uint8_t h[MAX_NUM_CHANNEL_BITS];
/// Pointer to the payload
uint8_t *b;
/// Pointers to transport block segments
uint8_t *c[MAX_NUM_ULSCH_SEGMENTS];
/// RTC values for each segment (for definition see 36-212 V8.6 2009-03, p.15)
uint32_t RTC[MAX_NUM_ULSCH_SEGMENTS];
/// Current Number of Symbols
uint8_t Nsymb_pusch;
/// SRS active flag
uint8_t srs_active;
/// Index of current HARQ round for this ULSCH
uint8_t round;
/// MCS format for this ULSCH
......@@ -404,50 +440,14 @@ typedef struct {
} LTE_UL_eNB_HARQ_t;
typedef struct {
/// Current Number of Symbols
uint8_t Nsymb_pusch;
/// SRS active flag
uint8_t srs_active;
/// Pointers to 8 HARQ processes for the ULSCH
LTE_UL_eNB_HARQ_t *harq_processes[8];
/// Concatenated "e"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18)
int16_t e[MAX_NUM_CHANNEL_BITS];
/// Temporary h sequence to flag PUSCH_x/PUSCH_y symbols which are not scrambled
uint8_t h[MAX_NUM_CHANNEL_BITS];
/// Maximum number of HARQ rounds (for definition see 36-212 V8.6 2009-03, p.17)
uint8_t Mdlharq;
/// Maximum number of iterations used in eNB turbo decoder
uint8_t max_turbo_iterations;
/// CQI CRC status
uint8_t cqi_crc_status;
/// Pointer to CQI data
uint8_t o[MAX_CQI_BYTES];
/// Format of CQI data
UCI_format_t uci_format;
/// Length of CQI data under RI=1 assumption(bits)
uint8_t Or1;
/// Length of CQI data under RI=2 assumption(bits)
uint8_t Or2;
/// Rank information
uint8_t o_RI[2];
/// Length of rank information (bits)
uint8_t O_RI;
/// Pointer to ACK
uint8_t o_ACK[4];
/// ACK/NAK Bundling flag
uint8_t bundling;
/// "q" sequences for CQI/PMI (for definition see 36-212 V8.6 2009-03, p.27)
int8_t q[MAX_CQI_PAYLOAD];
/// number of coded CQI bits after interleaving
uint8_t o_RCC;
/// coded and interleaved CQI bits
int8_t o_w[(MAX_CQI_BITS+8)*3];
/// coded CQI bits
int8_t o_d[96+((MAX_CQI_BITS+8)*3)];
/// coded ACK bits
int16_t q_ACK[MAX_ACK_PAYLOAD];
/// coded RI bits
int16_t q_RI[MAX_RI_PAYLOAD];
/// beta_offset_cqi times 8
uint16_t beta_offset_cqi_times8;
/// beta_offset_ri times 8
......
......@@ -880,8 +880,9 @@ int dlsch_modulation(mod_sym_t **txdataF,
int16_t amp_rho_a, amp_rho_b;
int16_t qam16_table_a[4],qam64_table_a[8],qam16_table_b[4],qam64_table_b[8];
int16_t *qam_table_s;
#ifdef DEBUG_DLSCH_MODULATION
uint8_t Nl = dlsch->harq_processes[harq_pid]->Nl;
#endif
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_MODULATION, VCD_FUNCTION_IN);
nsymb = (frame_parms->Ncp==0) ? 14:12;
......
......@@ -1283,6 +1283,9 @@ void rx_phich(PHY_VARS_UE *phy_vars_ue,
// ulsch->harq_processes[harq_pid]->Ndi = 0;
ulsch->harq_processes[harq_pid]->round++;
ulsch->harq_processes[harq_pid]->rvidx = rv_table[ulsch->harq_processes[harq_pid]->round&3];
ulsch->O_RI = 0;
ulsch->O = 0;
ulsch->uci_format = HLC_subband_cqi_nopmi;
}
......@@ -1406,6 +1409,11 @@ void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB,
// ulsch_eNB[UE_id]->harq_processes[harq_pid]->Ndi = 0;
// ulsch_eNB[UE_id]->harq_processes[harq_pid]->round++; //this is already done in phy_procedures
ulsch_eNB[UE_id]->harq_processes[harq_pid]->rvidx = rv_table[ulsch_eNB[UE_id]->harq_processes[harq_pid]->round&3];
ulsch_eNB[UE_id]->harq_processes[harq_pid]->O_RI = 0;
ulsch_eNB[UE_id]->harq_processes[harq_pid]->Or2 = 0;
ulsch_eNB[UE_id]->harq_processes[harq_pid]->Or1 = 0;//sizeof_HLC_subband_cqi_nopmi_5MHz;
ulsch_eNB[UE_id]->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_nopmi;
}
else {
LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d PHICH ACK (no format0 DCI) Clearing subframe_scheduling_flag, setting round to 0\n",
......
......@@ -120,14 +120,14 @@ int generate_eNB_ulsch_params_from_rar(unsigned char *rar_pdu,
cqireq = rar[3]&1;
if (cqireq==1){
ulsch->Or2 = sizeof_wideband_cqi_rank2_2A_5MHz;
ulsch->Or1 = sizeof_wideband_cqi_rank1_2A_5MHz;
ulsch->O_RI = 1;
ulsch->harq_processes[harq_pid]->Or2 = sizeof_wideband_cqi_rank2_2A_5MHz;
ulsch->harq_processes[harq_pid]->Or1 = sizeof_wideband_cqi_rank1_2A_5MHz;
ulsch->harq_processes[harq_pid]->O_RI = 1;
}
else{
ulsch->O_RI = 0;//1;
ulsch->Or2 = 0;
ulsch->Or1 = 0;
ulsch->harq_processes[harq_pid]->O_RI = 0;//1;
ulsch->harq_processes[harq_pid]->Or2 = 0;
ulsch->harq_processes[harq_pid]->Or1 = 0;
}
ulsch->harq_processes[harq_pid]->O_ACK = 0;//2;
......@@ -136,7 +136,7 @@ int generate_eNB_ulsch_params_from_rar(unsigned char *rar_pdu,
ulsch->beta_offset_harqack_times8 = 16;
ulsch->Nsymb_pusch = 12-(frame_parms->Ncp<<1);
ulsch->harq_processes[harq_pid]->Nsymb_pusch = 12-(frame_parms->Ncp<<1);
ulsch->rnti = (((uint16_t)rar[4])<<8)+rar[5];
if (ulsch->harq_processes[harq_pid]->round == 0) {
ulsch->harq_processes[harq_pid]->status = ACTIVE;
......@@ -160,8 +160,8 @@ int generate_eNB_ulsch_params_from_rar(unsigned char *rar_pdu,
msg("ulsch ra (eNB): round %d\n",ulsch->harq_processes[harq_pid]->round);
msg("ulsch ra (eNB): TBS %d\n",ulsch->harq_processes[harq_pid]->TBS);
msg("ulsch ra (eNB): mcs %d\n",ulsch->harq_processes[harq_pid]->mcs);
msg("ulsch ra (eNB): Or1 %d\n",ulsch->Or1);
msg("ulsch ra (eNB): ORI %d\n",ulsch->O_RI);
msg("ulsch ra (eNB): Or1 %d\n",ulsch->harq_processes[harq_pid]->Or1);
msg("ulsch ra (eNB): ORI %d\n",ulsch->harq_processes[harq_pid]->O_RI);
#endif
return(0);
}
......
......@@ -291,7 +291,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
Q_m = get_Qm_ul(ulsch->harq_processes[harq_pid]->mcs);
G = nb_rb * (12 * Q_m) * ulsch->Nsymb_pusch;
G = nb_rb * (12 * Q_m) * ulsch->harq_processes[harq_pid]->Nsymb_pusch;
#ifdef DEBUG_ULSCH_DECODING
......@@ -300,7 +300,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
ulsch->harq_processes[harq_pid]->round,
ulsch->harq_processes[harq_pid]->rvidx,
ulsch->harq_processes[harq_pid]->mcs,
ulsch->O_RI,
ulsch->harq_processes[harq_pid]->O_RI,
ulsch->harq_processes[harq_pid]->O_ACK,
G,
subframe);
......@@ -338,7 +338,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
ulsch->harq_processes[harq_pid]->round,
ulsch->harq_processes[harq_pid]->rvidx,
ulsch->harq_processes[harq_pid]->mcs,
ulsch->O_RI,
ulsch->harq_processes[harq_pid]->O_RI,
ulsch->harq_processes[harq_pid]->O_ACK,
G,
subframe);
......@@ -347,7 +347,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
}
// Compute Q_ri
Qprime = ulsch->O_RI*ulsch->harq_processes[harq_pid]->Msc_initial*ulsch->harq_processes[harq_pid]->Nsymb_initial * ulsch->beta_offset_ri_times8;
Qprime = ulsch->harq_processes[harq_pid]->O_RI*ulsch->harq_processes[harq_pid]->Msc_initial*ulsch->harq_processes[harq_pid]->Nsymb_initial * ulsch->beta_offset_ri_times8;
if (Qprime > 0 ) {
if ((Qprime % (8*sumKr)) > 0)
......@@ -383,12 +383,12 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
Qprime_ACK,ulsch->harq_processes[harq_pid]->Msc_initial,ulsch->harq_processes[harq_pid]->Nsymb_initial,sumKr);
#endif
// Compute Q_cqi
if (ulsch->Or1 < 12)
if (ulsch->harq_processes[harq_pid]->Or1 < 12)
L=0;
else
L=8;
if (ulsch->Or1 > 0)
Qprime = (ulsch->Or1 + L) * ulsch->harq_processes[harq_pid]->Msc_initial*ulsch->harq_processes[harq_pid]->Nsymb_initial * ulsch->beta_offset_cqi_times8;
if (ulsch->harq_processes[harq_pid]->Or1 > 0)
Qprime = (ulsch->harq_processes[harq_pid]->Or1 + L) * ulsch->harq_processes[harq_pid]->Msc_initial*ulsch->harq_processes[harq_pid]->Nsymb_initial * ulsch->beta_offset_cqi_times8;
else
Qprime=0;
......@@ -399,16 +399,16 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
Qprime = Qprime/(8*sumKr);
}
G = nb_rb * (12 * Q_m) * (ulsch->Nsymb_pusch);
G = nb_rb * (12 * Q_m) * (ulsch->harq_processes[harq_pid]->Nsymb_pusch);
if (Qprime > (G - ulsch->O_RI))
Qprime = G - ulsch->O_RI;
if (Qprime > (G - ulsch->harq_processes[harq_pid]->O_RI))
Qprime = G - ulsch->harq_processes[harq_pid]->O_RI;
Q_CQI = Q_m * Qprime;
//#ifdef DEBUG_ULSCH_DECODING
LOG_D(PHY,"ulsch_decoding: G %d, Q_RI %d, Q_CQI %d (L %d, Or1 %d) O_ACK %d\n",G,Q_RI,Q_CQI,L,ulsch->Or1,ulsch->harq_processes[harq_pid]->O_ACK);
LOG_D(PHY,"ulsch_decoding: G %d, Q_RI %d, Q_CQI %d (L %d, Or1 %d) O_ACK %d\n",G,Q_RI,Q_CQI,L,ulsch->harq_processes[harq_pid]->Or1,ulsch->harq_processes[harq_pid]->O_ACK);
//#endif
Qprime_CQI = Qprime;
......@@ -425,7 +425,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
// Demultiplexing/Deinterleaving of PUSCH/ACK/RI/CQI
Hpp = Hprime + Qprime_RI;
Cmux = ulsch->Nsymb_pusch;
Cmux = ulsch->harq_processes[harq_pid]->Nsymb_pusch;
// Rmux = Hpp*Q_m/Cmux;
Rmux_prime = Hpp/Cmux;
......@@ -764,17 +764,17 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
}
for (i=0;i<len_ACK;i++)
ulsch->q_ACK[i] = 0;
ulsch->harq_processes[harq_pid]->q_ACK[i] = 0;
for (i=0;i<Qprime_ACK;i++) {
r = Rmux_prime -1 - (i>>2);
for (q=0;q<Q_m;q++) {
if (y[q+(Q_m*((r*Cmux) + columnset[j]))]!=0)
ulsch->q_ACK[(q+(Q_m*i))%len_ACK] += y[q+(Q_m*((r*Cmux) + columnset[j]))];
ulsch->harq_processes[harq_pid]->q_ACK[(q+(Q_m*i))%len_ACK] += y[q+(Q_m*((r*Cmux) + columnset[j]))];
#ifdef DEBUG_ULSCH_DECODING
// LOG_D(PHY,"ACK %d => %d (%d,%d,%d)\n",(q+(Q_m*i))%len_ACK,ulsch->q_ACK[(q+(Q_m*i))%len_ACK],q+(Q_m*((r*Cmux) + columnset[j])),r,columnset[j]);
printf("ACK %d => %d (%d,%d,%d)\n",(q+(Q_m*i))%len_ACK,ulsch->q_ACK[(q+(Q_m*i))%len_ACK],q+(Q_m*((r*Cmux) + columnset[j])),r,columnset[j]);
// LOG_D(PHY,"ACK %d => %d (%d,%d,%d)\n",(q+(Q_m*i))%len_ACK,ulsch->harq_processes[harq_pid]->q_ACK[(q+(Q_m*i))%len_ACK],q+(Q_m*((r*Cmux) + columnset[j])),r,columnset[j]);
printf("ACK %d => %d (%d,%d,%d)\n",(q+(Q_m*i))%len_ACK,ulsch->harq_processes[harq_pid]->q_ACK[(q+(Q_m*i))%len_ACK],q+(Q_m*((r*Cmux) + columnset[j])),r,columnset[j]);
#endif
y[q+(Q_m*((r*Cmux) + columnset[j]))]=0; // NULL LLRs in ACK positions
}
......@@ -784,7 +784,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
// RI BITS
if (ulsch->O_RI == 1) {
if (ulsch->harq_processes[harq_pid]->O_RI == 1) {
switch (Q_m) {
case 2:
len_RI=2;
......@@ -798,13 +798,13 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
}
}
if (ulsch->O_RI > 1) {
if (ulsch->harq_processes[harq_pid]->O_RI > 1) {
LOG_E(PHY,"ulsch_decoding: FATAL, RI cannot be more than 1 bit yet\n");
return(-1);
}
for (i=0;i<len_RI;i++)
ulsch->q_RI[i] = 0;
ulsch->harq_processes[harq_pid]->q_RI[i] = 0;
if (frame_parms->Ncp == 0)
columnset = cs_ri_normal;
......@@ -814,7 +814,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
for (i=0;i<Qprime_RI;i++) {
r = Rmux_prime -1 - (i>>2);
for (q=0;q<Q_m;q++)
ulsch->q_RI[(q+(Q_m*i))%len_RI] += y[q+(Q_m*((r*Cmux) + columnset[j]))];
ulsch->harq_processes[harq_pid]->q_RI[(q+(Q_m*i))%len_RI] += y[q+(Q_m*((r*Cmux) + columnset[j]))];
ytag[(r*Cmux) + columnset[j]] = LTE_NULL;
j=(j+3)&3;
}
......@@ -838,11 +838,11 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
for (q=0;q<Q_m;q++) {
ys = y[q+(Q_m*((r*Cmux)+j))];
if (ys>127)
ulsch->q[q+(Q_m*i)] = 127;
ulsch->harq_processes[harq_pid]->q[q+(Q_m*i)] = 127;
else if (ys<-128)
ulsch->q[q+(Q_m*i)] = -128;
ulsch->harq_processes[harq_pid]->q[q+(Q_m*i)] = -128;
else
ulsch->q[q+(Q_m*i)] = ys;
ulsch->harq_processes[harq_pid]->q[q+(Q_m*i)] = ys;
#ifdef DEBUG_ULSCH_DECODING
msg("ulsch_decoding.c: CQI %d, r %d, j %d, y[%d] %d\n",q+(Q_m*i),r,j, q+(Q_m*((r*Cmux) + j)),ys);
#endif
......@@ -854,11 +854,11 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
// ys = y[q+(Q_m*((r*Cmux)+j))];
ys = y[q+j2];
if (ys>127)
ulsch->q[q+(Q_m*i)] = 127;
ulsch->harq_processes[harq_pid]->q[q+(Q_m*i)] = 127;
else if (ys<-128)
ulsch->q[q+(Q_m*i)] = -128;
ulsch->harq_processes[harq_pid]->q[q+(Q_m*i)] = -128;
else
ulsch->q[q+(Q_m*i)] = ys;
ulsch->harq_processes[harq_pid]->q[q+(Q_m*i)] = ys;
#ifdef DEBUG_ULSCH_DECODING
LOG_D(PHY,"ulsch_decoding.c: CQI %d, q %d, y[%d] %d\n",q+(Q_m*i),q,j2, q+j2,ys);
#endif
......@@ -873,8 +873,8 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
for (iprime=0;iprime<(Hprime-Qprime_CQI)<<1;) {
while (ytag[j]==LTE_NULL) { j++;j2+=2; }
ulsch->e[iprime++] = y[j2++];
ulsch->e[iprime++] = y[j2++];
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++];
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++];
#ifdef DEBUG_ULSCH_DECODING
// msg("ulsch_decoding.c: e %d, r %d, j %d, y[%d] %d\n",g,r,j,q+(Q_m*((r*Cmux) + j)),y[q+(Q_m*((r*Cmux)+j))]);
#endif
......@@ -886,10 +886,10 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
for (iprime=0;iprime<(Hprime-Qprime_CQI)<<2;) {
while (ytag[j]==LTE_NULL) { j++;j2+=4; }
ulsch->e[iprime++] = y[j2++];
ulsch->e[iprime++] = y[j2++];
ulsch->e[iprime++] = y[j2++];
ulsch->e[iprime++] = y[j2++];
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++];
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++];
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++];
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++];
#ifdef DEBUG_ULSCH_DECODING
// msg("ulsch_decoding.c: e %d, r %d, j %d, y[%d] %d\n",g,r,j,q+(Q_m*((r*Cmux) + j)),y[q+(Q_m*((r*Cmux)+j))]);
#endif
......@@ -900,12 +900,12 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
for (iprime=0;iprime<(Hprime-Qprime_CQI)*6;) {
while (ytag[j]==LTE_NULL) { j++;j2+=6; }
ulsch->e[iprime++] = y[j2++];
ulsch->e[iprime++] = y[j2++];
ulsch->e[iprime++] = y[j2++];
ulsch->e[iprime++] = y[j2++];
ulsch->e[iprime++] = y[j2++];
ulsch->e[iprime++] = y[j2++];
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++];
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++];
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++];
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++];
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++];
ulsch->harq_processes[harq_pid]->e[iprime++] = y[j2++];
#ifdef DEBUG_ULSCH_DECODING
// msg("ulsch_decoding.c: e %d, r %d, j %d, y[%d] %d\n",g,r,j,q+(Q_m*((r*Cmux) + j)),y[q+(Q_m*((r*Cmux)+j))]);
#endif
......@@ -933,11 +933,11 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
for (q=0;q<Q_m;q++) {
ys = y[q+(Q_m*((r*Cmux)+j))];
if (ys>127)
ulsch->q[q+(Q_m*i)] = 127;
ulsch->harq_processes[harq_pid]->q[q+(Q_m*i)] = 127;
else if (ys<-128)
ulsch->q[q+(Q_m*i)] = -128;
ulsch->harq_processes[harq_pid]->q[q+(Q_m*i)] = -128;
else
ulsch->q[q+(Q_m*i)] = ys;
ulsch->harq_processes[harq_pid]->q[q+(Q_m*i)] = ys;
#ifdef DEBUG_ULSCH_DECODING
msg("ulsch_decoding.c: CQI %d, r %d, j %d, y[%d] %d\n",q+(Q_m*i),r,j, q+(Q_m*((r*Cmux) + j)),ys);
#endif
......@@ -969,85 +969,85 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
ulsch->bundling,Nbundled,wACK_idx);
#endif
if (ulsch->harq_processes[harq_pid]->O_ACK == 1) {
ulsch->q_ACK[0] *= wACK_RX[wACK_idx][0];
ulsch->q_ACK[0] += (ulsch->bundling==0) ? ulsch->q_ACK[1]*wACK_RX[wACK_idx][0] : ulsch->q_ACK[1]*wACK_RX[wACK_idx][1];
ulsch->harq_processes[harq_pid]->q_ACK[0] *= wACK_RX[wACK_idx][0];
ulsch->harq_processes[harq_pid]->q_ACK[0] += (ulsch->bundling==0) ? ulsch->harq_processes[harq_pid]->q_ACK[1]*wACK_RX[wACK_idx][0] : ulsch->harq_processes[harq_pid]->q_ACK[1]*wACK_RX[wACK_idx][1];
if (ulsch->q_ACK[0] < 0)
ulsch->o_ACK[0] = 0;
if (ulsch->harq_processes[harq_pid]->q_ACK[0] < 0)
ulsch->harq_processes[harq_pid]->o_ACK[0] = 0;
else
ulsch->o_ACK[0] = 1;
ulsch->harq_processes[harq_pid]->o_ACK[0] = 1;
#ifdef DEBUG_ULSCH_DECODING
LOG_D(PHY,"ulsch_decoding.c: ulsch_q_ACK[0] %d (%d,%d)\n",ulsch->q_ACK[0],wACK_RX[wACK_idx][0],wACK_RX[wACK_idx][1]);
LOG_D(PHY,"ulsch_decoding.c: ulsch_q_ACK[0] %d (%d,%d)\n",ulsch->harq_processes[harq_pid]->q_ACK[0],wACK_RX[wACK_idx][0],wACK_RX[wACK_idx][1]);
#endif
}
if (ulsch->harq_processes[harq_pid]->O_ACK == 2) {
switch (Q_m) {
case 2:
ulsch->q_ACK[0] = ulsch->q_ACK[0]*wACK_RX[wACK_idx][0] + ulsch->q_ACK[3]*wACK_RX[wACK_idx][1];
ulsch->q_ACK[1] = ulsch->q_ACK[1]*wACK_RX[wACK_idx][0] + ulsch->q_ACK[4]*wACK_RX[wACK_idx][1];
ulsch->q_ACK[2] = ulsch->q_ACK[2]*wACK_RX[wACK_idx][0] + ulsch->q_ACK[5]*wACK_RX[wACK_idx][1];
ulsch->harq_processes[harq_pid]->q_ACK[0] = ulsch->harq_processes[harq_pid]->q_ACK[0]*wACK_RX[wACK_idx][0] + ulsch->harq_processes[harq_pid]->q_ACK[3]*wACK_RX[wACK_idx][1];
ulsch->harq_processes[harq_pid]->q_ACK[1] = ulsch->harq_processes[harq_pid]->q_ACK[1]*wACK_RX[wACK_idx][0] + ulsch->harq_processes[harq_pid]->q_ACK[4]*wACK_RX[wACK_idx][1];
ulsch->harq_processes[harq_pid]->q_ACK[2] = ulsch->harq_processes[harq_pid]->q_ACK[2]*wACK_RX[wACK_idx][0] + ulsch->harq_processes[harq_pid]->q_ACK[5]*wACK_RX[wACK_idx][1];
break;
case 4:
ulsch->q_ACK[0] = ulsch->q_ACK[0]*wACK_RX[wACK_idx][0] + ulsch->q_ACK[5]*wACK_RX[wACK_idx][1];
ulsch->q_ACK[1] = ulsch->q_ACK[1]*wACK_RX[wACK_idx][0] + ulsch->q_ACK[8]*wACK_RX[wACK_idx][1];
ulsch->q_ACK[2] = ulsch->q_ACK[4]*wACK_RX[wACK_idx][0] + ulsch->q_ACK[9]*wACK_RX[wACK_idx][1];
ulsch->harq_processes[harq_pid]->q_ACK[0] = ulsch->harq_processes[harq_pid]->q_ACK[0]*wACK_RX[wACK_idx][0] + ulsch->harq_processes[harq_pid]->q_ACK[5]*wACK_RX[wACK_idx][1];
ulsch->harq_processes[harq_pid]->q_ACK[1] = ulsch->harq_processes[harq_pid]->q_ACK[1]*wACK_RX[wACK_idx][0] + ulsch->harq_processes[harq_pid]->q_ACK[8]*wACK_RX[wACK_idx][1];
ulsch->harq_processes[harq_pid]->q_ACK[2] = ulsch->harq_processes[harq_pid]->q_ACK[4]*wACK_RX[wACK_idx][0] + ulsch->harq_processes[harq_pid]->q_ACK[9]*wACK_RX[wACK_idx][1];
break;
case 6:
ulsch->q_ACK[0] = ulsch->q_ACK[0]*wACK_RX[wACK_idx][0] + ulsch->q_ACK[7]*wACK_RX[wACK_idx][1];
ulsch->q_ACK[1] = ulsch->q_ACK[1]*wACK_RX[wACK_idx][0] + ulsch->q_ACK[12]*wACK_RX[wACK_idx][1];
ulsch->q_ACK[2] = ulsch->q_ACK[6]*wACK_RX[wACK_idx][0] + ulsch->q_ACK[13]*wACK_RX[wACK_idx][1];
ulsch->harq_processes[harq_pid]->q_ACK[0] = ulsch->harq_processes[harq_pid]->q_ACK[0]*wACK_RX[wACK_idx][0] + ulsch->harq_processes[harq_pid]->q_ACK[7]*wACK_RX[wACK_idx][1];
ulsch->harq_processes[harq_pid]->q_ACK[1] = ulsch->harq_processes[harq_pid]->q_ACK[1]*wACK_RX[wACK_idx][0] + ulsch->harq_processes[harq_pid]->q_ACK[12]*wACK_RX[wACK_idx][1];
ulsch->harq_processes[harq_pid]->q_ACK[2] = ulsch->harq_processes[harq_pid]->q_ACK[6]*wACK_RX[wACK_idx][0] + ulsch->harq_processes[harq_pid]->q_ACK[13]*wACK_RX[wACK_idx][1];
break;
}
ulsch->o_ACK[0] = 1;
ulsch->o_ACK[1] = 1;
metric = ulsch->q_ACK[0]+ulsch->q_ACK[1]-ulsch->q_ACK[2];
metric_new = -ulsch->q_ACK[0]+ulsch->q_ACK[1]+ulsch->q_ACK[2];
ulsch->harq_processes[harq_pid]->o_ACK[0] = 1;
ulsch->harq_processes[harq_pid]->o_ACK[1] = 1;
metric = ulsch->harq_processes[harq_pid]->q_ACK[0]+ulsch->harq_processes[harq_pid]->q_ACK[1]-ulsch->harq_processes[harq_pid]->q_ACK[2];
metric_new = -ulsch->harq_processes[harq_pid]->q_ACK[0]+ulsch->harq_processes[harq_pid]->q_ACK[1]+ulsch->harq_processes[harq_pid]->q_ACK[2];
if (metric_new > metric) {
ulsch->o_ACK[0]=0;
ulsch->o_ACK[1]=1;
ulsch->harq_processes[harq_pid]->o_ACK[0]=0;
ulsch->harq_processes[harq_pid]->o_ACK[1]=1;
metric = metric_new;
}
metric_new = ulsch->q_ACK[0]-ulsch->q_ACK[1]+ulsch->q_ACK[2];
metric_new = ulsch->harq_processes[harq_pid]->q_ACK[0]-ulsch->harq_processes[harq_pid]->q_ACK[1]+ulsch->harq_processes[harq_pid]->q_ACK[2];
if (metric_new > metric) {
ulsch->o_ACK[0] = 1;
ulsch->o_ACK[1] = 0;
ulsch->harq_processes[harq_pid]->o_ACK[0] = 1;
ulsch->harq_processes[harq_pid]->o_ACK[1] = 0;
metric = metric_new;
}
metric_new = -ulsch->q_ACK[0]-ulsch->q_ACK[1]-ulsch->q_ACK[2];
metric_new = -ulsch->harq_processes[harq_pid]->q_ACK[0]-ulsch->harq_processes[harq_pid]->q_ACK[1]-ulsch->harq_processes[harq_pid]->q_ACK[2];
if (metric_new > metric) {
ulsch->o_ACK[0] = 0;
ulsch->o_ACK[1] = 0;
ulsch->harq_processes[harq_pid]->o_ACK[0] = 0;
ulsch->harq_processes[harq_pid]->o_ACK[1] = 0;
metric = metric_new;
}
}
#ifdef DEBUG_ULSCH_DECODING
for (i=0;i<ulsch->harq_processes[harq_pid]->O_ACK;i++)
LOG_D(PHY,"ulsch_decoding: O_ACK[%d] %d, q_ACK => (%d,%d,%d)\n",i,ulsch->o_ACK[i],ulsch->q_ACK[0],ulsch->q_ACK[1],ulsch->q_ACK[2]);
for (i=0;i<ulsch->harq_processes[harq_pid]->harq_processes[harq_pid]->O_ACK;i++)
LOG_D(PHY,"ulsch_decoding: O_ACK[%d] %d, q_ACK => (%d,%d,%d)\n",i,ulsch->harq_processes[harq_pid]->o_ACK[i],ulsch->harq_processes[harq_pid]->q_ACK[0],ulsch->harq_processes[harq_pid]->q_ACK[1],ulsch->harq_processes[harq_pid]->q_ACK[2]);
#endif
// RI
if ((ulsch->O_RI == 1) && (Qprime_RI > 0)) {
ulsch->o_RI[0] = ((ulsch->q_RI[0] + ulsch->q_RI[Q_m/2]) > 0) ? 0 : 1;
if ((ulsch->harq_processes[harq_pid]->O_RI == 1) && (Qprime_RI > 0)) {
ulsch->harq_processes[harq_pid]->o_RI[0] = ((ulsch->harq_processes[harq_pid]->q_RI[0] + ulsch->harq_processes[harq_pid]->q_RI[Q_m/2]) > 0) ? 0 : 1;
}
#ifdef DEBUG_ULSCH_DECODING
if (Qprime_RI > 0) {
for (i=0;i<2*ulsch->O_RI;i++)
LOG_D(PHY,"ulsch_decoding: q_RI[%d] %d\n",i,ulsch->q_RI[i]);
for (i=0;i<2*ulsch->harq_processes[harq_pid]->O_RI;i++)
LOG_D(PHY,"ulsch_decoding: q_RI[%d] %d\n",i,ulsch->harq_processes[harq_pid]->q_RI[i]);
}
if (Qprime_CQI > 0) {
for (i=0;i<ulsch->O_RI;i++)
LOG_D(PHY,"ulsch_decoding: O_RI[%d] %d\n",i,ulsch->o_RI[i]);
for (i=0;i<ulsch->harq_processes[harq_pid]->O_RI;i++)
LOG_D(PHY,"ulsch_decoding: O_RI[%d] %d\n",i,ulsch->harq_processes[harq_pid]->o_RI[i]);
}
#endif
......@@ -1055,58 +1055,58 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
// CQI
if (Qprime_CQI>0) {
memset((void *)&dummy_w_cc[0],0,3*(ulsch->Or1+8+32));
memset((void *)&dummy_w_cc[0],0,3*(ulsch->harq_processes[harq_pid]->Or1+8+32));
O_RCC = generate_dummy_w_cc(ulsch->Or1+8,
O_RCC = generate_dummy_w_cc(ulsch->harq_processes[harq_pid]->Or1+8,
&dummy_w_cc[0]);
lte_rate_matching_cc_rx(O_RCC,
Q_CQI,
ulsch->o_w,
ulsch->harq_processes[harq_pid]->o_w,
dummy_w_cc,
ulsch->q);
ulsch->harq_processes[harq_pid]->q);
sub_block_deinterleaving_cc((unsigned int)(ulsch->Or1+8),
&ulsch->o_d[96],
&ulsch->o_w[0]);
sub_block_deinterleaving_cc((unsigned int)(ulsch->harq_processes[harq_pid]->Or1+8),
&ulsch->harq_processes[harq_pid]->o_d[96],
&ulsch->harq_processes[harq_pid]->o_w[0]);
memset(o_flip,0,1+((8+ulsch->Or1)/8));
phy_viterbi_lte_sse2(ulsch->o_d+96,o_flip,8+ulsch->Or1);
memset(o_flip,0,1+((8+ulsch->harq_processes[harq_pid]->Or1)/8));
phy_viterbi_lte_sse2(ulsch->harq_processes[harq_pid]->o_d+96,o_flip,8+ulsch->harq_processes[harq_pid]->Or1);
if (extract_cqi_crc(o_flip,ulsch->Or1) == (crc8(o_flip,ulsch->Or1)>>24))
ulsch->cqi_crc_status = 1;
if (extract_cqi_crc(o_flip,ulsch->harq_processes[harq_pid]->Or1) == (crc8(o_flip,ulsch->harq_processes[harq_pid]->Or1)>>24))
ulsch->harq_processes[harq_pid]->cqi_crc_status = 1;
else
ulsch->cqi_crc_status = 0;
ulsch->harq_processes[harq_pid]->cqi_crc_status = 0;
//printf("crc(cqi) rx: %x\n",(crc8(o_flip,ulsch->Or1)>>24));
if (ulsch->Or1<=32) {
ulsch->o[3] = o_flip[0] ;
ulsch->o[2] = o_flip[1] ;
ulsch->o[1] = o_flip[2] ;
ulsch->o[0] = o_flip[3] ;
if (ulsch->harq_processes[harq_pid]->Or1<=32) {
ulsch->harq_processes[harq_pid]->o[3] = o_flip[0] ;
ulsch->harq_processes[harq_pid]->o[2] = o_flip[1] ;
ulsch->harq_processes[harq_pid]->o[1] = o_flip[2] ;
ulsch->harq_processes[harq_pid]->o[0] = o_flip[3] ;
}
else {
ulsch->o[7] = o_flip[0] ;
ulsch->o[6] = o_flip[1] ;
ulsch->o[5] = o_flip[2] ;
ulsch->o[4] = o_flip[3] ;
ulsch->o[3] = o_flip[4] ;
ulsch->o[2] = o_flip[5] ;
ulsch->o[1] = o_flip[6] ;
ulsch->o[0] = o_flip[7] ;
ulsch->harq_processes[harq_pid]->o[7] = o_flip[0] ;
ulsch->harq_processes[harq_pid]->o[6] = o_flip[1] ;
ulsch->harq_processes[harq_pid]->o[5] = o_flip[2] ;
ulsch->harq_processes[harq_pid]->o[4] = o_flip[3] ;
ulsch->harq_processes[harq_pid]->o[3] = o_flip[4] ;
ulsch->harq_processes[harq_pid]->o[2] = o_flip[5] ;
ulsch->harq_processes[harq_pid]->o[1] = o_flip[6] ;
ulsch->harq_processes[harq_pid]->o[0] = o_flip[7] ;
}
#ifdef DEBUG_ULSCH_DECODING
LOG_D(PHY,"ulsch_decoding: Or1=%d\n",ulsch->Or1);
for (i=0;i<1+((8+ulsch->Or1)/8);i++)
msg("ulsch_decoding: O[%d] %d\n",i,ulsch->o[i]);
if (ulsch->cqi_crc_status == 1)
msg("RX CQI CRC OK (%x)\n",extract_cqi_crc(o_flip,ulsch->Or1));
for (i=0;i<1+((8+ulsch->harq_processes[harq_pid]->Or1)/8);i++)
msg("ulsch_decoding: O[%d] %d\n",i,ulsch->harq_processes[harq_pid]->o[i]);
if (ulsch->harq_processes[harq_pid]->cqi_crc_status == 1)
msg("RX CQI CRC OK (%x)\n",extract_cqi_crc(o_flip,ulsch->harq_processes[harq_pid]->Or1));
else
msg("RX CQI CRC NOT OK (%x)\n",extract_cqi_crc(o_flip,ulsch->Or1));
msg("RX CQI CRC NOT OK (%x)\n",extract_cqi_crc(o_flip,ulsch->harq_processes[harq_pid]->Or1));
#endif
}
......@@ -1163,7 +1163,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
G,
ulsch->harq_processes[harq_pid]->w[r],
(uint8_t*) &dummy_w[r][0],
ulsch->e+r_offset,
ulsch->harq_processes[harq_pid]->e+r_offset,
ulsch->harq_processes[harq_pid]->C,
NSOFT,
ulsch->Mdlharq,
......@@ -1759,36 +1759,36 @@ uint32_t ulsch_decoding_emul(PHY_VARS_eNB *phy_vars_eNB,
get_ack(&phy_vars_eNB->lte_frame_parms,
PHY_vars_UE_g[UE_id][CC_id]->dlsch_ue[0][0]->harq_ack,
subframe,
phy_vars_eNB->ulsch_eNB[UE_index]->o_ACK);
phy_vars_eNB->ulsch_eNB[UE_index]->harq_processes[harq_pid]->o_ACK);
}else { // get remote UEs' ack
phy_vars_eNB->ulsch_eNB[UE_index]->o_ACK[0] = PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->o_ACK[0];
phy_vars_eNB->ulsch_eNB[UE_index]->o_ACK[1] = PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->o_ACK[1];
phy_vars_eNB->ulsch_eNB[UE_index]->harq_processes[harq_pid]->o_ACK[0] = PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->o_ACK[0];
phy_vars_eNB->ulsch_eNB[UE_index]->harq_processes[harq_pid]->o_ACK[1] = PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->o_ACK[1];
}
// Do abstraction of PUSCH feedback
#ifdef DEBUG_PHY
LOG_D(PHY,"[eNB %d][EMUL] ue index %d UE_id %d: subframe %d : o_ACK (%d %d), cqi (val %d, len %d)\n",
phy_vars_eNB->Mod_id,UE_index, UE_id, subframe,phy_vars_eNB->ulsch_eNB[UE_index]->o_ACK[0],
phy_vars_eNB->ulsch_eNB[UE_index]->o_ACK[1],
phy_vars_eNB->Mod_id,UE_index, UE_id, subframe,phy_vars_eNB->ulsch_eNB[UE_index]->harq_processes[harq_pid]->o_ACK[0],
phy_vars_eNB->ulsch_eNB[UE_index]->harq_processes[harq_pid]->o_ACK[1],
((HLC_subband_cqi_rank1_2A_5MHz *)PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->o)->cqi1,
PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->O);
#endif
phy_vars_eNB->ulsch_eNB[UE_index]->Or1 = PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->O;
phy_vars_eNB->ulsch_eNB[UE_index]->Or2 = PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->O;
phy_vars_eNB->ulsch_eNB[UE_index]->harq_processes[harq_pid]->Or1 = PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->O;
phy_vars_eNB->ulsch_eNB[UE_index]->harq_processes[harq_pid]->Or2 = PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->O;
phy_vars_eNB->ulsch_eNB[UE_index]->uci_format = PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->uci_format;
memcpy(phy_vars_eNB->ulsch_eNB[UE_index]->o,PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->o,MAX_CQI_BYTES);
memcpy(phy_vars_eNB->ulsch_eNB[UE_index]->o_RI,PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->o_RI,2);
phy_vars_eNB->ulsch_eNB[UE_index]->harq_processes[harq_pid]->uci_format = PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->uci_format;
memcpy(phy_vars_eNB->ulsch_eNB[UE_index]->harq_processes[harq_pid]->o,PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->o,MAX_CQI_BYTES);
memcpy(phy_vars_eNB->ulsch_eNB[UE_index]->harq_processes[harq_pid]->o_RI,PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->o_RI,2);
phy_vars_eNB->ulsch_eNB[UE_index]->cqi_crc_status = 1;
phy_vars_eNB->ulsch_eNB[UE_index]->harq_processes[harq_pid]->cqi_crc_status = 1;
return(1);
}
else {
LOG_W(PHY,"[eNB %d] ulsch_decoding_emul abstraction failed for UE %d\n",phy_vars_eNB->Mod_id,UE_index);
phy_vars_eNB->ulsch_eNB[UE_index]->cqi_crc_status = 0;
phy_vars_eNB->ulsch_eNB[UE_index]->harq_processes[harq_pid]->cqi_crc_status = 0;
// retransmission
return(1+phy_vars_eNB->ulsch_eNB[UE_index]->max_turbo_iterations);
......
......@@ -1293,7 +1293,7 @@ void rx_ulsch(PHY_VARS_eNB *phy_vars_eNB,
rx_power_correction = 1;
for (l=0;l<(frame_parms->symbols_per_tti-ulsch[UE_id]->srs_active);l++) {
for (l=0;l<(frame_parms->symbols_per_tti-ulsch[UE_id]->harq_processes[harq_pid]->srs_active);l++) {
#ifdef DEBUG_ULSCH
msg("rx_ulsch : symbol %d (first_rb %d,nb_rb %d), rxdataF %p, rxdataF_ext %p\n",l,
......@@ -1400,7 +1400,7 @@ void rx_ulsch(PHY_VARS_eNB *phy_vars_eNB,
#endif
}
for (l=0;l<frame_parms->symbols_per_tti-ulsch[UE_id]->srs_active;l++) {
for (l=0;l<frame_parms->symbols_per_tti-ulsch[UE_id]->harq_processes[harq_pid]->srs_active;l++) {
if (((frame_parms->Ncp == 0) && ((l==3) || (l==10)))|| // skip pilots
((frame_parms->Ncp == 1) && ((l==2) || (l==8)))) {
......@@ -1505,7 +1505,7 @@ void rx_ulsch(PHY_VARS_eNB *phy_vars_eNB,
llrp = (int16_t*)&eNB_pusch_vars->llr[0];
for (l=0;l<frame_parms->symbols_per_tti-ulsch[UE_id]->srs_active;l++) {
for (l=0;l<frame_parms->symbols_per_tti-ulsch[UE_id]->harq_processes[harq_pid]->srs_active;l++) {
if (((frame_parms->Ncp == 0) && ((l==3) || (l==10)))|| // skip pilots
((frame_parms->Ncp == 1) && ((l==2) || (l==8)))) {
......@@ -1567,7 +1567,7 @@ void dump_ulsch(PHY_VARS_eNB *PHY_vars_eNB,uint8_t sched_subframe, uint8_t UE_id
harq_pid = subframe2harq_pid(&PHY_vars_eNB->lte_frame_parms,PHY_vars_eNB->proc[sched_subframe].frame_rx,subframe);
printf("Dumping ULSCH in subframe %d with harq_pid %d, for NB_rb %d, mcs %d, Qm %d, N_symb %d\n", subframe,harq_pid,PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->nb_rb,PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->mcs,get_Qm_ul(PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->mcs),PHY_vars_eNB->ulsch_eNB[UE_id]->Nsymb_pusch);
printf("Dumping ULSCH in subframe %d with harq_pid %d, for NB_rb %d, mcs %d, Qm %d, N_symb %d\n", subframe,harq_pid,PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->nb_rb,PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->mcs,get_Qm_ul(PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->mcs),PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->Nsymb_pusch);
//#ifndef OAI_EMU
write_output("/tmp/ulsch_d.m","ulsch_dseq",&PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->d[0][96],
PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->Kplus*3,1,0);
......@@ -1590,7 +1590,7 @@ void dump_ulsch(PHY_VARS_eNB *PHY_vars_eNB,uint8_t sched_subframe, uint8_t UE_id
write_output("/tmp/drs_est1.m","drsest1",PHY_vars_eNB->lte_eNB_pusch_vars[UE_id]->drs_ch_estimates[0][1],PHY_vars_eNB->lte_frame_parms.N_RB_UL*12*nsymb,1,1);
write_output("/tmp/ulsch_rxF_comp0.m","ulsch0_rxF_comp0",&PHY_vars_eNB->lte_eNB_pusch_vars[UE_id]->rxdataF_comp[0][0][0],PHY_vars_eNB->lte_frame_parms.N_RB_UL*12*nsymb,1,1);
// write_output("ulsch_rxF_comp1.m","ulsch0_rxF_comp1",&PHY_vars_eNB->lte_eNB_pusch_vars[UE_id]->rxdataF_comp[0][1][0],PHY_vars_eNB->lte_frame_parms.N_RB_UL*12*nsymb,1,1);
write_output("/tmp/ulsch_rxF_llr.m","ulsch_llr",PHY_vars_eNB->lte_eNB_pusch_vars[UE_id]->llr,PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->nb_rb*12*get_Qm_ul(PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->mcs)*PHY_vars_eNB->ulsch_eNB[UE_id]->Nsymb_pusch,1,0);
write_output("/tmp/ulsch_rxF_llr.m","ulsch_llr",PHY_vars_eNB->lte_eNB_pusch_vars[UE_id]->llr,PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->nb_rb*12*get_Qm_ul(PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->mcs)*PHY_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->Nsymb_pusch,1,0);
write_output("/tmp/ulsch_ch_mag.m","ulsch_ch_mag",&PHY_vars_eNB->lte_eNB_pusch_vars[UE_id]->ul_ch_mag[0][0][0],PHY_vars_eNB->lte_frame_parms.N_RB_UL*12*nsymb,1,1);
// write_output("ulsch_ch_mag1.m","ulsch_ch_mag1",&PHY_vars_eNB->lte_eNB_pusch_vars[UE_id]->ul_ch_mag[0][1][0],PHY_vars_eNB->lte_frame_parms.N_RB_UL*12*nsymb,1,1);
//#endif
......
......@@ -2192,14 +2192,15 @@ void process_HARQ_feedback(uint8_t UE_id,
int all_ACKed=1,nb_alloc=0,nb_ACK=0;
int frame = phy_vars_eNB->proc[sched_subframe].frame_rx;
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_rx;
int harq_pid = subframe2harq_pid( &phy_vars_eNB->lte_frame_parms,frame,subframe);
if (phy_vars_eNB->lte_frame_parms.frame_type == 0){ //FDD
if (phy_vars_eNB->lte_frame_parms.frame_type == FDD){ //FDD
subframe_m4 = (subframe<4) ? subframe+6 : subframe-4;
dl_harq_pid[0] = dlsch->harq_ids[subframe_m4];
M=1;
if (pusch_flag == 1)
dlsch_ACK[0] = phy_vars_eNB->ulsch_eNB[(uint8_t)UE_id]->o_ACK[0];
dlsch_ACK[0] = phy_vars_eNB->ulsch_eNB[(uint8_t)UE_id]->harq_processes[harq_pid]->o_ACK[0];
else
dlsch_ACK[0] = pucch_payload[0];
LOG_D(PHY,"[eNB %d] Frame %d: Received ACK/NAK %d for subframe %d\n",phy_vars_eNB->Mod_id,
......@@ -2217,8 +2218,8 @@ void process_HARQ_feedback(uint8_t UE_id,
// otherwise, it depends on how many of the PDSCH in the set are scheduled, we can leave it like this,
// but we have to adapt the code below. For example, if only one out of 2 are scheduled, only 1 bit o_ACK is used
dlsch_ACK[0] = phy_vars_eNB->ulsch_eNB[(uint8_t)UE_id]->o_ACK[0];
dlsch_ACK[1] = (phy_vars_eNB->pucch_config_dedicated[UE_id].tdd_AckNackFeedbackMode == bundling)?phy_vars_eNB->ulsch_eNB[(uint8_t)UE_id]->o_ACK[0]:phy_vars_eNB->ulsch_eNB[(uint8_t)UE_id]->o_ACK[1];
dlsch_ACK[0] = phy_vars_eNB->ulsch_eNB[(uint8_t)UE_id]->harq_processes[harq_pid]->o_ACK[0];
dlsch_ACK[1] = (phy_vars_eNB->pucch_config_dedicated[UE_id].tdd_AckNackFeedbackMode == bundling)?phy_vars_eNB->ulsch_eNB[(uint8_t)UE_id]->harq_processes[harq_pid]->o_ACK[0]:phy_vars_eNB->ulsch_eNB[(uint8_t)UE_id]->harq_processes[harq_pid]->o_ACK[1];
// printf("UE %d: ACK %d,%d\n",UE_id,dlsch_ACK[0],dlsch_ACK[1]);
}
......@@ -2952,8 +2953,8 @@ void phy_procedures_eNB_RX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
phy_vars_eNB->eNB_UE_stats[i].UL_rssi[1],
phy_vars_eNB->PHY_measurements_eNB->n0_power_dB[0],
phy_vars_eNB->PHY_measurements_eNB->n0_power_dB[1],
phy_vars_eNB->ulsch_eNB[i]->o_ACK[0],
phy_vars_eNB->ulsch_eNB[i]->o_ACK[1],
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->o_ACK[0],
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->o_ACK[1],
ret);
#endif //DEBUG_PHY_PROC
/*
......@@ -2989,13 +2990,13 @@ void phy_procedures_eNB_RX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
#endif
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->subframe_scheduling_flag=0;
if (phy_vars_eNB->ulsch_eNB[i]->cqi_crc_status == 1) {
if (phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->cqi_crc_status == 1) {
#ifdef DEBUG_PHY_PROC
//if (((phy_vars_eNB->proc[sched_subframe].frame_tx%10) == 0) || (phy_vars_eNB->proc[sched_subframe].frame_tx < 50))
//print_CQI(phy_vars_eNB->ulsch_eNB[i]->o,phy_vars_eNB->ulsch_eNB[i]->uci_format,0);
#endif
extract_CQI(phy_vars_eNB->ulsch_eNB[i]->o,phy_vars_eNB->ulsch_eNB[i]->uci_format,&phy_vars_eNB->eNB_UE_stats[i], &rnti, &access_mode);
phy_vars_eNB->eNB_UE_stats[i].rank = phy_vars_eNB->ulsch_eNB[i]->o_RI[0];
extract_CQI(phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->o,phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->uci_format,&phy_vars_eNB->eNB_UE_stats[i], &rnti, &access_mode);
phy_vars_eNB->eNB_UE_stats[i].rank = phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->o_RI[0];
}
if (ret == (1+MAX_TURBO_ITERATIONS)) {
......@@ -3060,8 +3061,8 @@ void phy_procedures_eNB_RX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
frame,subframe, i,
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->round-1,
phy_vars_eNB->ulsch_eNB[i]->Mdlharq,
phy_vars_eNB->ulsch_eNB[i]->o_ACK[0],
phy_vars_eNB->ulsch_eNB[i]->o_ACK[1]);
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->o_ACK[0],
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->o_ACK[1]);
/*
LOG_T(PHY,"[eNB] Frame %d, Subframe %d : ULSCH SDU (RX harq_pid %d) %d bytes:\n",frame,subframe,
......@@ -3253,9 +3254,9 @@ void phy_procedures_eNB_RX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
harq_pid,
i,
ret,
phy_vars_eNB->ulsch_eNB[i]->cqi_crc_status,
phy_vars_eNB->ulsch_eNB[i]->o_ACK[0],
phy_vars_eNB->ulsch_eNB[i]->o_ACK[1],
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->cqi_crc_status,
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->o_ACK[0],
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->o_ACK[1],
phy_vars_eNB->eNB_UE_stats[i].ulsch_errors[harq_pid],
phy_vars_eNB->eNB_UE_stats[i].ulsch_decoding_attempts[harq_pid][0]);
#endif
......@@ -3592,13 +3593,13 @@ void phy_procedures_eNB_RX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
&rnti);
}
#endif
if (phy_vars_eNB->ulsch_eNB[i]->cqi_crc_status == 1) {
if (phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->cqi_crc_status == 1) {
#ifdef DEBUG_PHY_PROC
//if (((phy_vars_eNB->proc[sched_subframe].frame_tx%10) == 0) || (phy_vars_eNB->proc[sched_subframe].frame_tx < 50))
// print_CQI(phy_vars_eNB->ulsch_eNB[i]->o,phy_vars_eNB->ulsch_eNB[i]->uci_format,0);
#endif
extract_CQI(phy_vars_eNB->ulsch_eNB[i]->o,phy_vars_eNB->ulsch_eNB[i]->uci_format,&phy_vars_eNB->eNB_UE_stats[i], &rnti, &access_mode);
phy_vars_eNB->eNB_UE_stats[i].rank = phy_vars_eNB->ulsch_eNB[i]->o_RI[0];
extract_CQI(phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->o,phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->uci_format,&phy_vars_eNB->eNB_UE_stats[i], &rnti, &access_mode);
phy_vars_eNB->eNB_UE_stats[i].rank = phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->o_RI[0];
}
/* LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d UE %d harq_pid %d resetting the sched_subframeuling_flag, total cba groups %d %d\n",
phy_vars_eNB->Mod_id,harq_pid,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe,i,harq_pid,
......
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