Commit c160f96d authored by Raymond Knopp's avatar Raymond Knopp

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4042 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 350c7808
...@@ -186,7 +186,7 @@ int data_detection(RX_VECTOR_t *rxv,uint8_t *data_ind,uint32_t* rx_data,int fram ...@@ -186,7 +186,7 @@ int data_detection(RX_VECTOR_t *rxv,uint8_t *data_ind,uint32_t* rx_data,int fram
#endif #endif
#endif #endif
// log2_maxh=10; // log2_maxh=7;
mult_cpx_vector_norep_unprepared_conjx2(rxDATA_F,(int16_t*)chest,(int16_t*)rxDATA_F_comp,64,log2_maxh); mult_cpx_vector_norep_unprepared_conjx2(rxDATA_F,(int16_t*)chest,(int16_t*)rxDATA_F_comp,64,log2_maxh);
#ifdef EXECTIME #ifdef EXECTIME
#ifdef RTAI #ifdef RTAI
...@@ -301,6 +301,8 @@ int data_detection(RX_VECTOR_t *rxv,uint8_t *data_ind,uint32_t* rx_data,int fram ...@@ -301,6 +301,8 @@ int data_detection(RX_VECTOR_t *rxv,uint8_t *data_ind,uint32_t* rx_data,int fram
rotate_cpx_vector_norep(rxDATA_F_comp2,&cfo_Q15,rxDATA_F_comp3,48,log2_maxh>>1); rotate_cpx_vector_norep(rxDATA_F_comp2,&cfo_Q15,rxDATA_F_comp3,48,log2_maxh>>1);
#ifdef DEBUG_DATA #ifdef DEBUG_DATA
if (s==0)
write_output("rxDATA_F_mag.m","rxDAT_mag",rxDATA_F_mag,48,1,0);
sprintf(fname,"rxDATA_F%d.m",s); sprintf(fname,"rxDATA_F%d.m",s);
sprintf(vname,"rxDAT_F_%d",s); sprintf(vname,"rxDAT_F_%d",s);
write_output(fname,vname, rxDATA_F,128,2,1); write_output(fname,vname, rxDATA_F,128,2,1);
...@@ -376,14 +378,14 @@ int data_detection(RX_VECTOR_t *rxv,uint8_t *data_ind,uint32_t* rx_data,int fram ...@@ -376,14 +378,14 @@ int data_detection(RX_VECTOR_t *rxv,uint8_t *data_ind,uint32_t* rx_data,int fram
pos = interleaver_16qam[k]; pos = interleaver_16qam[k];
// printf("k %d, pos %d\n",k,pos); // printf("k %d, pos %d\n",k,pos);
if ((pos&1)==1) { if ((pos&1)==1) {
tmp = ((int16_t*)rxDATA_F_comp3)[pos>>1]>>4; tmp = ((int16_t*)rxDATA_F_comp2)[pos>>1]>>4;
//printf("pos (msb) %d : %d\n",pos>>1,tmp); // printf("pos (msb) %d : %d\n",pos>>1,tmp);
} }
else { else {
tmp = ((int16_t*)rxDATA_F_comp3)[pos>>1]; tmp = ((int16_t*)rxDATA_F_comp2)[pos>>1];
tmp = (tmp<0)? tmp : -tmp; tmp = (tmp<0)? tmp : -tmp;
tmp = (tmp + rxDATA_F_mag[pos>>2])>>4; tmp = (tmp + rxDATA_F_mag[pos>>2])>>4;
//printf("pos (lsb) %d : rxDATA_F_mag[%d] %d : %d (%d)\n",pos>>1,pos>>2,rxDATA_F_mag[pos>>2],tmp,((int16_t*)rxDATA_F_comp2)[pos>>1]); // printf("pos (lsb) %d : rxDATA_F_mag[%d] %d : %d (%d)\n",pos>>1,pos>>2,rxDATA_F_mag[pos>>2],tmp,((int16_t*)rxDATA_F_comp2)[pos>>1]);
} }
if (tmp<-8) if (tmp<-8)
...@@ -401,10 +403,10 @@ int data_detection(RX_VECTOR_t *rxv,uint8_t *data_ind,uint32_t* rx_data,int fram ...@@ -401,10 +403,10 @@ int data_detection(RX_VECTOR_t *rxv,uint8_t *data_ind,uint32_t* rx_data,int fram
rxDATA_llr[k] = (int8_t)tmp; rxDATA_llr[k] = (int8_t)tmp;
*/ */
} }
if (rxv->rate==3) { // rate 3/4, so add zeros for punctured bits if (rxv->rate==5) { // rate 3/4, so add zeros for punctured bits
llr_ptr = rxDATA_llr2; llr_ptr = rxDATA_llr2;
memset(rxDATA_llr2,0,144); memset(rxDATA_llr2,0,288);
for (k=0,k2=0;k<96;k++,k2++) { for (k=0,k2=0;k<192;k++,k2++) {
rxDATA_llr2[k2] = rxDATA_llr[k]; rxDATA_llr2[k2] = rxDATA_llr[k];
if ((k&3) == 2) if ((k&3) == 2)
k2+=2; k2+=2;
......
...@@ -268,7 +268,7 @@ CHANNEL_STATUS_t initial_sync(RX_VECTOR_t **rx_vector, ...@@ -268,7 +268,7 @@ CHANNEL_STATUS_t initial_sync(RX_VECTOR_t **rx_vector,
#endif #endif
#endif #endif
if ((dB_fixed(mean_energy) > 15) && (peak_energy>(50*mean_energy))) { if ((dB_fixed(mean_energy) > 10) && (peak_energy>(50*mean_energy))) {
#ifdef DEBUG_SYNC #ifdef DEBUG_SYNC
write_output("STSLTScorr.m","STSLTScorrT", corrT,512,2,1); write_output("STSLTScorr.m","STSLTScorrT", corrT,512,2,1);
#endif #endif
......
...@@ -403,8 +403,11 @@ int phy_tx_start_bot(TX_VECTOR_t *tx_vector,int16_t *output_ptr,uint32_t tx_offs ...@@ -403,8 +403,11 @@ int phy_tx_start_bot(TX_VECTOR_t *tx_vector,int16_t *output_ptr,uint32_t tx_offs
} }
break; break;
default:
break;
} }
#ifdef DEBUG_TX #ifdef DEBUG_TX
if (s<12) { if (s<12) {
for (i=0;i<64;i++) for (i=0;i<64;i++)
......
...@@ -3,7 +3,7 @@ CC = gcc ...@@ -3,7 +3,7 @@ CC = gcc
SSE3PROC = $(shell echo `grep ssse3 /proc/cpuinfo`) SSE3PROC = $(shell echo `grep ssse3 /proc/cpuinfo`)
SSE4PROC = $(shell echo `grep sse4 /proc/cpuinfo`) SSE4PROC = $(shell echo `grep sse4 /proc/cpuinfo`)
CPUFLAGS = -mmmx -msse -msse2 -m32 -mssse3 #-msse4 CPUFLAGS = -mmmx -msse -msse2 -m32 -mssse3 -msse4.1
#CPUFLAGS += $(shell if [ -z $(SSE3PROC) ]; then echo "" ; else echo "-mssse3"; fi) #CPUFLAGS += $(shell if [ -z $(SSE3PROC) ]; then echo "" ; else echo "-mssse3"; fi)
#CPUFLAGS += $(shell if [ -z $(SSE4PROC) ]; then echo "" ; else echo "-msse4"; fi) #CPUFLAGS += $(shell if [ -z $(SSE4PROC) ]; then echo "" ; else echo "-msse4"; fi)
......
...@@ -55,6 +55,15 @@ int main(int argc, char **argv) { ...@@ -55,6 +55,15 @@ int main(int argc, char **argv) {
int off,off2; int off,off2;
double txg,txg_dB; double txg,txg_dB;
int log2_maxh; int log2_maxh;
double snr_array[100];
int errors_array[100];
int trials_array[100];
int misdetected_errors_array[100];
int signal_errors_array[100];
int missed_packets_array[100];
int cnt=0;
char fname[100],vname[100];
int stop=0;
data_ind = (uint8_t*)malloc(4095+2+1); data_ind = (uint8_t*)malloc(4095+2+1);
data_ind_rx = (uint8_t*)malloc(4095+2+1); data_ind_rx = (uint8_t*)malloc(4095+2+1);
...@@ -230,7 +239,7 @@ int main(int argc, char **argv) { ...@@ -230,7 +239,7 @@ int main(int argc, char **argv) {
} }
phy_tx_start(&tx_vector,txdata,0,data_ind); phy_tx_start(&tx_vector,txdata,0,FRAME_LENGTH_SAMPLES_MAX,data_ind);
tx_lev = signal_energy((int32_t*)txdata,320); tx_lev = signal_energy((int32_t*)txdata,320);
tx_lev_dB = (unsigned int) dB_fixed(tx_lev); tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
...@@ -246,11 +255,12 @@ int main(int argc, char **argv) { ...@@ -246,11 +255,12 @@ int main(int argc, char **argv) {
for (SNR=snr0;SNR<snr1;SNR+=.2) { for (SNR=snr0;SNR<snr1;SNR+=.2) {
printf("n_frames %d SNR %f\n",n_frames,SNR); printf("n_frames %d SNR %f sdu_length %d rate %d\n",n_frames,SNR,tx_vector.sdu_length,tx_vector.rate);
errors=0; errors=0;
misdetected_errors=0; misdetected_errors=0;
signal_errors=0; signal_errors=0;
missed_packets=0; missed_packets=0;
stop=0;
for (trial=0; trial<n_frames; trial++) { for (trial=0; trial<n_frames; trial++) {
// printf("Trial %d (errors %d), sdu_length_samples %d\n",trial,errors,sdu_length_samples); // printf("Trial %d (errors %d), sdu_length_samples %d\n",trial,errors,sdu_length_samples);
sigma2_dB = 25; //10*log10((double)tx_lev) - SNR; sigma2_dB = 25; //10*log10((double)tx_lev) - SNR;
...@@ -311,12 +321,18 @@ int main(int argc, char **argv) { ...@@ -311,12 +321,18 @@ int main(int argc, char **argv) {
else else
off2=off; off2=off;
if ((initial_sync(&rxv,&rx_offset,&log2_maxh,(uint32_t*)rxdata[0],FRAME_LENGTH_SAMPLES_MAX,off2,1) == BUSY)) { if ((initial_sync(&rxv,&rx_offset,&log2_maxh,(uint32_t*)rxdata[0],FRAME_LENGTH_SAMPLES_MAX,off2,1) == BUSY)) {
// printf("Channel is busy, rxv %p, offset %d\n",(void*)rxv,rx_offset); if (n_frames==1)
printf("Channel is busy, rxv %p, offset %d\n",(void*)rxv,rx_offset);
no_detection=0; no_detection=0;
if (rxv) { if (rxv) {
// printf("Rate %d, SDU_LENGTH %d\n",rxv->rate,rxv->sdu_length); if (n_frames==1)
printf("Rate %d, SDU_LENGTH %d\n",rxv->rate,rxv->sdu_length);
if ( (rxv->rate != tx_vector.rate)||(rxv->sdu_length != tx_vector.sdu_length)) { if ( (rxv->rate != tx_vector.rate)||(rxv->sdu_length != tx_vector.sdu_length)) {
signal_errors++; signal_errors++;
if ((signal_errors > (n_frames/10)) && (trial>=100)) {
stop=1;
}
if (n_frames == 1)
printf("SIGNAL error: rx_offset %d, tx_offset %d (off2 %d)\n",rx_offset,tx_offset,off2); printf("SIGNAL error: rx_offset %d, tx_offset %d (off2 %d)\n",rx_offset,tx_offset,off2);
break; break;
} }
...@@ -325,20 +341,32 @@ int main(int argc, char **argv) { ...@@ -325,20 +341,32 @@ int main(int argc, char **argv) {
if (data_detection(rxv,data_ind_rx,(uint32_t*)rxdata[0],FRAME_LENGTH_SAMPLES_MAX,rx_offset,log2_maxh,NULL)) { if (data_detection(rxv,data_ind_rx,(uint32_t*)rxdata[0],FRAME_LENGTH_SAMPLES_MAX,rx_offset,log2_maxh,NULL)) {
for (i=0;i<rxv->sdu_length+6;i++) { for (i=0;i<rxv->sdu_length+6;i++) {
if (data_ind[i]!=data_ind_rx[i]) { if (data_ind[i]!=data_ind_rx[i]) {
printf("error position %d : %x,%x\n",i,data_ind[i],data_ind_rx[i]); //printf("error position %d : %x,%x\n",i,data_ind[i],data_ind_rx[i]);
misdetected_errors++; misdetected_errors++;
errors++; errors++;
} }
} }
if ((errors > (n_frames/10)) && (trial>100)) {
stop=1;
break;
}
} // initial_synch returns IDLE } // initial_synch returns IDLE
else { else {
/* printf("Running data_detection fails\n"); errors++;
if (n_frames == 1) {
printf("Running data_detection fails\n");
for (i=0;i<rxv->sdu_length+6;i++) { for (i=0;i<rxv->sdu_length+6;i++) {
if (data_ind[i]!=data_ind_rx[i]) { if (data_ind[i]!=data_ind_rx[i]) {
printf("error position %d : %x,%x\n",i,data_ind[i],data_ind_rx[i]); printf("error position %d : %x,%x\n",i,data_ind[i],data_ind_rx[i]);
} }
} }
*/ }
if ((errors > (n_frames/10)) && (trial>=100)) {
stop=1;
break;
}
} }
break; break;
} }
...@@ -350,15 +378,43 @@ int main(int argc, char **argv) { ...@@ -350,15 +378,43 @@ int main(int argc, char **argv) {
} }
if (no_detection==1) if (no_detection==1)
missed_packets++; missed_packets++;
if (stop==1)
break;
} }
printf("\nSNR %f dB: errors %d/%d, misdetected errors %d/%d,signal_errors %d/%d, missed_packets %d/%d\n",SNR,errors,n_frames-signal_errors,misdetected_errors,n_frames-signal_errors,signal_errors,n_frames,missed_packets,n_frames); printf("\nSNR %f dB: errors %d/%d, misdetected errors %d/%d,signal_errors %d/%d, missed_packets %d/%d\n",SNR,errors,trial-signal_errors,misdetected_errors,trial-signal_errors,signal_errors,trial,missed_packets,trial);
snr_array[cnt] = SNR;
errors_array[cnt] = errors;
trials_array[cnt] = trial;
misdetected_errors_array[cnt] = misdetected_errors;
signal_errors_array[cnt] = signal_errors;
missed_packets_array[cnt] = missed_packets;
cnt++;
if (cnt>99) {
printf("too many SNR points, exiting ...\n");
break;
}
if (errors == 0)
break;
#ifdef EXECTIME #ifdef EXECTIME
print_is_stats(); print_is_stats();
print_dd_stats(); print_dd_stats();
#endif #endif
} }
sprintf(fname,"SNR_%d_%d.m",tx_vector.rate,tx_vector.sdu_length);
sprintf(vname,"SNR_%d_%d_v",tx_vector.rate,tx_vector.sdu_length);
write_output(fname,vname,snr_array,cnt,1,7);
sprintf(fname,"errors_%d_%d.m",tx_vector.rate,tx_vector.sdu_length);
sprintf(vname,"errors_%d_%d_v",tx_vector.rate,tx_vector.sdu_length);
write_output(fname,vname,errors_array,cnt,1,2);
sprintf(fname,"trials_%d_%d.m",tx_vector.rate,tx_vector.sdu_length);
sprintf(vname,"trials_%d_%d_v",tx_vector.rate,tx_vector.sdu_length);
write_output(fname,vname,trials_array,cnt,1,2);
sprintf(fname,"signal_errors_%d_%d.m",tx_vector.rate,tx_vector.sdu_length);
sprintf(vname,"signal_errors_%d_%d_v",tx_vector.rate,tx_vector.sdu_length);
write_output(fname,vname,signal_errors_array,cnt,1,2);
free(data_ind); free(data_ind);
free(data_ind_rx); free(data_ind_rx);
// free_channel_desc_scm(ch); // free_channel_desc_scm(ch);
......
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