Commit e09d843d authored by knopp's avatar knopp

Added bugfixes for PDCCH (not all). New --ue-dump--frame and --loop-memory...

Added bugfixes for PDCCH (not all). New --ue-dump--frame and --loop-memory option for lte-softmodem. Updates in PMCH/MCH transmission which were forgotten in recent DLSCH/PDSCH changes. mbmssim works again.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7702 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent a373ab3a
......@@ -711,7 +711,7 @@ int lte_rate_matching_turbo_rx(uint32_t RTC,
#endif
if (Kmimo==0 || Mdlharq==0 || C==0 || Qm==0 || Nl==0) {
msg("lte_rate_matching.c: invalid parameters (Kmimo %d, Mdlharq %d, C %d, Qm %d, Nl %d\n",
printf("lte_rate_matching.c: invalid parameters (Kmimo %d, Mdlharq %d, C %d, Qm %d, Nl %d\n",
Kmimo,Mdlharq,C,Qm,Nl);
return(-1);
}
......
......@@ -1231,7 +1231,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB,
LTE_eNB_PUSCH** const eNB_pusch_vars = phy_vars_eNB->lte_eNB_pusch_vars;
LTE_eNB_SRS* const eNB_srs_vars = phy_vars_eNB->lte_eNB_srs_vars;
LTE_eNB_PRACH* const eNB_prach_vars = &phy_vars_eNB->lte_eNB_prach_vars;
int i, j, eNB_id, UE_id;
int i, j, eNB_id, UE_id;
phy_vars_eNB->total_dlsch_bitrate = 0;
phy_vars_eNB->total_transmitted_bits = 0;
......
......@@ -139,7 +139,7 @@ uint16_t extract_crc(uint8_t *dci,uint8_t dci_len)
printf("extract_crc: crc %x\n",crc);
*/
#ifdef DEBUG_DCI_DECODING
msg("dci_crc (%x,%x,%x), dci_len&0x7=%d\n",dci[dci_len>>3],dci[1+(dci_len>>3)],dci[2+(dci_len>>3)],
LOG_I(PHY,"dci_crc (%x,%x,%x), dci_len&0x7=%d\n",dci[dci_len>>3],dci[1+(dci_len>>3)],dci[2+(dci_len>>3)],
dci_len&0x7);
#endif
......@@ -152,7 +152,7 @@ uint16_t extract_crc(uint8_t *dci,uint8_t dci_len)
}
#ifdef DEBUG_DCI_DECODING
msg("dci_crc =>%x\n",crc16);
LOG_I(PHY,"dci_crc =>%x\n",crc16);
#endif
// dci[(dci_len>>3)]&=(0xffff<<(dci_len&0xf));
......@@ -396,11 +396,11 @@ void pdcch_demapping(uint16_t *llr,uint16_t *wbar,LTE_DL_FRAME_PARMS *frame_parm
// if REG is allocated to PHICH, skip it
if (check_phich_reg(frame_parms,kprime,lprime,mi) == 1) {
//msg("dci_demapping : skipping REG %d\n",(lprime==0)?kprime/6 : kprime>>2);
if ((lprime == 0)&&((kprime%6)==0))
re_offset0+=4;
// printf("dci_demapping : skipping REG %d (RE %d)\n",(lprime==0)?kprime/6 : kprime>>2,kprime);
if ((lprime == 0)&&((kprime%6)==0))
re_offset0+=4;
} else { // not allocated to PHICH/PCFICH
// msg("dci_demapping: REG %d\n",(lprime==0)?kprime/6 : kprime>>2);
// printf("dci_demapping: REG %d\n",(lprime==0)?kprime/6 : kprime>>2);
if (lprime == 0) {
// first symbol, or second symbol+4 TX antennas skip pilots
kprime_mod12 = kprime%12;
......@@ -411,7 +411,7 @@ void pdcch_demapping(uint16_t *llr,uint16_t *wbar,LTE_DL_FRAME_PARMS *frame_parm
for (i=0; i<4; i++) {
wbar[mprime] = llr[tti_offset0+i];
#ifdef DEBUG_DCI_DECODING
msg("[PHY] PDCCH demapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset0,symbol_offset,re_offset0,*(char*)&wbar[mprime],*(1+(char*)&wbar[mprime]));
LOG_I(PHY,"PDCCH demapping mprime %d.%d <= llr %d (symbol %d re %d) -> (%d,%d)\n",mprime/4,i,tti_offset0+i,symbol_offset,re_offset0,*(char*)&wbar[mprime],*(1+(char*)&wbar[mprime]));
#endif
mprime++;
re_offset0++;
......@@ -427,7 +427,7 @@ void pdcch_demapping(uint16_t *llr,uint16_t *wbar,LTE_DL_FRAME_PARMS *frame_parm
for (i=0; i<4; i++) {
wbar[mprime] = llr[tti_offset+i];
#ifdef DEBUG_DCI_DECODING
msg("[PHY] PDCCH demapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset+i,*(char*)&wbar[mprime],*(1+(char*)&wbar[mprime]));
LOG_I(PHY,"PDCCH demapping mprime %d.%d <= llr %d (symbol %d re %d) -> (%d,%d)\n",mprime/4,i,tti_offset+i,symbol_offset,re_offset+i,*(char*)&wbar[mprime],*(1+(char*)&wbar[mprime]));
#endif
mprime++;
}
......@@ -466,8 +466,6 @@ void pdcch_deinterleaving(LTE_DL_FRAME_PARMS *frame_parms,uint16_t *z, uint16_t
// undo permutation
for (i=0; i<Mquad; i++) {
//wptr = &wtemp_rx[i<<2];
//wptr2 = &wbar[((i+frame_parms->Nid_cell)%Mquad)<<2];
wptr = &wtemp_rx[((i+frame_parms->Nid_cell)%Mquad)<<2];
wptr2 = &wbar[i<<2];
......@@ -475,16 +473,16 @@ void pdcch_deinterleaving(LTE_DL_FRAME_PARMS *frame_parms,uint16_t *z, uint16_t
wptr[1] = wptr2[1];
wptr[2] = wptr2[2];
wptr[3] = wptr2[3];
/*
msg("pdcch_deinterleaving (%p,%p): quad %d -> (%d,%d %d,%d %d,%d %d,%d)\n",wptr,wptr2,i,
((char*)wptr2)[0],
((char*)wptr2)[1],
((char*)wptr2)[2],
((char*)wptr2)[3],
((char*)wptr2)[4],
((char*)wptr2)[5],
((char*)wptr2)[6],
((char*)wptr2)[7]);
/*
printf("pdcch_deinterleaving (%p,%p): quad %d (%d) -> (%d,%d %d,%d %d,%d %d,%d)\n",wptr,wptr2,i,(i+frame_parms->Nid_cell)%Mquad,
((char*)wptr2)[0],
((char*)wptr2)[1],
((char*)wptr2)[2],
((char*)wptr2)[3],
((char*)wptr2)[4],
((char*)wptr2)[5],
((char*)wptr2)[6],
((char*)wptr2)[7]);
*/
}
......@@ -514,7 +512,7 @@ void pdcch_deinterleaving(LTE_DL_FRAME_PARMS *frame_parms,uint16_t *z, uint16_t
zptr[2] = wptr[2];
zptr[3] = wptr[3];
/*
/*
printf("deinterleaving ; k %d, index-Nd %d => (%d,%d,%d,%d,%d,%d,%d,%d)\n",k,(index-ND),
((int8_t *)wptr)[0],
((int8_t *)wptr)[1],
......@@ -524,7 +522,7 @@ void pdcch_deinterleaving(LTE_DL_FRAME_PARMS *frame_parms,uint16_t *z, uint16_t
((int8_t *)wptr)[5],
((int8_t *)wptr)[6],
((int8_t *)wptr)[7]);
*/
*/
k++;
}
......@@ -545,7 +543,7 @@ void pdcch_deinterleaving(LTE_DL_FRAME_PARMS *frame_parms,uint16_t *z, uint16_t
((int8_t *)zptr)[5],
((int8_t *)zptr)[6],
((int8_t *)zptr)[7]);
*/
*/
}
}
......@@ -922,7 +920,7 @@ void pdcch_extract_rbs_single(int32_t **rxdataF,
symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
#ifdef DEBUG_DCI_DECODING
msg("[PHY] extract_rbs_single: symbol_mod %d\n",symbol_mod);
LOG_I(PHY, "extract_rbs_single: symbol_mod %d\n",symbol_mod);
#endif
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
......@@ -1392,7 +1390,7 @@ void pdcch_channel_compensation(int32_t **rxdataF_ext,
#ifdef DEBUG_DCI_DECODING
msg("[PHY] PDCCH comp: symbol %d\n",symbol);
LOG_I(PHY, "PDCCH comp: symbol %d\n",symbol);
#endif
if (symbol==0)
......@@ -1756,9 +1754,9 @@ int32_t rx_pdcch(LTE_UE_COMMON *lte_ue_common_vars,
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++)
avgs = cmax(avgs,avgP[(aarx<<1)+aatx]);
log2_maxh = (log2_approx(avgs)/2) + 2 + frame_parms->nb_antennas_rx - 1;
log2_maxh = (log2_approx(avgs)/2) + 6 + frame_parms->nb_antennas_rx - 1;
#ifdef DEBUG_PHY
msg("[PDCCH] log2_maxh = %d (%d,%d)\n",log2_maxh,avgP[0],avgs);
LOG_I(PHY,"subframe %d: pdcch log2_maxh = %d (%d,%d)\n",subframe,log2_maxh,avgP[0],avgs);
#endif
......@@ -1946,16 +1944,17 @@ void pdcch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
x2 = (subframe<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.8.2
for (i=0; i<length; i++) {
if (i%32==0) {
if ((i&0x1f)==0) {
s = lte_gold_generic(&x1, &x2, reset);
//printf("lte_gold[%d]=%x\n",i,s);
// printf("lte_gold[%d]=%x\n",i,s);
reset = 0;
}
// take the quarter of the PBCH that corresponds to this frame
// printf("unscrambling %d : e %d, c %d\n",i,llr[i],((s>>(i&0x1f))&1));
// printf("unscrambling %d : e %d, c %d => ",i,llr[i],((s>>(i&0x1f))&1));
if (((s>>(i%32))&1)==0)
llr[i] = -llr[i];
// printf("%d\n",llr[i]);
}
}
......@@ -2013,7 +2012,7 @@ uint8_t get_num_pdcch_symbols(uint8_t num_dci,
}
msg("[PHY] dci.c: get_num_pdcch_symbols subframe %d FATAL, illegal numCCE %d (num_dci %d)\n",subframe,numCCE,num_dci);
LOG_I(PHY," dci.c: get_num_pdcch_symbols subframe %d FATAL, illegal numCCE %d (num_dci %d)\n",subframe,numCCE,num_dci);
//for (i=0;i<num_dci;i++) {
// printf("dci_alloc[%d].L = %d\n",i,dci_alloc[i].L);
//}
......@@ -2093,10 +2092,10 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
y[1] = &yseq1[0];
// reset all bits to <NIL>, here we set <NIL> elements as 2
//memset(e, 2, DCI_BITS_MAX);
// here we interpret NIL as a random QPSK sequence. That makes power estimation easier.
for (i=0; i<DCI_BITS_MAX; i++)
e[i]=0;//taus()&1;
memset(e, 2, DCI_BITS_MAX);
// // here we interpret NIL as a random QPSK sequence. That makes power estimation easier.
// for (i=0; i<DCI_BITS_MAX; i++)
// e[i]=2;//taus()&1;
e_ptr = e;
......@@ -2173,7 +2172,6 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
//((int16_t*)(&(y[1][i])))[0] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
((int16_t*)(&(y[0][i])))[0] = (*e_ptr == 2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
((int16_t*)(&(y[1][i])))[0] = (*e_ptr == 2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
e_ptr++;
//((int16_t*)(&(y[0][i])))[1] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
//((int16_t*)(&(y[1][i])))[1] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
......
......@@ -45,7 +45,7 @@
#include "SCHED/extern.h"
#include "SIMULATION/TOOLS/defs.h"
//#define DEBUG_DLSCH_DECODING
void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch)
{
......@@ -325,7 +325,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
}
#ifdef DEBUG_DLSCH_DECODING
msg("f1 %d, f2 %d, F %d\n",f1f2mat_old[2*iind],f1f2mat_old[1+(2*iind)],(r==0) ? harq_process->F : 0);
printf("f1 %d, f2 %d, F %d\n",f1f2mat_old[2*iind],f1f2mat_old[1+(2*iind)],(r==0) ? harq_process->F : 0);
#endif
start_meas(dlsch_rate_unmatching_stats);
......@@ -363,7 +363,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
r,
&E)==-1) {
stop_meas(dlsch_rate_unmatching_stats);
msg("dlsch_decoding.c: Problem in rate_matching\n");
LOG_E(PHY,"dlsch_decoding.c: Problem in rate_matching\n");
return(dlsch->max_turbo_iterations);
} else
stop_meas(dlsch_rate_unmatching_stats);
......@@ -371,7 +371,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
r_offset += E;
/*
msg("Subblock deinterleaving, d %p w %p\n",
printf("Subblock deinterleaving, d %p w %p\n",
harq_process->d[r],
harq_process->w);
*/
......@@ -389,29 +389,29 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
write_output("decoder_in.m","dec",&harq_process->d[0][96],(3*8*Kr_bytes)+12,1,0);
}
msg("decoder input(segment %d) :",r);
printf("decoder input(segment %d) :",r);
int i; for (i=0;i<(3*8*Kr_bytes)+12;i++)
msg("%d : %d\n",i,harq_process->d[r][96+i]);
msg("\n");*/
printf("%d : %d\n",i,harq_process->d[r][96+i]);
printf("\n");*/
#endif
// msg("Clearing c, %p\n",harq_process->c[r]);
// printf("Clearing c, %p\n",harq_process->c[r]);
memset(harq_process->c[r],0,Kr_bytes);
// msg("done\n");
// printf("done\n");
if (harq_process->C == 1)
crc_type = CRC24_A;
else
crc_type = CRC24_B;
/*
msg("decoder input(segment %d)\n",r);
printf("decoder input(segment %d)\n",r);
for (i=0;i<(3*8*Kr_bytes)+12;i++)
if ((harq_process->d[r][96+i]>7) ||
(harq_process->d[r][96+i] < -8))
msg("%d : %d\n",i,harq_process->d[r][96+i]);
msg("\n");
printf("%d : %d\n",i,harq_process->d[r][96+i]);
printf("\n");
*/
if (err_flag == 0) {
......@@ -446,7 +446,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
if ((err_flag == 0) && (ret>=(1+dlsch->max_turbo_iterations))) {// a Code segment is in error so break;
//msg("CRC failed, segment %d\n",r);
//printf("CRC failed, segment %d\n",r);
err_flag = 1;
}
......@@ -479,9 +479,9 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
offset = 0;
/*
msg("harq_pid %d\n",harq_pid);
msg("F %d, Fbytes %d\n",harq_process->F,harq_process->F>>3);
msg("C %d\n",harq_process->C);
printf("harq_pid %d\n",harq_pid);
printf("F %d, Fbytes %d\n",harq_process->F,harq_process->F>>3);
printf("C %d\n",harq_process->C);
*/
for (r=0; r<harq_process->C; r++) {
if (r<harq_process->Cminus)
......@@ -497,9 +497,9 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
&harq_process->c[0][(harq_process->F>>3)],
Kr_bytes - (harq_process->F>>3)- ((harq_process->C>1)?3:0));
offset = Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0);
// msg("copied %d bytes to b sequence (harq_pid %d)\n",
// printf("copied %d bytes to b sequence (harq_pid %d)\n",
// Kr_bytes - (harq_process->F>>3),harq_pid);
// msg("b[0] = %x,c[%d] = %x\n",
// printf("b[0] = %x,c[%d] = %x\n",
// harq_process->b[0],
// harq_process->F>>3,
// harq_process->c[0][(harq_process->F>>3)]);
......@@ -689,7 +689,7 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
case 0: // SI
dlsch_ue = phy_vars_ue->dlsch_ue_SI[eNB_id];
dlsch_eNB = PHY_vars_eNB_g[eNB_id2][CC_id]->dlsch_eNB_SI;
// msg("Doing SI: TBS %d\n",dlsch_ue->harq_processes[0]->TBS>>3);
// printf("Doing SI: TBS %d\n",dlsch_ue->harq_processes[0]->TBS>>3);
memcpy(dlsch_ue->harq_processes[0]->b,dlsch_eNB->harq_processes[0]->b,dlsch_ue->harq_processes[0]->TBS>>3);
#ifdef DEBUG_DLSCH_DECODING
LOG_D(PHY,"SI Decoded\n");
......@@ -790,9 +790,9 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
#ifdef DEBUG_DLSCH_DECODING
for (i=0; i<dlsch_ue->harq_processes[0]->TBS>>3; i++)
msg("%x.",dlsch_eNB->harq_processes[0]->b[i]);
printf("%x.",dlsch_eNB->harq_processes[0]->b[i]);
msg("\n");
printf("\n");
#endif
/*
......
......@@ -1007,7 +1007,7 @@ int allocate_REs_in_RB_MCH(mod_sym_t **txdataF,
uint8_t first_re,last_re;
int inc;
#ifdef DEBUG_DLSCH_MODULATION
printf("allocate_re_MCH (mod %d): symbol_offset %d re_offset %d (%d), jj %d -> %d,%d\n",mod_order,symbol_offset,re_offset,skip_dc,*jj, x0[*jj], x0[1+*jj]);
printf("allocate_re_MCH (mod %d): symbol_offset %d re_offset %d (%d), jj %d -> %d,%d, gain_lin_QPSK %d,txdataF %p\n",mod_order,symbol_offset,re_offset,skip_dc,*jj, x0[*jj], x0[1+*jj],gain_lin_QPSK,&txdataF[0][symbol_offset]);
#endif
last_re=12;
......@@ -1035,7 +1035,7 @@ int allocate_REs_in_RB_MCH(mod_sym_t **txdataF,
switch (mod_order) {
case 2: //QPSK
// printf("%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
// printf("%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++)
((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
......@@ -1046,7 +1046,7 @@ int allocate_REs_in_RB_MCH(mod_sym_t **txdataF,
*jj = *jj + 1;
// printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
// printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
break;
case 4: //16QAM
......@@ -1498,7 +1498,6 @@ int mch_modulation(mod_sym_t **txdataF,
LTE_DL_FRAME_PARMS *frame_parms,
LTE_eNB_DLSCH_t *dlsch)
{
uint8_t nsymb,nsymb_pmch;
uint32_t i,jj,re_allocated,symbol_offset;
uint16_t l,rb,re_offset;
......@@ -1526,7 +1525,7 @@ int mch_modulation(mod_sym_t **txdataF,
for (l=2; l<nsymb_pmch; l++) {
#ifdef DEBUG_DLSCH_MODULATION
msg("Generating MCH (mod %d) in %d\n",mod_order, l);
printf("Generating MCH (mod %d) in subframe %d for symbol %d\n",mod_order, subframe_offset,l);
#endif
re_offset = frame_parms->first_carrier_offset;
......@@ -1552,7 +1551,7 @@ int mch_modulation(mod_sym_t **txdataF,
else
qam_table_s = NULL;
// printf("Allocated rb %d, subframe_offset %d\n",rb,subframe_offset);
// printf("Allocated rb %d, subframe_offset %d,amp %d\n",rb,subframe_offset,amp);
allocate_REs_in_RB_MCH(txdataF,
&jj,
re_offset,
......
......@@ -78,9 +78,9 @@ void generate_pcfich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
first_reg = pcfich_reg[3];
}
#ifdef DEBUG_PCFICH
msg("[PHY] pcfich_reg : %d,%d,%d,%d\n",pcfich_reg[0],pcfich_reg[1],pcfich_reg[2],pcfich_reg[3]);
#endif
//#ifdef DEBUG_PCFICH
printf("pcfich_reg : %d,%d,%d,%d\n",pcfich_reg[0],pcfich_reg[1],pcfich_reg[2],pcfich_reg[3]);
//#endif
}
void pcfich_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
......
......@@ -291,6 +291,7 @@ void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
// compute Ngroup_PHICH (see formula at beginning of Section 6.9 in 36-211
Ngroup_PHICH = (frame_parms->phich_config_common.phich_resource*frame_parms->N_RB_DL)/48;
if (((frame_parms->phich_config_common.phich_resource*frame_parms->N_RB_DL)%48) > 0)
Ngroup_PHICH++;
......@@ -299,16 +300,25 @@ void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
Ngroup_PHICH<<=1;
}
#ifdef DEBUG_PHICH
LOG_D(PHY,"Ngroup_PHICH %d (phich_config_common.phich_resource %d,NidCell %d,Ncp %d, frame_type %d)\n",((frame_parms->Ncp == 0)?Ngroup_PHICH:(Ngroup_PHICH>>1)),
frame_parms->phich_config_common.phich_resource,
frame_parms->Nid_cell,frame_parms->Ncp,frame_parms->frame_type);
#endif
//#ifdef DEBUG_PHICH
printf("Ngroup_PHICH %d (phich_config_common.phich_resource %d,phich_config_common.phich_duration %s, NidCell %d,Ncp %d, frame_type %d), smallest pcfich REG %d, n0 %d, n1 %d (first PHICH REG %d)\n",
((frame_parms->Ncp == NORMAL)?Ngroup_PHICH:(Ngroup_PHICH>>1)),
frame_parms->phich_config_common.phich_resource,
frame_parms->phich_config_common.phich_duration==normal?"normal":"extended",
frame_parms->Nid_cell,frame_parms->Ncp,frame_parms->frame_type,
pcfich_reg[frame_parms->pcfich_first_reg_idx],
n0,
n1,
((frame_parms->Nid_cell*n0)/n1)%n0);
//#endif
// This is the algorithm from Section 6.9.3 in 36-211
for (mprime=0; mprime<((frame_parms->Ncp == 0)?Ngroup_PHICH:(Ngroup_PHICH>>1)); mprime++) {
// This is the algorithm from Section 6.9.3 in 36-211, it works only for normal PHICH duration for now ...
if (frame_parms->Ncp==0) { // normal prefix
for (mprime=0;
mprime<((frame_parms->Ncp == NORMAL)?Ngroup_PHICH:(Ngroup_PHICH>>1));
mprime++) {
if (frame_parms->phich_config_common.phich_duration==normal) { // normal PHICH duration
frame_parms->phich_reg[mprime][0] = (frame_parms->Nid_cell + mprime)%n0;
......@@ -326,9 +336,10 @@ void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
frame_parms->phich_reg[mprime][1] = (frame_parms->Nid_cell + mprime + (n0/3))%n0;
if (frame_parms->phich_reg[mprime][1]>=pcfich_reg[frame_parms->pcfich_first_reg_idx])
frame_parms->phich_reg[mprime][1]++;
if (frame_parms->phich_reg[mprime][1]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+1)&3])
frame_parms->phich_reg[mprime][1]++;
......@@ -337,9 +348,10 @@ void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
if (frame_parms->phich_reg[mprime][1]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+3)&3])
frame_parms->phich_reg[mprime][1]++;
frame_parms->phich_reg[mprime][2] = (frame_parms->Nid_cell + mprime + (2*n0/3))%n0;
if (frame_parms->phich_reg[mprime][2]>=pcfich_reg[frame_parms->pcfich_first_reg_idx])
frame_parms->phich_reg[mprime][2]++;
......@@ -351,11 +363,11 @@ void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
if (frame_parms->phich_reg[mprime][2]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+3)&3])
frame_parms->phich_reg[mprime][2]++;
#ifdef DEBUG_PHICH
LOG_D(PHY,"phich_reg :%d => %d,%d,%d\n",mprime,frame_parms->phich_reg[mprime][0],frame_parms->phich_reg[mprime][1],frame_parms->phich_reg[mprime][2]);
#endif
} else { // extended prefix
//#ifdef DEBUG_PHICH
printf("phich_reg :%d => %d,%d,%d\n",mprime,frame_parms->phich_reg[mprime][0],frame_parms->phich_reg[mprime][1],frame_parms->phich_reg[mprime][2]);
//#endif
} else { // extended PHICH duration
frame_parms->phich_reg[mprime<<1][0] = (frame_parms->Nid_cell + mprime)%n0;
frame_parms->phich_reg[1+(mprime<<1)][0] = (frame_parms->Nid_cell + mprime)%n0;
......@@ -364,10 +376,10 @@ void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
frame_parms->phich_reg[1+(mprime<<1)][1] = ((frame_parms->Nid_cell*n1/n0) + mprime + (n1/3))%n1;
frame_parms->phich_reg[1+(mprime<<1)][2] = ((frame_parms->Nid_cell*n2/n0) + mprime + (2*n2/3))%n2;
#ifdef DEBUG_PHICH
LOG_D(PHY,"phich_reg :%d => %d,%d,%d\n",mprime<<1,frame_parms->phich_reg[mprime<<1][0],frame_parms->phich_reg[mprime][1],frame_parms->phich_reg[mprime][2]);
LOG_D(PHY,"phich_reg :%d => %d,%d,%d\n",1+(mprime<<1),frame_parms->phich_reg[1+(mprime<<1)][0],frame_parms->phich_reg[1+(mprime<<1)][1],frame_parms->phich_reg[1+(mprime<<1)][2]);
#endif
//#ifdef DEBUG_PHICH
printf("phich_reg :%d => %d,%d,%d\n",mprime<<1,frame_parms->phich_reg[mprime<<1][0],frame_parms->phich_reg[mprime][1],frame_parms->phich_reg[mprime][2]);
printf("phich_reg :%d => %d,%d,%d\n",1+(mprime<<1),frame_parms->phich_reg[1+(mprime<<1)][0],frame_parms->phich_reg[1+(mprime<<1)][1],frame_parms->phich_reg[1+(mprime<<1)][2]);
//#endif
}
} // mprime loop
} // num_pdcch_symbols loop
......
lte_dfts: lte_dfts.c
gcc -O3 -msse4.1 -o lte_dfts lte_dfts.c fft.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DUSER_MODE -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS
gcc -O3 -mavx2 -o lte_dfts lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DUSER_MODE -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS
dft_cycles: lte_dfts
./lte_dfts | egrep cycles
......@@ -53,8 +53,11 @@
#define print_shorts(s,x) printf("%s %d,%d,%d,%d,%d,%d,%d,%d\n",s,(x)[0],(x)[1],(x)[2],(x)[3],(x)[4],(x)[5],(x)[6],(x)[7])
#define print_ints(s,x) printf("%s %d %d %d %d\n",s,(x)[0],(x)[1],(x)[2],(x)[3])
static int16_t conjugatedft[8] __attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1} ;
#ifdef AVX2
static int16_t conjugatedft2[16] __attribute__((aligned(32))) = {1,1,1,1,1,1,1,1,-1,1,-1,1,-1,1,-1,1,-1,1};
#endif
static int16_t conjugatedft[8] __attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1} ;
static short reflip[8] __attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
......@@ -857,8 +860,23 @@ static inline void bfly4_tw1(__m128i *x0,__m128i *x1,__m128i *x2,__m128i *x3,
static inline void bfly4_tw1(__m128i *x0,__m128i *x1,__m128i *x2,__m128i *x3,
__m128i *y0,__m128i *y1,__m128i *y2,__m128i *y3)
{
register __m128i x1_flip,x3_flip;
register __m128i x1_flip,x3_flip,x02t,x13t;
register __m128i complex_shuffle = _mm_set_epi8(13,12,15,14,9,8,11,10,5,4,7,6,1,0,3,2);
x02t = _mm_adds_epi16(*(x0),*(x2));
x13t = _mm_adds_epi16(*(x1),*(x3));
*(y0) = _mm_adds_epi16(x02t,x13t);
*(y2) = _mm_subs_epi16(x02t,x13t);
x1_flip = _mm_sign_epi16(*(x1),*(__m128i*)conjugatedft);
x1_flip = _mm_shuffle_epi8(x1_flip,complex_shuffle);
x3_flip = _mm_sign_epi16(*(x3),*(__m128i*)conjugatedft);
x3_flip = _mm_shuffle_epi8(x3_flip,complex_shuffle);
x02t = _mm_subs_epi16(*(x0),*(x2));
x13t = _mm_subs_epi16(x1_flip,x3_flip);
*(y1) = _mm_adds_epi16(x02t,x13t); // x0 + x1f - x2 - x3f
*(y3) = _mm_subs_epi16(x02t,x13t); // x0 - x1f - x2 + x3f
/*
*(y0) = _mm_adds_epi16(*(x0),_mm_adds_epi16(*(x1),_mm_adds_epi16(*(x2),*(x3))));
x1_flip = _mm_sign_epi16(*(x1),*(__m128i*)conjugatedft);
x1_flip = _mm_shuffle_epi8(x1_flip,_mm_set_epi8(13,12,15,14,9,8,11,10,5,4,7,6,1,0,3,2));
......@@ -867,7 +885,7 @@ static inline void bfly4_tw1(__m128i *x0,__m128i *x1,__m128i *x2,__m128i *x3,
*(y1) = _mm_adds_epi16(*(x0),_mm_subs_epi16(x1_flip,_mm_adds_epi16(*(x2),x3_flip)));
*(y2) = _mm_subs_epi16(*(x0),_mm_subs_epi16(*(x1),_mm_subs_epi16(*(x2),*(x3))));
*(y3) = _mm_subs_epi16(*(x0),_mm_adds_epi16(x1_flip,_mm_subs_epi16(*(x2),x3_flip)));
*/
}
#elif defined(__arm__)
......@@ -1417,6 +1435,9 @@ static inline void dft16(int16_t *x,int16_t *y)
__m128i *tw16a_128=(__m128i *)tw16a,*tw16b_128=(__m128i *)tw16b,*x128=(__m128i *)x,*y128=(__m128i *)y;
#ifndef AVX2
/* This is the original version before unrolling
bfly4_tw1(x128,x128+1,x128+2,x128+3,
......@@ -1431,6 +1452,7 @@ static inline void dft16(int16_t *x,int16_t *y)
register __m128i x1_flip,x3_flip,x02t,x13t;
register __m128i ytmp0,ytmp1,ytmp2,ytmp3,xtmp0,xtmp1,xtmp2,xtmp3;
register __m128i complex_shuffle = _mm_set_epi8(13,12,15,14,9,8,11,10,5,4,7,6,1,0,3,2);
// First stage : 4 Radix-4 butterflies without input twiddles
......@@ -1439,9 +1461,9 @@ static inline void dft16(int16_t *x,int16_t *y)
xtmp0 = _mm_adds_epi16(x02t,x13t);
xtmp2 = _mm_subs_epi16(x02t,x13t);
x1_flip = _mm_sign_epi16(x128[1],*(__m128i*)conjugatedft);
x1_flip = _mm_shuffle_epi8(x1_flip,_mm_set_epi8(13,12,15,14,9,8,11,10,5,4,7,6,1,0,3,2));
x1_flip = _mm_shuffle_epi8(x1_flip,complex_shuffle);
x3_flip = _mm_sign_epi16(x128[3],*(__m128i*)conjugatedft);
x3_flip = _mm_shuffle_epi8(x3_flip,_mm_set_epi8(13,12,15,14,9,8,11,10,5,4,7,6,1,0,3,2));
x3_flip = _mm_shuffle_epi8(x3_flip,complex_shuffle);
x02t = _mm_subs_epi16(x128[0],x128[2]);
x13t = _mm_subs_epi16(x1_flip,x3_flip);
xtmp1 = _mm_adds_epi16(x02t,x13t); // x0 + x1f - x2 - x3f
......@@ -1474,6 +1496,31 @@ static inline void dft16(int16_t *x,int16_t *y)
y128[1] = _mm_adds_epi16(x02t,x13t); // x0 + x1f - x2 - x3f
y128[3] = _mm_subs_epi16(x02t,x13t); // x0 - x1f - x2 + x3f
#else
// x02t = _mm_adds_epi16(x128[0],x128[2]);
// x13t = _mm_adds_epi16(x128[1],x128[3]);
xt = _mm256_adds_epi16(x256[0],x256[1]);
xtmp0 = _mm_adds_epi16(x02t,x13t);
xtmp2 = _mm_subs_epi16(x02t,x13t);
x13_flip
x1_flip = _mm_sign_epi16(x128[1],*(__m128i*)conjugatedft);
x1_flip = _mm_shuffle_epi8(x1_flip,_mm_set_epi8(13,12,15,14,9,8,11,10,5,4,7,6,1,0,3,2));
x3_flip = _mm_sign_epi16(x128[3],*(__m128i*)conjugatedft);
x3_flip = _mm_shuffle_epi8(x3_flip,_mm_set_epi8(13,12,15,14,9,8,11,10,5,4,7,6,1,0,3,2));
// x02t = _mm_subs_epi16(x128[0],x128[2]);
// x13t = _mm_subs_epi16(x1_flip,x3_flip);
xt = _mm256_subs_epi16(x256flip0,x256flip1);
xtmp1 = _mm_adds_epi16(x02t,x13t); // x0 + x1f - x2 - x3f
xtmp3 = _mm_subs_epi16(x02t,x13t); // x0 - x1f - x2 + x3f
#endif
#elif defined(__arm__)
......@@ -16044,7 +16091,6 @@ void dft1200(int16_t *x,int16_t *y,unsigned char scale_flag)
#include <string.h>
#include <stdio.h>
int opp_enabled=1;
int main(int argc, char**argv)
{
......@@ -16057,7 +16103,7 @@ int main(int argc, char**argv)
int i;
set_taus_seed(0);
opp_enabled = 1;
/*
((int16_t *)&tw0)[0] = 32767;
((int16_t *)&tw0)[1] = 0;
......@@ -16423,7 +16469,7 @@ int main(int argc, char**argv)
}
printf("\n\n64-point (%f cycles)\n",(double)ts.diff/(double)ts.trials);
printf("\n\n64-point (%f cycles, #trials %d)\n",(double)ts.diff/(double)ts.trials,ts.trials);
write_output("x64.m","x64",x,64,1,1);
write_output("y64.m","y64",y,64,1,1);
......@@ -127,7 +127,7 @@ static inline void* malloc16_clear( size_t size )
#define NB_BANDS_MAX 8
typedef enum {normal_txrx=0,rx_calib_ue=1,rx_calib_ue_med=2,rx_calib_ue_byp=3,debug_prach=4,no_L2_connect=5,calib_prach_tx=6} runmode_t;
typedef enum {normal_txrx=0,rx_calib_ue=1,rx_calib_ue_med=2,rx_calib_ue_byp=3,debug_prach=4,no_L2_connect=5,calib_prach_tx=6,rx_dump_frame=7,loop_through_memory=8} runmode_t;
enum transmission_access_mode {
NO_ACCESS=0,
......
......@@ -318,10 +318,11 @@ int get_nCCE_offset(const unsigned char L, const int nCCE, const int common_dci,
if (common_dci == 1) {
// check CCE(0 ... L-1)
nb_candidates = (L==4) ? 4 : 2;
nb_candidates = min(nb_candidates,nCCE/L);
for (m = 0 ; m < nb_candidates ; m++) {
for (m = nb_candidates-1 ; m >=0 ; m--) {
search_space_free = 1;
printf("Checking m %d\n",m);
for (l=0; l<L; l++) {
if (CCE_table[(m*L) + l] == 1) {
search_space_free = 0;
......@@ -332,7 +333,7 @@ int get_nCCE_offset(const unsigned char L, const int nCCE, const int common_dci,
if (search_space_free == 1) {
for (l=0; l<L; l++)
CCE_table[(m*L)+l]=1;
printf("OK");
return(m*L);
}
}
......
......@@ -1961,6 +1961,8 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *phy_vars_ue,uint8_t abst
(phy_vars_ue->lte_frame_parms.mode1_flag == 1) ? SISO : ALAMOUTI,
phy_vars_ue->high_speed_flag,
phy_vars_ue->is_secondary_ue);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH, VCD_FUNCTION_OUT);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DCI_DECODING, VCD_FUNCTION_IN);
dci_cnt = dci_decoding_procedure(phy_vars_ue,
......@@ -2107,8 +2109,11 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *phy_vars_ue,uint8_t abst
//if ((phy_vars_ue->UE_mode[eNB_id] != PRACH) &&
// (dci_alloc_rx[i].rnti != 0x1234) &&
if((dci_alloc_rx[i].rnti == phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti) &&
(dci_alloc_rx[i].format != format0)) {
if ((phy_vars_ue->UE_mode[eNB_id]>PRACH) &&
(dci_alloc_rx[i].rnti == phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti) &&
(dci_alloc_rx[i].format != format0)) {
#ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[UE %d][DCI][PDSCH %x] frame %d, subframe %d: format %d, num_pdcch_symbols %d, nCCE %d, total CCEs %d\n",
phy_vars_ue->Mod_id,dci_alloc_rx[i].rnti,
......@@ -2118,14 +2123,10 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *phy_vars_ue,uint8_t abst
phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->nCCE[subframe_rx],
get_nCCE(3,&phy_vars_ue->lte_frame_parms,get_mi(&phy_vars_ue->lte_frame_parms,0)));
/*
if (((frame_rx%100) == 0) || (frame_rx < 20))
dump_dci(&phy_vars_ue->lte_frame_parms, &dci_alloc_rx[i]);
*/
#endif
#ifdef DIAG_PHY
if (!(((subframe_rx == 7) && (dci_alloc_rx[i].format == format1E_2A_M10PRB)) ||
((subframe_rx == 7) && (dci_alloc_rx[i].format == format1)))) {
LOG_E(PHY,"[UE %d][DIAG] frame %d, subframe %d: should not have received C_RNTI Format %d!\n",phy_vars_ue->Mod_id,frame_rx,subframe_rx,dci_alloc_rx[i].format);
......@@ -2134,40 +2135,40 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *phy_vars_ue,uint8_t abst
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PDCCH_PROCEDURES, VCD_FUNCTION_OUT);
return(-1);
}
#endif