Commit d73f7388 authored by Sakthivel Velumani's avatar Sakthivel Velumani

Merge branch 'nr-coreset-bug-fix' of...

Merge branch 'nr-coreset-bug-fix' of https://gitlab.eurecom.fr/oai/openairinterface5g into nr-coreset-bug-fix
parents 8961090d cab801a0
...@@ -74,7 +74,7 @@ int nr_rate_matching_ldpc(uint8_t Ilbrm, ...@@ -74,7 +74,7 @@ int nr_rate_matching_ldpc(uint8_t Ilbrm,
uint8_t rvidx, uint8_t rvidx,
uint32_t E) uint32_t E)
{ {
uint32_t Ncb,k0,j,k,Nref,N,ind; uint32_t Ncb,ind,k,Nref,N;
if (C==0) { if (C==0) {
printf("nr_rate_matching: invalid parameters (C %d\n",C); printf("nr_rate_matching: invalid parameters (C %d\n",C);
...@@ -91,25 +91,18 @@ int nr_rate_matching_ldpc(uint8_t Ilbrm, ...@@ -91,25 +91,18 @@ int nr_rate_matching_ldpc(uint8_t Ilbrm,
Ncb = min(N, Nref); Ncb = min(N, Nref);
} }
k0 = (index_k0[BG-1][rvidx]*Ncb/N)*Z; ind = (index_k0[BG-1][rvidx]*Ncb/N)*Z;
#ifdef RM_DEBUG #ifdef RM_DEBUG
printf("nr_rate_matching_ldpc: E %d, k0 %d, Ncb %d, rvidx %d\n", E, ind, Ncb, rvidx); printf("nr_rate_matching_ldpc: E %d, k0 %d, Ncb %d, rvidx %d\n", E, ind, Ncb, rvidx);
#endif #endif
k=0; k=0;
j=0;
while(k<E) { for (; (ind<Ncb)&&(k<E); ind++) {
ind=(k0+j)%Ncb;
if (w[ind] != NR_NULL) e[k++]=w[ind];
j++;
}
/*for (; (ind<Ncb)&&(k<E); ind++) {
#ifdef RM_DEBUG #ifdef RM_DEBUG
printf("RM_TX k%d Ind: %d (%d)\t",k,ind,w[ind]); printf("RM_TX k%d Ind: %d (%d)\n",k,ind,w[ind]);
#endif #endif
if (w[ind] != NR_NULL) e[k++]=w[ind]; if (w[ind] != NR_NULL) e[k++]=w[ind];
...@@ -119,12 +112,12 @@ int nr_rate_matching_ldpc(uint8_t Ilbrm, ...@@ -119,12 +112,12 @@ int nr_rate_matching_ldpc(uint8_t Ilbrm,
for (ind=0; (ind<Ncb)&&(k<E); ind++) { for (ind=0; (ind<Ncb)&&(k<E); ind++) {
#ifdef RM_DEBUG #ifdef RM_DEBUG
printf("RM_TX k%d Ind: %d (%d)\t",k,ind,w[ind]); printf("RM_TX k%d Ind: %d (%d)\n",k,ind,w[ind]);
#endif #endif
if (w[ind] != NR_NULL) e[k++]=w[ind]; if (w[ind] != NR_NULL) e[k++]=w[ind];
} }
}*/ }
return 0; return 0;
...@@ -213,3 +206,4 @@ int nr_rate_matching_ldpc_rx(uint8_t Ilbrm, ...@@ -213,3 +206,4 @@ int nr_rate_matching_ldpc_rx(uint8_t Ilbrm,
return 0; return 0;
} }
...@@ -326,6 +326,8 @@ int nr_dlsch_encoding(unsigned char *a,int frame, ...@@ -326,6 +326,8 @@ int nr_dlsch_encoding(unsigned char *a,int frame,
printf("%02x.",a[i]); printf("%02x.",a[i]);
printf("\n"); printf("\n");
*/ */
if (A > 3824) {
// Add 24-bit crc (polynomial A) to payload // Add 24-bit crc (polynomial A) to payload
crc = crc24a(a,A)>>8; crc = crc24a(a,A)>>8;
a[A>>3] = ((uint8_t*)&crc)[2]; a[A>>3] = ((uint8_t*)&crc)[2];
...@@ -339,19 +341,32 @@ int nr_dlsch_encoding(unsigned char *a,int frame, ...@@ -339,19 +341,32 @@ int nr_dlsch_encoding(unsigned char *a,int frame,
AssertFatal((A/8)+4 <= MAX_DLSCH_PAYLOAD_BYTES,"A %d is too big (A/8+4 = %d > %d)\n",A,(A/8)+4,MAX_DLSCH_PAYLOAD_BYTES); AssertFatal((A/8)+4 <= MAX_DLSCH_PAYLOAD_BYTES,"A %d is too big (A/8+4 = %d > %d)\n",A,(A/8)+4,MAX_DLSCH_PAYLOAD_BYTES);
memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+4); memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+4); // why is this +4 if the CRC is only 3 bytes?
}
else {
// Add 16-bit crc (polynomial A) to payload
crc = crc16(a,A)>>16;
a[A>>3] = ((uint8_t*)&crc)[1];
a[1+(A>>3)] = ((uint8_t*)&crc)[0];
//printf("CRC %x (A %d)\n",crc,A);
//printf("a0 %d a1 %d \n", a[A>>3], a[1+(A>>3)]);
dlsch->harq_processes[harq_pid]->B = A+16;
// dlsch->harq_processes[harq_pid]->b = a;
AssertFatal((A/8)+3 <= MAX_DLSCH_PAYLOAD_BYTES,"A %d is too big (A/8+3 = %d > %d)\n",A,(A/8)+3,MAX_DLSCH_PAYLOAD_BYTES);
memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+3); // using 3 bytes to mimic the case of 24 bit crc
}
if (R<1000) if (R<1000)
Coderate = (float) R /(float) 1024; Coderate = (float) R /(float) 1024;
else // to scale for mcs 20 and 26 in table 5.1.3.1-2 which are decimal and input 2* in nr_tbs_tools else // to scale for mcs 20 and 26 in table 5.1.3.1-2 which are decimal and input 2* in nr_tbs_tools
Coderate = (float) R /(float) 2048; Coderate = (float) R /(float) 2048;
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25){ if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25)
BG = 2; BG = 2;
} else
else{
BG = 1; BG = 1;
}
nr_segmentation(dlsch->harq_processes[harq_pid]->b, nr_segmentation(dlsch->harq_processes[harq_pid]->b,
dlsch->harq_processes[harq_pid]->c, dlsch->harq_processes[harq_pid]->c,
......
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