Commit 701a756a authored by Raymond Knopp's avatar Raymond Knopp

fix rate-matching receiver and mappings in nr_dlsch_decoding.c and...

fix rate-matching receiver and mappings in nr_dlsch_decoding.c and nr_ulsch_decoding.c. Performance with dlschsim and ulschsim seem correct. Code written for all RV_IDX but only rv_idx=0 tested. ulschsim performance seems a bit too good.
parent d0cfae42
......@@ -38,7 +38,7 @@
#define MAX_TURBO_ITERATIONS_MBSFN 8
#define MAX_TURBO_ITERATIONS max_turbo_iterations
#define MAX_LDPC_ITERATIONS 5
#define MAX_LDPC_ITERATIONS 10//5
#define MAX_LDPC_ITERATIONS_MBSFN 4
#define LTE_NULL 2
......@@ -495,7 +495,9 @@ int nr_rate_matching_ldpc_rx(uint8_t Ilbrm,
uint8_t C,
uint8_t rvidx,
uint8_t clear,
uint32_t E);
uint32_t E,
uint32_t F,
uint32_t Foffset);
decoder_if_t phy_threegpplte_turbo_decoder;
decoder_if_t phy_threegpplte_turbo_decoder8;
......
......@@ -407,7 +407,9 @@ int nr_rate_matching_ldpc_rx(uint8_t Ilbrm,
uint8_t C,
uint8_t rvidx,
uint8_t clear,
uint32_t E)
uint32_t E,
uint32_t F,
uint32_t Foffset)
{
uint32_t Ncb,ind,k,Nref,N;
......@@ -431,53 +433,60 @@ int nr_rate_matching_ldpc_rx(uint8_t Ilbrm,
}
ind = (index_k0[BG-1][rvidx]*Ncb/N)*Z;
AssertFatal(Foffset <= E,"Foffset %d > E %d\n",Foffset,E);
AssertFatal(Foffset <= Ncb,"Foffset %d > Ncb %d\n",Foffset,Ncb);
#ifdef RM_DEBUG
printf("nr_rate_matching_ldpc_rx: Clear %d, E %d, k0 %d, Ncb %d, rvidx %d\n", clear, E, ind, Ncb, rvidx);
#endif
if (clear==1)
memset(w,0,Ncb*sizeof(int16_t));
if (clear==1) memset(w,0,Ncb*sizeof(int16_t));
k=0;
for (; (ind<Ncb)&&(k<E); ind++) {
if (soft_input[ind] != NR_NULL) {
w[ind] += soft_input[k++];
if (ind < Foffset)
for (; (ind<Foffset)&&(k<E); ind++) {
#ifdef RM_DEBUG
printf("RM_RX k%d Ind: %d (%d)\n",k-1,ind,w[ind]);
printf("RM_RX k%d Ind %d(before filler): %d (%d)=>",k,ind,w[ind],soft_input[k]);
#endif
}
w[ind]+=soft_input[k++];
#ifdef RM_DEBUG
else {
printf("RM_RX Ind: %d NULL %d\n",ind,nulled);
nulled++;
printf("%d\n",w[ind]);
#endif
}
if (ind >= Foffset && ind < Foffset+F) ind=Foffset+F;
for (; (ind<Ncb)&&(k<E); ind++) {
#ifdef RM_DEBUG
printf("RM_RX k%d Ind %d(after filler) %d (%d)=>",k,ind,w[ind],soft_input[k]);
#endif
w[ind] += soft_input[k++];
#ifdef RM_DEBUG
printf("%d\n",w[ind]);
#endif
}
if (rvidx !=0){
while(k<E) {
for (ind=0; (ind<Ncb)&&(k<E); ind++) {
if (soft_input[ind] != NR_NULL) {
w[ind] += soft_input[k++];
for (ind=0; (ind<Foffset)&&(k<E); ind++) {
#ifdef RM_DEBUG
printf("RM_RX k%d Ind: %d (%d)(soft in %d)\n",k-1,ind,w[ind],soft_input[k-1]);
printf("RM_RX k%d Ind %d(before filler) %d(%d)=>",k,ind,w[ind],soft_input[k]);
#endif
}
w[ind]+=soft_input[k++];
#ifdef RM_DEBUG
else {
printf("RM_RX Ind: %d NULL %d\n",ind,nulled);
nulled++;
}
printf("%d\n",w[ind]);
#endif
}
for (ind=Foffset+F; (ind<Ncb)&&(k<E); ind++) {
#ifdef RM_DEBUG
printf("RM_RX (after filler) k%d Ind: %d (%d)(soft in %d)=>",k,ind,w[ind],soft_input[k]);
#endif
w[ind] += soft_input[k++];
#ifdef RM_DEBUG
printf("%d\n",w[ind]);
#endif
}
}
}
return 0;
}
......
......@@ -455,6 +455,7 @@ int nr_dlsch_encoding(unsigned char *a,
if (F>0) {
for (int k=(Kr-F-2*(*Zc)); k<Kr-2*(*Zc); k++) {
// writing into positions d[r][k-2Zc] as in clause 5.3.2 step 2) in 38.212
dlsch->harq_processes[harq_pid]->d[r][k] = NR_NULL;
//if (k<(Kr-F+8))
//printf("r %d filler bits [%d] = %d \n", r,k, dlsch->harq_processes[harq_pid]->d[r][k]);
......
......@@ -523,7 +523,9 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
harq_process->C,
nfapi_ulsch_pdu_rel15->rv,
(harq_process->round==0)?1:0,
E)==-1) {
E,
harq_process->F,
Kr-harq_process->F-2*(p_decParams->Z))==-1) {
#if gNB_TIMING_TRACE
stop_meas(ulsch_rate_unmatching_stats);
#endif
......@@ -581,7 +583,9 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
}
AssertFatal(kc!=255,"");
for (i=Kr_bytes,j=K_bytes_F-((2*p_decParams->Z)>>3); i < ((kc*p_decParams->Z)>>3); i++, j++) {
j+=(harq_process->F>>3);
// for (i=Kr_bytes,j=K_bytes_F-((2*p_decParams->Z)>>3); i < ((kc*p_decParams->Z)>>3); i++, j++) {
for (i=Kr_bytes; i < ((kc*p_decParams->Z)>>3); i++, j++) {
pv[i]= _mm_loadu_si128((__m128i*)(&harq_process->d[r][8*j]));
}
......
......@@ -485,7 +485,9 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
harq_process->C,
harq_process->rvidx,
(harq_process->round==0)?1:0,
E)==-1) {
E,
harq_process->F,
Kr-harq_process->F-2*(p_decParams->Z))==-1) {
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_OUT);
#if UE_TIMING_TRACE
stop_meas(dlsch_rate_unmatching_stats);
......@@ -551,12 +553,15 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
//memset(pl,0,2*p_decParams->Z*sizeof(int8_t));
memset((pv+K_bytes_F),127,harq_process->F*sizeof(int16_t));
for (i=((2*p_decParams->Z)>>3), j = 0; i < K_bytes_F; i++, j++)
{
pv[i]= _mm_loadu_si128((__m128i*)(&harq_process->d[r][8*j]));
}
for (i=Kr_bytes,j=K_bytes_F-((2*p_decParams->Z)>>3); i < ((kc*p_decParams->Z)>>3); i++, j++)
// Kbytes_F = Kr_bytes - F>>3
j+=(harq_process->F>>3);
// for (i=Kr_bytes,j=K_bytes_F-((2*p_decParams->Z)>>3); i < ((kc*p_decParams->Z)>>3); i++, j++)
for (i=Kr_bytes; i < ((kc*p_decParams->Z)>>3); i++,j++)
{
pv[i]= _mm_loadu_si128((__m128i*)(&harq_process->d[r][8*j]));
}
......@@ -1052,7 +1057,9 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
harq_process->C,
harq_process->rvidx,
(harq_process->round==0)?1:0,
E)==-1) {
E,
harq_process->F,
Kr-harq_process->F-2*(p_decParams->Z))==-1) {
#if UE_TIMING_TRACE
stop_meas(dlsch_rate_unmatching_stats);
#endif
......@@ -1593,7 +1600,9 @@ void *nr_dlsch_decoding_process(void *arg)
harq_process->C,
harq_process->rvidx,
(harq_process->round==0)?1:0,
E)==-1) {
E,
harq_process->F,
Kr-harq_process->F-2*(p_decParams->Z))==-1) {
#if UE_TIMING_TRACE
stop_meas(dlsch_rate_unmatching_stats);
#endif
......@@ -1654,11 +1663,11 @@ void *nr_dlsch_decoding_process(void *arg)
start_meas(dlsch_turbo_decoding_stats);
#endif
// LOG_D(PHY,"AbsSubframe %d.%d Start turbo segment %d/%d \n",frame%1024,subframe,r,harq_process->C-1);
/*
for (int cnt =0; cnt < (kc-2)*p_decParams->Z; cnt++){
inv_d[cnt] = (1)*harq_process->d[r][cnt];
}
*/
memset(pv,0,2*p_decParams->Z*sizeof(int16_t));
//memset(pl,0,2*p_decParams->Z*sizeof(int8_t));
memset((pv+K_bytes_F),127,harq_process->F*sizeof(int16_t));
......
......@@ -517,9 +517,10 @@ int main(int argc, char **argv)
if (channel_output_uncoded[i] != ulsch_ue->harq_processes[harq_pid]->f[i])
errors_bit_uncoded = errors_bit_uncoded + 1;
}
/*
printf("errors bits uncoded %u\n", errors_bit_uncoded);
printf("\n");
*/
#ifdef DEBUG_CODER
printf("\n");
exit(-1);
......@@ -542,13 +543,13 @@ int main(int argc, char **argv)
errors_bit++;
}
}
/*
if (errors_bit > 0) {
n_false_positive++;
if (n_trials == 1)
printf("errors_bit %u (trial %d)\n", errors_bit, trial);
}
printf("\n");
printf("\n");*/
}
printf("*****************************************\n");
......@@ -558,7 +559,7 @@ int main(int argc, char **argv)
printf("*****************************************\n");
printf("\n");
if (errors_bit == 0) {
if (n_errors == 0) {
printf("PUSCH test OK\n");
printf("\n");
break;
......
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