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

Simplify gNB DLSCH type

DLSCH encoding is not concerned with HARQ processes directly. Instead,
it gets the redundancy version and encodes a specific redundancy version
for a given TB. The rest is up to the MAC, the L1 is stateless in that
regard. Hence, remove the HARQ type and put it into DLSCH, which also
simplifies the code elsewhere.
parent 09e0344b
...@@ -555,8 +555,7 @@ static int do_one_dlsch(unsigned char *input_ptr, PHY_VARS_gNB *gNB, NR_gNB_DLSC ...@@ -555,8 +555,7 @@ static int do_one_dlsch(unsigned char *input_ptr, PHY_VARS_gNB *gNB, NR_gNB_DLSC
time_stats_t *dlsch_scrambling_stats = &gNB->dlsch_scrambling_stats; time_stats_t *dlsch_scrambling_stats = &gNB->dlsch_scrambling_stats;
time_stats_t *dlsch_modulation_stats = &gNB->dlsch_modulation_stats; time_stats_t *dlsch_modulation_stats = &gNB->dlsch_modulation_stats;
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process; 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 = &harq->pdsch_pdu.pdsch_pdu_rel15;
const int layerSz = frame_parms->N_RB_DL * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB; const int layerSz = frame_parms->N_RB_DL * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB;
const int symbol_sz=frame_parms->ofdm_symbol_size; const int symbol_sz=frame_parms->ofdm_symbol_size;
const int dmrs_Type = rel15->dmrsConfigType; const int dmrs_Type = rel15->dmrsConfigType;
...@@ -591,9 +590,9 @@ static int do_one_dlsch(unsigned char *input_ptr, PHY_VARS_gNB *gNB, NR_gNB_DLSC ...@@ -591,9 +590,9 @@ static int do_one_dlsch(unsigned char *input_ptr, PHY_VARS_gNB *gNB, NR_gNB_DLSC
#ifdef DEBUG_DLSCH #ifdef DEBUG_DLSCH
printf("PDSCH encoding:\nPayload:\n"); printf("PDSCH encoding:\nPayload:\n");
for (int i = 0; i < (harq->B >> 3); i += 16) { for (int i = 0; i < (dlsch->B >> 3); i += 16) {
for (int j = 0; j < 16; j++) for (int j = 0; j < 16; j++)
printf("0x%02x\t", harq->pdu[i + j]); printf("0x%02x\t", dlsch->pdu[i + j]);
printf("\n"); printf("\n");
} }
printf("\nEncoded payload:\n"); printf("\nEncoded payload:\n");
...@@ -606,7 +605,7 @@ static int do_one_dlsch(unsigned char *input_ptr, PHY_VARS_gNB *gNB, NR_gNB_DLSC ...@@ -606,7 +605,7 @@ static int do_one_dlsch(unsigned char *input_ptr, PHY_VARS_gNB *gNB, NR_gNB_DLSC
#endif #endif
if (IS_SOFTMODEM_DLSIM) if (IS_SOFTMODEM_DLSIM)
memcpy(harq->f, input_ptr, (encoded_length + 7) >> 3); memcpy(dlsch->f, input_ptr, (encoded_length + 7) >> 3);
c16_t mod_symbs[rel15->NrOfCodewords][encoded_length] __attribute__((aligned(64))); c16_t mod_symbs[rel15->NrOfCodewords][encoded_length] __attribute__((aligned(64)));
for (int codeWord = 0; codeWord < rel15->NrOfCodewords; codeWord++) { for (int codeWord = 0; codeWord < rel15->NrOfCodewords; codeWord++) {
...@@ -791,8 +790,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot) ...@@ -791,8 +790,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
for (int dlsch_id = 0; dlsch_id < msgTx->num_pdsch_slot; dlsch_id++) { for (int dlsch_id = 0; dlsch_id < msgTx->num_pdsch_slot; dlsch_id++) {
NR_gNB_DLSCH_t *dlsch = msgTx->dlsch[dlsch_id]; NR_gNB_DLSCH_t *dlsch = msgTx->dlsch[dlsch_id];
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process; 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 = &harq->pdsch_pdu.pdsch_pdu_rel15;
LOG_D(PHY, LOG_D(PHY,
"pdsch: BWPStart %d, BWPSize %d, rbStart %d, rbsize %d\n", "pdsch: BWPStart %d, BWPSize %d, rbStart %d, rbsize %d\n",
...@@ -816,10 +814,10 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot) ...@@ -816,10 +814,10 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
n_ptrs = (rel15->rbSize + rel15->PTRSFreqDensity - 1) / rel15->PTRSFreqDensity; n_ptrs = (rel15->rbSize + rel15->PTRSFreqDensity - 1) / rel15->PTRSFreqDensity;
ptrsSymbPerSlot = get_ptrs_symbols_in_slot(dlPtrsSymPos, rel15->StartSymbolIndex, rel15->NrOfSymbols); ptrsSymbPerSlot = get_ptrs_symbols_in_slot(dlPtrsSymPos, rel15->StartSymbolIndex, rel15->NrOfSymbols);
} }
harq->unav_res = ptrsSymbPerSlot * n_ptrs; dlsch->unav_res = ptrsSymbPerSlot * n_ptrs;
/// CRC, coding, interleaving and rate matching /// CRC, coding, interleaving and rate matching
AssertFatal(harq->pdu != NULL, "%4d.%2d no HARQ PDU for PDSCH generation\n", msgTx->frame, msgTx->slot); AssertFatal(dlsch->pdu != NULL, "%4d.%2d no PDU for PDSCH generation\n", msgTx->frame, msgTx->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
......
...@@ -52,20 +52,19 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch, uint16_t N_RB, const NR_DL_FRAME_PARM ...@@ -52,20 +52,19 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch, uint16_t N_RB, const NR_DL_FRAME_PARM
a_segments = a_segments / 273 + 1; a_segments = a_segments / 273 + 1;
} }
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process; if (dlsch->b) {
if (harq->b) { free16(dlsch->b, a_segments * 1056);
free16(harq->b, a_segments * 1056); dlsch->b = NULL;
harq->b = NULL;
} }
if (harq->f) { if (dlsch->f) {
free16(harq->f, N_RB * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS); free16(dlsch->f, N_RB * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS);
harq->f = NULL; dlsch->f = NULL;
} }
for (int r = 0; r < a_segments; r++) { for (int r = 0; r < a_segments; r++) {
free(harq->c[r]); free(dlsch->c[r]);
harq->c[r] = NULL; dlsch->c[r] = NULL;
} }
free(harq->c); free(dlsch->c);
} }
NR_gNB_DLSCH_t new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, uint16_t N_RB) NR_gNB_DLSCH_t new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, uint16_t N_RB)
...@@ -80,28 +79,26 @@ NR_gNB_DLSCH_t new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, uint16_t N_RB) ...@@ -80,28 +79,26 @@ NR_gNB_DLSCH_t new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, uint16_t N_RB)
LOG_D(PHY, "Allocating %d segments (MAX %d, N_PRB %d)\n", a_segments, MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER, N_RB); LOG_D(PHY, "Allocating %d segments (MAX %d, N_PRB %d)\n", a_segments, MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER, N_RB);
uint32_t dlsch_bytes = a_segments * 1056; // allocated bytes per segment uint32_t dlsch_bytes = a_segments * 1056; // allocated bytes per segment
NR_gNB_DLSCH_t dlsch; NR_gNB_DLSCH_t dlsch = {0};
NR_DL_gNB_HARQ_t *harq = &dlsch.harq_process; dlsch.b = malloc16(dlsch_bytes);
bzero(harq, sizeof(NR_DL_gNB_HARQ_t)); AssertFatal(dlsch.b, "cannot allocate memory for dlsch.b\n");
harq->b = malloc16(dlsch_bytes); bzero(dlsch.b, dlsch_bytes);
AssertFatal(harq->b, "cannot allocate memory for harq->b\n");
bzero(harq->b, dlsch_bytes);
harq->c = (uint8_t **)malloc16(a_segments * sizeof(uint8_t *)); dlsch.c = (uint8_t **)malloc16(a_segments * sizeof(uint8_t *));
for (int r = 0; r < a_segments; r++) { for (int r = 0; r < a_segments; r++) {
// account for filler in first segment and CRCs for multiple segment case // account for filler in first segment and CRCs for multiple segment case
// [hna] 8448 is the maximum CB size in NR // [hna] 8448 is the maximum CB size in NR
// 68*348 = 68*(maximum size of Zc) // 68*348 = 68*(maximum size of Zc)
// In section 5.3.2 in 38.212, the for loop is up to N + 2*Zc (maximum size of N is 66*Zc, therefore 68*Zc) // In section 5.3.2 in 38.212, the for loop is up to N + 2*Zc (maximum size of N is 66*Zc, therefore 68*Zc)
harq->c[r] = malloc16(8448); dlsch.c[r] = malloc16(8448);
AssertFatal(harq->c[r], "cannot allocate harq->c[%d]\n", r); AssertFatal(dlsch.c[r], "cannot allocate dlsch.c[%d]\n", r);
bzero(harq->c[r], 8448); bzero(dlsch.c[r], 8448);
} }
harq->f = malloc16(N_RB * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS); dlsch.f = malloc16(N_RB * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS);
AssertFatal(harq->f, "cannot allocate harq->f\n"); AssertFatal(dlsch.f, "cannot allocate dlsch->f\n");
bzero(harq->f, N_RB * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS); bzero(dlsch.f, N_RB * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS);
return (dlsch); return (dlsch);
} }
...@@ -139,11 +136,10 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -139,11 +136,10 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
for (int dlsch_id = 0; dlsch_id < msgTx->num_pdsch_slot; dlsch_id++) { for (int dlsch_id = 0; dlsch_id < msgTx->num_pdsch_slot; dlsch_id++) {
NR_gNB_DLSCH_t *dlsch = msgTx->dlsch[dlsch_id]; NR_gNB_DLSCH_t *dlsch = msgTx->dlsch[dlsch_id];
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
unsigned int crc = 1; unsigned int crc = 1;
const nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15; const nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &dlsch->pdsch_pdu.pdsch_pdu_rel15;
uint32_t A = rel15->TBSize[0] << 3; uint32_t A = rel15->TBSize[0] << 3;
unsigned char *a = harq->pdu; unsigned char *a = dlsch->pdu;
if (rel15->rnti != SI_RNTI) { if (rel15->rnti != SI_RNTI) {
ws_trace_t tmp = {.nr = true, ws_trace_t tmp = {.nr = true,
.direction = DIRECTION_DOWNLINK, .direction = DIRECTION_DOWNLINK,
...@@ -182,9 +178,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -182,9 +178,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
// printf("CRC %x (A %d)\n",crc,A); // printf("CRC %x (A %d)\n",crc,A);
// printf("a0 %d a1 %d a2 %d\n", a[A>>3], a[1+(A>>3)], a[2+(A>>3)]); // printf("a0 %d a1 %d a2 %d\n", a[A>>3], a[1+(A>>3)], a[2+(A>>3)]);
B = A + 24; B = A + 24;
// harq->b = a;
AssertFatal((A / 8) + 4 <= max_bytes, "A %d is too big (A/8+4 = %d > %d)\n", A, (A / 8) + 4, max_bytes); AssertFatal((A / 8) + 4 <= max_bytes, "A %d is too big (A/8+4 = %d > %d)\n", A, (A / 8) + 4, max_bytes);
memcpy(harq->b, a, (A / 8) + 4); // why is this +4 if the CRC is only 3 bytes? memcpy(dlsch->b, a, (A / 8) + 4); // why is this +4 if the CRC is only 3 bytes?
} else { } else {
// Add 16-bit crc (polynomial A) to payload // Add 16-bit crc (polynomial A) to payload
crc = crc16(a, A) >> 16; crc = crc16(a, A) >> 16;
...@@ -193,9 +188,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -193,9 +188,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
// printf("CRC %x (A %d)\n",crc,A); // printf("CRC %x (A %d)\n",crc,A);
// printf("a0 %d a1 %d \n", a[A>>3], a[1+(A>>3)]); // printf("a0 %d a1 %d \n", a[A>>3], a[1+(A>>3)]);
B = A + 16; B = A + 16;
// harq->b = a;
AssertFatal((A / 8) + 3 <= max_bytes, "A %d is too big (A/8+3 = %d > %d)\n", A, (A / 8) + 3, max_bytes); AssertFatal((A / 8) + 3 <= max_bytes, "A %d is too big (A/8+3 = %d > %d)\n", A, (A / 8) + 3, max_bytes);
memcpy(harq->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[dlsch_id];
...@@ -205,8 +199,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -205,8 +199,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
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);
TB_parameters->Kb = nr_segmentation(harq->b, TB_parameters->Kb = nr_segmentation(dlsch->b,
harq->c, dlsch->c,
B, B,
&TB_parameters->C, &TB_parameters->C,
&TB_parameters->K, &TB_parameters->K,
...@@ -229,18 +223,17 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -229,18 +223,17 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
for (int dlsch_id = 0; dlsch_id < msgTx->num_pdsch_slot; dlsch_id++) { for (int dlsch_id = 0; dlsch_id < msgTx->num_pdsch_slot; dlsch_id++) {
NR_gNB_DLSCH_t *dlsch = msgTx->dlsch[dlsch_id]; NR_gNB_DLSCH_t *dlsch = msgTx->dlsch[dlsch_id];
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process; 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 = &harq->pdsch_pdu.pdsch_pdu_rel15;
nrLDPC_TB_encoding_parameters_t *TB_parameters = &TBs[dlsch_id]; nrLDPC_TB_encoding_parameters_t *TB_parameters = &TBs[dlsch_id];
#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++) {
LOG_D(PHY, "Encoder: B %d F %d \n", harq->B, TB_parameters->F); LOG_D(PHY, "Encoder: B %d F %d \n", dlsch->B, TB_parameters->F);
LOG_D(PHY, "start ldpc encoder segment %d/%d\n", r, TB_parameters->C); LOG_D(PHY, "start ldpc encoder segment %d/%d\n", r, TB_parameters->C);
LOG_D(PHY, "input %d %d %d %d %d \n", harq->c[r][0], harq->c[r][1], harq->c[r][2], harq->c[r][3], harq->c[r][4]); LOG_D(PHY, "input %d %d %d %d %d \n", dlsch->c[r][0], dlsch->c[r][1], dlsch->c[r][2], dlsch->c[r][3], dlsch->c[r][4]);
for (int cnt = 0; cnt < 22 * (TB_parameters->Z) / 8; cnt++) { for (int cnt = 0; cnt < 22 * (TB_parameters->Z) / 8; cnt++) {
LOG_D(PHY, "%d ", harq->c[r][cnt]); LOG_D(PHY, "%d ", dlsch->c[r][cnt]);
} }
LOG_D(PHY, "\n"); LOG_D(PHY, "\n");
} }
...@@ -258,7 +251,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -258,7 +251,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
rel15->NrOfSymbols, rel15->NrOfSymbols,
nb_re_dmrs, nb_re_dmrs,
get_num_dmrs(rel15->dlDmrsSymbPos), get_num_dmrs(rel15->dlDmrsSymbPos),
harq->unav_res, dlsch->unav_res,
rel15->qamModOrder[0], rel15->qamModOrder[0],
rel15->nrOfLayers); rel15->nrOfLayers);
...@@ -269,7 +262,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -269,7 +262,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
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];
segment_parameters->c = harq->c[r]; segment_parameters->c = dlsch->c[r];
segment_parameters->E = nr_get_E(TB_parameters->G, TB_parameters->C, TB_parameters->Qm, rel15->nrOfLayers, r); segment_parameters->E = nr_get_E(TB_parameters->G, TB_parameters->C, TB_parameters->Qm, rel15->nrOfLayers, r);
reset_meas(&segment_parameters->ts_interleave); reset_meas(&segment_parameters->ts_interleave);
......
...@@ -37,15 +37,14 @@ ...@@ -37,15 +37,14 @@
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)
{ {
NR_gNB_DLSCH_t *dlsch = &msgTx->dlsch[msgTx->num_pdsch_slot][0]; NR_gNB_DLSCH_t *dlsch = &msgTx->dlsch[msgTx->num_pdsch_slot][0];
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
/// DLSCH struct /// DLSCH struct
memcpy((void*)&harq->pdsch_pdu, (void*)pdsch_pdu, sizeof(nfapi_nr_dl_tti_pdsch_pdu)); memcpy((void*)&dlsch->pdsch_pdu, (void*)pdsch_pdu, sizeof(nfapi_nr_dl_tti_pdsch_pdu));
AssertFatal(msgTx->num_pdsch_slot == pdsch_pdu->pdsch_pdu_rel15.pduIndex, AssertFatal(msgTx->num_pdsch_slot == pdsch_pdu->pdsch_pdu_rel15.pduIndex,
"PDSCH PDU index %d does not match msgTx index %d\n", "PDSCH PDU index %d does not match msgTx index %d\n",
pdsch_pdu->pdsch_pdu_rel15.pduIndex, pdsch_pdu->pdsch_pdu_rel15.pduIndex,
msgTx->num_pdsch_slot); msgTx->num_pdsch_slot);
msgTx->num_pdsch_slot++; msgTx->num_pdsch_slot++;
harq->pdu = NULL; dlsch->pdu = NULL;
} }
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)
...@@ -55,8 +54,7 @@ void nr_fill_dlsch_tx_req(processingData_L1tx_t *msgTx, int idx, uint8_t *sdu) ...@@ -55,8 +54,7 @@ void nr_fill_dlsch_tx_req(processingData_L1tx_t *msgTx, int idx, uint8_t *sdu)
/* not sure if FAPI could transmit DL_TTI_req and TX_req in different orders. /* not sure if FAPI could transmit DL_TTI_req and TX_req in different orders.
* for the moment, assume they are in the same order (and check!) */ * for the moment, assume they are in the same order (and check!) */
NR_gNB_DLSCH_t *dlsch = &msgTx->dlsch[idx][0]; NR_gNB_DLSCH_t *dlsch = &msgTx->dlsch[idx][0];
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process; nfapi_nr_dl_tti_pdsch_pdu *pdsch = &dlsch->pdsch_pdu;
nfapi_nr_dl_tti_pdsch_pdu *pdsch = &harq->pdsch_pdu;
AssertFatal(pdsch->pdsch_pdu_rel15.pduIndex == idx, "PDSCH PDU index %d does not match %d\n", pdsch->pdsch_pdu_rel15.pduIndex, idx); AssertFatal(pdsch->pdsch_pdu_rel15.pduIndex == idx, "PDSCH PDU index %d does not match %d\n", pdsch->pdsch_pdu_rel15.pduIndex, idx);
harq->pdu = sdu; dlsch->pdu = sdu;
} }
...@@ -53,21 +53,6 @@ typedef struct { ...@@ -53,21 +53,6 @@ typedef struct {
int lut[MAX_PUCCH0_NID][160][14]; int lut[MAX_PUCCH0_NID][160][14];
} NR_gNB_PUCCH0_LUT_t; } NR_gNB_PUCCH0_LUT_t;
typedef struct {
/// Nfapi DLSCH PDU
nfapi_nr_dl_tti_pdsch_pdu pdsch_pdu;
/// pointer to pdu from MAC interface (this is "a" in 36.212)
uint8_t *pdu;
/// Pointer to the payload
uint8_t *b;
/// Pointers to transport block segments
uint8_t **c;
/// Interleaver outputs
uint8_t *f;
/// REs unavailable for DLSCH (overlapping with PTRS, CSIRS etc.)
uint32_t unav_res;
} NR_DL_gNB_HARQ_t;
typedef struct { typedef struct {
int dump_frame; int dump_frame;
int round_trials[8]; int round_trials[8];
...@@ -112,8 +97,18 @@ typedef struct { ...@@ -112,8 +97,18 @@ typedef struct {
} NR_gNB_PHY_STATS_t; } NR_gNB_PHY_STATS_t;
typedef struct { typedef struct {
/// Pointers to variables related to DLSCH harq process /// Nfapi DLSCH PDU
NR_DL_gNB_HARQ_t harq_process; nfapi_nr_dl_tti_pdsch_pdu pdsch_pdu;
/// pointer to pdu from MAC interface (this is "a" in 36.212)
uint8_t *pdu;
/// Pointer to the payload
uint8_t *b;
/// Pointers to transport block segments
uint8_t **c;
/// Interleaver outputs
uint8_t *f;
/// REs unavailable for DLSCH (overlapping with PTRS, CSIRS etc.)
uint32_t unav_res;
} NR_gNB_DLSCH_t; } NR_gNB_DLSCH_t;
typedef struct { typedef struct {
......
...@@ -442,7 +442,7 @@ int main(int argc, char **argv) ...@@ -442,7 +442,7 @@ int main(int argc, char **argv)
processingData_L1tx_t msgDataTx; processingData_L1tx_t msgDataTx;
init_DLSCH_struct(gNB, &msgDataTx); init_DLSCH_struct(gNB, &msgDataTx);
NR_gNB_DLSCH_t *dlsch = &msgDataTx.dlsch[0][0]; NR_gNB_DLSCH_t *dlsch = &msgDataTx.dlsch[0][0];
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &dlsch->harq_process.pdsch_pdu.pdsch_pdu_rel15; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &dlsch->pdsch_pdu.pdsch_pdu_rel15;
//time_stats_t *rm_stats, *te_stats, *i_stats; //time_stats_t *rm_stats, *te_stats, *i_stats;
unsigned int TBS = 8424; unsigned int TBS = 8424;
uint8_t nb_re_dmrs = 6; // No data in dmrs symbol uint8_t nb_re_dmrs = 6; // No data in dmrs symbol
...@@ -498,7 +498,7 @@ int main(int argc, char **argv) ...@@ -498,7 +498,7 @@ int main(int argc, char **argv)
printf("harq process ue mcs = %d Qm = %d, symb %d\n", dlsch0_ue->dlsch_config.mcs, dlsch0_ue->dlsch_config.qamModOrder, nb_symb_sch); printf("harq process ue mcs = %d Qm = %d, symb %d\n", dlsch0_ue->dlsch_config.mcs, dlsch0_ue->dlsch_config.qamModOrder, nb_symb_sch);
uint8_t test_input[TBS / 8 + 4]; // + 3 for CRC + 1 additional byte, see nr_dlsch_encoding() uint8_t test_input[TBS / 8 + 4]; // + 3 for CRC + 1 additional byte, see nr_dlsch_encoding()
dlsch->harq_process.pdu = test_input; dlsch->pdu = test_input;
//unsigned char test_input[TBS / 8] __attribute__ ((aligned(16))); //unsigned char test_input[TBS / 8] __attribute__ ((aligned(16)));
for (i = 0; i < TBS / 8; i++) for (i = 0; i < TBS / 8; i++)
test_input[i] = (unsigned char) rand(); test_input[i] = (unsigned char) rand();
......
...@@ -1059,7 +1059,7 @@ int main(int argc, char **argv) ...@@ -1059,7 +1059,7 @@ int main(int argc, char **argv)
if (n_trials== 1) num_rounds = 1; if (n_trials== 1) num_rounds = 1;
NR_gNB_DLSCH_t *gNB_dlsch = &msgDataTx->dlsch[0][0]; NR_gNB_DLSCH_t *gNB_dlsch = &msgDataTx->dlsch[0][0];
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &gNB_dlsch->harq_process.pdsch_pdu.pdsch_pdu_rel15; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &gNB_dlsch->pdsch_pdu.pdsch_pdu_rel15;
for (trial = 0; trial < n_trials && !stop; trial++) { for (trial = 0; trial < n_trials && !stop; trial++) {
...@@ -1255,7 +1255,7 @@ int main(int argc, char **argv) ...@@ -1255,7 +1255,7 @@ int main(int argc, char **argv)
} }
for (i = 0; i < available_bits; i++) { for (i = 0; i < available_bits; i++) {
const uint8_t current_bit = (gNB_dlsch->harq_process.f[i / 8] & (1 << (i & 7))) >> (i & 7); const uint8_t current_bit = (gNB_dlsch->f[i / 8] & (1 << (i & 7))) >> (i & 7);
if (((current_bit == 0) && (UE_llr[i] <= 0)) || ((current_bit == 1) && (UE_llr[i] >= 0))) { if (((current_bit == 0) && (UE_llr[i] <= 0)) || ((current_bit == 1) && (UE_llr[i] >= 0))) {
if (errors_scrambling[round] == 0) { if (errors_scrambling[round] == 0) {
LOG_D(PHY,"First bit in error in unscrambling = %d\n",i); LOG_D(PHY,"First bit in error in unscrambling = %d\n",i);
...@@ -1275,7 +1275,7 @@ int main(int argc, char **argv) ...@@ -1275,7 +1275,7 @@ int main(int argc, char **argv)
for (i = 0; i < TBS; i++) { for (i = 0; i < TBS; i++) {
estimated_output_bit[i] = (UE->phy_sim_dlsch_b[i/8] & (1 << (i & 7))) >> (i & 7); estimated_output_bit[i] = (UE->phy_sim_dlsch_b[i/8] & (1 << (i & 7))) >> (i & 7);
test_input_bit[i] = (gNB_dlsch->harq_process.b[i / 8] & (1 << (i & 7))) >> (i & 7); // Further correct for multiple segments test_input_bit[i] = (gNB_dlsch->b[i / 8] & (1 << (i & 7))) >> (i & 7); // Further correct for multiple segments
if (estimated_output_bit[i] != test_input_bit[i]) { if (estimated_output_bit[i] != test_input_bit[i]) {
if(errors_bit == 0) if(errors_bit == 0)
......
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