Commit 5fa78b4d authored by yilmazt's avatar yilmazt

Final --phy_simulators warning removals for this branch, and former polar...

Final --phy_simulators warning removals for this branch, and former polar coding function corrections
parent 75f131ad
...@@ -83,11 +83,11 @@ extern "C" { ...@@ -83,11 +83,11 @@ extern "C" {
* @brief LOG defines 9 levels of messages for users. Importance of these levels decrease gradually from 0 to 8 * @brief LOG defines 9 levels of messages for users. Importance of these levels decrease gradually from 0 to 8
* @{*/ * @{*/
# define OAILOG_DISABLE -1 /*!< \brief disable all LOG messages, cannot be used in LOG macros, use only in LOG module */ # define OAILOG_DISABLE -1 /*!< \brief disable all LOG messages, cannot be used in LOG macros, use only in LOG module */
# define OAILOG_ERR 0 /*!< \brief critical error conditions, impact on "must have" fuctinalities */ # define OAILOG_ERR 0 /*!< \brief critical error conditions, impact on "must have" functionalities */
# define OAILOG_WARNING 1 /*!< \brief warning conditions, shouldn't happen but doesn't impact "must have" functionalities */ # define OAILOG_WARNING 1 /*!< \brief warning conditions, shouldn't happen but doesn't impact "must have" functionalities */
# define OAILOG_INFO 2 /*!< \brief informational messages most people don't need, shouldn't impact real-time behavior */ # define OAILOG_INFO 2 /*!< \brief informational messages most people don't need, shouldn't impact real-time behavior */
# define OAILOG_DEBUG 3 /*!< \brief first level debug-level messages, for developers , may impact real-time behavior */ # define OAILOG_DEBUG 3 /*!< \brief first level debug-level messages, for developers, may impact real-time behavior */
# define OAILOG_TRACE 4 /*!< \brief second level debug-level messages, for developers ,likely impact real-time behavior*/ # define OAILOG_TRACE 4 /*!< \brief second level debug-level messages, for developers, likely impact real-time behavior*/
#define NUM_LOG_LEVEL 5 /*!< \brief the number of message levels users have with LOG (OAILOG_DISABLE is not available to user as a level, so it is not included)*/ #define NUM_LOG_LEVEL 5 /*!< \brief the number of message levels users have with LOG (OAILOG_DISABLE is not available to user as a level, so it is not included)*/
/* @}*/ /* @}*/
......
...@@ -27,9 +27,9 @@ int main(int argc, char *argv[]) { ...@@ -27,9 +27,9 @@ int main(int argc, char *argv[]) {
int16_t nBitError = 0; // -1 = Decoding failed (All list entries have failed the CRC checks). int16_t nBitError = 0; // -1 = Decoding failed (All list entries have failed the CRC checks).
uint32_t decoderState=0, blockErrorState=0; //0 = Success, -1 = Decoding failed, 1 = Block Error. uint32_t decoderState=0, blockErrorState=0; //0 = Success, -1 = Decoding failed, 1 = Block Error.
uint16_t testLength = NR_POLAR_PBCH_PAYLOAD_BITS, coderLength = NR_POLAR_PBCH_E; uint16_t testLength = NR_POLAR_PBCH_PAYLOAD_BITS, coderLength = NR_POLAR_PBCH_E;
uint16_t blockErrorCumulative=0, bitErrorCumulative=0, aPrioriLength=0; uint16_t blockErrorCumulative=0, bitErrorCumulative=0;
double timeEncoderCumulative = 0, timeDecoderCumulative = 0; double timeEncoderCumulative = 0, timeDecoderCumulative = 0;
uint8_t aggregation_level = 8, decoderListSize = 8, pathMetricAppr = 0, logFlag = 0, aPrioriFlag=0; uint8_t aggregation_level = 8, decoderListSize = 8, logFlag = 0;
uint16_t rnti=0; uint16_t rnti=0;
while ((arguments = getopt (argc, argv, "s:d:f:m:i:l:a:p:hqgFL:k:")) != -1) while ((arguments = getopt (argc, argv, "s:d:f:m:i:l:a:p:hqgFL:k:")) != -1)
...@@ -60,12 +60,6 @@ int main(int argc, char *argv[]) { ...@@ -60,12 +60,6 @@ int main(int argc, char *argv[]) {
decoderListSize = (uint8_t) atoi(optarg); decoderListSize = (uint8_t) atoi(optarg);
break; break;
case 'a':
pathMetricAppr = (uint8_t) atoi(optarg);
break;
case 'q': case 'q':
decoder_int16 = 1; decoder_int16 = 1;
break; break;
...@@ -97,19 +91,10 @@ int main(int argc, char *argv[]) { ...@@ -97,19 +91,10 @@ int main(int argc, char *argv[]) {
} }
break; break;
case 'p':
aPrioriLength = (uint8_t) atoi(optarg);
if (aPrioriLength > testLength){
printf("A priori information(%d) cannot be larger than test length(%d)\n",aPrioriLength, testLength);
exit(-1);
}
aPrioriFlag = 1;
break;
case 'h': case 'h':
printf("./polartest\nOptions\n-h Print this help\n-s SNRstart (dB)\n-d SNRinc (dB)\n-f SNRstop (dB)\n-m [0=PBCH|1=DCI|2=UCI]\n" printf("./polartest\nOptions\n-h Print this help\n-s SNRstart (dB)\n-d SNRinc (dB)\n-f SNRstop (dB)\n-m [0=PBCH|1=DCI|2=UCI]\n"
"-i Number of iterations\n-l decoderListSize\n-a pathMetricAppr\n-q Flag for optimized coders usage\n-F Flag for test results logging\n" "-i Number of iterations\n-l decoderListSize\n-q Flag for optimized coders usage\n-F Flag for test results logging\n"
"-L aggregation level (for DCI)\n-k packet_length (bits) for DCI/UCI\n-p (Only for PBCH for now) A priori information length used in polar decoder\n"); "-L aggregation level (for DCI)\n-k packet_length (bits) for DCI/UCI\n");
exit(-1); exit(-1);
break; break;
...@@ -148,9 +133,9 @@ int main(int argc, char *argv[]) { ...@@ -148,9 +133,9 @@ int main(int argc, char *argv[]) {
if (logFlag){ if (logFlag){
time (&currentTime); time (&currentTime);
#ifdef DEBUG_POLAR_TIMING #ifdef DEBUG_POLAR_TIMING
sprintf(fileName,"%s/TIMING_ListSize_%d_pmAppr_%d_Payload_%d_Itr_%d",folderName,decoderListSize,pathMetricAppr,testLength,iterations); sprintf(fileName,"%s/TIMING_ListSize_%d_Payload_%d_Itr_%d", folderName, decoderListSize, testLength, iterations);
#else #else
sprintf(fileName,"%s/_ListSize_%d_pmAppr_%d_Payload_%d_Itr_%d",folderName,decoderListSize,pathMetricAppr,testLength,iterations); sprintf(fileName,"%s/_ListSize_%d_Payload_%d_Itr_%d", folderName, decoderListSize, testLength, iterations);
#endif #endif
strftime(currentTimeInfo, 25, "_%Y-%m-%d-%H-%M-%S.csv", localtime(&currentTime)); strftime(currentTimeInfo, 25, "_%Y-%m-%d-%H-%M-%S.csv", localtime(&currentTime));
strcat(fileName,currentTimeInfo); strcat(fileName,currentTimeInfo);
...@@ -184,11 +169,6 @@ if (logFlag){ ...@@ -184,11 +169,6 @@ if (logFlag){
double channelOutput[coderLength]; //add noise double channelOutput[coderLength]; //add noise
int16_t channelOutput_int16[coderLength]; int16_t channelOutput_int16[coderLength];
//A priori knowledge about the payload is assumed according to "aPrioriFlag".
double aPrioriArray[testLength];
uint8_t testInputByte[testLength];
uint16_t aPrioriInd[aPrioriLength];
t_nrPolar_params *currentPtr = nr_polar_params(polarMessageType, testLength, aggregation_level); t_nrPolar_params *currentPtr = nr_polar_params(polarMessageType, testLength, aggregation_level);
#ifdef DEBUG_DCI_POLAR_PARAMS #ifdef DEBUG_DCI_POLAR_PARAMS
...@@ -224,7 +204,7 @@ if (logFlag){ ...@@ -224,7 +204,7 @@ if (logFlag){
modulated_input[i]=(-1)/sqrt(2); modulated_input[i]=(-1)/sqrt(2);
channel_output[i] = modulated_input[i] + (gaussdouble(0.0,1.0) * (1/sqrt(2*SNR_lin))); channel_output[i] = modulated_input[i] + (gaussdouble(0.0,1.0) * (1/sqrt(2*SNR_lin)));
} }
decoderState = polar_decoder_dci(channel_output, dci_est, currentPtrDCI, NR_POLAR_DECODER_LISTSIZE, NR_POLAR_DECODER_PATH_METRIC_APPROXIMATION, rnti); decoderState = polar_decoder_dci(channel_output, dci_est, currentPtrDCI, NR_POLAR_DECODER_LISTSIZE, rnti);
printf("dci_est: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n", dci_est[0], dci_est[1], dci_est[2], dci_est[3]); printf("dci_est: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n", dci_est[0], dci_est[1], dci_est[2], dci_est[3]);
free(encoder_outputByte); free(encoder_outputByte);
free(channel_output); free(channel_output);
...@@ -245,22 +225,10 @@ if (logFlag){ ...@@ -245,22 +225,10 @@ if (logFlag){
} }
testInput[i] |= ( ((uint32_t) (rand()%2)) &1); testInput[i] |= ( ((uint32_t) (rand()%2)) &1);
} }
//Generate random a priori information in "aPrioriArray", if "aPrioriFlag" is set.
if (aPrioriFlag){
nr_bit2byte_uint32_8(testInput, testLength, testInputByte);
for (int i=0; i<testLength; i++){
aPrioriArray[i] = NAN;
}
for (int i=0; i<aPrioriLength; i++){
aPrioriInd[i]=(rand()%(testLength));
aPrioriArray[aPrioriInd[i]]=testInputByte[aPrioriInd[i]];
}
}
#ifdef DEBUG_POLARTEST #ifdef DEBUG_POLARTEST
//testInput[0] = 0x360f8a5c; //testInput[0] = 0x360f8a5c;
printf("testInput: [0]->0x%08x\n", testInput[0]); printf("testInput: [0]->0x%08x\n", testInput[0]);
for (int i=0; i<32; i++) printf("testInput:%d-testInputByte:%d-aPrioriArray:%f\n",(testInput[0]>>i)&1, testInputByte[i], aPrioriArray[i]);
#endif #endif
int len_mod64=currentPtr->payloadBits&63; int len_mod64=currentPtr->payloadBits&63;
((uint64_t *)testInput)[currentPtr->payloadBits/64]&=((((uint64_t)1)<<len_mod64)-1); ((uint64_t *)testInput)[currentPtr->payloadBits/64]&=((((uint64_t)1)<<len_mod64)-1);
...@@ -307,26 +275,15 @@ if (logFlag){ ...@@ -307,26 +275,15 @@ if (logFlag){
decoderState = polar_decoder_int16(channelOutput_int16, (uint64_t *)estimatedOutput, currentPtr); decoderState = polar_decoder_int16(channelOutput_int16, (uint64_t *)estimatedOutput, currentPtr);
} else { //0 --> PBCH, 1 --> DCI, -1 --> UCI } else { //0 --> PBCH, 1 --> DCI, -1 --> UCI
if (polarMessageType == 0) { if (polarMessageType == 0) {
if (aPrioriFlag) {
decoderState = polar_decoder_aPriori(channelOutput,
estimatedOutput,
currentPtr,
decoderListSize,
NR_POLAR_DECODER_PATH_METRIC_APPROXIMATION,
aPrioriArray);
} else {
decoderState = polar_decoder(channelOutput, decoderState = polar_decoder(channelOutput,
estimatedOutput, estimatedOutput,
currentPtr, currentPtr,
decoderListSize, decoderListSize);
NR_POLAR_DECODER_PATH_METRIC_APPROXIMATION);
}
} else if (polarMessageType == 1) { } else if (polarMessageType == 1) {
decoderState = polar_decoder_dci(channelOutput, decoderState = polar_decoder_dci(channelOutput,
estimatedOutput, estimatedOutput,
currentPtr, currentPtr,
decoderListSize, decoderListSize,
NR_POLAR_DECODER_PATH_METRIC_APPROXIMATION,
rnti); rnti);
} }
} }
...@@ -379,8 +336,8 @@ if (logFlag){ ...@@ -379,8 +336,8 @@ if (logFlag){
} }
//Calculate error statistics for the SNR. //Calculate error statistics for the SNR.
printf("[ListSize=%d, Appr=%d] SNR=%+8.3f, BLER=%9.6f, BER=%12.9f, t_Encoder=%9.3fus, t_Decoder=%9.3fus\n", printf("[ListSize=%d] SNR=%+8.3f, BLER=%9.6f, BER=%12.9f, t_Encoder=%9.3fus, t_Decoder=%9.3fus\n",
decoderListSize, pathMetricAppr, SNR, ((double)blockErrorCumulative/iterations), decoderListSize, SNR, ((double)blockErrorCumulative/iterations),
((double)bitErrorCumulative / (iterations*testLength)), ((double)bitErrorCumulative / (iterations*testLength)),
(double)timeEncoder.diff/timeEncoder.trials/(cpu_freq_GHz*1000.0),(double)timeDecoder.diff/timeDecoder.trials/(cpu_freq_GHz*1000.0)); (double)timeEncoder.diff/timeEncoder.trials/(cpu_freq_GHz*1000.0),(double)timeDecoder.diff/timeDecoder.trials/(cpu_freq_GHz*1000.0));
//(timeEncoderCumulative/iterations),timeDecoderCumulative/iterations); //(timeEncoderCumulative/iterations),timeDecoderCumulative/iterations);
......
...@@ -29,13 +29,14 @@ int main(int argc, char *argv[]) { ...@@ -29,13 +29,14 @@ int main(int argc, char *argv[]) {
reset_meas(&timeDecoder); reset_meas(&timeDecoder);
randominit(0); randominit(0);
int arguments, iterations = 1000, matlabDebug = 0, messageLength = 11; int arguments, iterations = 1000, messageLength = 11;
//int matlabDebug = 0;
uint32_t testInput, encoderOutput, codingDifference, nBitError=0, blockErrorState = 0, blockErrorCumulative=0, bitErrorCumulative=0; uint32_t testInput, encoderOutput, codingDifference, nBitError=0, blockErrorState = 0, blockErrorCumulative=0, bitErrorCumulative=0;
uint16_t estimatedOutput; uint16_t estimatedOutput;
double SNRstart = -20.0, SNRstop = 5.0, SNRinc= 0.5; //dB double SNRstart = -20.0, SNRstop = 5.0, SNRinc= 0.5; //dB
double SNR, SNR_lin, sigma; double SNR, SNR_lin, sigma;
double modulatedInput[NR_SMALL_BLOCK_CODED_BITS], channelOutput[NR_SMALL_BLOCK_CODED_BITS]; double modulatedInput[NR_SMALL_BLOCK_CODED_BITS], channelOutput[NR_SMALL_BLOCK_CODED_BITS];
int16_t channelOutput_int16[NR_SMALL_BLOCK_CODED_BITS]; //int16_t channelOutput_int16[NR_SMALL_BLOCK_CODED_BITS];
int8_t channelOutput_int8[NR_SMALL_BLOCK_CODED_BITS]; int8_t channelOutput_int8[NR_SMALL_BLOCK_CODED_BITS];
unsigned char qbits=8; unsigned char qbits=8;
...@@ -62,10 +63,10 @@ int main(int argc, char *argv[]) { ...@@ -62,10 +63,10 @@ int main(int argc, char *argv[]) {
iterations = atoi(optarg); iterations = atoi(optarg);
break; break;
case 'm': /*case 'm':
matlabDebug = 1; matlabDebug = 1;
//#define DEBUG_POLAR_MATLAB //#define DEBUG_POLAR_MATLAB
break; break;*/
case 'g': case 'g':
iterations = 1; iterations = 1;
...@@ -75,7 +76,8 @@ int main(int argc, char *argv[]) { ...@@ -75,7 +76,8 @@ int main(int argc, char *argv[]) {
break; break;
case 'h': case 'h':
printf("./smallblocktest -s SNRstart -d SNRinc -f SNRstop -l messageLength -i iterations -m Matlab Debug\n"); //printf("./smallblocktest -s SNRstart -d SNRinc -f SNRstop -l messageLength -i iterations -m Matlab Debug\n");
printf("./smallblocktest -s SNRstart -d SNRinc -f SNRstop -l messageLength -i iterations\n");
exit(-1); exit(-1);
default: default:
......
...@@ -228,7 +228,7 @@ crc8 (unsigned char * inptr, int bitlen) ...@@ -228,7 +228,7 @@ crc8 (unsigned char * inptr, int bitlen)
int check_crc(uint8_t* decoded_bytes, uint32_t n, uint32_t F, uint8_t crc_type) int check_crc(uint8_t* decoded_bytes, uint32_t n, uint32_t F, uint8_t crc_type)
{ {
uint32_t crc=0,oldcrc=0; uint32_t crc=0,oldcrc=0;
uint8_t crc_len,temp; uint8_t crc_len=0;
switch (crc_type) { switch (crc_type) {
case CRC24_A: case CRC24_A:
......
...@@ -42,8 +42,8 @@ ...@@ -42,8 +42,8 @@
int8_t polar_decoder(double *input, int8_t polar_decoder(double *input,
uint32_t *out, uint32_t *out,
t_nrPolar_params *polarParams, t_nrPolar_params *polarParams,
uint8_t listSize, uint8_t listSize)
uint8_t pathMetricAppr) { {
//Assumes no a priori knowledge. //Assumes no a priori knowledge.
uint8_t ***bit = nr_alloc_uint8_3D_array(polarParams->N, (polarParams->n+1), 2*listSize); uint8_t ***bit = nr_alloc_uint8_3D_array(polarParams->N, (polarParams->n+1), 2*listSize);
uint8_t **bitUpdated = nr_alloc_uint8_2D_array(polarParams->N, (polarParams->n+1)); //0=False, 1=True uint8_t **bitUpdated = nr_alloc_uint8_2D_array(polarParams->N, (polarParams->n+1)); //0=False, 1=True
...@@ -117,12 +117,12 @@ int8_t polar_decoder(double *input, ...@@ -117,12 +117,12 @@ int8_t polar_decoder(double *input,
uint8_t listIndex[2*listSize], copyIndex; uint8_t listIndex[2*listSize], copyIndex;
for (uint16_t currentBit=0; currentBit<polarParams->N; currentBit++) { for (uint16_t currentBit=0; currentBit<polarParams->N; currentBit++) {
updateLLR(llr, llrUpdated, bit, bitUpdated, currentListSize, currentBit, 0, polarParams->N, (polarParams->n+1), pathMetricAppr); updateLLR(llr, llrUpdated, bit, bitUpdated, currentListSize, currentBit, 0, polarParams->N, (polarParams->n+1));
if (polarParams->information_bit_pattern[currentBit]==0) { //Frozen bit. if (polarParams->information_bit_pattern[currentBit]==0) { //Frozen bit.
updatePathMetric(pathMetric, llr, currentListSize, 0, currentBit, pathMetricAppr); //approximation=0 --> 11b, approximation=1 --> 12 updatePathMetric(pathMetric, llr, currentListSize, 0, currentBit);
} else { //Information or CRC bit. } else { //Information or CRC bit.
updatePathMetric2(pathMetric, llr, currentListSize, currentBit, pathMetricAppr); updatePathMetric2(pathMetric, llr, currentListSize, currentBit);
for (int i = 0; i < currentListSize; i++) { for (int i = 0; i < currentListSize; i++) {
for (int j = 0; j < polarParams->N; j++) { for (int j = 0; j < polarParams->N; j++) {
...@@ -296,286 +296,10 @@ int8_t polar_decoder(double *input, ...@@ -296,286 +296,10 @@ int8_t polar_decoder(double *input,
return(0); return(0);
} }
int8_t polar_decoder_aPriori(double *input,
uint32_t *out,
t_nrPolar_params *polarParams,
uint8_t listSize,
uint8_t pathMetricAppr,
double *aPrioriPayload) {
uint8_t ***bit = nr_alloc_uint8_3D_array(polarParams->N, (polarParams->n+1), 2*listSize);
uint8_t **bitUpdated = nr_alloc_uint8_2D_array(polarParams->N, (polarParams->n+1)); //0=False, 1=True
uint8_t **llrUpdated = nr_alloc_uint8_2D_array(polarParams->N, (polarParams->n+1)); //0=False, 1=True
double ***llr = nr_alloc_double_3D_array(polarParams->N, (polarParams->n+1), 2*listSize);
uint8_t **crcChecksum = nr_alloc_uint8_2D_array(polarParams->crcParityBits, 2*listSize);
double *pathMetric = malloc(sizeof(double)*(2*listSize));
uint8_t *crcState = malloc(sizeof(uint8_t)*(2*listSize)); //0=False, 1=True
for (int i=0; i<(2*listSize); i++) {
pathMetric[i] = 0;
crcState[i]=1;
}
for (int i=0; i<polarParams->N; i++) {
llrUpdated[i][polarParams->n]=1;
bitUpdated[i][0]=((polarParams->information_bit_pattern[i]+1) % 2);
}
uint8_t **extended_crc_generator_matrix = malloc(polarParams->K * sizeof(uint8_t *)); //G_P3
uint8_t **tempECGM = malloc(polarParams->K * sizeof(uint8_t *)); //G_P2
for (int i = 0; i < polarParams->K; i++) {
extended_crc_generator_matrix[i] = malloc(polarParams->crcParityBits * sizeof(uint8_t));
tempECGM[i] = malloc(polarParams->crcParityBits * sizeof(uint8_t));
}
for (int i=0; i<polarParams->payloadBits; i++) {
for (int j=0; j<polarParams->crcParityBits; j++) {
tempECGM[i][j]=polarParams->crc_generator_matrix[i][j];
}
}
for (int i=polarParams->payloadBits; i<polarParams->K; i++) {
for (int j=0; j<polarParams->crcParityBits; j++) {
if( (i-polarParams->payloadBits) == j ) {
tempECGM[i][j]=1;
} else {
tempECGM[i][j]=0;
}
}
}
for (int i=0; i<polarParams->K; i++) {
for (int j=0; j<polarParams->crcParityBits; j++) {
extended_crc_generator_matrix[i][j]=tempECGM[polarParams->interleaving_pattern[i]][j];
}
}
//The index of the last 1-valued bit that appears in each column.
uint16_t last1ind[polarParams->crcParityBits];
for (int j=0; j<polarParams->crcParityBits; j++) {
for (int i=0; i<polarParams->K; i++) {
if (extended_crc_generator_matrix[i][j]==1) last1ind[j]=i;
}
}
double *d_tilde = malloc(sizeof(double) * polarParams->N);
nr_polar_rate_matching(input, d_tilde, polarParams->rate_matching_pattern, polarParams->K, polarParams->N, polarParams->encoderLength);
for (int j = 0; j < polarParams->N; j++) llr[j][polarParams->n][0]=d_tilde[j];
/*
* SCL polar decoder.
*/
uint32_t nonFrozenBit=0;
uint8_t currentListSize=1;
uint8_t decoderIterationCheck=0;
int16_t checkCrcBits=-1;
uint8_t listIndex[2*listSize], copyIndex;
for (uint16_t currentBit=0; currentBit<polarParams->N; currentBit++) {
updateLLR(llr, llrUpdated, bit, bitUpdated, currentListSize, currentBit, 0, polarParams->N, (polarParams->n+1), pathMetricAppr);
if (polarParams->information_bit_pattern[currentBit]==0) { //Frozen bit.
updatePathMetric(pathMetric, llr, currentListSize, 0, currentBit, pathMetricAppr); //approximation=0 --> 11b, approximation=1 --> 12
} else { //Information or CRC bit.
if ( (polarParams->interleaving_pattern[nonFrozenBit] <= polarParams->payloadBits) &&
(aPrioriPayload[polarParams->interleaving_pattern[nonFrozenBit]] == 0) ) {
//Information bit with known value of "0".
updatePathMetric(pathMetric, llr, currentListSize, 0, currentBit, pathMetricAppr);
bitUpdated[currentBit][0]=1; //0=False, 1=True
} else if ( (polarParams->interleaving_pattern[nonFrozenBit] <= polarParams->payloadBits) &&
(aPrioriPayload[polarParams->interleaving_pattern[nonFrozenBit]] == 1) ) {
//Information bit with known value of "1".
updatePathMetric(pathMetric, llr, currentListSize, 1, currentBit, pathMetricAppr);
for (uint8_t i=0; i<currentListSize; i++) bit[currentBit][0][i]=1;
bitUpdated[currentBit][0]=1;
updateCrcChecksum(crcChecksum, extended_crc_generator_matrix, currentListSize, nonFrozenBit, polarParams->crcParityBits);
} else {
updatePathMetric2(pathMetric, llr, currentListSize, currentBit, pathMetricAppr);
for (int i = 0; i < currentListSize; i++) {
for (int j = 0; j < polarParams->N; j++) {
for (int k = 0; k < (polarParams->n+1); k++) {
bit[j][k][i+currentListSize]=bit[j][k][i];
llr[j][k][i+currentListSize]=llr[j][k][i];
}
}
}
for (int i = 0; i < currentListSize; i++) {
bit[currentBit][0][i]=0;
crcState[i+currentListSize]=crcState[i];
}
for (int i = currentListSize; i < 2*currentListSize; i++) bit[currentBit][0][i]=1;
bitUpdated[currentBit][0]=1;
updateCrcChecksum2(crcChecksum, extended_crc_generator_matrix, currentListSize, nonFrozenBit, polarParams->crcParityBits);
currentListSize*=2;
//Keep only the best "listSize" number of entries.
if (currentListSize > listSize) {
for (uint8_t i = 0; i < 2*listSize; i++) listIndex[i]=i;
nr_sort_asc_double_1D_array_ind(pathMetric, listIndex, currentListSize);
//sort listIndex[listSize, ..., 2*listSize-1] in descending order.
uint8_t swaps, tempInd;
for (uint8_t i = 0; i < listSize; i++) {
swaps = 0;
for (uint8_t j = listSize; j < (2*listSize - i) - 1; j++) {
if (listIndex[j+1] > listIndex[j]) {
tempInd = listIndex[j];
listIndex[j] = listIndex[j + 1];
listIndex[j + 1] = tempInd;
swaps++;
}
}
if (swaps == 0)
break;
}
//First, backup the best "listSize" number of entries.
for (int k=(listSize-1); k>0; k--) {
for (int i=0; i<polarParams->N; i++) {
for (int j=0; j<(polarParams->n+1); j++) {
bit[i][j][listIndex[(2*listSize-1)-k]]=bit[i][j][listIndex[k]];
llr[i][j][listIndex[(2*listSize-1)-k]]=llr[i][j][listIndex[k]];
}
}
}
for (int k=(listSize-1); k>0; k--) {
for (int i = 0; i < polarParams->crcParityBits; i++) {
crcChecksum[i][listIndex[(2*listSize-1)-k]] = crcChecksum[i][listIndex[k]];
}
}
for (int k=(listSize-1); k>0; k--) crcState[listIndex[(2*listSize-1)-k]]=crcState[listIndex[k]];
//Copy the best "listSize" number of entries to the first indices.
for (int k = 0; k < listSize; k++) {
if (k > listIndex[k]) {
copyIndex = listIndex[(2*listSize-1)-k];
} else { //Use the backup.
copyIndex = listIndex[k];
}
for (int i = 0; i < polarParams->N; i++) {
for (int j = 0; j < (polarParams->n + 1); j++) {
bit[i][j][k] = bit[i][j][copyIndex];
llr[i][j][k] = llr[i][j][copyIndex];
}
}
}
for (int k = 0; k < listSize; k++) {
if (k > listIndex[k]) {
copyIndex = listIndex[(2*listSize-1)-k];
} else { //Use the backup.
copyIndex = listIndex[k];
}
for (int i = 0; i < polarParams->crcParityBits; i++) {
crcChecksum[i][k]=crcChecksum[i][copyIndex];
}
}
for (int k = 0; k < listSize; k++) {
if (k > listIndex[k]) {
copyIndex = listIndex[(2*listSize-1)-k];
} else { //Use the backup.
copyIndex = listIndex[k];
}
crcState[k]=crcState[copyIndex];
}
currentListSize = listSize;
}
}
for (int i=0; i<polarParams->crcParityBits; i++) {
if (last1ind[i]==nonFrozenBit) {
checkCrcBits=i;
break;
}
}
if ( checkCrcBits > (-1) ) {
for (uint8_t i = 0; i < currentListSize; i++) {
if (crcChecksum[checkCrcBits][i]==1) {
crcState[i]=0; //0=False, 1=True
}
}
}
for (uint8_t i = 0; i < currentListSize; i++) decoderIterationCheck+=crcState[i];
if (decoderIterationCheck==0) {
//perror("[SCL polar decoder] All list entries have failed the CRC checks.");
free(d_tilde);
free(pathMetric);
free(crcState);
nr_free_uint8_3D_array(bit, polarParams->N, (polarParams->n+1));
nr_free_double_3D_array(llr, polarParams->N, (polarParams->n+1));
nr_free_uint8_2D_array(crcChecksum, polarParams->crcParityBits);
return(-1);
}
nonFrozenBit++;
decoderIterationCheck=0;
checkCrcBits=-1;
}
}
for (uint8_t i = 0; i < 2*listSize; i++) listIndex[i]=i;
nr_sort_asc_double_1D_array_ind(pathMetric, listIndex, currentListSize);
for (uint8_t i = 0; i < fmin(listSize, (pow(2,polarParams->crcCorrectionBits)) ); i++) {
if ( crcState[listIndex[i]] == 1 ) {
for (int j = 0; j < polarParams->N; j++) polarParams->nr_polar_U[j]=bit[j][0][listIndex[i]];
//Extract the information bits (û to ĉ)
nr_polar_info_bit_extraction(polarParams->nr_polar_U, polarParams->nr_polar_CPrime, polarParams->information_bit_pattern, polarParams->N);
//Deinterleaving (ĉ to b)
nr_polar_deinterleaver(polarParams->nr_polar_CPrime, polarParams->nr_polar_B, polarParams->interleaving_pattern, polarParams->K);
//Remove the CRC (â)
for (int j = 0; j < polarParams->payloadBits; j++)
polarParams->nr_polar_A[j]=polarParams->nr_polar_B[j];
break;
}
}
free(d_tilde);
free(pathMetric);
free(crcState);
nr_free_uint8_3D_array(bit, polarParams->N, (polarParams->n+1));
nr_free_double_3D_array(llr, polarParams->N, (polarParams->n+1));
nr_free_uint8_2D_array(crcChecksum, polarParams->crcParityBits);
nr_free_uint8_2D_array(extended_crc_generator_matrix, polarParams->K);
nr_free_uint8_2D_array(tempECGM, polarParams->K);
/*
* Return bits.
*/
nr_byte2bit_uint8_32(polarParams->nr_polar_A, polarParams->payloadBits, out);
return(0);
}
int8_t polar_decoder_dci(double *input, int8_t polar_decoder_dci(double *input,
uint32_t *out, uint32_t *out,
t_nrPolar_params *polarParams, t_nrPolar_params *polarParams,
uint8_t listSize, uint8_t listSize,
uint8_t pathMetricAppr,
uint16_t n_RNTI) { uint16_t n_RNTI) {
uint8_t ***bit = nr_alloc_uint8_3D_array(polarParams->N, (polarParams->n+1), 2*listSize); uint8_t ***bit = nr_alloc_uint8_3D_array(polarParams->N, (polarParams->n+1), 2*listSize);
uint8_t **bitUpdated = nr_alloc_uint8_2D_array(polarParams->N, (polarParams->n+1)); //0=False, 1=True uint8_t **bitUpdated = nr_alloc_uint8_2D_array(polarParams->N, (polarParams->n+1)); //0=False, 1=True
...@@ -663,12 +387,12 @@ int8_t polar_decoder_dci(double *input, ...@@ -663,12 +387,12 @@ int8_t polar_decoder_dci(double *input,
uint8_t listIndex[2*listSize], copyIndex; uint8_t listIndex[2*listSize], copyIndex;
for (uint16_t currentBit=0; currentBit<polarParams->N; currentBit++) { for (uint16_t currentBit=0; currentBit<polarParams->N; currentBit++) {
updateLLR(llr, llrUpdated, bit, bitUpdated, currentListSize, currentBit, 0, polarParams->N, (polarParams->n+1), pathMetricAppr); updateLLR(llr, llrUpdated, bit, bitUpdated, currentListSize, currentBit, 0, polarParams->N, (polarParams->n+1));
if (polarParams->information_bit_pattern[currentBit]==0) { //Frozen bit. if (polarParams->information_bit_pattern[currentBit]==0) { //Frozen bit.
updatePathMetric(pathMetric, llr, currentListSize, 0, currentBit, pathMetricAppr); //approximation=0 --> 11b, approximation=1 --> 12 updatePathMetric(pathMetric, llr, currentListSize, 0, currentBit);
} else { //Information or CRC bit. } else { //Information or CRC bit.
updatePathMetric2(pathMetric, llr, currentListSize, currentBit, pathMetricAppr); updatePathMetric2(pathMetric, llr, currentListSize, currentBit);
for (int i = 0; i < currentListSize; i++) { for (int i = 0; i < currentListSize; i++) {
for (int j = 0; j < polarParams->N; j++) { for (int j = 0; j < polarParams->N; j++) {
......
...@@ -44,20 +44,19 @@ void updateLLR(double ***llr, ...@@ -44,20 +44,19 @@ void updateLLR(double ***llr,
uint16_t row, uint16_t row,
uint16_t col, uint16_t col,
uint16_t xlen, uint16_t xlen,
uint8_t ylen, uint8_t ylen)
uint8_t approximation)
{ {
uint16_t offset = (xlen/(pow(2,(ylen-col-1)))); uint16_t offset = (xlen/(pow(2,(ylen-col-1))));
for (uint8_t i=0; i<listSize; i++) { for (uint8_t i=0; i<listSize; i++) {
if (( (row) % (2*offset) ) >= offset ) { if (( (row) % (2*offset) ) >= offset ) {
if(bitU[row-offset][col]==0) updateBit(bit, bitU, listSize, (row-offset), col, xlen, ylen); if(bitU[row-offset][col]==0) updateBit(bit, bitU, listSize, (row-offset), col, xlen, ylen);
if(llrU[row-offset][col+1]==0) updateLLR(llr, llrU, bit, bitU, listSize, (row-offset), (col+1), xlen, ylen, approximation); if(llrU[row-offset][col+1]==0) updateLLR(llr, llrU, bit, bitU, listSize, (row-offset), (col+1), xlen, ylen);
if(llrU[row][col+1]==0) updateLLR(llr, llrU, bit, bitU, listSize, row, (col+1), xlen, ylen, approximation); if(llrU[row][col+1]==0) updateLLR(llr, llrU, bit, bitU, listSize, row, (col+1), xlen, ylen);
llr[row][col][i] = (pow((-1),bit[row-offset][col][i])*llr[row-offset][col+1][i]) + llr[row][col+1][i]; llr[row][col][i] = (pow((-1),bit[row-offset][col][i])*llr[row-offset][col+1][i]) + llr[row][col+1][i];
} else { } else {
if(llrU[row][col+1]==0) updateLLR(llr, llrU, bit, bitU, listSize, row, (col+1), xlen, ylen, approximation); if(llrU[row][col+1]==0) updateLLR(llr, llrU, bit, bitU, listSize, row, (col+1), xlen, ylen);
if(llrU[row+offset][col+1]==0) updateLLR(llr, llrU, bit, bitU, listSize, (row+offset), (col+1), xlen, ylen, approximation); if(llrU[row+offset][col+1]==0) updateLLR(llr, llrU, bit, bitU, listSize, (row+offset), (col+1), xlen, ylen);
computeLLR(llr, row, col, i, offset, approximation); computeLLR(llr, row, col, i, offset);
} }
} }
llrU[row][col]=1; llrU[row][col]=1;
...@@ -93,48 +92,31 @@ void updatePathMetric(double *pathMetric, ...@@ -93,48 +92,31 @@ void updatePathMetric(double *pathMetric,
double ***llr, double ***llr,
uint8_t listSize, uint8_t listSize,
uint8_t bitValue, uint8_t bitValue,
uint16_t row, uint16_t row)
uint8_t approximation)
{ {
if (approximation) { //eq. (12)
for (uint8_t i=0; i<2*listSize; i++) {
if ((2*bitValue) != ( 1 - copysign(1.0,llr[row][0][i]) )) pathMetric[i] += fabs(llr[row][0][i]);
}
} else { //eq. (11b)
int8_t multiplier = (2*bitValue) - 1; int8_t multiplier = (2*bitValue) - 1;
for (uint8_t i=0; i<2*listSize; i++) pathMetric[i] += log ( 1 + exp(multiplier*llr[row][0][i]) ) ; for (uint8_t i=0; i<listSize; i++)
} pathMetric[i] += log ( 1 + exp(multiplier*llr[row][0][i]) ) ; //eq. (11b)
} }
void updatePathMetric2(double *pathMetric, void updatePathMetric2(double *pathMetric,
double ***llr, double ***llr,
uint8_t listSize, uint8_t listSize,
uint16_t row, uint16_t row)
uint8_t appr)
{ {
double *tempPM = malloc(sizeof(double) * listSize); double *tempPM = malloc(sizeof(double) * listSize);
for (int i=0; i < listSize; i++) tempPM[i]=pathMetric[i]; memcpy(tempPM, pathMetric, (sizeof(double) * listSize));
uint8_t bitValue = 0; uint8_t bitValue = 0;
if (appr) { //eq. (12)
for (uint8_t i = 0; i < listSize; i++) {
if ((2 * bitValue) != (1 - copysign(1.0, llr[row][0][i]))) pathMetric[i] += fabs(llr[row][0][i]);
}
} else { //eq. (11b)
int8_t multiplier = (2 * bitValue) - 1; int8_t multiplier = (2 * bitValue) - 1;
for (uint8_t i = 0; i < listSize; i++) pathMetric[i] += log(1 + exp(multiplier * llr[row][0][i])); for (uint8_t i = 0; i < listSize; i++)
} pathMetric[i] += log(1 + exp(multiplier * llr[row][0][i])); //eq. (11b)
bitValue = 1; bitValue = 1;
if (appr) { //eq. (12) multiplier = (2 * bitValue) - 1;
for (uint8_t i = listSize; i < 2*listSize; i++) { for (uint8_t i = listSize; i < 2*listSize; i++)
if ((2 * bitValue) != (1 - copysign(1.0, llr[row][0][(i-listSize)]))) pathMetric[i] = tempPM[(i-listSize)] + fabs(llr[row][0][(i-listSize)]); pathMetric[i] = tempPM[(i-listSize)] + log(1 + exp(multiplier * llr[row][0][(i-listSize)])); //eq. (11b)
}
} else { //eq. (11b)
int8_t multiplier = (2 * bitValue) - 1;
for (uint8_t i = listSize; i < 2*listSize; i++) pathMetric[i] = tempPM[(i-listSize)] + log(1 + exp(multiplier * llr[row][0][(i-listSize)]));
}
free(tempPM); free(tempPM);
} }
...@@ -143,19 +125,11 @@ void computeLLR(double ***llr, ...@@ -143,19 +125,11 @@ void computeLLR(double ***llr,
uint16_t row, uint16_t row,
uint16_t col, uint16_t col,
uint8_t i, uint8_t i,
uint16_t offset, uint16_t offset)
uint8_t approximation)
{ {
double a = llr[row][col + 1][i]; double a = llr[row][col + 1][i];
double absA = fabs(a);
double b = llr[row + offset][col + 1][i]; double b = llr[row + offset][col + 1][i];
double absB = fabs(b); llr[row][col][i] = log((exp(a + b) + 1) / (exp(a) + exp(b))); //eq. (8a)
if (approximation || isinf(absA) || isinf(absB)) { //eq. (9)
llr[row][col][i] = copysign(1.0, a) * copysign(1.0, b) * fmin(absA, absB);
} else { //eq. (8a)
llr[row][col][i] = log((exp(a + b) + 1) / (exp(a) + exp(b)));
}
} }
void updateCrcChecksum(uint8_t **crcChecksum, void updateCrcChecksum(uint8_t **crcChecksum,
......
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
//#include "SIMULATION/TOOLS/sim.h" //#include "SIMULATION/TOOLS/sim.h"
#define NR_POLAR_DECODER_LISTSIZE 8 //uint8_t #define NR_POLAR_DECODER_LISTSIZE 8 //uint8_t
#define NR_POLAR_DECODER_PATH_METRIC_APPROXIMATION 0 //uint8_t; 0 --> eq. (8a) and (11b), 1 --> eq. (9) and (12)
#define NR_POLAR_AGGREGATION_LEVEL_1_PRIME 149 //uint16_t #define NR_POLAR_AGGREGATION_LEVEL_1_PRIME 149 //uint16_t
#define NR_POLAR_AGGREGATION_LEVEL_2_PRIME 151 //uint16_t #define NR_POLAR_AGGREGATION_LEVEL_2_PRIME 151 //uint16_t
...@@ -154,25 +153,16 @@ void polar_encoder_fast(uint64_t *A, ...@@ -154,25 +153,16 @@ void polar_encoder_fast(uint64_t *A,
int8_t polar_decoder(double *input, int8_t polar_decoder(double *input,
uint32_t *output, uint32_t *output,
t_nrPolar_params *polarParams, t_nrPolar_params *polarParams,
uint8_t listSize, uint8_t listSize);
uint8_t pathMetricAppr);
uint32_t polar_decoder_int16(int16_t *input, uint32_t polar_decoder_int16(int16_t *input,
uint64_t *out, uint64_t *out,
const t_nrPolar_params *polarParams); const t_nrPolar_params *polarParams);
int8_t polar_decoder_aPriori(double *input,
uint32_t *output,
t_nrPolar_params *polarParams,
uint8_t listSize,
uint8_t pathMetricAppr,
double *aPrioriPayload);
int8_t polar_decoder_dci(double *input, int8_t polar_decoder_dci(double *input,
uint32_t *out, uint32_t *out,
t_nrPolar_params *polarParams, t_nrPolar_params *polarParams,
uint8_t listSize, uint8_t listSize,
uint8_t pathMetricAppr,
uint16_t n_RNTI); uint16_t n_RNTI);
void generic_polar_decoder(const t_nrPolar_params *pp, void generic_polar_decoder(const t_nrPolar_params *pp,
...@@ -330,8 +320,7 @@ void updateLLR(double ***llr, ...@@ -330,8 +320,7 @@ void updateLLR(double ***llr,
uint16_t row, uint16_t row,
uint16_t col, uint16_t col,
uint16_t xlen, uint16_t xlen,
uint8_t ylen, uint8_t ylen);
uint8_t approximation);
void updateBit(uint8_t ***bit, void updateBit(uint8_t ***bit,
uint8_t **bitU, uint8_t **bitU,
...@@ -345,21 +334,18 @@ void updatePathMetric(double *pathMetric, ...@@ -345,21 +334,18 @@ void updatePathMetric(double *pathMetric,
double ***llr, double ***llr,
uint8_t listSize, uint8_t listSize,
uint8_t bitValue, uint8_t bitValue,
uint16_t row, uint16_t row);
uint8_t approximation);
void updatePathMetric2(double *pathMetric, void updatePathMetric2(double *pathMetric,
double ***llr, double ***llr,
uint8_t listSize, uint8_t listSize,
uint16_t row, uint16_t row);
uint8_t approximation);
void computeLLR(double ***llr, void computeLLR(double ***llr,
uint16_t row, uint16_t row,
uint16_t col, uint16_t col,
uint8_t i, uint8_t i,
uint16_t offset, uint16_t offset);
uint8_t approximation);
void updateCrcChecksum(uint8_t **crcChecksum, void updateCrcChecksum(uint8_t **crcChecksum,
uint8_t **crcGen, uint8_t **crcGen,
......
...@@ -64,7 +64,8 @@ void nr_fill_cce_list(NR_gNB_DCI_ALLOC_t* dci_alloc, uint16_t n_shift, uint8_t m ...@@ -64,7 +64,8 @@ void nr_fill_cce_list(NR_gNB_DCI_ALLOC_t* dci_alloc, uint16_t n_shift, uint8_t m
} }
if (pdcch_params->cr_mapping_type == NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED) { if (pdcch_params->cr_mapping_type == NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED) {
AssertFatal((N_reg%(bsize*R))==0,"CCE to REG interleaving: Invalid configuration leading to non integer C (N_reg %us, bsize %d R %d)\n",N_reg, bsize, R); uint16_t assertFatalCond = (N_reg%(bsize*R));
AssertFatal(assertFatalCond == 0,"CCE to REG interleaving: Invalid configuration leading to non integer C (N_reg %us, bsize %d R %d)\n",N_reg, bsize, R);
C = N_reg/(bsize*R); C = N_reg/(bsize*R);
} }
......
...@@ -333,5 +333,4 @@ typedef struct nr_band_info_s { ...@@ -333,5 +333,4 @@ typedef struct nr_band_info_s {
nr_bandentry_t band_info[100]; nr_bandentry_t band_info[100];
} nr_band_info_t; } nr_band_info_t;
#endif #endif
...@@ -56,7 +56,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ ...@@ -56,7 +56,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
NR_UE_PDCCH *pdcch_vars2 = PHY_vars_UE_g[module_id][cc_id]->pdcch_vars[thread_id][0]; NR_UE_PDCCH *pdcch_vars2 = PHY_vars_UE_g[module_id][cc_id]->pdcch_vars[thread_id][0];
NR_UE_DLSCH_t *dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch[thread_id][0][0]; NR_UE_DLSCH_t *dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch[thread_id][0][0];
NR_UE_ULSCH_t *ulsch0 = PHY_vars_UE_g[module_id][cc_id]->ulsch[thread_id][0][0]; NR_UE_ULSCH_t *ulsch0 = PHY_vars_UE_g[module_id][cc_id]->ulsch[thread_id][0][0];
NR_DL_FRAME_PARMS frame_parms = PHY_vars_UE_g[module_id][cc_id]->frame_parms; //NR_DL_FRAME_PARMS frame_parms = PHY_vars_UE_g[module_id][cc_id]->frame_parms;
PRACH_RESOURCES_t *prach_resources = PHY_vars_UE_g[module_id][cc_id]->prach_resources[0]; PRACH_RESOURCES_t *prach_resources = PHY_vars_UE_g[module_id][cc_id]->prach_resources[0];
// PUCCH_ConfigCommon_nr_t *pucch_config_common = PHY_vars_UE_g[module_id][cc_id]->pucch_config_common_nr[0]; // PUCCH_ConfigCommon_nr_t *pucch_config_common = PHY_vars_UE_g[module_id][cc_id]->pucch_config_common_nr[0];
...@@ -185,11 +185,11 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ ...@@ -185,11 +185,11 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
if(ul_config->ul_config_list[i].pdu_type == FAPI_NR_UL_CONFIG_TYPE_PRACH){ if(ul_config->ul_config_list[i].pdu_type == FAPI_NR_UL_CONFIG_TYPE_PRACH){
// prach config pdu // prach config pdu
fapi_nr_ul_config_prach_pdu *prach_config_pdu = &ul_config->ul_config_list[i].prach_config_pdu; fapi_nr_ul_config_prach_pdu *prach_config_pdu = &ul_config->ul_config_list[i].prach_config_pdu;
frame_parms.prach_config_common.rootSequenceIndex = prach_config_pdu->root_sequence_index; /*frame_parms.prach_config_common.rootSequenceIndex = prach_config_pdu->root_sequence_index;
frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex = prach_config_pdu->prach_configuration_index; frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex = prach_config_pdu->prach_configuration_index;
frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig = prach_config_pdu->zero_correlation_zone_config; frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig = prach_config_pdu->zero_correlation_zone_config;
frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag = prach_config_pdu->restrictedset_config; frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag = prach_config_pdu->restrictedset_config;
frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset = prach_config_pdu->prach_freq_offset; frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset = prach_config_pdu->prach_freq_offset;*/
prach_resources->ra_PreambleIndex = prach_config_pdu->preamble_index; prach_resources->ra_PreambleIndex = prach_config_pdu->preamble_index;
} }
} }
......
...@@ -1560,25 +1560,26 @@ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDUR ...@@ -1560,25 +1560,26 @@ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDUR
#endif #endif
void ue_ulsch_uespec_procedures(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag) { void ue_ulsch_uespec_procedures(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
int harq_pid; uint8_t eNB_id,
int frame_tx=proc->frame_tx; uint8_t abstraction_flag)
{
int nr_tti_tx=proc->nr_tti_tx; int nr_tti_tx=proc->nr_tti_tx;
unsigned int input_buffer_length;
int i;
int aa;
int tx_amp;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC,VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC,VCD_FUNCTION_IN);
/* reset harq for tx of current rx slot because it is sure that transmission has already been achieved for this slot */ /* reset harq for tx of current rx slot because it is sure that transmission has already been achieved for this slot */
set_tx_harq_id(ue->ulsch[ue->current_thread_id[nr_tti_tx]][eNB_id][0], NR_MAX_HARQ_PROCESSES, proc->nr_tti_rx); set_tx_harq_id(ue->ulsch[ue->current_thread_id[nr_tti_tx]][eNB_id][0], NR_MAX_HARQ_PROCESSES, proc->nr_tti_rx);
#if 0
int frame_tx=proc->frame_tx;
int harq_pid;
/* get harq pid related to this next tx slot */ /* get harq pid related to this next tx slot */
harq_pid = get_tx_harq_id(ue->ulsch[ue->current_thread_id[nr_tti_tx]][eNB_id][0], nr_tti_tx); harq_pid = get_tx_harq_id(ue->ulsch[ue->current_thread_id[nr_tti_tx]][eNB_id][0], nr_tti_tx);
#if 0 int tx_amp;
unsigned int input_buffer_length;
int Mod_id = ue->Mod_id; int Mod_id = ue->Mod_id;
int CC_id = ue->CC_id; int CC_id = ue->CC_id;
uint8_t Msg3_flag=0; uint8_t Msg3_flag=0;
...@@ -1864,7 +1865,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8 ...@@ -1864,7 +1865,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8
#ifdef DEBUG_ULSCH #ifdef DEBUG_ULSCH
LOG_D(PHY,"[UE] Frame %d, nr_tti_rx %d : ULSCH SDU (TX harq_pid %d) (%d bytes) : \n",frame_tx,nr_tti_tx,harq_pid, ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS>>3); LOG_D(PHY,"[UE] Frame %d, nr_tti_rx %d : ULSCH SDU (TX harq_pid %d) (%d bytes) : \n",frame_tx,nr_tti_tx,harq_pid, ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS>>3);
for (i=0; i<ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS>>3; i++) for (int i=0; i<ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS>>3; i++)
LOG_T(PHY,"%x.",ulsch_input_buffer[i]); LOG_T(PHY,"%x.",ulsch_input_buffer[i]);
LOG_T(PHY,"\n"); LOG_T(PHY,"\n");
...@@ -1874,7 +1875,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8 ...@@ -1874,7 +1875,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8
else { else {
unsigned int taus(void); unsigned int taus(void);
for (i=0; i<input_buffer_length; i++) for (int i=0; i<input_buffer_length; i++)
ulsch_input_buffer[i]= (uint8_t)(taus()&0xff); ulsch_input_buffer[i]= (uint8_t)(taus()&0xff);
} }
...@@ -1956,7 +1957,7 @@ if (abstraction_flag == 0) { ...@@ -1956,7 +1957,7 @@ if (abstraction_flag == 0) {
nr_tti_tx, nr_tti_tx,
&ue->frame_parms, &ue->frame_parms,
ue->ulsch[eNB_id]); ue->ulsch[eNB_id]);
for (aa=0; aa<1/*frame_parms->nb_antennas_tx*/; aa++) for (int aa=0; aa<1/*frame_parms->nb_antennas_tx*/; aa++)
generate_drs_pusch(ue, generate_drs_pusch(ue,
proc, proc,
eNB_id, eNB_id,
...@@ -2670,22 +2671,18 @@ void phy_procedures_UE_S_TX(PHY_VARS_NR_UE *ue,uint8_t eNB_id,uint8_t abstractio ...@@ -2670,22 +2671,18 @@ void phy_procedures_UE_S_TX(PHY_VARS_NR_UE *ue,uint8_t eNB_id,uint8_t abstractio
#endif #endif
void nr_ue_measurement_procedures( void nr_ue_measurement_procedures(uint16_t l, // symbol index of each slot [0..6]
uint16_t l, // symbol index of each slot [0..6]
PHY_VARS_NR_UE *ue, PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,
uint8_t eNB_id, uint8_t eNB_id,
uint16_t slot, // slot index of each radio frame [0..19] uint16_t slot, // slot index of each radio frame [0..19]
runmode_t mode) runmode_t mode)
{ {
LOG_D(PHY,"ue_measurement_procedures l %u Ncp %d\n",l,ue->frame_parms.Ncp); LOG_D(PHY,"ue_measurement_procedures l %u Ncp %d\n",l,ue->frame_parms.Ncp);
#if 0
NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
int nr_tti_rx = proc->nr_tti_rx; int nr_tti_rx = proc->nr_tti_rx;
#if 0
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_MEASUREMENT_PROCEDURES, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_MEASUREMENT_PROCEDURES, VCD_FUNCTION_IN);
if (l==0) { if (l==0) {
...@@ -2806,16 +2803,17 @@ void restart_phy(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc, uint8_t eNB_id,uint ...@@ -2806,16 +2803,17 @@ void restart_phy(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc, uint8_t eNB_id,uint
} }
#endif //(0) #endif //(0)
void nr_ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc, uint8_t abstraction_flag) void nr_ue_pbch_procedures(uint8_t eNB_id,
PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
uint8_t abstraction_flag)
{ {
// int i; // int i;
//int pbch_tx_ant=0; //int pbch_tx_ant=0;
//uint8_t pbch_phase; //uint8_t pbch_phase;
int ret = 0; int ret = 0;
uint16_t frame_tx; //static uint8_t first_run = 1;
static uint8_t first_run = 1; //uint8_t pbch_trials = 0;
uint8_t pbch_trials = 0;
DevAssert(ue); DevAssert(ue);
...@@ -2838,6 +2836,7 @@ void nr_ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t * ...@@ -2838,6 +2836,7 @@ void nr_ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *
#ifdef DEBUG_PHY_PROC #ifdef DEBUG_PHY_PROC
uint16_t frame_tx;
LOG_D(PHY,"[UE %d] frame %d, nr_tti_rx %d, Received PBCH (MIB): frame_tx %d. N_RB_DL %d\n", LOG_D(PHY,"[UE %d] frame %d, nr_tti_rx %d, Received PBCH (MIB): frame_tx %d. N_RB_DL %d\n",
ue->Mod_id, ue->Mod_id,
frame_rx, frame_rx,
...@@ -2908,9 +2907,10 @@ unsigned int get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb ...@@ -2908,9 +2907,10 @@ unsigned int get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb
#ifdef NR_PDCCH_SCHED #ifdef NR_PDCCH_SCHED
int nr_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc) int nr_ue_pdcch_procedures(uint8_t eNB_id,
PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc)
{ {
// unsigned int dci_cnt=0, i; //removed for nr_ue_pdcch_procedures and added in the loop for nb_coreset_active // unsigned int dci_cnt=0, i; //removed for nr_ue_pdcch_procedures and added in the loop for nb_coreset_active
#ifdef NR_PDCCH_SCHED_DEBUG #ifdef NR_PDCCH_SCHED_DEBUG
printf("<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> Entering function nr_ue_pdcch_procedures() \n"); printf("<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> Entering function nr_ue_pdcch_procedures() \n");
...@@ -2940,7 +2940,7 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t * ...@@ -2940,7 +2940,7 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *
pdcch_vars[eNB_id]->crnti = 0x1234; //to be check how to set when using loop memory pdcch_vars[eNB_id]->crnti = 0x1234; //to be check how to set when using loop memory
uint16_t c_rnti=pdcch_vars[eNB_id]->crnti; uint16_t c_rnti=pdcch_vars[eNB_id]->crnti;
uint16_t cs_rnti=0,new_rnti=0,tc_rnti; uint16_t cs_rnti=0,new_rnti=0,tc_rnti=0;
uint16_t p_rnti=P_RNTI; uint16_t p_rnti=P_RNTI;
uint16_t si_rnti=SI_RNTI; uint16_t si_rnti=SI_RNTI;
uint16_t ra_rnti=99; uint16_t ra_rnti=99;
...@@ -2958,10 +2958,10 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t * ...@@ -2958,10 +2958,10 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *
#endif #endif
// p in TS 38.212 Subclause 10.1, for each active BWP the UE can deal with 3 different CORESETs (including coresetId 0 for common search space) // p in TS 38.212 Subclause 10.1, for each active BWP the UE can deal with 3 different CORESETs (including coresetId 0 for common search space)
int nb_coreset_total = NR_NBR_CORESET_ACT_BWP; //int nb_coreset_total = NR_NBR_CORESET_ACT_BWP;
unsigned int dci_cnt=0; unsigned int dci_cnt=0;
// this table contains 56 (NBR_NR_DCI_FIELDS) elements for each dci field and format described in TS 38.212. Each element represents the size in bits for each dci field // this table contains 56 (NBR_NR_DCI_FIELDS) elements for each dci field and format described in TS 38.212. Each element represents the size in bits for each dci field
uint8_t dci_fields_sizes[NBR_NR_DCI_FIELDS][NBR_NR_FORMATS] = {{0}}; //uint8_t dci_fields_sizes[NBR_NR_DCI_FIELDS][NBR_NR_FORMATS] = {{0}};
// this is the UL bandwidth part. FIXME! To be defined where this value comes from // this is the UL bandwidth part. FIXME! To be defined where this value comes from
// uint16_t n_RB_ULBWP = 106; // uint16_t n_RB_ULBWP = 106;
// this is the DL bandwidth part. FIXME! To be defined where this value comes from // this is the DL bandwidth part. FIXME! To be defined where this value comes from
...@@ -2970,7 +2970,7 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t * ...@@ -2970,7 +2970,7 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *
// Up to 10 searchSpaces can be configured to UE (s<=10) // Up to 10 searchSpaces can be configured to UE (s<=10)
for (nb_searchspace_active=0; nb_searchspace_active<nb_searchspace_total; nb_searchspace_active++){ for (nb_searchspace_active=0; nb_searchspace_active<nb_searchspace_total; nb_searchspace_active++){
int nb_coreset_active=nb_searchspace_active; int nb_coreset_active=nb_searchspace_active;
int do_pdcch_monitoring_current_slot=1; // this variable can be removed and fapi is handling //int do_pdcch_monitoring_current_slot=1; // this variable can be removed and fapi is handling
/* /*
* The following code has been removed as it is handled by higher layers (fapi) * The following code has been removed as it is handled by higher layers (fapi)
* *
...@@ -2988,7 +2988,7 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t * ...@@ -2988,7 +2988,7 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *
* To be implemented LATER !!! * To be implemented LATER !!!
*/ */
//int _offset,_index,_M; //int _offset,_index,_M;
int searchSpace_id = pdcch_vars2->searchSpace[nb_searchspace_active].searchSpaceId; //int searchSpace_id = pdcch_vars2->searchSpace[nb_searchspace_active].searchSpaceId;
#ifdef NR_PDCCH_SCHED_DEBUG #ifdef NR_PDCCH_SCHED_DEBUG
...@@ -3001,16 +3001,16 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t * ...@@ -3001,16 +3001,16 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *
// the searchSpace indicates that we need to monitor PDCCH in current nr_tti_rx // the searchSpace indicates that we need to monitor PDCCH in current nr_tti_rx
// get the parameters describing the current SEARCHSPACE // get the parameters describing the current SEARCHSPACE
// the CORESET id applicable to the current SearchSpace // the CORESET id applicable to the current SearchSpace
int searchSpace_coreset_id = pdcch_vars2->searchSpace[nb_searchspace_active].controlResourceSetId; //int searchSpace_coreset_id = pdcch_vars2->searchSpace[nb_searchspace_active].controlResourceSetId;
// FIXME this variable is a bit string (14 bits) identifying every OFDM symbol in a slot. // FIXME this variable is a bit string (14 bits) identifying every OFDM symbol in a slot.
// at the moment we will not take into consideration this variable and we will consider that the OFDM symbol offset is always the first OFDM in a symbol // at the moment we will not take into consideration this variable and we will consider that the OFDM symbol offset is always the first OFDM in a symbol
uint16_t symbol_within_slot_mon = pdcch_vars2->searchSpace[nb_searchspace_active].monitoringSymbolWithinSlot; uint16_t symbol_within_slot_mon = pdcch_vars2->searchSpace[nb_searchspace_active].monitoringSymbolWithinSlot;
// get the remaining parameters describing the current SEARCHSPACE: // FIXME! To be defined where we get this information from // get the remaining parameters describing the current SEARCHSPACE: // FIXME! To be defined where we get this information from
NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L1 = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel1; /*NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L1 = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel1;
NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L2 = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel2; NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L2 = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel2;
NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L4 = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel4; NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L4 = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel4;
NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L8 = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel8; NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L8 = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel8;
NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L16 = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel16; NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L16 = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel16;*/
// FIXME! A table of five enum elements // FIXME! A table of five enum elements
// searchSpaceType indicates whether this is a common search space or a UE-specific search space // searchSpaceType indicates whether this is a common search space or a UE-specific search space
//int searchSpaceType = pdcch_vars2->searchSpace[nb_searchspace_active].searchSpaceType.type; //int searchSpaceType = pdcch_vars2->searchSpace[nb_searchspace_active].searchSpaceType.type;
...@@ -3127,9 +3127,8 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t * ...@@ -3127,9 +3127,8 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DCI_DECODING, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DCI_DECODING, VCD_FUNCTION_OUT);
//LOG_D(PHY,"[UE %d][PUSCH] Frame %d nr_tti_rx %d PHICH RX\n",ue->Mod_id,frame_rx,nr_tti_rx); //LOG_D(PHY,"[UE %d][PUSCH] Frame %d nr_tti_rx %d PHICH RX\n",ue->Mod_id,frame_rx,nr_tti_rx);
uint8_t *nCCE_current = &ue->pdcch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->nCCE[nr_tti_rx];
/* /*
uint8_t *nCCE_current = &ue->pdcch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->nCCE[nr_tti_rx];
uint8_t *nCCE_dest = &ue->pdcch_vars[next1_thread_id][eNB_id]->nCCE[nr_tti_rx]; uint8_t *nCCE_dest = &ue->pdcch_vars[next1_thread_id][eNB_id]->nCCE[nr_tti_rx];
uint8_t *nCCE_dest1 = &ue->pdcch_vars[next2_thread_id][eNB_id]->nCCE[nr_tti_rx]; uint8_t *nCCE_dest1 = &ue->pdcch_vars[next2_thread_id][eNB_id]->nCCE[nr_tti_rx];
memcpy(nCCE_dest, nCCE_current, sizeof(uint8_t)); memcpy(nCCE_dest, nCCE_current, sizeof(uint8_t));
...@@ -3780,7 +3779,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -3780,7 +3779,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
int frame_rx = proc->frame_rx; int frame_rx = proc->frame_rx;
int nr_tti_rx = proc->nr_tti_rx; int nr_tti_rx = proc->nr_tti_rx;
int ret=0, ret1=0; int ret=0, ret1=0;
int CC_id = ue->CC_id; //int CC_id = ue->CC_id;
NR_UE_PDSCH *pdsch_vars; NR_UE_PDSCH *pdsch_vars;
uint8_t is_cw0_active = 0; uint8_t is_cw0_active = 0;
uint8_t is_cw1_active = 0; uint8_t is_cw1_active = 0;
...@@ -3887,7 +3886,9 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -3887,7 +3886,9 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
#endif #endif
#ifdef UE_DLSCH_PARALLELISATION #ifdef UE_DLSCH_PARALLELISATION
ret = nr_dlsch_decoding_mthread(ue,proc,eNB_id, ret = nr_dlsch_decoding_mthread(ue,
proc,
eNB_id,
pdsch_vars->llr[0], pdsch_vars->llr[0],
&ue->frame_parms, &ue->frame_parms,
dlsch0, dlsch0,
...@@ -3898,6 +3899,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -3898,6 +3899,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
harq_pid, harq_pid,
pdsch==PDSCH?1:0, pdsch==PDSCH?1:0,
dlsch0->harq_processes[harq_pid]->TBS>256?1:0); dlsch0->harq_processes[harq_pid]->TBS>256?1:0);
LOG_T(PHY,"UE_DLSCH_PARALLELISATION is defined, ret = %d\n", ret);
#else #else
ret = nr_dlsch_decoding(ue, ret = nr_dlsch_decoding(ue,
pdsch_vars->llr[0], pdsch_vars->llr[0],
...@@ -3910,6 +3912,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -3910,6 +3912,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
harq_pid, harq_pid,
pdsch==PDSCH?1:0,//proc->decoder_switch, pdsch==PDSCH?1:0,//proc->decoder_switch,
dlsch0->harq_processes[harq_pid]->TBS>256?1:0); dlsch0->harq_processes[harq_pid]->TBS>256?1:0);
LOG_T(PHY,"UE_DLSCH_PARALLELISATION is NOT defined, ret = %d\n", ret);
//printf("start cW0 dlsch decoding\n"); //printf("start cW0 dlsch decoding\n");
#endif #endif
...@@ -3964,7 +3967,9 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -3964,7 +3967,9 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
#endif #endif
#ifdef UE_DLSCH_PARALLELISATION #ifdef UE_DLSCH_PARALLELISATION
ret1 = nr_dlsch_decoding_mthread(ue,proc, eNB_id, ret1 = nr_dlsch_decoding_mthread(ue,
proc,
eNB_id,
pdsch_vars->llr[1], pdsch_vars->llr[1],
&ue->frame_parms, &ue->frame_parms,
dlsch1, dlsch1,
...@@ -3975,8 +3980,8 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -3975,8 +3980,8 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
harq_pid, harq_pid,
pdsch==PDSCH?1:0, pdsch==PDSCH?1:0,
dlsch1->harq_processes[harq_pid]->TBS>256?1:0); dlsch1->harq_processes[harq_pid]->TBS>256?1:0);
LOG_T(PHY,"UE_DLSCH_PARALLELISATION is defined, ret1 = %d\n", ret1);
#else #else
ret1 = nr_dlsch_decoding(ue, ret1 = nr_dlsch_decoding(ue,
pdsch_vars->llr[1], pdsch_vars->llr[1],
&ue->frame_parms, &ue->frame_parms,
...@@ -3988,6 +3993,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -3988,6 +3993,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
harq_pid, harq_pid,
pdsch==PDSCH?1:0,//proc->decoder_switch, pdsch==PDSCH?1:0,//proc->decoder_switch,
dlsch1->harq_processes[harq_pid]->TBS>256?1:0); dlsch1->harq_processes[harq_pid]->TBS>256?1:0);
LOG_T(PHY,"UE_DLSCH_PARALLELISATION is NOT defined, ret1 = %d\n", ret1);
printf("start cw1 dlsch decoding\n"); printf("start cw1 dlsch decoding\n");
#endif #endif
...@@ -4317,14 +4323,12 @@ void *UE_thread_slot1_dl_processing(void *arg) { ...@@ -4317,14 +4323,12 @@ void *UE_thread_slot1_dl_processing(void *arg) {
int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id, int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
uint8_t do_pdcch_flag,runmode_t mode) { UE_nr_rxtx_proc_t *proc,
uint8_t eNB_id,
uint8_t do_pdcch_flag,
runmode_t mode)
int l,l2; {
int pilot1;
int frame_rx = proc->frame_rx; int frame_rx = proc->frame_rx;
int nr_tti_rx = proc->nr_tti_rx; int nr_tti_rx = proc->nr_tti_rx;
NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[ue->current_thread_id[nr_tti_rx]][0]; NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[ue->current_thread_id[nr_tti_rx]][0];
......
...@@ -67,9 +67,19 @@ ...@@ -67,9 +67,19 @@
* *
*********************************************************************/ *********************************************************************/
int16_t get_pucch_tx_power_ue(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t *proc, pucch_format_nr_t pucch_format, int16_t get_pucch_tx_power_ue(PHY_VARS_NR_UE *ue,
int nb_of_prbs, int N_sc_ctrl_RB, int N_symb_PUCCH, int O_UCI, int O_SR, int O_CSI, int O_ACK, uint8_t gNB_id,
int O_CRC, int n_HARQ_ACK) { UE_nr_rxtx_proc_t *proc,
pucch_format_nr_t pucch_format,
int nb_of_prbs,
int N_sc_ctrl_RB,
int N_symb_PUCCH,
int O_UCI,
int O_SR,
int O_CSI,
int O_ACK,
int O_CRC,
int n_HARQ_ACK) {
int16_t P_O_NOMINAL_PUCCH = ue->pucch_config_common_nr[gNB_id].p0_nominal; int16_t P_O_NOMINAL_PUCCH = ue->pucch_config_common_nr[gNB_id].p0_nominal;
PUCCH_PowerControl_t *power_config = &ue->pucch_config_dedicated_nr[gNB_id].pucch_PowerControl; PUCCH_PowerControl_t *power_config = &ue->pucch_config_dedicated_nr[gNB_id].pucch_PowerControl;
...@@ -147,7 +157,6 @@ int16_t get_pucch_tx_power_ue(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_pro ...@@ -147,7 +157,6 @@ int16_t get_pucch_tx_power_ue(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_pro
} }
} }
int l = 0;
int k2; int k2;
if (power_config->twoPUCCH_PC_AdjustmentStates > 1) { if (power_config->twoPUCCH_PC_AdjustmentStates > 1) {
...@@ -156,11 +165,11 @@ int16_t get_pucch_tx_power_ue(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_pro ...@@ -156,11 +165,11 @@ int16_t get_pucch_tx_power_ue(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_pro
} }
/* response to a detection by the UE of a DCI format 1_0 or DCI format 1_1 */ /* response to a detection by the UE of a DCI format 1_0 or DCI format 1_1 */
int K_PUCCH = 0; //int K_PUCCH = 0;
if (O_ACK != 0) { if (O_ACK != 0) {
/* it assumes that PDCCH is in the first symbol of receive slot FFS TDDO NR */ /* it assumes that PDCCH is in the first symbol of receive slot FFS TDDO NR */
int slots_gap = (proc->nr_tti_tx > proc->nr_tti_rx ? (proc->nr_tti_tx - proc->nr_tti_rx - 1) : ((proc->nr_tti_tx + ue->frame_parms.ttis_per_subframe) - proc->nr_tti_rx - 1)); //int slots_gap = (proc->nr_tti_tx > proc->nr_tti_rx ? (proc->nr_tti_tx - proc->nr_tti_rx - 1) : ((proc->nr_tti_tx + ue->frame_parms.ttis_per_subframe) - proc->nr_tti_rx - 1));
K_PUCCH = (slots_gap * (ue->frame_parms.symbols_per_tti)) - 1; //K_PUCCH = (slots_gap * (ue->frame_parms.symbols_per_tti)) - 1;
} }
else { else {
/* field k2 is not present - to check k2 of pucch from upper layer FFS TDDO NR */ /* field k2 is not present - to check k2 of pucch from upper layer FFS TDDO NR */
...@@ -189,7 +198,7 @@ int16_t get_pucch_tx_power_ue(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_pro ...@@ -189,7 +198,7 @@ int16_t get_pucch_tx_power_ue(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_pro
} while(ue->pusch_config.pusch_TimeDomainResourceAllocation[i] != NULL); } while(ue->pusch_config.pusch_TimeDomainResourceAllocation[i] != NULL);
k2 = k2_min; k2 = k2_min;
} }
K_PUCCH = N_SYMB_SLOT * k2; /* the product of a number of symbols per slot and the minimum of the values provided by higher layer parameter k2 */ //K_PUCCH = N_SYMB_SLOT * k2; /* the product of a number of symbols per slot and the minimum of the values provided by higher layer parameter k2 */
} }
int contributor = (10 * log10((double)(pow(2,(ue->frame_parms.numerology_index)) * nb_of_prbs))); int contributor = (10 * log10((double)(pow(2,(ue->frame_parms.numerology_index)) * nb_of_prbs)));
......
...@@ -128,45 +128,46 @@ int main(int argc, char **argv) ...@@ -128,45 +128,46 @@ int main(int argc, char **argv)
char c; char c;
int i,l,aa; int i,aa;//,l;
double sigma2, sigma2_dB=10,SNR,snr0=-2.0,snr1=2.0; double sigma2, sigma2_dB=10,SNR,snr0=-2.0,snr1=2.0;
uint8_t snr1set=0; uint8_t snr1set=0;
int **txdata; int **txdata;
double **s_re,**s_im,**r_re,**r_im; double **s_re,**s_im,**r_re,**r_im;
double iqim = 0.0; //double iqim = 0.0;
unsigned char pbch_pdu[6]; //unsigned char pbch_pdu[6];
// int sync_pos, sync_pos_slot; // int sync_pos, sync_pos_slot;
// FILE *rx_frame_file; // FILE *rx_frame_file;
FILE *output_fd = NULL; FILE *output_fd = NULL;
uint8_t write_output_file=0; //uint8_t write_output_file=0;
//int result; //int result;
int freq_offset; //int freq_offset;
// int subframe_offset; // int subframe_offset;
// char fname[40], vname[40]; // char fname[40], vname[40];
int trial,n_trials=1,n_errors,n_errors2,n_alamouti; int trial,n_trials=1,n_errors=0;
//int n_errors2, n_alamouti;
uint8_t transmission_mode = 1,n_tx=1,n_rx=1; uint8_t transmission_mode = 1,n_tx=1,n_rx=1;
uint16_t Nid_cell=0; uint16_t Nid_cell=0;
uint64_t SSB_positions=0x01; uint64_t SSB_positions=0x01;
channel_desc_t *gNB2UE; channel_desc_t *gNB2UE;
uint32_t nsymb,tx_lev,tx_lev1 = 0,tx_lev2 = 0; //uint32_t nsymb,tx_lev,tx_lev1 = 0,tx_lev2 = 0;
uint8_t extended_prefix_flag=0; //uint8_t extended_prefix_flag=0;
int8_t interf1=-21,interf2=-21; //int8_t interf1=-21,interf2=-21;
FILE *input_fd=NULL,*pbch_file_fd=NULL; FILE *input_fd=NULL,*pbch_file_fd=NULL;
char input_val_str[50],input_val_str2[50]; //char input_val_str[50],input_val_str2[50];
uint8_t frame_mod4,num_pdcch_symbols = 0; //uint8_t frame_mod4,num_pdcch_symbols = 0;
SCM_t channel_model=AWGN;//Rayleigh1_anticorr; SCM_t channel_model=AWGN;//Rayleigh1_anticorr;
double pbch_sinr; //double pbch_sinr;
int pbch_tx_ant; //int pbch_tx_ant;
int N_RB_DL=273,mu=1; int N_RB_DL=273,mu=1;
uint64_t ssb_pattern = 0x01; uint64_t ssb_pattern = 0x01;
unsigned char frame_type = 0; //unsigned char frame_type = 0;
unsigned char pbch_phase = 0; unsigned char pbch_phase = 0;
int frame=0,slot=1; int frame=0,slot=1;
...@@ -199,7 +200,7 @@ int main(int argc, char **argv) ...@@ -199,7 +200,7 @@ int main(int argc, char **argv)
while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:s:S:t:x:y:z:M:N:F:GR:dP:IL:")) != -1) { while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:s:S:t:x:y:z:M:N:F:GR:dP:IL:")) != -1) {
switch (c) { switch (c) {
case 'f': /*case 'f':
write_output_file=1; write_output_file=1;
output_fd = fopen(optarg,"w"); output_fd = fopen(optarg,"w");
...@@ -207,12 +208,11 @@ int main(int argc, char **argv) ...@@ -207,12 +208,11 @@ int main(int argc, char **argv)
printf("Error opening %s\n",optarg); printf("Error opening %s\n",optarg);
exit(-1); exit(-1);
} }
break;*/
break; /*case 'd':
case 'd':
frame_type = 1; frame_type = 1;
break; break;*/
case 'g': case 'g':
switch((char)*optarg) { switch((char)*optarg) {
...@@ -251,13 +251,13 @@ int main(int argc, char **argv) ...@@ -251,13 +251,13 @@ int main(int argc, char **argv)
break; break;
case 'i': /*case 'i':
interf1=atoi(optarg); interf1=atoi(optarg);
break; break;
case 'j': case 'j':
interf2=atoi(optarg); interf2=atoi(optarg);
break; break;*/
case 'n': case 'n':
n_trials = atoi(optarg); n_trials = atoi(optarg);
...@@ -279,9 +279,9 @@ int main(int argc, char **argv) ...@@ -279,9 +279,9 @@ int main(int argc, char **argv)
Td= atof(optarg); Td= atof(optarg);
break; break;
*/ */
case 'p': /*case 'p':
extended_prefix_flag=1; extended_prefix_flag=1;
break; break;*/
/* /*
case 'r': case 'r':
...@@ -368,8 +368,8 @@ int main(int argc, char **argv) ...@@ -368,8 +368,8 @@ int main(int argc, char **argv)
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n", printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n",
argv[0]); argv[0]);
printf("-h This message\n"); printf("-h This message\n");
printf("-p Use extended prefix mode\n"); //printf("-p Use extended prefix mode\n");
printf("-d Use TDD\n"); //printf("-d Use TDD\n");
printf("-n Number of frames to simulate\n"); printf("-n Number of frames to simulate\n");
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n"); printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
printf("-S Ending SNR, runs from SNR0 to SNR1\n"); printf("-S Ending SNR, runs from SNR0 to SNR1\n");
...@@ -378,15 +378,15 @@ int main(int argc, char **argv) ...@@ -378,15 +378,15 @@ int main(int argc, char **argv)
printf("-x Transmission mode (1,2,6 for the moment)\n"); printf("-x Transmission mode (1,2,6 for the moment)\n");
printf("-y Number of TX antennas used in eNB\n"); printf("-y Number of TX antennas used in eNB\n");
printf("-z Number of RX antennas used in UE\n"); printf("-z Number of RX antennas used in UE\n");
printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n"); //printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n"); //printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
printf("-M Multiple SSB positions in burst\n"); printf("-M Multiple SSB positions in burst\n");
printf("-N Nid_cell\n"); printf("-N Nid_cell\n");
printf("-R N_RB_DL\n"); printf("-R N_RB_DL\n");
printf("-O oversampling factor (1,2,4,8,16)\n"); printf("-O oversampling factor (1,2,4,8,16)\n");
printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n"); printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n");
// printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n"); //printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
printf("-f Output filename (.txt format) for Pe/SNR results\n"); //printf("-f Output filename (.txt format) for Pe/SNR results\n");
printf("-F Input filename (.txt format) for RX conformance testing\n"); printf("-F Input filename (.txt format) for RX conformance testing\n");
exit (-1); exit (-1);
break; break;
...@@ -683,8 +683,8 @@ int main(int argc, char **argv) ...@@ -683,8 +683,8 @@ int main(int argc, char **argv)
for (SNR=snr0; SNR<snr1; SNR+=.2) { for (SNR=snr0; SNR<snr1; SNR+=.2) {
n_errors = 0; n_errors = 0;
n_errors2 = 0; //n_errors2 = 0;
n_alamouti = 0; //n_alamouti = 0;
for (trial=0; trial<n_trials; trial++) { for (trial=0; trial<n_trials; trial++) {
...@@ -777,6 +777,3 @@ int main(int argc, char **argv) ...@@ -777,6 +777,3 @@ int main(int argc, char **argv)
return(n_errors); return(n_errors);
} }
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
#include "L1_paramdef.h" #include "L1_paramdef.h"
#include "MACRLC_paramdef.h" #include "MACRLC_paramdef.h"
#include "common/config/config_userapi.h" #include "common/config/config_userapi.h"
#include "RRC_config_tools.h" //#include "RRC_config_tools.h"
#include "gnb_paramdef.h" #include "gnb_paramdef.h"
#include "LAYER2/NR_MAC_gNB/mac_proto.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h"
...@@ -81,6 +81,8 @@ extern void set_parallel_conf(char *parallel_conf); ...@@ -81,6 +81,8 @@ extern void set_parallel_conf(char *parallel_conf);
extern void set_worker_conf(char *worker_conf); extern void set_worker_conf(char *worker_conf);
extern PARALLEL_CONF_t get_thread_parallel_conf(void); extern PARALLEL_CONF_t get_thread_parallel_conf(void);
extern WORKER_CONF_t get_thread_worker_conf(void); extern WORKER_CONF_t get_thread_worker_conf(void);
extern int config_check_band_frequencies(int ind, int16_t band, uint32_t downlink_frequency,
int32_t uplink_frequency_offset, uint32_t frame_type);
void RCconfig_nr_flexran() void RCconfig_nr_flexran()
{ {
...@@ -628,7 +630,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { ...@@ -628,7 +630,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
paramdef_t GNBParams[] = GNBPARAMS_DESC; paramdef_t GNBParams[] = GNBPARAMS_DESC;
paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0}; paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0};
////////// Physical parameters ////////// Physical parameters
checkedparam_t config_check_CCparams[] = NRCCPARAMS_CHECK; //checkedparam_t config_check_CCparams[] = NRCCPARAMS_CHECK;
paramdef_t CCsParams[] = NRCCPARAMS_DESC; paramdef_t CCsParams[] = NRCCPARAMS_DESC;
paramlist_def_t CCsParamList = {GNB_CONFIG_STRING_COMPONENT_CARRIERS,NULL,0}; paramlist_def_t CCsParamList = {GNB_CONFIG_STRING_COMPONENT_CARRIERS,NULL,0};
......
...@@ -65,11 +65,16 @@ uint8_t table_9_2_2_1[16][8]={ ...@@ -65,11 +65,16 @@ uint8_t table_9_2_2_1[16][8]={
{1,0, 14,4, 0,3,6,9}, {1,0, 14,4, 0,3,6,9},
{1,0, 14,26,0,3,0,0} {1,0, 14,26,0,3,0,0}
}; };
int8_t nr_ue_process_dlsch(module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_nr_dci_indication_t *dci_ind, void *pduP, uint32_t pdu_len){ int8_t nr_ue_process_dlsch(module_id_t module_id,
int cc_id,
uint8_t gNB_index,
fapi_nr_dci_indication_t *dci_ind,
void *pduP,
uint32_t pdu_len)
{
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
fapi_nr_ul_config_request_t *ul_config = &mac->ul_config_request; fapi_nr_ul_config_request_t *ul_config = &mac->ul_config_request;
fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request; //fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request;
nr_phy_config_t *phy_config = &mac->phy_config; nr_phy_config_t *phy_config = &mac->phy_config;
//ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.rnti = rnti; //ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.rnti = rnti;
...@@ -1149,7 +1154,7 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment( ...@@ -1149,7 +1154,7 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(
{0,4,7}, // row index 15 {0,4,7}, // row index 15
{0,8,4} // row index 16 {0,8,4} // row index 16
}; };
uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[16][3]={ // for PDSCH from TS 38.214 subclause 5.1.2.1.1 /*uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[16][3]={ // for PDSCH from TS 38.214 subclause 5.1.2.1.1
{0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?6:5}, // row index 1 {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?6:5}, // row index 1
{0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?10:9}, // row index 2 {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?10:9}, // row index 2
{0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?9:8}, // row index 3 {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?9:8}, // row index 3
...@@ -1166,8 +1171,8 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment( ...@@ -1166,8 +1171,8 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(
{0,2,4}, // row index 14 {0,2,4}, // row index 14
{0,4,6}, // row index 15 {0,4,6}, // row index 15
{0,8,4} // row index 16 {0,8,4} // row index 16
}; };*/
uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B[16][3]={ // for PDSCH from TS 38.214 subclause 5.1.2.1.1 /*uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B[16][3]={ // for PDSCH from TS 38.214 subclause 5.1.2.1.1
{0,2,2}, // row index 1 {0,2,2}, // row index 1
{0,4,2}, // row index 2 {0,4,2}, // row index 2
{0,6,2}, // row index 3 {0,6,2}, // row index 3
...@@ -1184,8 +1189,8 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment( ...@@ -1184,8 +1189,8 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(
{0,(dmrs_typeA_pos == 0)?2:3,(dmrs_typeA_pos == 0)?12:11}, // row index 14 {0,(dmrs_typeA_pos == 0)?2:3,(dmrs_typeA_pos == 0)?12:11}, // row index 14
{1,2,4}, // row index 15 {1,2,4}, // row index 15
{0,0,0} // row index 16 {0,0,0} // row index 16
}; };*/
uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C[16][3]={ // for PDSCH from TS 38.214 subclause 5.1.2.1.1 /*uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C[16][3]={ // for PDSCH from TS 38.214 subclause 5.1.2.1.1
{0,2,2}, // row index 1 {0,2,2}, // row index 1
{0,4,2}, // row index 2 {0,4,2}, // row index 2
{0,6,2}, // row index 3 {0,6,2}, // row index 3
...@@ -1202,7 +1207,7 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment( ...@@ -1202,7 +1207,7 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(
{0,(dmrs_typeA_pos == 0)?2:3,(dmrs_typeA_pos == 0)?12:11}, // row index 14 {0,(dmrs_typeA_pos == 0)?2:3,(dmrs_typeA_pos == 0)?12:11}, // row index 14
{0,0,6}, // row index 15 {0,0,6}, // row index 15
{0,2,6} // row index 16 {0,2,6} // row index 16
}; };*/
uint8_t mu_pusch = 1; uint8_t mu_pusch = 1;
// definition table j Table 6.1.2.1.1-4 // definition table j Table 6.1.2.1.1-4
uint8_t j = (mu_pusch==3)?3:(mu_pusch==2)?2:1; uint8_t j = (mu_pusch==3)?3:(mu_pusch==2)?2:1;
...@@ -1224,7 +1229,7 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment( ...@@ -1224,7 +1229,7 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(
{j+3,0,14}, // row index 15 {j+3,0,14}, // row index 15
{j+3,0,10} // row index 16 {j+3,0,10} // row index 16
}; };
uint8_t table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[16][3]={ // for PUSCH from TS 38.214 subclause 6.1.2.1.1 /*uint8_t table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[16][3]={ // for PUSCH from TS 38.214 subclause 6.1.2.1.1
{j, 0,8}, // row index 1 {j, 0,8}, // row index 1
{j, 0,12}, // row index 2 {j, 0,12}, // row index 2
{j, 0,10}, // row index 3 {j, 0,10}, // row index 3
...@@ -1241,7 +1246,7 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment( ...@@ -1241,7 +1246,7 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(
{j, 8,4}, // row index 14 {j, 8,4}, // row index 14
{j+3,0,8}, // row index 15 {j+3,0,8}, // row index 15
{j+3,0,10} // row index 16 {j+3,0,10} // row index 16
}; };*/
/* /*
* TS 38.214 subclause 5.1.2.1 Resource allocation in time domain (downlink) * TS 38.214 subclause 5.1.2.1 Resource allocation in time domain (downlink)
......
...@@ -336,7 +336,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -336,7 +336,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
rnti = UE_RNTI(module_idP, i); rnti = UE_RNTI(module_idP, i);
CC_id = UE_PCCID(module_idP, i); CC_id = UE_PCCID(module_idP, i);
int spf = get_spf(cfg); //int spf = get_spf(cfg);
if (((frameP&127) == 0) && (slotP == 0)) { if (((frameP&127) == 0) && (slotP == 0)) {
LOG_I(MAC, LOG_I(MAC,
......
...@@ -203,8 +203,8 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP, ...@@ -203,8 +203,8 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
int dl_carrier_bandwidth = cfg->rf_config.dl_carrier_bandwidth.value; int dl_carrier_bandwidth = cfg->rf_config.dl_carrier_bandwidth.value;
// everything here is hard-coded to 30 kHz // everything here is hard-coded to 30 kHz
int scs = get_dlscs(cfg); //int scs = get_dlscs(cfg);
int slots_per_frame = get_spf(cfg); //int slots_per_frame = get_spf(cfg);
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
LOG_I(MAC, "Scheduling UE specific search space DCI type 1 for CC_id %d\n",CC_id); LOG_I(MAC, "Scheduling UE specific search space DCI type 1 for CC_id %d\n",CC_id);
......
...@@ -58,7 +58,6 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, ...@@ -58,7 +58,6 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
uint8_t sfn_msb = (uint8_t)((frameP>>4)&0x3f); uint8_t sfn_msb = (uint8_t)((frameP>>4)&0x3f);
#ifdef DEBUG_RRC #ifdef DEBUG_RRC
int i;
LOG_I(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_idP,Srb_id); LOG_I(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_idP,Srb_id);
#endif #endif
......
...@@ -141,19 +141,18 @@ void rrc_gNB_process_SgNBAdditionRequest( ...@@ -141,19 +141,18 @@ void rrc_gNB_process_SgNBAdditionRequest(
void rrc_gNB_generate_SgNBAdditionRequestAcknowledge( void rrc_gNB_generate_SgNBAdditionRequestAcknowledge(
const protocol_ctxt_t *const ctxt_pP, const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *const ue_context_pP rrc_gNB_ue_context_t *const ue_context_pP)
){ {
//uint8_t size;
uint8_t size; //uint8_t buffer[100];
uint8_t buffer[100]; //int CC_id = ue_context_pP->ue_context.primaryCC_id;
int CC_id = ue_context_pP->ue_context.primaryCC_id; //OCTET_STRING_t *secondaryCellGroup;
OCTET_STRING_t *secondaryCellGroup;
NR_CellGroupConfig_t *cellGroupconfig; NR_CellGroupConfig_t *cellGroupconfig;
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_BearerToAddModList; struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_BearerToAddModList;
struct NR_MAC_CellGroupConfig *mac_CellGroupConfig; struct NR_MAC_CellGroupConfig *mac_CellGroupConfig;
struct NR_PhysicalCellGroupConfig *physicalCellGroupConfig; struct NR_PhysicalCellGroupConfig *physicalCellGroupConfig;
struct NR_SpCellConfig *spCellConfig; struct NR_SpCellConfig *spCellConfig;
struct NR_CellGroupConfig__sCellToAddModList *sCellToAddModList; //struct NR_CellGroupConfig__sCellToAddModList *sCellToAddModList;
cellGroupconfig = CALLOC(1,sizeof(NR_CellGroupConfig_t)); cellGroupconfig = CALLOC(1,sizeof(NR_CellGroupConfig_t));
cellGroupconfig->rlc_BearerToAddModList = CALLOC(1,sizeof(struct NR_CellGroupConfig__rlc_BearerToAddModList)); cellGroupconfig->rlc_BearerToAddModList = CALLOC(1,sizeof(struct NR_CellGroupConfig__rlc_BearerToAddModList));
......
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