Commit df9cd171 authored by Laurent THOMAS's avatar Laurent THOMAS

remove a useless copy and specific buffer for all UE UL payload

parent 74977924
......@@ -534,8 +534,7 @@ void free_nr_ue_ul_harq(NR_UL_UE_HARQ_t harq_list[NR_MAX_ULSCH_HARQ_PROCESSES],
}
for (int i = 0; i < number_of_processes; i++) {
free_and_zero(harq_list[i].a);
free_and_zero(harq_list[i].b);
free_and_zero(harq_list[i].payload_AB);
for (int r = 0; r < a_segments; r++) {
free_and_zero(harq_list[i].c[r]);
free_and_zero(harq_list[i].d[r]);
......@@ -598,13 +597,9 @@ void nr_init_ul_harq_processes(NR_UL_UE_HARQ_t harq_list[NR_MAX_ULSCH_HARQ_PROCE
memset(harq_list + i, 0, sizeof(NR_UL_UE_HARQ_t));
harq_list[i].a = malloc16(ulsch_bytes);
DevAssert(harq_list[i].a);
bzero(harq_list[i].a, ulsch_bytes);
harq_list[i].b = malloc16(ulsch_bytes);
DevAssert(harq_list[i].b);
bzero(harq_list[i].b, ulsch_bytes);
harq_list[i].payload_AB = malloc16(ulsch_bytes);
DevAssert(harq_list[i].payload_AB);
bzero(harq_list[i].payload_AB, ulsch_bytes);
harq_list[i].c = malloc16(a_segments*sizeof(uint8_t *));
harq_list[i].d = malloc16(a_segments*sizeof(uint16_t *));
......
......@@ -55,9 +55,7 @@ typedef struct {
/// Index of current HARQ round for this ULSCH
uint8_t round;
/// pointer to pdu from MAC interface (TS 36.212 V15.4.0, Sec 5.1 p. 8)
unsigned char *a;
/// Pointer to the payload + CRC
uint8_t *b;
unsigned char *payload_AB;
/// Pointers to transport block segments
uint8_t **c;
/// LDPC-code outputs
......
......@@ -87,21 +87,19 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
int B;
if (A > NR_MAX_PDSCH_TBS) {
// Add 24-bit crc (polynomial A) to payload
crc = crc24a(harq_process->a,A)>>8;
harq_process->a[A>>3] = ((uint8_t*)&crc)[2];
harq_process->a[1+(A>>3)] = ((uint8_t*)&crc)[1];
harq_process->a[2 + (A >> 3)] = ((uint8_t *)&crc)[0];
crc = crc24a(harq_process->payload_AB, A) >> 8;
harq_process->payload_AB[A >> 3] = ((uint8_t *)&crc)[2];
harq_process->payload_AB[1 + (A >> 3)] = ((uint8_t *)&crc)[1];
harq_process->payload_AB[2 + (A >> 3)] = ((uint8_t *)&crc)[0];
B = A + 24;
AssertFatal((A / 8) + 4 <= max_payload_bytes, "A %d is too big (A/8+4 = %d > %d)\n", A, (A / 8) + 4, max_payload_bytes);
memcpy(harq_process->b,harq_process->a,(A/8)+4);
} else {
// Add 16-bit crc (polynomial A) to payload
crc = crc16(harq_process->a,A)>>16;
harq_process->a[A>>3] = ((uint8_t*)&crc)[1];
harq_process->a[1 + (A >> 3)] = ((uint8_t *)&crc)[0];
crc = crc16(harq_process->payload_AB, A) >> 16;
harq_process->payload_AB[A >> 3] = ((uint8_t *)&crc)[1];
harq_process->payload_AB[1 + (A >> 3)] = ((uint8_t *)&crc)[0];
B = A + 16;
AssertFatal((A / 8) + 3 <= max_payload_bytes, "A %d is too big (A/8+3 = %d > %d)\n", A, (A / 8) + 3, max_payload_bytes);
memcpy(harq_process->b,harq_process->a,(A/8)+3); // using 3 bytes to mimic the case of 24 bit crc
}
///////////////////////// b---->| block segmentation |---->c /////////////////////////
......@@ -110,7 +108,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_SEGMENTATION, VCD_FUNCTION_IN);
start_meas(&ue->ulsch_segmentation_stats);
impp.Kb = nr_segmentation(harq_process->b,
impp.Kb = nr_segmentation(harq_process->payload_AB,
harq_process->c,
B,
&harq_process->C,
......
......@@ -191,10 +191,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
mod_order,
Nl);
trace_NRpdu(DIRECTION_UPLINK,
harq_process_ul_ue->a,
tb_size,
WS_C_RNTI, rnti, frame, slot, 0, 0);
trace_NRpdu(DIRECTION_UPLINK, harq_process_ul_ue->payload_AB, tb_size, WS_C_RNTI, rnti, frame, slot, 0, 0);
if (nr_ulsch_encoding(UE, ulsch_ue, frame_parms, harq_pid, tb_size, G) == -1)
return;
......
......@@ -468,7 +468,7 @@ static void nr_ue_scheduled_response_ul(PHY_VARS_NR_UE *phy, fapi_nr_ul_config_r
ul_config->slot,
pdu->pusch_config_pdu.tx_request_body.pdu_length,
current_harq_pid);
memcpy(harq_process_ul_ue->a,
memcpy(harq_process_ul_ue->payload_AB,
pdu->pusch_config_pdu.tx_request_body.pdu,
pdu->pusch_config_pdu.tx_request_body.pdu_length);
}
......
......@@ -507,7 +507,7 @@ int main(int argc, char **argv)
ulsch_ue->pusch_pdu.target_code_rate = code_rate;
ulsch_ue->pusch_pdu.qam_mod_order = mod_order;
ulsch_ue->pusch_pdu.ldpcBaseGraph = get_BG(TBS, code_rate);
unsigned char *test_input = harq_process_ul_ue->a;
unsigned char *test_input = harq_process_ul_ue->payload_AB;
///////////
////////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -1141,7 +1141,7 @@ int main(int argc, char *argv[])
}
for (int i = 0; i < (TBS / 8); i++)
UE->ul_harq_processes[harq_pid].a[i] = i & 0xff;
UE->ul_harq_processes[harq_pid].payload_AB[i] = i & 0xff;
if (input_fd == NULL) {
// set FAPI parameters for UE, put them in the scheduled response and call
......@@ -1457,8 +1457,8 @@ int main(int argc, char *argv[])
for (i = 0; i < TBS; i++) {
uint8_t estimated_output_bit = (ulsch_gNB->harq_process->b[i / 8] & (1 << (i & 7))) >> (i & 7);
uint8_t test_input_bit = (UE->ul_harq_processes[harq_pid].b[i / 8] & (1 << (i & 7))) >> (i & 7);
uint8_t test_input_bit = (UE->ul_harq_processes[harq_pid].payload_AB[i / 8] & (1 << (i & 7))) >> (i & 7);
if (estimated_output_bit != test_input_bit) {
/*if(errors_decoding == 0)
printf("\x1B[34m""[frame %d][trial %d]\t1st bit in error in decoding = %d\n" "\x1B[0m", frame, trial, i);*/
......
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