Tx and Rx data check in PDSCH test

(cherry picked from commit 6679a160c6f39876aa8d5930a1c8d6bc58a551d3)

(cherry picked from commit 8ae673d)
master
Xavier Arteaga 7 years ago
parent bbf7ffffa2
commit 9deadc13dc

@ -133,7 +133,8 @@ void parse_args(int argc, char **argv) {
} }
} }
uint8_t *data[SRSLTE_MAX_CODEWORDS] = {NULL}; static uint8_t *data_tx[SRSLTE_MAX_CODEWORDS] = {NULL};
static uint8_t *data_rx[SRSLTE_MAX_CODEWORDS] = {NULL};
cf_t *ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS]; cf_t *ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
srslte_softbuffer_rx_t *softbuffers_rx[SRSLTE_MAX_CODEWORDS]; srslte_softbuffer_rx_t *softbuffers_rx[SRSLTE_MAX_CODEWORDS];
srslte_ra_dl_grant_t grant; srslte_ra_dl_grant_t grant;
@ -258,12 +259,20 @@ int main(int argc, char **argv) {
for (int i = 0; i < grant.nof_tb; i++) { for (int i = 0; i < grant.nof_tb; i++) {
if (grant.mcs[i].tbs) { if (grant.mcs[i].tbs) {
data[i] = srslte_vec_malloc(sizeof(uint8_t) * grant.mcs[i].tbs); data_tx[i] = srslte_vec_malloc(sizeof(uint8_t) * grant.mcs[i].tbs);
if (!data[i]) { if (!data_tx[i]) {
perror("srslte_vec_malloc"); perror("srslte_vec_malloc");
goto quit; goto quit;
} }
bzero(data[i], sizeof(uint8_t) * grant.mcs[i].tbs); bzero(data_tx[i], sizeof(uint8_t) * grant.mcs[i].tbs);
data_rx[i] = srslte_vec_malloc(sizeof(uint8_t) * grant.mcs[i].tbs);
if (!data_rx[i]) {
perror("srslte_vec_malloc");
goto quit;
}
bzero(data_rx[i], sizeof(uint8_t) * grant.mcs[i].tbs);
} }
} }
@ -274,7 +283,7 @@ int main(int argc, char **argv) {
srslte_pdsch_set_rnti(&pdsch_rx, rnti); srslte_pdsch_set_rnti(&pdsch_rx, rnti);
for (i = 0; i < SRSLTE_MAX_TB; i++) { for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) {
softbuffers_rx[i] = calloc(sizeof(srslte_softbuffer_rx_t), 1); softbuffers_rx[i] = calloc(sizeof(srslte_softbuffer_rx_t), 1);
if (!softbuffers_rx[i]) { if (!softbuffers_rx[i]) {
fprintf(stderr, "Error allocating RX soft buffer\n"); fprintf(stderr, "Error allocating RX soft buffer\n");
@ -322,7 +331,7 @@ int main(int argc, char **argv) {
#ifdef DO_OFDM #ifdef DO_OFDM
srslte_filesource_read(&fsrc, rx_slot_symbols, SRSLTE_SF_LEN_PRB(cell.nof_prb)); srslte_filesource_read(&fsrc, rx_slot_symbols, SRSLTE_SF_LEN_PRB(cell.nof_prb));
#else #else
srslte_filesource_read_multi(&fsrc, (void*) rx_slot_symbols, SRSLTE_SF_LEN_RE(cell.nof_prb, cell.cp), pdsch_cfg.nof_layers); srslte_filesource_read(&fsrc, rx_slot_symbols[0], SRSLTE_SF_LEN_RE(cell.nof_prb, cell.cp));
#endif #endif
srslte_chest_dl_t chest; srslte_chest_dl_t chest;
@ -330,7 +339,7 @@ int main(int argc, char **argv) {
fprintf(stderr, "Error initializing equalizer\n"); fprintf(stderr, "Error initializing equalizer\n");
exit(-1); exit(-1);
} }
srslte_chest_dl_estimate_multi(&chest, rx_slot_symbols, ce, subframe, nof_rx_antennas); srslte_chest_dl_estimate(&chest, rx_slot_symbols[0], ce[0], subframe);
srslte_chest_dl_free(&chest); srslte_chest_dl_free(&chest);
srslte_filesource_free(&fsrc); srslte_filesource_free(&fsrc);
@ -345,7 +354,6 @@ int main(int argc, char **argv) {
for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) {
softbuffers_tx[i] = calloc(sizeof(srslte_softbuffer_tx_t), 1); softbuffers_tx[i] = calloc(sizeof(srslte_softbuffer_tx_t), 1);
if (!softbuffers_tx[i]) { if (!softbuffers_tx[i]) {
fprintf(stderr, "Error allocating TX soft buffer\n"); fprintf(stderr, "Error allocating TX soft buffer\n");
} }
@ -364,9 +372,9 @@ int main(int argc, char **argv) {
} }
} }
for (i = 0; i< grant.nof_tb; i++) { for (int tb = 0; tb < grant.nof_tb; tb++) {
for (i = 0; i < grant.mcs[i].tbs / 8; i++) { for (int byte = 0; byte < grant.mcs[tb].tbs / 8; byte++) {
data[i][i] = (uint8_t) (rand() % 256); data_tx[tb][byte] = (uint8_t)(rand() % 256);
} }
} }
@ -377,7 +385,7 @@ int main(int argc, char **argv) {
if (rv_idx[0] != 0 || rv_idx[1] != 0) { if (rv_idx[0] != 0 || rv_idx[1] != 0) {
/* Do 1st transmission for rv_idx!=0 */ /* Do 1st transmission for rv_idx!=0 */
bzero(pdsch_cfg.rv, sizeof(uint32_t)*SRSLTE_MAX_CODEWORDS); bzero(pdsch_cfg.rv, sizeof(uint32_t)*SRSLTE_MAX_CODEWORDS);
if (srslte_pdsch_encode_multi(&pdsch_tx, &pdsch_cfg, softbuffers_tx, data, rnti, tx_slot_symbols)) { if (srslte_pdsch_encode_multi(&pdsch_tx, &pdsch_cfg, softbuffers_tx, data_tx, rnti, tx_slot_symbols)) {
fprintf(stderr, "Error encoding PDSCH\n"); fprintf(stderr, "Error encoding PDSCH\n");
goto quit; goto quit;
} }
@ -385,7 +393,7 @@ int main(int argc, char **argv) {
memcpy(pdsch_cfg.rv, rv_idx, sizeof(uint32_t)*SRSLTE_MAX_CODEWORDS); memcpy(pdsch_cfg.rv, rv_idx, sizeof(uint32_t)*SRSLTE_MAX_CODEWORDS);
gettimeofday(&t[1], NULL); gettimeofday(&t[1], NULL);
for (k = 0; k < M; k++) { for (k = 0; k < M; k++) {
if (srslte_pdsch_encode_multi(&pdsch_tx, &pdsch_cfg, softbuffers_tx, data, rnti, tx_slot_symbols)) { if (srslte_pdsch_encode_multi(&pdsch_tx, &pdsch_cfg, softbuffers_tx, data_tx, rnti, tx_slot_symbols)) {
ERROR("Error encoding PDSCH"); ERROR("Error encoding PDSCH");
goto quit; goto quit;
} }
@ -441,7 +449,7 @@ int main(int argc, char **argv) {
srslte_softbuffer_rx_reset_tbs(softbuffers_rx[i], (uint32_t) grant.mcs[i].tbs); srslte_softbuffer_rx_reset_tbs(softbuffers_rx[i], (uint32_t) grant.mcs[i].tbs);
} }
} }
r = srslte_pdsch_decode_multi(&pdsch_rx, &pdsch_cfg, softbuffers_rx, rx_slot_symbols, ce, 0, rnti, data, acks); r = srslte_pdsch_decode_multi(&pdsch_rx, &pdsch_cfg, softbuffers_rx, rx_slot_symbols, ce, 0, rnti, data_rx, acks);
} }
gettimeofday(&t[2], NULL); gettimeofday(&t[2], NULL);
get_time_interval(t); get_time_interval(t);
@ -451,11 +459,21 @@ int main(int argc, char **argv) {
/* If there is an error in PDSCH decode */ /* If there is an error in PDSCH decode */
if (r) { if (r) {
ERROR("PDSCH decode"); ret = -1;
ret = SRSLTE_ERROR;
goto quit; goto quit;
} }
/* Check Tx and Rx bytes */
for (int tb = 0; tb < grant.nof_tb; tb++) {
for (int byte = 0; byte < grant.mcs[tb].tbs / 8; byte++) {
if (data_tx[tb][byte] != data_rx[tb][byte]) {
ERROR("Found BYTE error in TB %d (%02X != %02X), quiting...", tb, data_tx[tb][byte], data_rx[tb][byte]);
ret = SRSLTE_ERROR;
goto quit;
}
}
}
/* Check all transport blocks have been decoded OK */ /* Check all transport blocks have been decoded OK */
for (int tb = 0; tb < grant.nof_tb; tb++) { for (int tb = 0; tb < grant.nof_tb; tb++) {
ret |= (acks[tb]) ? SRSLTE_SUCCESS : SRSLTE_ERROR; ret |= (acks[tb]) ? SRSLTE_SUCCESS : SRSLTE_ERROR;
@ -477,8 +495,12 @@ quit:
free(softbuffers_rx[i]); free(softbuffers_rx[i]);
} }
if (data[i]) { if (data_tx[i]) {
free(data[i]); free(data_tx[i]);
}
if (data_rx[i]) {
free(data_rx[i]);
} }
} }

Loading…
Cancel
Save