pucch format 2/2a/2b UE TX
This commit is contained in:
@@ -518,7 +518,8 @@ uint32_t lte_rate_matching_turbo(uint32_t RTC,
|
|||||||
// if (rvidx==3)
|
// if (rvidx==3)
|
||||||
// for (cnt=0;cnt<Ncb;cnt++)
|
// for (cnt=0;cnt<Ncb;cnt++)
|
||||||
// counter_buffer[rvidx][cnt]=0;
|
// counter_buffer[rvidx][cnt]=0;
|
||||||
AssertFatal(Ncb>=(3*RTC<<5),"Exiting, RM condition (Ncb %d, Nir/C %d, Nsoft %d, Kw %d\n",Ncb,Nir/C,Nsoft,3*(RTC<<5));
|
if (Ncb>(3*(RTC<<5)))
|
||||||
|
AssertFatal(1==0,"Exiting, RM condition (Ncb %d, RTC %d, Nir/C %d, Nsoft %d, Kw %d)\n",Ncb,RTC,Nir/C,Nsoft,3*(RTC<<5));
|
||||||
|
|
||||||
|
|
||||||
Gp = G/Nl/Qm;
|
Gp = G/Nl/Qm;
|
||||||
|
|||||||
@@ -1679,6 +1679,7 @@ inline int check_skip_dc(int rb,LTE_DL_FRAME_PARMS *frame_parms) {
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int dlsch_modulation(int32_t **txdataF,
|
int dlsch_modulation(int32_t **txdataF,
|
||||||
int16_t amp,
|
int16_t amp,
|
||||||
uint32_t subframe_offset,
|
uint32_t subframe_offset,
|
||||||
|
|||||||
@@ -319,8 +319,8 @@ void generate_mch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t *a)
|
|||||||
AMP);
|
AMP);
|
||||||
|
|
||||||
|
|
||||||
if (dlsch_encoding(a,
|
if (dlsch_encoding(eNB,
|
||||||
&eNB->frame_parms,
|
a,
|
||||||
1,
|
1,
|
||||||
eNB->dlsch_MCH,
|
eNB->dlsch_MCH,
|
||||||
proc->frame_tx,
|
proc->frame_tx,
|
||||||
|
|||||||
@@ -1709,17 +1709,16 @@ void dlsch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
|||||||
|
|
||||||
void init_ncs_cell(LTE_DL_FRAME_PARMS *frame_parms,uint8_t ncs_cell[20][7]);
|
void init_ncs_cell(LTE_DL_FRAME_PARMS *frame_parms,uint8_t ncs_cell[20][7]);
|
||||||
|
|
||||||
void generate_pucch(int32_t **txdataF,
|
void generate_pucch1x(int32_t **txdataF,
|
||||||
LTE_DL_FRAME_PARMS *frame_parms,
|
LTE_DL_FRAME_PARMS *frame_parms,
|
||||||
uint8_t ncs_cell[20][7],
|
uint8_t ncs_cell[20][7],
|
||||||
PUCCH_FMT_t fmt,
|
PUCCH_FMT_t fmt,
|
||||||
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
|
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
|
||||||
uint16_t n1_pucch,
|
uint16_t n1_pucch,
|
||||||
uint16_t n2_pucch,
|
uint8_t shortened_format,
|
||||||
uint8_t shortened_format,
|
uint8_t *payload,
|
||||||
uint8_t *payload,
|
int16_t amp,
|
||||||
int16_t amp,
|
uint8_t subframe);
|
||||||
uint8_t subframe);
|
|
||||||
|
|
||||||
void generate_pucch_emul(PHY_VARS_UE *phy_vars_ue,
|
void generate_pucch_emul(PHY_VARS_UE *phy_vars_ue,
|
||||||
UE_rxtx_proc_t *proc,
|
UE_rxtx_proc_t *proc,
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
* \warning
|
* \warning
|
||||||
*/
|
*/
|
||||||
#include "PHY/defs.h"
|
#include "PHY/defs.h"
|
||||||
#include "PHY/extern.h"
|
#include "PHY/extern.h"
|
||||||
#include "LAYER2/MAC/extern.h"
|
#include "LAYER2/MAC/extern.h"
|
||||||
|
|
||||||
#include "UTIL/LOG/log.h"
|
#include "UTIL/LOG/log.h"
|
||||||
@@ -97,7 +97,7 @@ void init_ncs_cell(LTE_DL_FRAME_PARMS *frame_parms,uint8_t ncs_cell[20][7])
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_PUCCH_TX
|
#ifdef DEBUG_PUCCH_TX
|
||||||
msg("[PHY] PUCCH ncs_cell init (j %d): Ns %d, l %d => ncs_cell %d\n",j,ns,l,ncs_cell[ns][l]);
|
printf("[PHY] PUCCH ncs_cell init (j %d): Ns %d, l %d => ncs_cell %d\n",j,ns,l,ncs_cell[ns][l]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,17 +123,16 @@ int16_t W3_im[3][6] = {{0 ,0 ,0 },
|
|||||||
|
|
||||||
char pucch_format_string[6][20] = {"format 1\0","format 1a\0","format 1b\0","format 2\0","format 2a\0","format 2b\0"};
|
char pucch_format_string[6][20] = {"format 1\0","format 1a\0","format 1b\0","format 2\0","format 2a\0","format 2b\0"};
|
||||||
|
|
||||||
void generate_pucch(int32_t **txdataF,
|
void generate_pucch1x(int32_t **txdataF,
|
||||||
LTE_DL_FRAME_PARMS *frame_parms,
|
LTE_DL_FRAME_PARMS *frame_parms,
|
||||||
uint8_t ncs_cell[20][7],
|
uint8_t ncs_cell[20][7],
|
||||||
PUCCH_FMT_t fmt,
|
PUCCH_FMT_t fmt,
|
||||||
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
|
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
|
||||||
uint16_t n1_pucch,
|
uint16_t n1_pucch,
|
||||||
uint16_t n2_pucch,
|
uint8_t shortened_format,
|
||||||
uint8_t shortened_format,
|
uint8_t *payload,
|
||||||
uint8_t *payload,
|
int16_t amp,
|
||||||
int16_t amp,
|
uint8_t subframe)
|
||||||
uint8_t subframe)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
uint32_t u,v,n;
|
uint32_t u,v,n;
|
||||||
@@ -152,7 +151,8 @@ void generate_pucch(int32_t **txdataF,
|
|||||||
|
|
||||||
uint8_t deltaPUCCH_Shift = frame_parms->pucch_config_common.deltaPUCCH_Shift;
|
uint8_t deltaPUCCH_Shift = frame_parms->pucch_config_common.deltaPUCCH_Shift;
|
||||||
uint8_t NRB2 = frame_parms->pucch_config_common.nRB_CQI;
|
uint8_t NRB2 = frame_parms->pucch_config_common.nRB_CQI;
|
||||||
uint8_t Ncs1_div_deltaPUCCH_Shift = frame_parms->pucch_config_common.nCS_AN;
|
uint8_t Ncs1 = frame_parms->pucch_config_common.nCS_AN;
|
||||||
|
uint8_t Ncs1_div_deltaPUCCH_Shift = Ncs1/deltaPUCCH_Shift;
|
||||||
|
|
||||||
uint32_t u0 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[subframe<<1]) % 30;
|
uint32_t u0 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[subframe<<1]) % 30;
|
||||||
uint32_t u1 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[1+(subframe<<1)]) % 30;
|
uint32_t u1 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[1+(subframe<<1)]) % 30;
|
||||||
@@ -160,12 +160,12 @@ void generate_pucch(int32_t **txdataF,
|
|||||||
uint32_t v1=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)];
|
uint32_t v1=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)];
|
||||||
|
|
||||||
if ((deltaPUCCH_Shift==0) || (deltaPUCCH_Shift>3)) {
|
if ((deltaPUCCH_Shift==0) || (deltaPUCCH_Shift>3)) {
|
||||||
msg("[PHY] generate_pucch: Illegal deltaPUCCH_shift %d (should be 1,2,3)\n",deltaPUCCH_Shift);
|
printf("[PHY] generate_pucch: Illegal deltaPUCCH_shift %d (should be 1,2,3)\n",deltaPUCCH_Shift);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ncs1_div_deltaPUCCH_Shift > 7) {
|
if (Ncs1_div_deltaPUCCH_Shift > 7) {
|
||||||
msg("[PHY] generate_pucch: Illegal Ncs1_div_deltaPUCCH_Shift %d (should be 0...7)\n",Ncs1_div_deltaPUCCH_Shift);
|
printf("[PHY] generate_pucch: Illegal Ncs1_div_deltaPUCCH_Shift %d (should be 0...7)\n",Ncs1_div_deltaPUCCH_Shift);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ void generate_pucch(int32_t **txdataF,
|
|||||||
Nprime = Nprime_div_deltaPUCCH_Shift * deltaPUCCH_Shift;
|
Nprime = Nprime_div_deltaPUCCH_Shift * deltaPUCCH_Shift;
|
||||||
|
|
||||||
#ifdef DEBUG_PUCCH_TX
|
#ifdef DEBUG_PUCCH_TX
|
||||||
msg("[PHY] PUCCH: cNcs1/deltaPUCCH_Shift %d, Nprime %d, n1_pucch %d\n",thres,Nprime,n1_pucch);
|
printf("[PHY] PUCCH: cNcs1/deltaPUCCH_Shift %d, Nprime %d, n1_pucch %d\n",thres,Nprime,n1_pucch);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
N_UL_symb = (frame_parms->Ncp==0) ? 7 : 6;
|
N_UL_symb = (frame_parms->Ncp==0) ? 7 : 6;
|
||||||
@@ -194,7 +194,7 @@ void generate_pucch(int32_t **txdataF,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_PUCCH_TX
|
#ifdef DEBUG_PUCCH_TX
|
||||||
msg("[PHY] PUCCH: nprime0 %d nprime1 %d, %s, payload (%d,%d)\n",nprime0,nprime1,pucch_format_string[fmt],payload[0],payload[1]);
|
printf("[PHY] PUCCH: nprime0 %d nprime1 %d, %s, payload (%d,%d)\n",nprime0,nprime1,pucch_format_string[fmt],payload[0],payload[1]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
n_oc0 = nprime0/Nprime_div_deltaPUCCH_Shift;
|
n_oc0 = nprime0/Nprime_div_deltaPUCCH_Shift;
|
||||||
@@ -208,7 +208,7 @@ void generate_pucch(int32_t **txdataF,
|
|||||||
n_oc1<<=1;
|
n_oc1<<=1;
|
||||||
|
|
||||||
#ifdef DEBUG_PUCCH_TX
|
#ifdef DEBUG_PUCCH_TX
|
||||||
msg("[PHY] PUCCH: noc0 %d noc11 %d\n",n_oc0,n_oc1);
|
printf("[PHY] PUCCH: noc0 %d noc11 %d\n",n_oc0,n_oc1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nprime=nprime0;
|
nprime=nprime0;
|
||||||
@@ -280,7 +280,7 @@ void generate_pucch(int32_t **txdataF,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_PUCCH_TX
|
#ifdef DEBUG_PUCCH_TX
|
||||||
msg("[PHY] PUCCH: ncs[%d][%d]=%d, W_re %d, W_im %d, S %d, refs %d\n",ns,l,n_cs,W_re,W_im,S,refs);
|
printf("[PHY] PUCCH: ncs[%d][%d]=%d, W_re %d, W_im %d, S %d, refs %d\n",ns,l,n_cs,W_re,W_im,S,refs);
|
||||||
#endif
|
#endif
|
||||||
alpha_ind=0;
|
alpha_ind=0;
|
||||||
// compute output sequence
|
// compute output sequence
|
||||||
@@ -329,15 +329,9 @@ void generate_pucch(int32_t **txdataF,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case pucch_format2:
|
case pucch_format2:
|
||||||
msg("[PHY] PUCCH format 2 not implemented\n");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case pucch_format2a:
|
case pucch_format2a:
|
||||||
msg("[PHY] PUCCH format 2a not implemented\n");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case pucch_format2b:
|
case pucch_format2b:
|
||||||
msg("[PHY] PUCCH format 2b not implemented\n");
|
AssertFatal(1==0,"should not go here\n");
|
||||||
break;
|
break;
|
||||||
} // switch fmt
|
} // switch fmt
|
||||||
} else { // These are PUCCH reference symbols
|
} else { // These are PUCCH reference symbols
|
||||||
@@ -348,7 +342,7 @@ void generate_pucch(int32_t **txdataF,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_PUCCH_TX
|
#ifdef DEBUG_PUCCH_TX
|
||||||
msg("[PHY] PUCCH subframe %d z(%d,%d) => %d,%d, alpha(%d) => %d,%d\n",subframe,l,n,((int16_t *)&zptr[n])[0],((int16_t *)&zptr[n])[1],
|
printf("[PHY] PUCCH subframe %d z(%d,%d) => %d,%d, alpha(%d) => %d,%d\n",subframe,l,n,((int16_t *)&zptr[n])[0],((int16_t *)&zptr[n])[1],
|
||||||
alpha_ind,alpha_re[alpha_ind],alpha_im[alpha_ind]);
|
alpha_ind,alpha_re[alpha_ind],alpha_im[alpha_ind]);
|
||||||
#endif
|
#endif
|
||||||
alpha_ind = (alpha_ind + n_cs)%12;
|
alpha_ind = (alpha_ind + n_cs)%12;
|
||||||
@@ -366,13 +360,12 @@ void generate_pucch(int32_t **txdataF,
|
|||||||
m = (n1_pucch < thres) ? NRB2 : (((n1_pucch-thres)/(12*c/deltaPUCCH_Shift))+NRB2+((deltaPUCCH_Shift*Ncs1_div_deltaPUCCH_Shift)>>3)+rem);
|
m = (n1_pucch < thres) ? NRB2 : (((n1_pucch-thres)/(12*c/deltaPUCCH_Shift))+NRB2+((deltaPUCCH_Shift*Ncs1_div_deltaPUCCH_Shift)>>3)+rem);
|
||||||
|
|
||||||
#ifdef DEBUG_PUCCH_TX
|
#ifdef DEBUG_PUCCH_TX
|
||||||
msg("[PHY] PUCCH: m %d\n",m);
|
printf("[PHY] PUCCH: m %d\n",m);
|
||||||
#endif
|
#endif
|
||||||
nsymb = N_UL_symb<<1;
|
nsymb = N_UL_symb<<1;
|
||||||
|
|
||||||
//for (j=0,l=0;l<(nsymb-1);l++) {
|
//for (j=0,l=0;l<(nsymb-1);l++) {
|
||||||
for (j=0,l=0; l<(nsymb); l++) {
|
for (j=0,l=0; l<(nsymb); l++) {
|
||||||
|
|
||||||
if ((l<(nsymb>>1)) && ((m&1) == 0))
|
if ((l<(nsymb>>1)) && ((m&1) == 0))
|
||||||
re_offset = (m*6) + frame_parms->first_carrier_offset;
|
re_offset = (m*6) + frame_parms->first_carrier_offset;
|
||||||
else if ((l<(nsymb>>1)) && ((m&1) == 1))
|
else if ((l<(nsymb>>1)) && ((m&1) == 1))
|
||||||
@@ -395,7 +388,7 @@ void generate_pucch(int32_t **txdataF,
|
|||||||
re_offset = 0;
|
re_offset = 0;
|
||||||
|
|
||||||
#ifdef DEBUG_PUCCH_TX
|
#ifdef DEBUG_PUCCH_TX
|
||||||
msg("[PHY] PUCCH subframe %d (%d,%d,%d,%d) => %d,%d\n",subframe,l,i,re_offset-1,m,((int16_t *)&z[j])[0],((int16_t *)&z[j])[1]);
|
printf("[PHY] PUCCH subframe %d (%d,%d,%d,%d) => %d,%d\n",subframe,l,i,re_offset-1,m,((int16_t *)&z[j])[0],((int16_t *)&z[j])[1]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -431,13 +424,210 @@ void generate_pucch_emul(PHY_VARS_UE *ue,
|
|||||||
ue->pucch_payload[0] = pucch_payload[0] + (pucch_payload[1]<<1);
|
ue->pucch_payload[0] = pucch_payload[0] + (pucch_payload[1]<<1);
|
||||||
UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pucch_payload = pucch_payload[0] + (pucch_payload[1]<<1);
|
UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pucch_payload = pucch_payload[0] + (pucch_payload[1]<<1);
|
||||||
} else if (format == pucch_format1) {
|
} else if (format == pucch_format1) {
|
||||||
LOG_D(PHY,"[UE %d] Frame %d subframe %d Generating PUCCH for SR %d\n",ue->Mod_id,proc->frame_tx,subframe,sr);
|
// LOG_D(PHY,"[UE %d] Frame %d subframe %d Generating PUCCH for SR %d\n",ue->Mod_id,proc->frame_tx,subframe,sr);
|
||||||
}
|
}
|
||||||
|
|
||||||
ue->sr[subframe] = sr;
|
ue->sr[subframe] = sr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void pucch2x_scrambling(LTE_DL_FRAME_PARMS *fp,int subframe,uint16_t rnti,uint32_t B,uint8_t *btilde) __attribute__((always_inline));
|
||||||
|
inline void pucch2x_scrambling(LTE_DL_FRAME_PARMS *fp,int subframe,uint16_t rnti,uint32_t B,uint8_t *btilde) {
|
||||||
|
|
||||||
|
uint32_t x1, x2, s=0;
|
||||||
|
int i;
|
||||||
|
uint8_t c;
|
||||||
|
|
||||||
|
x2 = (rnti<<14) + ((1+subframe)<<16)*(1+(fp->Nid_cell<<1)); //this is c_init in 36.211 Sec 6.3.1
|
||||||
|
s = lte_gold_generic(&x1, &x2, 1);
|
||||||
|
for (i=0;i<19;i++) {
|
||||||
|
c = (uint8_t)((s>>i)&1);
|
||||||
|
btilde[i] = (((B>>i)&1) ^ c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void pucch2x_modulation(uint8_t *btilde,int16_t *d,int16_t amp) __attribute__((always_inline));
|
||||||
|
inline void pucch2x_modulation(uint8_t *btilde,int16_t *d,int16_t amp) {
|
||||||
|
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i=0;i<20;i++)
|
||||||
|
d[i] = btilde[i] == 1 ? amp : -amp;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t pucch_code[13] = {0xFFFFF,0x5A933,0x10E5A,0x6339C,0x73CE0,
|
||||||
|
0xFFC00,0xD8E64,0x4F6B0,0x218EC,0x1B746,
|
||||||
|
0x0FFFF,0x33FFF,0x3FFFC};
|
||||||
|
|
||||||
|
void generate_pucch2x(int32_t **txdataF,
|
||||||
|
LTE_DL_FRAME_PARMS *fp,
|
||||||
|
uint8_t ncs_cell[20][7],
|
||||||
|
PUCCH_FMT_t fmt,
|
||||||
|
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
|
||||||
|
uint16_t n2_pucch,
|
||||||
|
uint8_t shortened_format,
|
||||||
|
uint32_t *payload,
|
||||||
|
int A,
|
||||||
|
int B2,
|
||||||
|
int16_t amp,
|
||||||
|
uint8_t subframe,
|
||||||
|
uint16_t rnti) {
|
||||||
|
|
||||||
|
int i,j;
|
||||||
|
uint32_t B=0;
|
||||||
|
uint8_t btilde[20];
|
||||||
|
int16_t d[22];
|
||||||
|
uint8_t deltaPUCCH_Shift = fp->pucch_config_common.deltaPUCCH_Shift;
|
||||||
|
uint8_t NRB2 = fp->pucch_config_common.nRB_CQI;
|
||||||
|
uint8_t Ncs1 = fp->pucch_config_common.nCS_AN;
|
||||||
|
|
||||||
|
uint32_t u0 = (fp->Nid_cell + fp->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[subframe<<1]) % 30;
|
||||||
|
uint32_t u1 = (fp->Nid_cell + fp->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[1+(subframe<<1)]) % 30;
|
||||||
|
uint32_t v0=fp->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1];
|
||||||
|
uint32_t v1=fp->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)];
|
||||||
|
uint32_t z[12*14],*zptr;
|
||||||
|
uint32_t u,v,n;
|
||||||
|
uint8_t ns,N_UL_symb,nsymb;
|
||||||
|
uint32_t nprime,l,n_cs;
|
||||||
|
int alpha_ind,data_ind;
|
||||||
|
int16_t ref_re,ref_im;
|
||||||
|
int m,re_offset,symbol_offset;
|
||||||
|
int32_t *txptr;
|
||||||
|
|
||||||
|
if ((deltaPUCCH_Shift==0) || (deltaPUCCH_Shift>3)) {
|
||||||
|
printf("[PHY] generate_pucch: Illegal deltaPUCCH_shift %d (should be 1,2,3)\n",deltaPUCCH_Shift);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Ncs1 > 7) {
|
||||||
|
printf("[PHY] generate_pucch: Illegal Ncs1 %d (should be 0...7)\n",Ncs1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// pucch2x_encoding
|
||||||
|
for (i=0;i<A;i++)
|
||||||
|
if ((*payload & (1<<i)) > 0)
|
||||||
|
B=B^pucch_code[i];
|
||||||
|
|
||||||
|
// scrambling
|
||||||
|
pucch2x_scrambling(fp,subframe,rnti,B,btilde);
|
||||||
|
// modulation
|
||||||
|
pucch2x_modulation(btilde,d,amp);
|
||||||
|
|
||||||
|
// add extra symbol for 2a/2b
|
||||||
|
d[20]=0;
|
||||||
|
d[21]=0;
|
||||||
|
if (fmt==pucch_format2a)
|
||||||
|
d[20] = (B2 == 0) ? amp : -amp;
|
||||||
|
else if (fmt==pucch_format2b) {
|
||||||
|
switch (B2) {
|
||||||
|
case 0:
|
||||||
|
d[20] = amp;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
d[21] = -amp;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
d[21] = amp;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
d[20] = -amp;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
AssertFatal(1==0,"Illegal modulation symbol %d for PUCCH %s\n",B2,pucch_format_string[fmt]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
zptr = z;
|
||||||
|
|
||||||
|
#ifdef DEBUG_PUCCH_TX
|
||||||
|
printf("[PHY] PUCCH2x: n2_pucch %d\n",n2_pucch);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
N_UL_symb = (fp->Ncp==0) ? 7 : 6;
|
||||||
|
|
||||||
|
for (ns=(subframe<<1),u=u0,v=v0; ns<(2+(subframe<<1)); ns++,u=u1,v=v1) {
|
||||||
|
|
||||||
|
if ((ns&1) == 0)
|
||||||
|
nprime = (n2_pucch < 12*NRB2) ?
|
||||||
|
n2_pucch % 12 :
|
||||||
|
(n2_pucch+Ncs1 + 1)%12;
|
||||||
|
else
|
||||||
|
nprime = (n2_pucch < 12*NRB2) ?
|
||||||
|
((12*(nprime+1)) % 13)-1 :
|
||||||
|
(10-n2_pucch)%12;
|
||||||
|
|
||||||
|
//loop over symbols in slot
|
||||||
|
for (l=0; l<N_UL_symb; l++) {
|
||||||
|
// Compute n_cs (36.211 p. 18)
|
||||||
|
n_cs = (ncs_cell[ns][l]+nprime)%12;
|
||||||
|
|
||||||
|
alpha_ind = n_cs;
|
||||||
|
data_ind = 0;
|
||||||
|
|
||||||
|
for (n=0; n<12; n++) {
|
||||||
|
|
||||||
|
// this is r_uv^alpha(n)
|
||||||
|
ref_re = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][n<<1] - (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)])>>15);
|
||||||
|
ref_im = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)] + (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][n<<1])>>15);
|
||||||
|
|
||||||
|
if ((l<2)||(l>=(N_UL_symb-2))) { //these are PUCCH data symbols
|
||||||
|
((int16_t *)&zptr[n])[0] = ((int32_t)d[data_ind]*ref_re - (int32_t)d[data_ind+1]*ref_im)>>15;
|
||||||
|
((int16_t *)&zptr[n])[1] = ((int32_t)d[data_ind]*ref_im + (int32_t)d[data_ind+1]*ref_re)>>15;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
((int16_t *)&zptr[n])[0] = ref_re;
|
||||||
|
((int16_t *)&zptr[n])[1] = ref_im;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // n
|
||||||
|
if ((l<2)||(l>=(N_UL_symb-2))) //these are PUCCH data symbols so increment data index
|
||||||
|
data_ind+=2;
|
||||||
|
} // l
|
||||||
|
} //ns
|
||||||
|
|
||||||
|
m = n2_pucch/12;
|
||||||
|
|
||||||
|
#ifdef DEBUG_PUCCH_TX
|
||||||
|
printf("[PHY] PUCCH: m %d\n",m);
|
||||||
|
#endif
|
||||||
|
nsymb = N_UL_symb<<1;
|
||||||
|
|
||||||
|
//for (j=0,l=0;l<(nsymb-1);l++) {
|
||||||
|
for (j=0,l=0; l<(nsymb); l++) {
|
||||||
|
if ((l<(nsymb>>1)) && ((m&1) == 0))
|
||||||
|
re_offset = (m*6) + fp->first_carrier_offset;
|
||||||
|
else if ((l<(nsymb>>1)) && ((m&1) == 1))
|
||||||
|
re_offset = fp->first_carrier_offset + (fp->N_RB_DL - (m>>1) - 1)*12;
|
||||||
|
else if ((m&1) == 0)
|
||||||
|
re_offset = fp->first_carrier_offset + (fp->N_RB_DL - (m>>1) - 1)*12;
|
||||||
|
else
|
||||||
|
re_offset = ((m-1)*6) + fp->first_carrier_offset;
|
||||||
|
|
||||||
|
if (re_offset > fp->ofdm_symbol_size)
|
||||||
|
re_offset -= (fp->ofdm_symbol_size);
|
||||||
|
|
||||||
|
symbol_offset = (unsigned int)fp->ofdm_symbol_size*(l+(subframe*nsymb));
|
||||||
|
txptr = &txdataF[0][symbol_offset];
|
||||||
|
|
||||||
|
for (i=0; i<12; i++,j++) {
|
||||||
|
txptr[re_offset++] = z[j];
|
||||||
|
|
||||||
|
if (re_offset==fp->ofdm_symbol_size)
|
||||||
|
re_offset = 0;
|
||||||
|
|
||||||
|
#ifdef DEBUG_PUCCH_TX
|
||||||
|
printf("[PHY] PUCCH subframe %d (%d,%d,%d,%d) => %d,%d\n",subframe,l,i,re_offset-1,m,((int16_t *)&z[j])[0],((int16_t *)&z[j])[1]);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||||
PUCCH_FMT_t fmt,
|
PUCCH_FMT_t fmt,
|
||||||
uint8_t UE_id,
|
uint8_t UE_id,
|
||||||
@@ -535,7 +725,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
Nprime = Nprime_div_deltaPUCCH_Shift * deltaPUCCH_Shift;
|
Nprime = Nprime_div_deltaPUCCH_Shift * deltaPUCCH_Shift;
|
||||||
|
|
||||||
#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
LOG_D(PHY,"[eNB] PUCCH: cNcs1/deltaPUCCH_Shift %d, Nprime %d, n1_pucch %d\n",thres,Nprime,n1_pucch);
|
printf("[eNB] PUCCH: cNcs1/deltaPUCCH_Shift %d, Nprime %d, n1_pucch %d\n",thres,Nprime,n1_pucch);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
N_UL_symb = (frame_parms->Ncp==NORMAL) ? 7 : 6;
|
N_UL_symb = (frame_parms->Ncp==NORMAL) ? 7 : 6;
|
||||||
@@ -554,7 +744,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
LOG_D(PHY,"PUCCH: nprime0 %d nprime1 %d\n",nprime0,nprime1);
|
printf("PUCCH: nprime0 %d nprime1 %d\n",nprime0,nprime1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
n_oc0 = nprime0/Nprime_div_deltaPUCCH_Shift;
|
n_oc0 = nprime0/Nprime_div_deltaPUCCH_Shift;
|
||||||
@@ -568,7 +758,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
n_oc1<<=1;
|
n_oc1<<=1;
|
||||||
|
|
||||||
#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
LOG_D(PHY,"[eNB] PUCCH: noc0 %d noc11 %d\n",n_oc0,n_oc1);
|
printf("[eNB] PUCCH: noc0 %d noc11 %d\n",n_oc0,n_oc1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nprime=nprime0;
|
nprime=nprime0;
|
||||||
@@ -647,7 +837,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
LOG_D(PHY,"[eNB] PUCCH: ncs[%d][%d]=%d, W_re %d, W_im %d, S %d, refs %d\n",ns,l,n_cs,W_re,W_im,S,refs);
|
printf("[eNB] PUCCH: ncs[%d][%d]=%d, W_re %d, W_im %d, S %d, refs %d\n",ns,l,n_cs,W_re,W_im,S,refs);
|
||||||
#endif
|
#endif
|
||||||
alpha_ind=0;
|
alpha_ind=0;
|
||||||
// compute output sequence
|
// compute output sequence
|
||||||
@@ -663,7 +853,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
zptr[1+(n<<1)] = -(tmp_re*W_im + tmp_im*W_re)>>15;
|
zptr[1+(n<<1)] = -(tmp_re*W_im + tmp_im*W_re)>>15;
|
||||||
|
|
||||||
#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
LOG_D(PHY,"[eNB] PUCCH subframe %d z(%d,%d) => %d,%d, alpha(%d) => %d,%d\n",subframe,l,n,zptr[n<<1],zptr[(n<<1)+1],
|
printf("[eNB] PUCCH subframe %d z(%d,%d) => %d,%d, alpha(%d) => %d,%d\n",subframe,l,n,zptr[n<<1],zptr[(n<<1)+1],
|
||||||
alpha_ind,alpha_re[alpha_ind],alpha_im[alpha_ind]);
|
alpha_ind,alpha_re[alpha_ind],alpha_im[alpha_ind]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -682,7 +872,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
m = (n1_pucch < thres) ? NRB2 : (((n1_pucch-thres)/(12*c/deltaPUCCH_Shift))+NRB2+((deltaPUCCH_Shift*Ncs1_div_deltaPUCCH_Shift)>>3)+rem);
|
m = (n1_pucch < thres) ? NRB2 : (((n1_pucch-thres)/(12*c/deltaPUCCH_Shift))+NRB2+((deltaPUCCH_Shift*Ncs1_div_deltaPUCCH_Shift)>>3)+rem);
|
||||||
|
|
||||||
#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
LOG_D(PHY,"[eNB] PUCCH: m %d\n",m);
|
printf("[eNB] PUCCH: m %d\n",m);
|
||||||
#endif
|
#endif
|
||||||
nsymb = N_UL_symb<<1;
|
nsymb = N_UL_symb<<1;
|
||||||
|
|
||||||
@@ -716,7 +906,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
re_offset = 0;
|
re_offset = 0;
|
||||||
|
|
||||||
#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
LOG_D(PHY,"[eNB] PUCCH subframe %d (%d,%d,%d,%d,%d) => (%d,%d) x (%d,%d) : (%d,%d)\n",subframe,l,i,re_offset,m,j,
|
printf("[eNB] PUCCH subframe %d (%d,%d,%d,%d,%d) => (%d,%d) x (%d,%d) : (%d,%d)\n",subframe,l,i,re_offset,m,j,
|
||||||
rxptr[re_offset<<1],rxptr[1+(re_offset<<1)],
|
rxptr[re_offset<<1],rxptr[1+(re_offset<<1)],
|
||||||
zptr[j],zptr[1+j],
|
zptr[j],zptr[1+j],
|
||||||
rxcomp[aa][j],rxcomp[aa][1+j]);
|
rxcomp[aa][j],rxcomp[aa][1+j]);
|
||||||
@@ -731,7 +921,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
|
|
||||||
if (fmt == pucch_format1) {
|
if (fmt == pucch_format1) {
|
||||||
#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
LOG_D(PHY,"Doing PUCCH detection for format 1\n");
|
printf("Doing PUCCH detection for format 1\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
stat_max = 0;
|
stat_max = 0;
|
||||||
@@ -754,7 +944,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
LOG_D(PHY,"[eNB] PUCCH subframe %d (%d,%d,%d) => (%d,%d) x (%d,%d) : (%d,%d) , stat %d\n",subframe,phase,l,re,
|
printf("[eNB] PUCCH subframe %d (%d,%d,%d) => (%d,%d) x (%d,%d) : (%d,%d) , stat %d\n",subframe,phase,l,re,
|
||||||
rxcomp[aa][off],rxcomp[aa][1+off],
|
rxcomp[aa][off],rxcomp[aa][1+off],
|
||||||
cfo[l<<1],cfo[1+(l<<1)],
|
cfo[l<<1],cfo[1+(l<<1)],
|
||||||
stat_re,stat_im,stat);
|
stat_re,stat_im,stat);
|
||||||
@@ -767,7 +957,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
off+=2;
|
off+=2;
|
||||||
|
|
||||||
#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
LOG_D(PHY,"[eNB] PUCCH subframe %d (%d,%d,%d) => (%d,%d) x (%d,%d) : (%d,%d), stat %d\n",subframe,phase,l2,re,
|
printf("[eNB] PUCCH subframe %d (%d,%d,%d) => (%d,%d) x (%d,%d) : (%d,%d), stat %d\n",subframe,phase,l2,re,
|
||||||
rxcomp[aa][off],rxcomp[aa][1+off],
|
rxcomp[aa][off],rxcomp[aa][1+off],
|
||||||
cfo[l2<<1],cfo[1+(l2<<1)],
|
cfo[l2<<1],cfo[1+(l2<<1)],
|
||||||
stat_re,stat_im,stat);
|
stat_re,stat_im,stat);
|
||||||
@@ -791,7 +981,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
stat_max *= nsymb; // normalize to energy per symbol
|
stat_max *= nsymb; // normalize to energy per symbol
|
||||||
stat_max /= (frame_parms->N_RB_UL*12); //
|
stat_max /= (frame_parms->N_RB_UL*12); //
|
||||||
#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
LOG_D(PHY,"[eNB] PUCCH: stat %d, stat_max %d, phase_max %d\n", stat,stat_max,phase_max);
|
printf("[eNB] PUCCH: stat %d, stat_max %d, phase_max %d\n", stat,stat_max,phase_max);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
@@ -825,7 +1015,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
*payload = 0;
|
*payload = 0;
|
||||||
*Po_PUCCH1_below = ((*Po_PUCCH1_below<<9) + (stat_max<<9)+1024)>>10;
|
*Po_PUCCH1_below = ((*Po_PUCCH1_below<<9) + (stat_max<<9)+1024)>>10;
|
||||||
}
|
}
|
||||||
LOG_D(PHY,"[eNB] PUCCH fmt1: stat_max : %d, sigma2_dB %d (I0 %d dBm, thres %d), Po_PUCCH1_below/above : %d / %d\n",dB_fixed(stat_max),sigma2_dB,eNB->measurements[0].n0_subband_power_tot_dBm[6],pucch1_thres,dB_fixed(*Po_PUCCH1_below),dB_fixed(*Po_PUCCH1_above));
|
printf("[eNB] PUCCH fmt1: stat_max : %d, sigma2_dB %d (I0 %d dBm, thres %d), Po_PUCCH1_below/above : %d / %d\n",dB_fixed(stat_max),sigma2_dB,eNB->measurements[0].n0_subband_power_tot_dBm[6],pucch1_thres,dB_fixed(*Po_PUCCH1_below),dB_fixed(*Po_PUCCH1_above));
|
||||||
*Po_PUCCH_update = 1;
|
*Po_PUCCH_update = 1;
|
||||||
if (UE_id==0) {
|
if (UE_id==0) {
|
||||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_SR_ENERGY,dB_fixed(stat_max));
|
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_SR_ENERGY,dB_fixed(stat_max));
|
||||||
@@ -861,7 +1051,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
|
|
||||||
off+=2;
|
off+=2;
|
||||||
#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
LOG_D(PHY,"[eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d)\n",subframe,l,re,
|
printf("[eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d)\n",subframe,l,re,
|
||||||
rxcomp[aa][off],rxcomp[aa][1+off],
|
rxcomp[aa][off],rxcomp[aa][1+off],
|
||||||
cfo[l<<1],cfo[1+(l<<1)],
|
cfo[l<<1],cfo[1+(l<<1)],
|
||||||
stat_re,stat_im);
|
stat_re,stat_im);
|
||||||
@@ -882,7 +1072,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
|
|
||||||
off+=2;
|
off+=2;
|
||||||
#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
LOG_D(PHY,"[eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d)\n",subframe,l2,re,
|
printf("[eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d)\n",subframe,l2,re,
|
||||||
rxcomp[aa][off],rxcomp[aa][1+off],
|
rxcomp[aa][off],rxcomp[aa][1+off],
|
||||||
cfo[l2<<1],cfo[1+(l2<<1)],
|
cfo[l2<<1],cfo[1+(l2<<1)],
|
||||||
stat_re,stat_im);
|
stat_re,stat_im);
|
||||||
@@ -891,7 +1081,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
LOG_D(PHY,"aa%d re %d : phase %d : stat %d\n",aa,re,phase,stat);
|
printf("aa%d re %d : phase %d : stat %d\n",aa,re,phase,stat);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
stat += ((((stat_re*stat_re)) + ((stat_im*stat_im)) +
|
stat += ((((stat_re*stat_re)) + ((stat_im*stat_im)) +
|
||||||
@@ -911,23 +1101,23 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
} //phase
|
} //phase
|
||||||
|
|
||||||
stat_max/=(12); //normalize to energy per symbol and RE
|
stat_max/=(12); //normalize to energy per symbol and RE
|
||||||
//#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
LOG_D(PHY,"[eNB] PUCCH fmt1a/b: stat_max : %d, phase_max : %d\n",stat_max,phase_max);
|
printf("[eNB] PUCCH fmt1a/b: stat_max : %d, phase_max : %d\n",stat_max,phase_max);
|
||||||
//#endif
|
#endif
|
||||||
|
|
||||||
stat_re=0;
|
stat_re=0;
|
||||||
stat_im=0;
|
stat_im=0;
|
||||||
LOG_D(PHY,"PUCCH1A : Po_PUCCH before %d dB (%d)\n",dB_fixed(*Po_PUCCH),*Po_PUCCH);
|
printf("PUCCH1A : Po_PUCCH before %d dB (%d)\n",dB_fixed(*Po_PUCCH),*Po_PUCCH);
|
||||||
*Po_PUCCH = ((*Po_PUCCH>>1) + ((stat_max)>>1));
|
*Po_PUCCH = ((*Po_PUCCH>>1) + ((stat_max)>>1));
|
||||||
*Po_PUCCH_dBm = dB_fixed(*Po_PUCCH/frame_parms->N_RB_UL) - eNB->rx_total_gain_dB;
|
*Po_PUCCH_dBm = dB_fixed(*Po_PUCCH/frame_parms->N_RB_UL) - eNB->rx_total_gain_dB;
|
||||||
*Po_PUCCH_update = 1;
|
*Po_PUCCH_update = 1;
|
||||||
|
|
||||||
LOG_D(PHY,"PUCCH1A : stat_max %d (%d,%d,%d) => Po_PUCCH %d\n",
|
printf("PUCCH1A : stat_max %d (%d,%d,%d) => Po_PUCCH %d\n",
|
||||||
dB_fixed(stat_max),
|
dB_fixed(stat_max),
|
||||||
pucch1_thres+sigma2_dB,
|
pucch1_thres+sigma2_dB,
|
||||||
pucch1_thres,
|
pucch1_thres,
|
||||||
sigma2_dB,
|
sigma2_dB,
|
||||||
dB_fixed(*Po_PUCCH));
|
dB_fixed(*Po_PUCCH));
|
||||||
|
|
||||||
// Do detection now
|
// Do detection now
|
||||||
if (sigma2_dB<(dB_fixed(stat_max)-pucch1_thres)) {//
|
if (sigma2_dB<(dB_fixed(stat_max)-pucch1_thres)) {//
|
||||||
@@ -951,7 +1141,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
LOG_D(PHY,"[eNB] PUCCH subframe %d l %d re %d chest1 => (%d,%d)\n",subframe,l,re,
|
printf("[eNB] PUCCH subframe %d l %d re %d chest1 => (%d,%d)\n",subframe,l,re,
|
||||||
chest_re,chest_im);
|
chest_re,chest_im);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -963,7 +1153,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
stat_im += (((tmp_re*chest_im)>>15) - ((tmp_im*chest_re)>>15))/4;
|
stat_im += (((tmp_re*chest_im)>>15) - ((tmp_im*chest_re)>>15))/4;
|
||||||
off+=2;
|
off+=2;
|
||||||
#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
LOG_D(PHY,"[eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d)\n",subframe,l,re,
|
printf("[eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d)\n",subframe,l,re,
|
||||||
rxcomp[aa][off],rxcomp[aa][1+off],
|
rxcomp[aa][off],rxcomp[aa][1+off],
|
||||||
cfo[l<<1],cfo[1+(l<<1)],
|
cfo[l<<1],cfo[1+(l<<1)],
|
||||||
stat_re,stat_im);
|
stat_re,stat_im);
|
||||||
@@ -978,7 +1168,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
stat_im += (((tmp_re*chest_im)>>15) - ((tmp_im*chest_re)>>15)/4);
|
stat_im += (((tmp_re*chest_im)>>15) - ((tmp_im*chest_re)>>15)/4);
|
||||||
off+=2;
|
off+=2;
|
||||||
#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
LOG_D(PHY,"[eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d)\n",subframe,l,re,
|
printf("[eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d)\n",subframe,l,re,
|
||||||
rxcomp[aa][off],rxcomp[aa][1+off],
|
rxcomp[aa][off],rxcomp[aa][1+off],
|
||||||
cfo[l<<1],cfo[1+(l<<1)],
|
cfo[l<<1],cfo[1+(l<<1)],
|
||||||
stat_re,stat_im);
|
stat_re,stat_im);
|
||||||
@@ -996,7 +1186,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
LOG_D(PHY,"[eNB] PUCCH subframe %d l %d re %d chest2 => (%d,%d)\n",subframe,l,re,
|
printf("[eNB] PUCCH subframe %d l %d re %d chest2 => (%d,%d)\n",subframe,l,re,
|
||||||
chest_re,chest_im);
|
chest_re,chest_im);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1008,7 +1198,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
stat_im += (((tmp_re*chest_im)>>15) - ((tmp_im*chest_re)>>15))/4;
|
stat_im += (((tmp_re*chest_im)>>15) - ((tmp_im*chest_re)>>15))/4;
|
||||||
off+=2;
|
off+=2;
|
||||||
#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
LOG_D(PHY,"[PHY][eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d)\n",subframe,l,re,
|
printf("[PHY][eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d)\n",subframe,l,re,
|
||||||
rxcomp[aa][off],rxcomp[aa][1+off],
|
rxcomp[aa][off],rxcomp[aa][1+off],
|
||||||
cfo[l<<1],cfo[1+(l<<1)],
|
cfo[l<<1],cfo[1+(l<<1)],
|
||||||
stat_re,stat_im);
|
stat_re,stat_im);
|
||||||
@@ -1023,7 +1213,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
stat_im += (((tmp_re*chest_im)>>15) - ((tmp_im*chest_re)>>15))/4;
|
stat_im += (((tmp_re*chest_im)>>15) - ((tmp_im*chest_re)>>15))/4;
|
||||||
off+=2;
|
off+=2;
|
||||||
#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
LOG_D(PHY,"[PHY][eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d)\n",subframe,l,re,
|
printf("[PHY][eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d)\n",subframe,l,re,
|
||||||
rxcomp[aa][off],rxcomp[aa][1+off],
|
rxcomp[aa][off],rxcomp[aa][1+off],
|
||||||
cfo[l<<1],cfo[1+(l<<1)],
|
cfo[l<<1],cfo[1+(l<<1)],
|
||||||
stat_re,stat_im);
|
stat_re,stat_im);
|
||||||
@@ -1031,7 +1221,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_PUCCH_RX
|
#ifdef DEBUG_PUCCH_RX
|
||||||
LOG_D(PHY,"aa%d re %d : stat %d,%d\n",aa,re,stat_re,stat_im);
|
printf("aa%d re %d : stat %d,%d\n",aa,re,stat_re,stat_im);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} //re
|
} //re
|
||||||
|
|||||||
@@ -1189,17 +1189,16 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
|
|||||||
|
|
||||||
if (abstraction_flag == 0) {
|
if (abstraction_flag == 0) {
|
||||||
|
|
||||||
generate_pucch(ue->common_vars.txdataF,
|
generate_pucch1x(ue->common_vars.txdataF,
|
||||||
&ue->frame_parms,
|
&ue->frame_parms,
|
||||||
ue->ncs_cell,
|
ue->ncs_cell,
|
||||||
format,
|
format,
|
||||||
&ue->pucch_config_dedicated[eNB_id],
|
&ue->pucch_config_dedicated[eNB_id],
|
||||||
n1_pucch,
|
n1_pucch,
|
||||||
0, // n2_pucch
|
1, // shortened format
|
||||||
1, // shortened format
|
pucch_ack_payload,
|
||||||
pucch_ack_payload,
|
tx_amp,
|
||||||
tx_amp,
|
subframe_tx);
|
||||||
subframe_tx);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
#ifdef PHY_ABSTRACTION
|
#ifdef PHY_ABSTRACTION
|
||||||
@@ -1240,17 +1239,16 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
|
|||||||
|
|
||||||
if (abstraction_flag == 0) {
|
if (abstraction_flag == 0) {
|
||||||
|
|
||||||
generate_pucch(ue->common_vars.txdataF,
|
generate_pucch1x(ue->common_vars.txdataF,
|
||||||
&ue->frame_parms,
|
&ue->frame_parms,
|
||||||
ue->ncs_cell,
|
ue->ncs_cell,
|
||||||
pucch_format1,
|
pucch_format1,
|
||||||
&ue->pucch_config_dedicated[eNB_id],
|
&ue->pucch_config_dedicated[eNB_id],
|
||||||
ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex,
|
ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex,
|
||||||
0, // n2_pucch
|
1, // shortened format
|
||||||
1, // shortened format
|
pucch_ack_payload, // this is ignored anyway, we just need a pointer
|
||||||
pucch_ack_payload, // this is ignored anyway, we just need a pointer
|
tx_amp,
|
||||||
tx_amp,
|
subframe_tx);
|
||||||
subframe_tx);
|
|
||||||
} else {
|
} else {
|
||||||
LOG_D(PHY,"Calling generate_pucch_emul ...\n");
|
LOG_D(PHY,"Calling generate_pucch_emul ...\n");
|
||||||
generate_pucch_emul(ue,
|
generate_pucch_emul(ue,
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ int main(int argc, char **argv)
|
|||||||
uint8_t snr1set=0;
|
uint8_t snr1set=0;
|
||||||
//mod_sym_t **txdataF;
|
//mod_sym_t **txdataF;
|
||||||
int **txdata;
|
int **txdata;
|
||||||
double **s_re,**s_im,**r_re,**r_im;
|
double s_re[2][30720],s_im[2][30720],r_re[2][30720],r_im[2][30720];
|
||||||
double ricean_factor=0.0000005,iqim=0.0;
|
double ricean_factor=0.0000005,iqim=0.0;
|
||||||
|
|
||||||
int trial, n_trials, ntrials=1, n_errors;
|
int trial, n_trials, ntrials=1, n_errors;
|
||||||
@@ -325,10 +325,6 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
txdata = eNB->common_vars.txdata[eNB_id];
|
txdata = eNB->common_vars.txdata[eNB_id];
|
||||||
|
|
||||||
s_re = malloc(2*sizeof(double*));
|
|
||||||
s_im = malloc(2*sizeof(double*));
|
|
||||||
r_re = malloc(2*sizeof(double*));
|
|
||||||
r_im = malloc(2*sizeof(double*));
|
|
||||||
nsymb = (frame_parms->Ncp == 0) ? 14 : 12;
|
nsymb = (frame_parms->Ncp == 0) ? 14 : 12;
|
||||||
|
|
||||||
printf("FFT Size %d, Extended Prefix %d, Samples per subframe %d, Symbols per subframe %d\n",NUMBER_OF_OFDM_CARRIERS,
|
printf("FFT Size %d, Extended Prefix %d, Samples per subframe %d, Symbols per subframe %d\n",NUMBER_OF_OFDM_CARRIERS,
|
||||||
@@ -352,19 +348,6 @@ int main(int argc, char **argv)
|
|||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i<2; i++) {
|
|
||||||
|
|
||||||
s_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
|
||||||
bzero(s_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
|
||||||
s_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
|
||||||
bzero(s_im[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
|
||||||
|
|
||||||
r_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
|
||||||
bzero(r_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
|
||||||
r_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
|
||||||
bzero(r_im[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
|
||||||
}
|
|
||||||
|
|
||||||
init_ncs_cell(&eNB->frame_parms,eNB->ncs_cell);
|
init_ncs_cell(&eNB->frame_parms,eNB->ncs_cell);
|
||||||
|
|
||||||
init_ncs_cell(&UE->frame_parms,UE->ncs_cell);
|
init_ncs_cell(&UE->frame_parms,UE->ncs_cell);
|
||||||
@@ -378,17 +361,16 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
pucch_payload = 0;
|
pucch_payload = 0;
|
||||||
|
|
||||||
generate_pucch(UE->common_vars.txdataF,
|
generate_pucch1x(UE->common_vars.txdataF,
|
||||||
frame_parms,
|
frame_parms,
|
||||||
UE->ncs_cell,
|
UE->ncs_cell,
|
||||||
pucch_format,
|
pucch_format,
|
||||||
&pucch_config_dedicated,
|
&pucch_config_dedicated,
|
||||||
n1_pucch,
|
n1_pucch,
|
||||||
n2_pucch,
|
0, //shortened_format,
|
||||||
0, //shortened_format,
|
&pucch_payload,
|
||||||
&pucch_payload,
|
AMP, //amp,
|
||||||
AMP, //amp,
|
subframe); //subframe
|
||||||
subframe); //subframe
|
|
||||||
write_output("txsigF0.m","txsF0", &UE->common_vars.txdataF[0][2*subframe*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX],OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX*nsymb,1,1);
|
write_output("txsigF0.m","txsF0", &UE->common_vars.txdataF[0][2*subframe*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX],OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX*nsymb,1,1);
|
||||||
|
|
||||||
tx_lev = 0;
|
tx_lev = 0;
|
||||||
@@ -453,7 +435,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
|
|
||||||
multipath_channel(UE2eNB,s_re,s_im,r_re,r_im,
|
multipath_channel(UE2eNB,s_re,s_im,r_re,r_im,
|
||||||
2*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES,0);
|
eNB->frame_parms.samples_per_tti,0);
|
||||||
|
|
||||||
sigma2_dB = N0;//10*log10((double)tx_lev) - SNR;
|
sigma2_dB = N0;//10*log10((double)tx_lev) - SNR;
|
||||||
tx_gain = sqrt(pow(10.0,.1*(N0+SNR))/(double)tx_lev);
|
tx_gain = sqrt(pow(10.0,.1*(N0+SNR))/(double)tx_lev);
|
||||||
@@ -509,8 +491,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (sig==1) {
|
if (sig==1) {
|
||||||
((short*) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i] = (short) (((tx_gain*r_re[aa][i]) +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
((short*) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i] = (short) (((tx_gain*r_re[aa][i]) +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||||
((short*) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i+1] = (short) (((tx_gain*r_im[aa][i]) + (iqim*r_re[aa][i]*tx_gain) + sqrt(sigma2/2)*gaussdouble(
|
((short*) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i+1] = (short) (((tx_gain*r_im[aa][i]) + (iqim*r_re[aa][i]*tx_gain) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||||
0.0,1.0)));
|
|
||||||
} else {
|
} else {
|
||||||
((short*) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
((short*) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||||
((short*) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i+1] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
((short*) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i+1] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||||
@@ -603,18 +584,6 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (i=0; i<2; i++) {
|
|
||||||
free(s_re[i]);
|
|
||||||
free(s_im[i]);
|
|
||||||
free(r_re[i]);
|
|
||||||
free(r_im[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
free(s_re);
|
|
||||||
free(s_im);
|
|
||||||
free(r_re);
|
|
||||||
free(r_im);
|
|
||||||
|
|
||||||
lte_sync_time_free();
|
lte_sync_time_free();
|
||||||
|
|
||||||
return(n_errors);
|
return(n_errors);
|
||||||
|
|||||||
Reference in New Issue
Block a user