correction for dci crc computation
This commit is contained in:
@@ -241,8 +241,8 @@ if (logFlag){
|
|||||||
|
|
||||||
start_meas(&timeEncoder);
|
start_meas(&timeEncoder);
|
||||||
if (decoder_int16==1) {
|
if (decoder_int16==1) {
|
||||||
polar_encoder_fast((uint64_t *)testInput, encoderOutput, 0, currentPtr);
|
polar_encoder_fast((uint64_t *)testInput, encoderOutput, 0, 0, currentPtr);
|
||||||
//polar_encoder_fast((uint64_t*)testInput, (uint64_t*)encoderOutput,0, currentPtr);
|
//polar_encoder_fast((uint64_t*)testInput, (uint64_t*)encoderOutput,0,0,currentPtr);
|
||||||
} else { //0 --> PBCH, 1 --> DCI, -1 --> UCI
|
} else { //0 --> PBCH, 1 --> DCI, -1 --> UCI
|
||||||
if (polarMessageType == 0)
|
if (polarMessageType == 0)
|
||||||
polar_encoder(testInput, encoderOutput, currentPtr);
|
polar_encoder(testInput, encoderOutput, currentPtr);
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ void polar_encoder_dci(uint32_t *in,
|
|||||||
void polar_encoder_fast(uint64_t *A,
|
void polar_encoder_fast(uint64_t *A,
|
||||||
uint32_t *out,
|
uint32_t *out,
|
||||||
int32_t crcmask,
|
int32_t crcmask,
|
||||||
|
uint8_t ones_flag,
|
||||||
t_nrPolar_params *polarParams);
|
t_nrPolar_params *polarParams);
|
||||||
|
|
||||||
int8_t polar_decoder(double *input,
|
int8_t polar_decoder(double *input,
|
||||||
|
|||||||
@@ -410,6 +410,7 @@ void build_polar_tables(t_nrPolar_params *polarParams) {
|
|||||||
void polar_encoder_fast(uint64_t *A,
|
void polar_encoder_fast(uint64_t *A,
|
||||||
uint32_t *out,
|
uint32_t *out,
|
||||||
int32_t crcmask,
|
int32_t crcmask,
|
||||||
|
uint8_t ones_flag,
|
||||||
t_nrPolar_params *polarParams) {
|
t_nrPolar_params *polarParams) {
|
||||||
AssertFatal(polarParams->K > 32, "K = %d < 33, is not supported yet\n",polarParams->K);
|
AssertFatal(polarParams->K > 32, "K = %d < 33, is not supported yet\n",polarParams->K);
|
||||||
AssertFatal(polarParams->K < 129, "K = %d > 128, is not supported yet\n",polarParams->K);
|
AssertFatal(polarParams->K < 129, "K = %d > 128, is not supported yet\n",polarParams->K);
|
||||||
@@ -421,6 +422,10 @@ void polar_encoder_fast(uint64_t *A,
|
|||||||
AssertFatal(polarParams->crcParityBits == 24,"support for 24-bit crc only for now\n");
|
AssertFatal(polarParams->crcParityBits == 24,"support for 24-bit crc only for now\n");
|
||||||
//int bitlen0=bitlen;
|
//int bitlen0=bitlen;
|
||||||
uint64_t tcrc=0;
|
uint64_t tcrc=0;
|
||||||
|
uint8_t offset = 0;
|
||||||
|
|
||||||
|
// appending 24 ones before a0 for DCI as stated in 38.212 7.3.2
|
||||||
|
if (ones_flag) offset = 3;
|
||||||
|
|
||||||
// A bit string should be stored as 0, 0, ..., 0, a'_0, a'_1, ..., a'_A-1,
|
// A bit string should be stored as 0, 0, ..., 0, a'_0, a'_1, ..., a'_A-1,
|
||||||
//???a'_{N-1} a'_{N-2} ... a'_{N-A} 0 .... 0, where N=64,128,192,..., N is smallest multiple of 64 greater than or equal to A
|
//???a'_{N-1} a'_{N-2} ... a'_{N-A} 0 .... 0, where N=64,128,192,..., N is smallest multiple of 64 greater than or equal to A
|
||||||
@@ -428,38 +433,53 @@ void polar_encoder_fast(uint64_t *A,
|
|||||||
// First flip A bitstring byte endian for CRC routines (optimized for DLSCH/ULSCH, not PBCH/PDCCH)
|
// First flip A bitstring byte endian for CRC routines (optimized for DLSCH/ULSCH, not PBCH/PDCCH)
|
||||||
// CRC reads in each byte in bit positions 7 down to 0, for PBCH/PDCCH we need to read in a_{A-1} down to a_{0}, A = length of bit string (e.g. 32 for PBCH)
|
// CRC reads in each byte in bit positions 7 down to 0, for PBCH/PDCCH we need to read in a_{A-1} down to a_{0}, A = length of bit string (e.g. 32 for PBCH)
|
||||||
if (bitlen<=32) {
|
if (bitlen<=32) {
|
||||||
uint8_t A32_flip[4];
|
uint8_t A32_flip[4+offset];
|
||||||
|
if (ones_flag) {
|
||||||
|
A32_flip[0] = 0xff;
|
||||||
|
A32_flip[1] = 0xff;
|
||||||
|
A32_flip[2] = 0xff;
|
||||||
|
}
|
||||||
uint32_t Aprime= (uint32_t)(((uint32_t)*A)<<(32-bitlen));
|
uint32_t Aprime= (uint32_t)(((uint32_t)*A)<<(32-bitlen));
|
||||||
A32_flip[0]=((uint8_t *)&Aprime)[3];
|
A32_flip[0+offset]=((uint8_t *)&Aprime)[3];
|
||||||
A32_flip[1]=((uint8_t *)&Aprime)[2];
|
A32_flip[1+offset]=((uint8_t *)&Aprime)[2];
|
||||||
A32_flip[2]=((uint8_t *)&Aprime)[1];
|
A32_flip[2+offset]=((uint8_t *)&Aprime)[1];
|
||||||
A32_flip[3]=((uint8_t *)&Aprime)[0];
|
A32_flip[3+offset]=((uint8_t *)&Aprime)[0];
|
||||||
tcrc = (uint64_t)((crcmask^(crc24c(A32_flip,bitlen)>>8)));
|
tcrc = (uint64_t)((crcmask^(crc24c(A32_flip,8*offset+bitlen)>>8)));
|
||||||
} else if (bitlen<=64) {
|
} else if (bitlen<=64) {
|
||||||
uint8_t A64_flip[8];
|
uint8_t A64_flip[8+offset];
|
||||||
uint64_t Aprime= (uint32_t)(((uint64_t)*A)<<(64-bitlen));
|
if (ones_flag) {
|
||||||
A64_flip[0]=((uint8_t *)&Aprime)[7];
|
A64_flip[0] = 0xff;
|
||||||
A64_flip[1]=((uint8_t *)&Aprime)[6];
|
A64_flip[1] = 0xff;
|
||||||
A64_flip[2]=((uint8_t *)&Aprime)[5];
|
A64_flip[2] = 0xff;
|
||||||
A64_flip[3]=((uint8_t *)&Aprime)[4];
|
}
|
||||||
A64_flip[4]=((uint8_t *)&Aprime)[3];
|
uint64_t Aprime= (uint64_t)(((uint64_t)*A)<<(64-bitlen));
|
||||||
A64_flip[5]=((uint8_t *)&Aprime)[2];
|
A64_flip[0+offset]=((uint8_t *)&Aprime)[7];
|
||||||
A64_flip[6]=((uint8_t *)&Aprime)[1];
|
A64_flip[1+offset]=((uint8_t *)&Aprime)[6];
|
||||||
A64_flip[7]=((uint8_t *)&Aprime)[0];
|
A64_flip[2+offset]=((uint8_t *)&Aprime)[5];
|
||||||
tcrc = (uint64_t)((crcmask^(crc24c(A64_flip,bitlen)>>8)));
|
A64_flip[3+offset]=((uint8_t *)&Aprime)[4];
|
||||||
|
A64_flip[4+offset]=((uint8_t *)&Aprime)[3];
|
||||||
|
A64_flip[5+offset]=((uint8_t *)&Aprime)[2];
|
||||||
|
A64_flip[6+offset]=((uint8_t *)&Aprime)[1];
|
||||||
|
A64_flip[7+offset]=((uint8_t *)&Aprime)[0];
|
||||||
|
tcrc = (uint64_t)((crcmask^(crc24c(A64_flip,8*offset+bitlen)>>8)));
|
||||||
}
|
}
|
||||||
else if (bitlen<=128) {
|
else if (bitlen<=128) {
|
||||||
uint8_t A128_flip[16];
|
uint8_t A128_flip[16+offset];
|
||||||
uint128_t Aprime= (uint32_t)(((uint128_t)*A)<<(128-bitlen));
|
if (ones_flag) {
|
||||||
A128_flip[0]=((uint8_t*)&Aprime)[15]; A128_flip[1]=((uint8_t*)&Aprime)[14];
|
A128_flip[0] = 0xff;
|
||||||
A128_flip[2]=((uint8_t*)&Aprime)[13]; A128_flip[3]=((uint8_t*)&Aprime)[12];
|
A128_flip[1] = 0xff;
|
||||||
A128_flip[4]=((uint8_t*)&Aprime)[11]; A128_flip[5]=((uint8_t*)&Aprime)[10];
|
A128_flip[2] = 0xff;
|
||||||
A128_flip[6] =((uint8_t*)&Aprime)[9]; A128_flip[7] =((uint8_t*)&Aprime)[8];
|
}
|
||||||
A128_flip[8] =((uint8_t*)&Aprime)[7]; A128_flip[9] =((uint8_t*)&Aprime)[6];
|
uint128_t Aprime= (uint128_t)(((uint128_t)*A)<<(128-bitlen));
|
||||||
A128_flip[10]=((uint8_t*)&Aprime)[5]; A128_flip[11]=((uint8_t*)&Aprime)[4];
|
A128_flip[0+offset]=((uint8_t*)&Aprime)[15]; A128_flip[1+offset]=((uint8_t*)&Aprime)[14];
|
||||||
A128_flip[12]=((uint8_t*)&Aprime)[3]; A128_flip[13]=((uint8_t*)&Aprime)[2];
|
A128_flip[2+offset]=((uint8_t*)&Aprime)[13]; A128_flip[3+offset]=((uint8_t*)&Aprime)[12];
|
||||||
A128_flip[14]=((uint8_t*)&Aprime)[1]; A128_flip[15]=((uint8_t*)&Aprime)[0];
|
A128_flip[4+offset]=((uint8_t*)&Aprime)[11]; A128_flip[5+offset]=((uint8_t*)&Aprime)[10];
|
||||||
tcrc = (uint64_t)((crcmask^(crc24c(A128_flip,bitlen)>>8)));
|
A128_flip[6+offset] =((uint8_t*)&Aprime)[9]; A128_flip[7+offset] =((uint8_t*)&Aprime)[8];
|
||||||
|
A128_flip[8+offset] =((uint8_t*)&Aprime)[7]; A128_flip[9+offset] =((uint8_t*)&Aprime)[6];
|
||||||
|
A128_flip[10+offset]=((uint8_t*)&Aprime)[5]; A128_flip[11+offset]=((uint8_t*)&Aprime)[4];
|
||||||
|
A128_flip[12+offset]=((uint8_t*)&Aprime)[3]; A128_flip[13+offset]=((uint8_t*)&Aprime)[2];
|
||||||
|
A128_flip[14+offset]=((uint8_t*)&Aprime)[1]; A128_flip[15+offset]=((uint8_t*)&Aprime)[0];
|
||||||
|
tcrc = (uint64_t)((crcmask^(crc24c(A128_flip,8*offset+bitlen)>>8)));
|
||||||
}
|
}
|
||||||
|
|
||||||
int n;
|
int n;
|
||||||
@@ -473,7 +493,6 @@ void polar_encoder_fast(uint64_t *A,
|
|||||||
|
|
||||||
//??? b_{N'-1} b_{N'-2} ... b_{N'-A} b_{N'-A-1} ... b_{N'-A-Nparity} = a_{N-1} a_{N-2} ... a_{N-A} p_{N_parity-1} ... p_0
|
//??? b_{N'-1} b_{N'-2} ... b_{N'-A} b_{N'-A-1} ... b_{N'-A-Nparity} = a_{N-1} a_{N-2} ... a_{N-A} p_{N_parity-1} ... p_0
|
||||||
|
|
||||||
|
|
||||||
for (n=0; n<quadwlen; n++) if (n==0) B[n] = (A[n] << polarParams->crcParityBits) | tcrc;
|
for (n=0; n<quadwlen; n++) if (n==0) B[n] = (A[n] << polarParams->crcParityBits) | tcrc;
|
||||||
else B[n] = (A[n] << polarParams->crcParityBits) | (A[n-1]>>(64-polarParams->crcParityBits));
|
else B[n] = (A[n] << polarParams->crcParityBits) | (A[n-1]>>(64-polarParams->crcParityBits));
|
||||||
|
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ uint8_t nr_generate_dci_top(NR_gNB_PDCCH pdcch_vars,
|
|||||||
uint16_t Nid = (pdcch_params.search_space_type == NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC)?
|
uint16_t Nid = (pdcch_params.search_space_type == NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC)?
|
||||||
pdcch_params.scrambling_id : config.sch_config.physical_cell_id.value;
|
pdcch_params.scrambling_id : config.sch_config.physical_cell_id.value;
|
||||||
t_nrPolar_params *currentPtr = nr_polar_params(NR_POLAR_DCI_MESSAGE_TYPE, dci_alloc.size, dci_alloc.L);
|
t_nrPolar_params *currentPtr = nr_polar_params(NR_POLAR_DCI_MESSAGE_TYPE, dci_alloc.size, dci_alloc.L);
|
||||||
polar_encoder_fast(dci_alloc.dci_pdu, encoder_output, pdcch_params.rnti,currentPtr);
|
polar_encoder_fast(dci_alloc.dci_pdu, encoder_output, pdcch_params.rnti, 1, currentPtr);
|
||||||
#ifdef DEBUG_CHANNEL_CODING
|
#ifdef DEBUG_CHANNEL_CODING
|
||||||
printf("polar rnti %d\n",pdcch_params.rnti);
|
printf("polar rnti %d\n",pdcch_params.rnti);
|
||||||
printf("DCI PDU: [0]->0x%lx \t [1]->0x%lx\n",
|
printf("DCI PDU: [0]->0x%lx \t [1]->0x%lx\n",
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
|
|||||||
a_reversed |= (((uint64_t)pbch->pbch_a_prime>>i)&1)<<(31-i);
|
a_reversed |= (((uint64_t)pbch->pbch_a_prime>>i)&1)<<(31-i);
|
||||||
|
|
||||||
/// CRC, coding and rate matching
|
/// CRC, coding and rate matching
|
||||||
polar_encoder_fast (&a_reversed, (uint32_t *)pbch->pbch_e, 0,
|
polar_encoder_fast (&a_reversed, (uint32_t *)pbch->pbch_e, 0, 0,
|
||||||
nr_polar_params( NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL)
|
nr_polar_params( NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL)
|
||||||
);
|
);
|
||||||
#ifdef DEBUG_PBCH_ENCODING
|
#ifdef DEBUG_PBCH_ENCODING
|
||||||
|
|||||||
Reference in New Issue
Block a user