diff --git a/lib/examples/pdsch_ue.c b/lib/examples/pdsch_ue.c index 2b267efde..702049f73 100644 --- a/lib/examples/pdsch_ue.c +++ b/lib/examples/pdsch_ue.c @@ -685,19 +685,20 @@ int main(int argc, char **argv) { /* Transmission mode 1 */ n = srslte_ue_dl_decode(&ue_dl, data, 0, sfn*10+srslte_ue_sync_get_sfidx(&ue_sync), acks); } else { - if (prog_args.rf_nof_rx_ant == 1) { - /* Transmission mode 2 */ - n = srslte_ue_dl_decode(&ue_dl, data, 1, sfn * 10 + srslte_ue_sync_get_sfidx(&ue_sync), - acks); - } else { + /* Transmission mode 2 */ + n = srslte_ue_dl_decode(&ue_dl, data, 1, sfn * 10 + srslte_ue_sync_get_sfidx(&ue_sync), + acks); + + if (n < 1) { /* Transmission mode 3 */ n = srslte_ue_dl_decode(&ue_dl, data, 2, sfn * 10 + srslte_ue_sync_get_sfidx(&ue_sync), acks); - if (n < 1) { - /* Transmission mode 4 */ - n = srslte_ue_dl_decode(&ue_dl, data, 3, sfn * 10 + srslte_ue_sync_get_sfidx(&ue_sync), - acks); - } + } + + if (n < 1) { + /* Transmission mode 4 */ + n = srslte_ue_dl_decode(&ue_dl, data, 3, sfn * 10 + srslte_ue_sync_get_sfidx(&ue_sync), + acks); } } @@ -817,10 +818,13 @@ int main(int argc, char **argv) { /* MIMO: if tx and rx antennas are bigger than 1 */ if (cell.nof_ports > 1 && ue_dl.pdsch.nof_rx_antennas > 1) { /* Compute condition number */ - srslte_ue_dl_ri_select(&ue_dl, NULL, &cn); - - /* Print condition number */ - PRINT_LINE(" κ: %.1f dB (Condition number, 0 dB => Best)", cn); + if (srslte_ue_dl_ri_select(&ue_dl, NULL, &cn)) { + /* Condition number calculation is not supported for the number of tx & rx antennas*/ + PRINT_LINE(" κ: NA"); + } else { + /* Print condition number */ + PRINT_LINE(" κ: %.1f dB (Condition number, 0 dB => Best)", cn); + } } PRINT_LINE(""); @@ -828,24 +832,25 @@ int main(int argc, char **argv) { if (ue_dl.pdsch_cfg.mimo_type == SRSLTE_MIMO_TYPE_SPATIAL_MULTIPLEX) { /* Compute Rank Indicator (RI) and Precoding Matrix Indicator (PMI) */ - srslte_ue_dl_ri_pmi_select(&ue_dl, &ri, &pmi, NULL); - for (uint32_t nl = 0; nl < SRSLTE_MAX_LAYERS; nl++) { - for (uint32_t cb = 0; cb < SRSLTE_MAX_CODEBOOKS; cb++) { - sinr[nl][cb] = SRSLTE_VEC_EMA(ue_dl.sinr[nl][cb], sinr[nl][cb], 0.5f); + if (!srslte_ue_dl_ri_pmi_select(&ue_dl, &ri, &pmi, NULL)) { + for (uint32_t nl = 0; nl < SRSLTE_MAX_LAYERS; nl++) { + for (uint32_t cb = 0; cb < SRSLTE_MAX_CODEBOOKS; cb++) { + sinr[nl][cb] = SRSLTE_VEC_EMA(ue_dl.sinr[nl][cb], sinr[nl][cb], 0.5f); + } } - } - /* Print Multiplex stats */ - PRINT_LINE("SINR (dB) Vs RI and PMI:"); - PRINT_LINE(" | RI | 1 | 2 |"); - PRINT_LINE(" -------+-------+-------+"); - PRINT_LINE(" P | 0 | %5.2f%c| %5.2f%c|", 10 * log10(sinr[0][0]), (ri == 1 && pmi == 0) ? '*' : ' ', - 10 * log10(sinr[1][0]), (ri == 2 && pmi == 0) ? '*' : ' '); - PRINT_LINE(" M | 1 | %5.2f%c| %5.2f%c|", 10 * log10(sinr[0][1]), (ri == 1 && pmi == 1) ? '*' : ' ', - 10 * log10(sinr[1][1]), (ri == 2 && pmi == 1) ? '*' : ' '); - PRINT_LINE(" I | 2 | %5.2f%c|-------+ ", 10 * log10(sinr[0][2]), (ri == 1 && pmi == 2) ? '*' : ' '); - PRINT_LINE(" | 3 | %5.2f%c| ", 10 * log10(sinr[0][3]), (ri == 1 && pmi == 3) ? '*' : ' '); - PRINT_LINE(""); + /* Print Multiplex stats */ + PRINT_LINE("SINR (dB) Vs RI and PMI:"); + PRINT_LINE(" | RI | 1 | 2 |"); + PRINT_LINE(" -------+-------+-------+"); + PRINT_LINE(" P | 0 | %5.2f%c| %5.2f%c|", 10 * log10(sinr[0][0]), (ri == 1 && pmi == 0) ? '*' : ' ', + 10 * log10(sinr[1][0]), (ri == 2 && pmi == 0) ? '*' : ' '); + PRINT_LINE(" M | 1 | %5.2f%c| %5.2f%c|", 10 * log10(sinr[0][1]), (ri == 1 && pmi == 1) ? '*' : ' ', + 10 * log10(sinr[1][1]), (ri == 2 && pmi == 1) ? '*' : ' '); + PRINT_LINE(" I | 2 | %5.2f%c|-------+ ", 10 * log10(sinr[0][2]), (ri == 1 && pmi == 2) ? '*' : ' '); + PRINT_LINE(" | 3 | %5.2f%c| ", 10 * log10(sinr[0][3]), (ri == 1 && pmi == 3) ? '*' : ' '); + PRINT_LINE(""); + } } PRINT_LINE("Press enter maximum printing debug log of 1 subframe."); PRINT_LINE(""); diff --git a/lib/src/phy/mimo/precoding.c b/lib/src/phy/mimo/precoding.c index 31ba2ca0a..a78c13056 100644 --- a/lib/src/phy/mimo/precoding.c +++ b/lib/src/phy/mimo/precoding.c @@ -689,13 +689,13 @@ int srslte_predecoding_ccd_zf(cf_t *y[SRSLTE_MAX_PORTS], cf_t *h[SRSLTE_MAX_PORT #endif /* LV_HAVE_SSE */ #endif /* LV_HAVE_AVX */ } else { - fprintf(stderr, "Error predecoding CCD: Invalid number of layers %d\n", nof_layers); + DEBUG("Error predecoding CCD: Invalid number of layers %d\n", nof_layers); return -1; } } else if (nof_ports == 4) { - fprintf(stderr, "Error predecoding CCD: Only 2 ports supported\n"); + DEBUG("Error predecoding CCD: Only 2 ports supported\n"); } else { - fprintf(stderr, "Error predecoding CCD: Invalid combination of ports %d and rx antennax %d\n", nof_ports, nof_rxant); + DEBUG("Error predecoding CCD: Invalid combination of ports %d and rx antennax %d\n", nof_ports, nof_rxant); } return SRSLTE_ERROR; } @@ -809,20 +809,20 @@ int srslte_predecoding_ccd_mmse(cf_t *y[SRSLTE_MAX_PORTS], cf_t *h[SRSLTE_MAX_PO #ifdef LV_HAVE_AVX return srslte_predecoding_ccd_2x2_mmse_avx(y, h, x, nof_symbols, scaling, noise_estimate); #else - #ifdef LV_HAVE_SSE +#ifdef LV_HAVE_SSE return srslte_predecoding_ccd_2x2_mmse_sse(y, h, x, nof_symbols, scaling, noise_estimate); #else return srslte_predecoding_ccd_2x2_mmse_gen(y, h, x, nof_symbols, scaling, noise_estimate); #endif /* LV_HAVE_SSE */ #endif /* LV_HAVE_AVX */ } else { - fprintf(stderr, "Error predecoding CCD: Invalid number of layers %d\n", nof_layers); + DEBUG("Error predecoding CCD: Invalid number of layers %d\n", nof_layers); return -1; } } else if (nof_ports == 4) { - fprintf(stderr, "Error predecoding CCD: Only 2 ports supported\n"); + DEBUG("Error predecoding CCD: Only 2 ports supported\n"); } else { - fprintf(stderr, "Error predecoding CCD: Invalid combination of ports %d and rx antennax %d\n", nof_ports, nof_rxant); + DEBUG("Error predecoding CCD: Invalid combination of ports %d and rx antennax %d\n", nof_ports, nof_rxant); } return SRSLTE_ERROR; } @@ -843,7 +843,7 @@ int srslte_predecoding_multiplex_2x2_zf_avx(cf_t *y[SRSLTE_MAX_PORTS], cf_t *h[S norm = 2.0f / scaling; break; default: - ERROR("Wrong codebook_idx=%d", codebook_idx); + DEBUG("Wrong codebook_idx=%d", codebook_idx); return SRSLTE_ERROR; } @@ -874,7 +874,7 @@ int srslte_predecoding_multiplex_2x2_zf_avx(cf_t *y[SRSLTE_MAX_PORTS], cf_t *h[S h11 = _mm256_sub_ps(_h01, _MM256_MULJ_PS(_h11)); break; default: - fprintf(stderr, "Wrong codebook_idx=%d\n", codebook_idx); + DEBUG("Wrong codebook_idx=%d\n", codebook_idx); return SRSLTE_ERROR; } @@ -1405,9 +1405,9 @@ int srslte_predecoding_multiplex(cf_t *y[SRSLTE_MAX_PORTS], cf_t *h[SRSLTE_MAX_P #endif /* LV_HAVE_AVX */ } } else if (nof_ports == 4) { - ERROR("Error predecoding multiplex: not implemented for %d Tx ports", nof_ports); + DEBUG("Error predecoding multiplex: not implemented for %d Tx ports", nof_ports); } else { - ERROR("Error predecoding multiplex: Invalid combination of ports %d and rx antennas %d\n", nof_ports, nof_rxant); + DEBUG("Error predecoding multiplex: Invalid combination of ports %d and rx antennas %d\n", nof_ports, nof_rxant); } return SRSLTE_ERROR; } @@ -1445,8 +1445,7 @@ int srslte_predecoding_type(cf_t *y[SRSLTE_MAX_PORTS], cf_t *h[SRSLTE_MAX_PORTS] break; } } else { - fprintf(stderr, - "Invalid number of layers %d\n", nof_layers); + DEBUG("Invalid number of layers %d\n", nof_layers); return -1; } return -1; @@ -1611,7 +1610,7 @@ int srslte_precoding_cdd(cf_t *x[SRSLTE_MAX_LAYERS], cf_t *y[SRSLTE_MAX_PORTS], { if (nof_ports == 2) { if (nof_layers != 2) { - fprintf(stderr, "Invalid number of layers %d for 2 ports\n", nof_layers); + DEBUG("Invalid number of layers %d for 2 ports\n", nof_layers); return -1; } #ifdef LV_HAVE_AVX @@ -1624,10 +1623,10 @@ int srslte_precoding_cdd(cf_t *x[SRSLTE_MAX_LAYERS], cf_t *y[SRSLTE_MAX_PORTS], #endif /* LV_HAVE_SSE */ #endif /* LV_HAVE_AVX */ } else if (nof_ports == 4) { - fprintf(stderr, "Not implemented\n"); + DEBUG("Not implemented\n"); return -1; } else { - fprintf(stderr, "Number of ports must be 2 or 4 for transmit diversity (nof_ports=%d)\n", nof_ports); + DEBUG("Number of ports must be 2 or 4 for transmit diversity (nof_ports=%d)\n", nof_ports); return -1; } } @@ -2557,7 +2556,7 @@ int srslte_precoding_cn(cf_t *h[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS], uint32_t no *cn = srslte_precoding_2x2_cn_gen(h, nof_symbols); return SRSLTE_SUCCESS; } else { - ERROR("MIMO Condition Number calculation not implemented for %d×%d", nof_tx_antennas, nof_rx_antennas); + DEBUG("MIMO Condition Number calculation not implemented for %d×%d", nof_tx_antennas, nof_rx_antennas); return SRSLTE_ERROR; } } diff --git a/lib/src/phy/phch/pdsch.c b/lib/src/phy/phch/pdsch.c index 8c57d5ac9..fbf0860be 100644 --- a/lib/src/phy/phch/pdsch.c +++ b/lib/src/phy/phch/pdsch.c @@ -702,8 +702,8 @@ int srslte_pdsch_decode(srslte_pdsch_t *q, // Pre-decoder if (srslte_predecoding_type(q->symbols, q->ce, x, q->nof_rx_antennas, q->cell.nof_ports, cfg->nof_layers, cfg->codebook_idx, cfg->nbits[0].nof_re, cfg->mimo_type, pdsch_scaling, noise_estimate)<0) { - printf("Error predecoding\n"); - return -1; + DEBUG("Error predecoding\n"); + return SRSLTE_ERROR; } // Layer demapping only if necessary @@ -765,7 +765,7 @@ int srslte_pdsch_pmi_select(srslte_pdsch_t *q, } } } else { - ERROR("Not implemented configuration"); + DEBUG("Not implemented configuration"); return SRSLTE_ERROR_INVALID_INPUTS; } diff --git a/lib/src/phy/ue/ue_dl.c b/lib/src/phy/ue/ue_dl.c index 348d0bdb6..036f2b7cb 100644 --- a/lib/src/phy/ue/ue_dl.c +++ b/lib/src/phy/ue/ue_dl.c @@ -718,7 +718,7 @@ int srslte_ue_dl_ri_pmi_select(srslte_ue_dl_t *q, uint8_t *ri, uint8_t *pmi, flo } else { if (srslte_pdsch_pmi_select(&q->pdsch, &q->pdsch_cfg, q->ce_m, noise_estimate, SRSLTE_SF_LEN_RE(q->cell.nof_prb, q->cell.cp), q->pmi, q->sinr)) { - ERROR("SINR calculation error"); + DEBUG("SINR calculation error"); return SRSLTE_ERROR; }