L1 DLSCH: don't preallocate memory, improve log
The L1 receives a pointer to the L1 payload to use for PDSCH generation. This would overwrite an existing pre-allocated pointer. Remove this preallocation. Instead, allocate it in the simulator (the only place that actively uses this buffer allocation; in nr-softmodem, it's lost by assigning a pointer). Allocate with an extra byte, because the payload (in bits) might not be a multiple of 8 bits/1 byte, so the CRC is in the last 3 bytes. Also, improve the log with frame/slot information if the PDSCH payload pointer is NULL.
This commit is contained in:
@@ -93,7 +93,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
|
||||
harq->unav_res = ptrsSymbPerSlot * n_ptrs;
|
||||
|
||||
/// CRC, coding, interleaving and rate matching
|
||||
AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n");
|
||||
AssertFatal(harq->pdu != NULL, "%4d.%2d no HARQ PDU for PDSCH generation\n", msgTx->frame, msgTx->slot);
|
||||
|
||||
/* output and its parts for each dlsch should be aligned on 64 bytes
|
||||
* => size_output is a sum of parts sizes rounded up to a multiple of 64
|
||||
|
||||
@@ -56,8 +56,6 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
||||
time_stats_t *dlsch_interleaving_stats,
|
||||
time_stats_t *dlsch_segmentation_stats);
|
||||
|
||||
void nr_emulate_dlsch_payload(uint8_t* payload, uint16_t size);
|
||||
|
||||
void dump_pdsch_stats(FILE *fd,PHY_VARS_gNB *gNB);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -66,7 +66,6 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch, uint16_t N_RB, const NR_DL_FRAME_PARM
|
||||
harq->c[r] = NULL;
|
||||
}
|
||||
free(harq->c);
|
||||
free(harq->pdu);
|
||||
}
|
||||
|
||||
NR_gNB_DLSCH_t new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, uint16_t N_RB)
|
||||
@@ -87,10 +86,6 @@ NR_gNB_DLSCH_t new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, uint16_t N_RB)
|
||||
bzero(harq, sizeof(NR_DL_gNB_HARQ_t));
|
||||
harq->b = malloc16(dlsch_bytes);
|
||||
AssertFatal(harq->b, "cannot allocate memory for harq->b\n");
|
||||
harq->pdu = malloc16(dlsch_bytes);
|
||||
AssertFatal(harq->pdu, "cannot allocate memory for harq->pdu\n");
|
||||
bzero(harq->pdu, dlsch_bytes);
|
||||
nr_emulate_dlsch_payload(harq->pdu, (dlsch_bytes) >> 3);
|
||||
bzero(harq->b, dlsch_bytes);
|
||||
|
||||
harq->c = (uint8_t **)malloc16(a_segments*sizeof(uint8_t *));
|
||||
|
||||
@@ -36,14 +36,6 @@
|
||||
|
||||
extern void set_taus_seed(unsigned int seed_type);
|
||||
|
||||
|
||||
/// Payload emulation
|
||||
void nr_emulate_dlsch_payload(uint8_t* pdu, uint16_t size) {
|
||||
set_taus_seed(0);
|
||||
for (int i=0; i<size; i++)
|
||||
*(pdu+i) = (uint8_t)rand();
|
||||
}
|
||||
|
||||
void nr_fill_dlsch_dl_tti_req(processingData_L1tx_t *msgTx, nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu)
|
||||
{
|
||||
NR_gNB_DLSCH_t *dlsch = &msgTx->dlsch[msgTx->num_pdsch_slot][0];
|
||||
|
||||
@@ -497,7 +497,8 @@ int main(int argc, char **argv)
|
||||
dlsch0_ue->dlsch_config.tbslbrm = Tbslbrm;
|
||||
printf("harq process ue mcs = %d Qm = %d, symb %d\n", dlsch0_ue->dlsch_config.mcs, dlsch0_ue->dlsch_config.qamModOrder, nb_symb_sch);
|
||||
|
||||
unsigned char *test_input=dlsch->harq_process.pdu;
|
||||
uint8_t test_input[TBS / 8 + 4]; // + 3 for CRC + 1 additional byte, see nr_dlsch_encoding()
|
||||
dlsch->harq_process.pdu = test_input;
|
||||
//unsigned char test_input[TBS / 8] __attribute__ ((aligned(16)));
|
||||
for (i = 0; i < TBS / 8; i++)
|
||||
test_input[i] = (unsigned char) rand();
|
||||
|
||||
Reference in New Issue
Block a user