|
|
@ -33,11 +33,6 @@
|
|
|
|
#include <assert.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include "srslte/phy/phch/pdsch.h"
|
|
|
|
#include "srslte/phy/phch/pdsch.h"
|
|
|
|
#include "srslte/phy/phch/pusch.h"
|
|
|
|
|
|
|
|
#include "srslte/phy/phch/sch.h"
|
|
|
|
|
|
|
|
#include "srslte/phy/phch/pmch.h"
|
|
|
|
|
|
|
|
#include "srslte/phy/phch/uci.h"
|
|
|
|
|
|
|
|
#include "srslte/phy/common/phy_common.h"
|
|
|
|
|
|
|
|
#include "srslte/phy/utils/bit.h"
|
|
|
|
#include "srslte/phy/utils/bit.h"
|
|
|
|
#include "srslte/phy/utils/debug.h"
|
|
|
|
#include "srslte/phy/utils/debug.h"
|
|
|
|
#include "srslte/phy/utils/vector.h"
|
|
|
|
#include "srslte/phy/utils/vector.h"
|
|
|
@ -174,15 +169,10 @@ void srslte_sch_set_max_noi(srslte_sch_t *q, uint32_t max_iterations) {
|
|
|
|
q->max_iterations = max_iterations;
|
|
|
|
q->max_iterations = max_iterations;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
float srslte_sch_average_noi(srslte_sch_t *q) {
|
|
|
|
|
|
|
|
return q->average_nof_iterations;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t srslte_sch_last_noi(srslte_sch_t *q) {
|
|
|
|
uint32_t srslte_sch_last_noi(srslte_sch_t *q) {
|
|
|
|
return q->nof_iterations;
|
|
|
|
return q->nof_iterations;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Encode a transport block according to 36.212 5.3.2
|
|
|
|
/* Encode a transport block according to 36.212 5.3.2
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -340,7 +330,7 @@ bool decode_tb_cb(srslte_sch_t *q,
|
|
|
|
|
|
|
|
|
|
|
|
for (int i=0;i<SRSLTE_TDEC_NPAR;i++) {
|
|
|
|
for (int i=0;i<SRSLTE_TDEC_NPAR;i++) {
|
|
|
|
cb_idx[i] = i+first_cb;
|
|
|
|
cb_idx[i] = i+first_cb;
|
|
|
|
decoder_input[i] = false;
|
|
|
|
decoder_input[i] = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (int i=0;i<nof_cb;i++) {
|
|
|
|
for (int i=0;i<nof_cb;i++) {
|
|
|
@ -351,6 +341,8 @@ bool decode_tb_cb(srslte_sch_t *q,
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t remaining_cb = nof_cb;
|
|
|
|
uint32_t remaining_cb = nof_cb;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
q->nof_iterations = 0;
|
|
|
|
|
|
|
|
|
|
|
|
while(remaining_cb>0) {
|
|
|
|
while(remaining_cb>0) {
|
|
|
|
|
|
|
|
|
|
|
|
// Unratematch the codeblocks left to decode
|
|
|
|
// Unratematch the codeblocks left to decode
|
|
|
@ -384,11 +376,9 @@ bool decode_tb_cb(srslte_sch_t *q,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Run 1 iteration for up to TDEC_NPAR codeblocks
|
|
|
|
// Run 1 iteration for the codeblocks in queue
|
|
|
|
srslte_tdec_iteration_par(&q->decoder, decoder_input, cb_len);
|
|
|
|
srslte_tdec_iteration_par(&q->decoder, decoder_input, cb_len);
|
|
|
|
|
|
|
|
|
|
|
|
q->nof_iterations = srslte_tdec_get_nof_iterations_cb(&q->decoder, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Decide output bits and compute CRC
|
|
|
|
// Decide output bits and compute CRC
|
|
|
|
for (int i=0;i<SRSLTE_TDEC_NPAR;i++) {
|
|
|
|
for (int i=0;i<SRSLTE_TDEC_NPAR;i++) {
|
|
|
|
if (decoder_input[i]) {
|
|
|
|
if (decoder_input[i]) {
|
|
|
@ -410,6 +400,8 @@ bool decode_tb_cb(srslte_sch_t *q,
|
|
|
|
|
|
|
|
|
|
|
|
memcpy(&data[(cb_idx[i]*rlen)/8], q->cb_in, rlen/8 * sizeof(uint8_t));
|
|
|
|
memcpy(&data[(cb_idx[i]*rlen)/8], q->cb_in, rlen/8 * sizeof(uint8_t));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
q->nof_iterations += srslte_tdec_get_nof_iterations_cb(&q->decoder, i);
|
|
|
|
|
|
|
|
|
|
|
|
// Reset number of iterations for that CB in the decoder
|
|
|
|
// Reset number of iterations for that CB in the decoder
|
|
|
|
srslte_tdec_reset_cb(&q->decoder, i);
|
|
|
|
srslte_tdec_reset_cb(&q->decoder, i);
|
|
|
|
remaining_cb--;
|
|
|
|
remaining_cb--;
|
|
|
@ -421,12 +413,16 @@ bool decode_tb_cb(srslte_sch_t *q,
|
|
|
|
} else if (srslte_tdec_get_nof_iterations_cb(&q->decoder, i) >= q->max_iterations) {
|
|
|
|
} else if (srslte_tdec_get_nof_iterations_cb(&q->decoder, i) >= q->max_iterations) {
|
|
|
|
INFO("CB %d: Error. CB is erroneous. remaining_cb=%d, i=%d, first_cb=%d, nof_cb=%d\n",
|
|
|
|
INFO("CB %d: Error. CB is erroneous. remaining_cb=%d, i=%d, first_cb=%d, nof_cb=%d\n",
|
|
|
|
cb_idx[i], remaining_cb, i, first_cb, nof_cb);
|
|
|
|
cb_idx[i], remaining_cb, i, first_cb, nof_cb);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
q->nof_iterations += q->max_iterations;
|
|
|
|
|
|
|
|
q->nof_iterations /= (nof_cb-remaining_cb+1);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
q->nof_iterations /= nof_cb;
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|