Commit 2be5ff36 authored by Robert Schmidt's avatar Robert Schmidt

Don't use msgTx inside nr_dlsch_encoding() and nr_generate_pdsch()

A later commit will remove "msgTx" altogether. Push it out from L1
functions.
parent 751cab3d
...@@ -773,9 +773,8 @@ static int do_one_dlsch(unsigned char *input_ptr, PHY_VARS_gNB *gNB, NR_gNB_DLSC ...@@ -773,9 +773,8 @@ static int do_one_dlsch(unsigned char *input_ptr, PHY_VARS_gNB *gNB, NR_gNB_DLSC
return ((size_output_tb + 511) >> 9) << 6; return ((size_output_tb + 511) >> 9) << 6;
} }
void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot) void nr_generate_pdsch(PHY_VARS_gNB *gNB, int n_dlsch, NR_gNB_DLSCH_t *dlsch_array, int frame, int slot)
{ {
PHY_VARS_gNB *gNB = msgTx->gNB;
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
time_stats_t *dlsch_encoding_stats = &gNB->dlsch_encoding_stats; time_stats_t *dlsch_encoding_stats = &gNB->dlsch_encoding_stats;
time_stats_t *tinput = &gNB->tinput; time_stats_t *tinput = &gNB->tinput;
...@@ -788,8 +787,8 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot) ...@@ -788,8 +787,8 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
size_t size_output = 0; size_t size_output = 0;
for (int dlsch_id = 0; dlsch_id < msgTx->num_pdsch_slot; dlsch_id++) { for (int i = 0; i < n_dlsch; i++) {
NR_gNB_DLSCH_t *dlsch = &msgTx->dlsch[dlsch_id]; NR_gNB_DLSCH_t *dlsch = &dlsch_array[i];
const nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &dlsch->pdsch_pdu.pdsch_pdu_rel15; const nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &dlsch->pdsch_pdu.pdsch_pdu_rel15;
LOG_D(PHY, LOG_D(PHY,
...@@ -817,7 +816,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot) ...@@ -817,7 +816,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
dlsch->unav_res = ptrsSymbPerSlot * n_ptrs; dlsch->unav_res = ptrsSymbPerSlot * n_ptrs;
/// CRC, coding, interleaving and rate matching /// CRC, coding, interleaving and rate matching
AssertFatal(dlsch->pdu != NULL, "%4d.%2d no PDU for PDSCH generation\n", msgTx->frame, msgTx->slot); AssertFatal(dlsch->pdu != NULL, "%4d.%2d no PDU for PDSCH generation\n", frame, slot);
/* output and its parts for each dlsch should be aligned on 64 bytes (or 8 * 64 bits) /* output and its parts for each dlsch should be aligned on 64 bytes (or 8 * 64 bits)
* => size_output is a sum of parts sizes rounded up to a multiple of 8 * 64 * => size_output is a sum of parts sizes rounded up to a multiple of 8 * 64
...@@ -831,7 +830,8 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot) ...@@ -831,7 +830,8 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
start_meas(dlsch_encoding_stats); start_meas(dlsch_encoding_stats);
if (nr_dlsch_encoding(gNB, if (nr_dlsch_encoding(gNB,
msgTx, n_dlsch,
dlsch_array,
frame, frame,
slot, slot,
frame_parms, frame_parms,
...@@ -849,8 +849,8 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot) ...@@ -849,8 +849,8 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
stop_meas(dlsch_encoding_stats); stop_meas(dlsch_encoding_stats);
unsigned char *output_ptr = output; unsigned char *output_ptr = output;
for (int dlsch_id = 0; dlsch_id < msgTx->num_pdsch_slot; dlsch_id++) { for (int i = 0; i < n_dlsch; i++) {
output_ptr += do_one_dlsch(output_ptr, gNB, &msgTx->dlsch[dlsch_id], slot); output_ptr += do_one_dlsch(output_ptr, gNB, &dlsch_array[i], slot);
} }
} }
......
...@@ -38,12 +38,11 @@ ...@@ -38,12 +38,11 @@
void nr_fill_dlsch_dl_tti_req(processingData_L1tx_t *msgTx, nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu); void nr_fill_dlsch_dl_tti_req(processingData_L1tx_t *msgTx, nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu);
void nr_fill_dlsch_tx_req(processingData_L1tx_t *msgTx, int idx, uint8_t *sdu); void nr_fill_dlsch_tx_req(processingData_L1tx_t *msgTx, int idx, uint8_t *sdu);
void nr_generate_pdsch(processingData_L1tx_t *msgTx, void nr_generate_pdsch(PHY_VARS_gNB *gNB, int n_dlsch, NR_gNB_DLSCH_t *dlsch_array, int frame, int slot);
int frame,
int slot);
int nr_dlsch_encoding(PHY_VARS_gNB *gNB, int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
processingData_L1tx_t *msgTx, int n_dlsch,
NR_gNB_DLSCH_t *dlsch_array,
int frame, int frame,
uint8_t slot, uint8_t slot,
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
......
...@@ -104,7 +104,8 @@ NR_gNB_DLSCH_t new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, uint16_t N_RB) ...@@ -104,7 +104,8 @@ NR_gNB_DLSCH_t new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, uint16_t N_RB)
} }
int nr_dlsch_encoding(PHY_VARS_gNB *gNB, int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
processingData_L1tx_t *msgTx, int n_dlsch,
NR_gNB_DLSCH_t *dlsch_array,
int frame, int frame,
uint8_t slot, uint8_t slot,
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
...@@ -119,11 +120,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -119,11 +120,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
{ {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_IN);
nrLDPC_TB_encoding_parameters_t TBs[msgTx->num_pdsch_slot]; nrLDPC_TB_encoding_parameters_t TBs[n_dlsch];
memset(TBs, 0, sizeof(TBs)); memset(TBs, 0, sizeof(TBs));
nrLDPC_slot_encoding_parameters_t slot_parameters = {.frame = frame, nrLDPC_slot_encoding_parameters_t slot_parameters = {.frame = frame,
.slot = slot, .slot = slot,
.nb_TBs = msgTx->num_pdsch_slot, .nb_TBs = n_dlsch,
.threadPool = &gNB->threadPool, .threadPool = &gNB->threadPool,
.tinput = tinput, .tinput = tinput,
.tprep = tprep, .tprep = tprep,
...@@ -133,8 +134,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -133,8 +134,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
int num_segments = 0; int num_segments = 0;
for (int dlsch_id = 0; dlsch_id < msgTx->num_pdsch_slot; dlsch_id++) { for (int i = 0; i < n_dlsch; i++) {
NR_gNB_DLSCH_t *dlsch = &msgTx->dlsch[dlsch_id]; NR_gNB_DLSCH_t *dlsch = &dlsch_array[i];
unsigned int crc = 1; unsigned int crc = 1;
const nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &dlsch->pdsch_pdu.pdsch_pdu_rel15; const nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &dlsch->pdsch_pdu.pdsch_pdu_rel15;
...@@ -192,10 +193,10 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -192,10 +193,10 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
memcpy(dlsch->b, a, (A / 8) + 3); // using 3 bytes to mimic the case of 24 bit crc memcpy(dlsch->b, a, (A / 8) + 3); // using 3 bytes to mimic the case of 24 bit crc
} }
nrLDPC_TB_encoding_parameters_t *TB_parameters = &TBs[dlsch_id]; nrLDPC_TB_encoding_parameters_t *TB_parameters = &TBs[i];
// The harq_pid is not unique among the active HARQ processes in the instance so we use dlsch_id instead // The harq_pid is not unique among the active HARQ processes in the instance so we use i instead
TB_parameters->harq_unique_pid = dlsch_id; TB_parameters->harq_unique_pid = i;
TB_parameters->BG = rel15->maintenance_parms_v3.ldpcBaseGraph; TB_parameters->BG = rel15->maintenance_parms_v3.ldpcBaseGraph;
TB_parameters->A = A; TB_parameters->A = A;
start_meas(dlsch_segmentation_stats); start_meas(dlsch_segmentation_stats);
...@@ -221,11 +222,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -221,11 +222,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
size_t segments_offset = 0; size_t segments_offset = 0;
size_t dlsch_offset = 0; size_t dlsch_offset = 0;
for (int dlsch_id = 0; dlsch_id < msgTx->num_pdsch_slot; dlsch_id++) { for (int i = 0; i < n_dlsch; i++) {
NR_gNB_DLSCH_t *dlsch = &msgTx->dlsch[dlsch_id]; NR_gNB_DLSCH_t *dlsch = &dlsch_array[i];
const nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &dlsch->pdsch_pdu.pdsch_pdu_rel15; const nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &dlsch->pdsch_pdu.pdsch_pdu_rel15;
nrLDPC_TB_encoding_parameters_t *TB_parameters = &TBs[dlsch_id]; nrLDPC_TB_encoding_parameters_t *TB_parameters = &TBs[i];
#ifdef DEBUG_DLSCH_CODING #ifdef DEBUG_DLSCH_CODING
for (int r = 0; r < TB_parameters->C; r++) { for (int r = 0; r < TB_parameters->C; r++) {
...@@ -281,8 +282,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -281,8 +282,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
gNB->nrLDPC_coding_interface.nrLDPC_coding_encoder(&slot_parameters); gNB->nrLDPC_coding_interface.nrLDPC_coding_encoder(&slot_parameters);
for (int dlsch_id = 0; dlsch_id < msgTx->num_pdsch_slot; dlsch_id++) { for (int i = 0; i < n_dlsch; i++) {
nrLDPC_TB_encoding_parameters_t *TB_parameters = &TBs[dlsch_id]; nrLDPC_TB_encoding_parameters_t *TB_parameters = &TBs[i];
for (int r = 0; r < TB_parameters->C; r++) { for (int r = 0; r < TB_parameters->C; r++) {
nrLDPC_segment_encoding_parameters_t *segment_parameters = &TB_parameters->segments[r]; nrLDPC_segment_encoding_parameters_t *segment_parameters = &TB_parameters->segments[r];
merge_meas(dlsch_interleaving_stats, &segment_parameters->ts_interleave); merge_meas(dlsch_interleaving_stats, &segment_parameters->ts_interleave);
......
...@@ -312,7 +312,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, ...@@ -312,7 +312,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
if (msgTx->num_pdsch_slot > 0) { if (msgTx->num_pdsch_slot > 0) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,1);
LOG_D(PHY, "PDSCH generation started (%d) in frame %d.%d\n", msgTx->num_pdsch_slot,frame,slot); LOG_D(PHY, "PDSCH generation started (%d) in frame %d.%d\n", msgTx->num_pdsch_slot,frame,slot);
nr_generate_pdsch(msgTx, frame, slot); nr_generate_pdsch(gNB, msgTx->num_pdsch_slot, msgTx->dlsch, frame, slot);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,0);
} }
msgTx->num_pdsch_slot = 0; msgTx->num_pdsch_slot = 0;
......
...@@ -515,8 +515,7 @@ int main(int argc, char **argv) ...@@ -515,8 +515,7 @@ int main(int argc, char **argv)
unsigned char output[rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * NR_MAX_NB_LAYERS] __attribute__((aligned(64))); unsigned char output[rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * NR_MAX_NB_LAYERS] __attribute__((aligned(64)));
bzero(output, sizeof(output)); bzero(output, sizeof(output));
if (input_fd == NULL) { if (input_fd == NULL) {
msgDataTx.num_pdsch_slot = 1; nr_dlsch_encoding(gNB, 1, dlsch, frame, slot, frame_parms, output, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
nr_dlsch_encoding(gNB, &msgDataTx, frame, slot, frame_parms, output, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
} }
for (SNR = snr0; SNR < snr1 && !stop; SNR += snr_step) { for (SNR = snr0; SNR < snr1 && !stop; SNR += snr_step) {
......
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