Commit 380bac3e authored by yilmazt's avatar yilmazt

Warning removals and first update of small block coding

parent 151fced6
...@@ -583,7 +583,7 @@ typedef struct { ...@@ -583,7 +583,7 @@ typedef struct {
} nfapi_pnf_phy_rf_config_t; } nfapi_pnf_phy_rf_config_t;
#define NFAPI_PNF_PHY_RF_TAG 0x1003 #define NFAPI_PNF_PHY_RF_TAG 0x1003
// Generic strucutre for single tlv value. // Generic structure for single tlv value.
typedef struct { typedef struct {
nfapi_tl_t tl; nfapi_tl_t tl;
uint16_t value; uint16_t value;
......
...@@ -72,7 +72,7 @@ typedef struct ...@@ -72,7 +72,7 @@ typedef struct
// These TLVs are used by the VNF to configure the RF in the PNF // These TLVs are used by the VNF to configure the RF in the PNF
// nfapi_uint16_tlv_t max_transmit_power; // nfapi_uint16_tlv_t max_transmit_power;
nfapi_uint16_tlv_t nrarfcn; nfapi_uint32_tlv_t nrarfcn;
// nfapi_nmm_frequency_bands_t nmm_gsm_frequency_bands; // nfapi_nmm_frequency_bands_t nmm_gsm_frequency_bands;
// nfapi_nmm_frequency_bands_t nmm_umts_frequency_bands; // nfapi_nmm_frequency_bands_t nmm_umts_frequency_bands;
......
...@@ -11,10 +11,36 @@ ...@@ -11,10 +11,36 @@
#include "PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h" #include "PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h"
#include "PHY/CODING/coding_defs.h" #include "PHY/CODING/coding_defs.h"
#include "SIMULATION/TOOLS/sim.h" #include "SIMULATION/TOOLS/sim.h"
//#include "PHY/NR_TRANSPORT/nr_transport.h"
//#include "common/utils/LOG/log.h"
//#define DEBUG_DCI_POLAR_PARAMS //#define DEBUG_DCI_POLAR_PARAMS
//#define DEBUG_POLAR_TIMING //#define DEBUG_POLAR_TIMING
//#define DEBUG_CRC //#define DEBUG_CRC
//#define DEBUG_POLARTEST
uint8_t nr_pbch_payload_interleaving_pattern[32] = {16, 23, 18, 17, 8, 30, 10, 6, 24, 7, 0, 5, 3, 2, 1, 4,
9, 11, 12, 13, 14, 15, 19, 20, 21, 22, 25, 26, 27, 28, 29, 31};
void nr_init_pbch_interleaver(uint8_t *interleaver) {
uint8_t j_sfn=0, j_hrf=10, j_ssb=11, j_other=14;
memset((void*)interleaver,0, NR_POLAR_PBCH_PAYLOAD_BITS);
for (uint8_t i=0; i<NR_POLAR_PBCH_PAYLOAD_BITS; i++)
if (!i) // choice bit:1
*(interleaver+i) = *(nr_pbch_payload_interleaving_pattern+j_other++);
else if (i<7) //Sfn bits:6
*(interleaver+i) = *(nr_pbch_payload_interleaving_pattern+j_sfn++);
else if (i<24) // other:17
*(interleaver+i) = *(nr_pbch_payload_interleaving_pattern+j_other++);
else if (i<28) // Sfn:4
*(interleaver+i) = *(nr_pbch_payload_interleaving_pattern+j_sfn++);
else if (i==28) // Hrf bit:1
*(interleaver+i) = *(nr_pbch_payload_interleaving_pattern+j_hrf);
else // Ssb bits:3
*(interleaver+i) = *(nr_pbch_payload_interleaving_pattern+j_ssb++);
}
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
...@@ -37,9 +63,9 @@ int main(int argc, char *argv[]) { ...@@ -37,9 +63,9 @@ int main(int argc, char *argv[]) {
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 = 0, coderLength = 0, blockErrorCumulative=0, bitErrorCumulative=0; uint16_t testLength = 0, coderLength = 0, blockErrorCumulative=0, bitErrorCumulative=0;
double timeEncoderCumulative = 0, timeDecoderCumulative = 0; double timeEncoderCumulative = 0, timeDecoderCumulative = 0;
uint8_t aggregation_level = 8, decoderListSize = 8, pathMetricAppr = 0; uint8_t aggregation_level = 8, decoderListSize = 8, pathMetricAppr = 0, matlabDebug = 0;
while ((arguments = getopt (argc, argv, "s:d:f:m:i:l:a:hqg")) != -1) while ((arguments = getopt (argc, argv, "s:d:f:c:i:l:a:hqgm")) != -1)
switch (arguments) switch (arguments)
{ {
case 's': case 's':
...@@ -54,7 +80,7 @@ int main(int argc, char *argv[]) { ...@@ -54,7 +80,7 @@ int main(int argc, char *argv[]) {
SNRstop = atof(optarg); SNRstop = atof(optarg);
break; break;
case 'm': case 'c':
polarMessageType = atoi(optarg); polarMessageType = atoi(optarg);
break; break;
...@@ -74,6 +100,11 @@ int main(int argc, char *argv[]) { ...@@ -74,6 +100,11 @@ int main(int argc, char *argv[]) {
decoder_int16 = 1; decoder_int16 = 1;
break; break;
case 'm':
matlabDebug = 1;
//#define DEBUG_POLAR_MATLAB
break;
case 'g': case 'g':
iterations = 1; iterations = 1;
SNRstart = -6.0; SNRstart = -6.0;
...@@ -82,7 +113,7 @@ int main(int argc, char *argv[]) { ...@@ -82,7 +113,7 @@ int main(int argc, char *argv[]) {
break; break;
case 'h': case 'h':
printf("./polartest -s SNRstart -d SNRinc -f SNRstop -m [0=PBCH|1=DCI|2=UCI] -i iterations -l decoderListSize -a pathMetricAppr\n"); printf("./polartest -s SNRstart -d SNRinc -f SNRstop -c [0=PBCH|1=DCI|2=UCI] -i iterations -l decoderListSize -a pathMetricAppr -m Matlab Debug\n");
exit(-1); exit(-1);
default: default:
...@@ -91,7 +122,7 @@ int main(int argc, char *argv[]) { ...@@ -91,7 +122,7 @@ int main(int argc, char *argv[]) {
} }
if (polarMessageType == 0) { //PBCH if (polarMessageType == 0) { //PBCH
testLength = 64;//NR_POLAR_PBCH_PAYLOAD_BITS; testLength = NR_POLAR_PBCH_PAYLOAD_BITS;
coderLength = NR_POLAR_PBCH_E; coderLength = NR_POLAR_PBCH_E;
aggregation_level = NR_POLAR_PBCH_AGGREGATION_LEVEL; aggregation_level = NR_POLAR_PBCH_AGGREGATION_LEVEL;
} else if (polarMessageType == 1) { //DCI } else if (polarMessageType == 1) { //DCI
...@@ -320,20 +351,87 @@ int main(int argc, char *argv[]) { ...@@ -320,20 +351,87 @@ int main(int argc, char *argv[]) {
testInput[i] |= ( ((uint32_t) (rand()%2)) &1); testInput[i] |= ( ((uint32_t) (rand()%2)) &1);
} }
/*printf("testInput: [0]->0x%08x\n", testInput[0]); #ifdef DEBUG_POLARTEST
for (int i=0; i<32; i++) printf("testInput: ");
printf("%d\n",(testInput[0]>>i)&1);*/ for (int i = 0; i < testArrayLength; i++) printf("[%d]->0x%08x\t",i, testInput[i]);
printf("\n");
printf("testInput[0]: ");
for (int i=0; i<32; i++) printf("[%d]=%d-",i,(testInput[0]>>i)&1);
printf("\n");
printf("testInput[1]: ");
for (int i=0; i<32; i++) printf("[%d]=%d-",i,(testInput[1]>>i)&1);
printf("\n");
#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);
#ifdef DEBUG_POLARTEST
printf("testInput: ");
for (int i = 0; i < testArrayLength; i++) printf("[%d]->0x%08x\t",i, testInput[i]);
printf("\n");
printf("testInput[0]: ");
for (int i=0; i<32; i++) printf("[%d]=%d-",i,(testInput[0]>>i)&1);
printf("\n");
printf("testInput[1]: ");
for (int i=0; i<32; i++) printf("[%d]=%d-",i,(testInput[1]>>i)&1);
printf("\n");
#endif
if (matlabDebug == 1){
memset(testInput,0,sizeof(uint32_t) * testArrayLength);
/*testInput[0] |= ((uint32_t)1 << 31); testInput[0] |= ((uint32_t)1 << 28); testInput[0] |= ((uint32_t)1 << 26);
testInput[0] |= ((uint32_t)1 << 25); testInput[0] |= ((uint32_t)1 << 22); testInput[0] |= ((uint32_t)1 << 21);
testInput[0] |= ((uint32_t)1 << 19); testInput[0] |= ((uint32_t)1 << 17); testInput[0] |= ((uint32_t)1 << 15);
testInput[0] |= ((uint32_t)1 << 14); testInput[0] |= ((uint32_t)1 << 12); testInput[0] |= ((uint32_t)1 << 10);
testInput[0] |= ((uint32_t)1 << 8); testInput[0] |= ((uint32_t)1 << 5); testInput[0] |= ((uint32_t)1 << 3);
testInput[0] |= ((uint32_t)1 << 2); testInput[0] |= ((uint32_t)1 << 1);*/
testInput[0] |= ((uint32_t)1 << 30); testInput[0] |= ((uint32_t)1 << 29); testInput[0] |= ((uint32_t)1 << 28);
testInput[0] |= ((uint32_t)1 << 26); testInput[0] |= ((uint32_t)1 << 23); testInput[0] |= ((uint32_t)1 << 21);
testInput[0] |= ((uint32_t)1 << 19); testInput[0] |= ((uint32_t)1 << 17); testInput[0] |= ((uint32_t)1 << 16);
testInput[0] |= ((uint32_t)1 << 14); testInput[0] |= ((uint32_t)1 << 12); testInput[0] |= ((uint32_t)1 << 10);
testInput[0] |= ((uint32_t)1 << 9); testInput[0] |= ((uint32_t)1 << 6); testInput[0] |= ((uint32_t)1 << 5);
testInput[0] |= ((uint32_t)1 << 3); testInput[0] |= ((uint32_t)1);
/*printf("testInput (a_31,..., a_0): ");
for (int i=31; i>=0; i--) printf("%d-",(testInput[0]>>i)&1); //a_31, a_30, ..., a_0
printf("testInput = 0x%llx\n", testInput[0]);
printf("\n");*/
/*for (int i=0;i<32;i++){
memset(testInput,0,sizeof(uint32_t) * testArrayLength);
testInput[0] |= ((uint32_t)1 << i);
int crc = crc24c(testInput,32);
printf("[i=%d]testInput = 0x%08lx, crc = 0x%lx\n", i,testInput[0], crc);
}
memset(testInput,0,sizeof(uint32_t) * testArrayLength);
int crc = crc24c(testInput,32);
printf("testInput = 0x%08lx, crc = 0x%lx\n", testInput[0], crc);*/
}
uint8_t nr_pbch_interleaver[NR_POLAR_PBCH_PAYLOAD_BITS];
memset((void*)nr_pbch_interleaver,0, NR_POLAR_PBCH_PAYLOAD_BITS);
nr_init_pbch_interleaver(nr_pbch_interleaver);
for (int i=0; i<=31;i++)
printf("nr_pbch_interleaver[%d]=%d\n",i,nr_pbch_interleaver[i]);
for (int i=0; i<NR_POLAR_PBCH_PAYLOAD_BITS; i++)
printf("nr_pbch_interleaver_operation[%d]=%d\n",i,(*(nr_pbch_interleaver+i)));
start_meas(&timeEncoder); start_meas(&timeEncoder);
if (decoder_int16==0) if (decoder_int16==1)
polar_encoder(testInput, encoderOutput, currentPtr); polar_encoder_fast((uint64_t*)testInput, encoderOutput, 0, currentPtr);
else else
polar_encoder_fast((uint64_t*)testInput, encoderOutput,0, currentPtr); polar_encoder(testInput, encoderOutput, currentPtr);
//polar_encoder_fast((uint64_t*)testInput, (uint64_t*)encoderOutput,0, currentPtr); //polar_encoder_fast((uint64_t*)testInput, (uint64_t*)encoderOutput,0, currentPtr);
stop_meas(&timeEncoder); stop_meas(&timeEncoder);
/*printf("encoderOutput: [0]->0x%08x\n", encoderOutput[0]); /*printf("encoderOutput: [0]->0x%08x\n", encoderOutput[0]);
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#include <stdint.h> #include <stdint.h>
#include <PHY/defs_common.h> #include <PHY/defs_common.h>
typedef unsigned __int128 uint128_t;
#define CRC24_A 0 #define CRC24_A 0
#define CRC24_B 1 #define CRC24_B 1
#define CRC16 2 #define CRC16 2
......
...@@ -258,7 +258,7 @@ unsigned int crcPayload(unsigned char * inptr, int bitlen, uint32_t* crc256Table ...@@ -258,7 +258,7 @@ unsigned int crcPayload(unsigned char * inptr, int bitlen, uint32_t* crc256Table
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;
switch (crc_type) { switch (crc_type) {
case CRC24_A: case CRC24_A:
......
...@@ -147,7 +147,7 @@ void polar_encoder_dci(uint32_t *in, ...@@ -147,7 +147,7 @@ void polar_encoder_dci(uint32_t *in,
t_nrPolar_paramsPtr polarParams, t_nrPolar_paramsPtr polarParams,
uint16_t n_RNTI); uint16_t n_RNTI);
void polar_encoder_fast(uint64_t *A, void polar_encoder_fast(uint64_t *Aprime,
uint32_t *out, uint32_t *out,
int32_t crcmask, int32_t crcmask,
t_nrPolar_paramsPtr polarParams); t_nrPolar_paramsPtr polarParams);
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
//#define DEBUG_POLAR_ENCODER //#define DEBUG_POLAR_ENCODER
//#define DEBUG_POLAR_ENCODER_DCI //#define DEBUG_POLAR_ENCODER_DCI
//#define DEBUG_POLAR_ENCODER_TIMING //#define DEBUG_POLAR_ENCODER_TIMING
#define DEBUG_POLAR_MATLAB
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h" #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
#include "assertions.h" #include "assertions.h"
...@@ -385,7 +386,7 @@ void build_polar_tables(t_nrPolar_paramsPtr polarParams) { ...@@ -385,7 +386,7 @@ void build_polar_tables(t_nrPolar_paramsPtr polarParams) {
} }
void polar_encoder_fast(uint64_t *A, void polar_encoder_fast(uint64_t *Aprime,
uint32_t *out, uint32_t *out,
int32_t crcmask, int32_t crcmask,
t_nrPolar_paramsPtr polarParams) { t_nrPolar_paramsPtr polarParams) {
...@@ -394,9 +395,13 @@ void polar_encoder_fast(uint64_t *A, ...@@ -394,9 +395,13 @@ void polar_encoder_fast(uint64_t *A,
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);
AssertFatal(polarParams->payloadBits < 65, "payload bits = %d > 64, is not supported yet\n",polarParams->payloadBits); AssertFatal(polarParams->payloadBits < 65, "payload bits = %d > 64, is not supported yet\n",polarParams->payloadBits);
uint64_t B[4]={0,0,0,0},Cprime[4]={0,0,0,0}; uint64_t B[4]={0,0,0,0}, Cprime[4]={0,0,0,0};
int bitlen = polarParams->payloadBits; int bitlen = polarParams->payloadBits;
#ifdef DEBUG_POLAR_MATLAB
if (polarParams->K<65) printf("[polar_encoder_fast]A[0] = 0x%llx\n", (unsigned long long)(Aprime[0])); //(unsigned long long)(Aprime[0]&(((uint64_t)1<<bitlen)-1)),
#endif
// append crc // append crc
AssertFatal(bitlen<129,"support for payloads <= 128 bits\n"); AssertFatal(bitlen<129,"support for payloads <= 128 bits\n");
...@@ -406,45 +411,65 @@ void polar_encoder_fast(uint64_t *A, ...@@ -406,45 +411,65 @@ void polar_encoder_fast(uint64_t *A,
uint64_t tcrc=0; uint64_t tcrc=0;
// A bitstring should be stored as 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 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
// 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 downto 0, for PBCH/PDCCH we need to read in a_{A-1} downto 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];
uint32_t Aprime= (uint32_t)(((uint32_t)*A)<<(32-bitlen)); uint32_t AprimeTmp= (uint32_t)(((uint32_t)*Aprime)<<(32-bitlen));
A32_flip[0]=((uint8_t*)&Aprime)[3]; A32_flip[0]=((uint8_t*)&AprimeTmp)[3]; //a'_0, a'_1, ..., a'_7
A32_flip[1]=((uint8_t*)&Aprime)[2]; A32_flip[1]=((uint8_t*)&AprimeTmp)[2];
A32_flip[2]=((uint8_t*)&Aprime)[1]; A32_flip[2]=((uint8_t*)&AprimeTmp)[1];
A32_flip[3]=((uint8_t*)&Aprime)[0]; A32_flip[3]=((uint8_t*)&AprimeTmp)[0];
tcrc = (uint64_t)((crcmask^(crc24c(A32_flip,bitlen)>>8))); tcrc = (uint64_t)((crcmask^(crc24c(A32_flip,bitlen)>>8)));
} }
else if (bitlen<=64) { else if (bitlen<=64) {
uint8_t A64_flip[8]; uint8_t A64_flip[8];
uint64_t Aprime= (uint32_t)(((uint64_t)*A)<<(64-bitlen)); uint64_t AprimeTmp= (uint32_t)(((uint64_t)*Aprime)<<(64-bitlen));
A64_flip[0]=((uint8_t*)&Aprime)[7]; A64_flip[0]=((uint8_t*)&AprimeTmp)[7];
A64_flip[1]=((uint8_t*)&Aprime)[6]; A64_flip[1]=((uint8_t*)&AprimeTmp)[6];
A64_flip[2]=((uint8_t*)&Aprime)[5]; A64_flip[2]=((uint8_t*)&AprimeTmp)[5];
A64_flip[3]=((uint8_t*)&Aprime)[4]; A64_flip[3]=((uint8_t*)&AprimeTmp)[4];
A64_flip[4]=((uint8_t*)&Aprime)[3]; A64_flip[4]=((uint8_t*)&AprimeTmp)[3];
A64_flip[5]=((uint8_t*)&Aprime)[2]; A64_flip[5]=((uint8_t*)&AprimeTmp)[2];
A64_flip[6]=((uint8_t*)&Aprime)[1]; A64_flip[6]=((uint8_t*)&AprimeTmp)[1];
A64_flip[7]=((uint8_t*)&Aprime)[0]; A64_flip[7]=((uint8_t*)&AprimeTmp)[0];
tcrc = (uint64_t)((crcmask^(crc24c(A64_flip,bitlen)>>8))); tcrc = (uint64_t)((crcmask^(crc24c(A64_flip,bitlen)>>8)));
} }
else if (bitlen<=128) {
uint8_t A128_flip[16];
uint128_t AprimeTmp= (uint32_t)(((uint128_t)*Aprime)<<(128-bitlen));
A128_flip[0]=((uint8_t*)&AprimeTmp)[15]; A128_flip[1]=((uint8_t*)&AprimeTmp)[14];
A128_flip[2]=((uint8_t*)&AprimeTmp)[13]; A128_flip[3]=((uint8_t*)&AprimeTmp)[12];
A128_flip[4]=((uint8_t*)&AprimeTmp)[11]; A128_flip[5]=((uint8_t*)&AprimeTmp)[10];
A128_flip[6] =((uint8_t*)&AprimeTmp)[9]; A128_flip[7] =((uint8_t*)&AprimeTmp)[8];
A128_flip[8] =((uint8_t*)&AprimeTmp)[7]; A128_flip[9] =((uint8_t*)&AprimeTmp)[6];
A128_flip[10]=((uint8_t*)&AprimeTmp)[5]; A128_flip[11]=((uint8_t*)&AprimeTmp)[4];
A128_flip[12]=((uint8_t*)&AprimeTmp)[3]; A128_flip[13]=((uint8_t*)&AprimeTmp)[2];
A128_flip[14]=((uint8_t*)&AprimeTmp)[1]; A128_flip[15]=((uint8_t*)&AprimeTmp)[0];
tcrc = (uint64_t)((crcmask^(crc24c(A128_flip,bitlen)>>8)));
}
int n; int n;
// this is number of quadwords in the bit string int quadwlen = (polarParams->K>>6); // this is number of quadwords (64-bits) in the bit string
int quadwlen = (polarParams->K>>6);
if ((polarParams->K&63) > 0) quadwlen++; if ((polarParams->K&63) > 0) quadwlen++;
// Create the B bitstring as // Create the B bit string as
// 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 // 0, 0, ..., 0, a'_0, a'_1, ..., a'_A-1, p_0, p_1, ..., p_{N_parity-1}
for (n=0;n<quadwlen;n++) if (n==0) B[n] = (A[n] << polarParams->crcParityBits) | tcrc; //??? 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
else B[n] = (A[n] << polarParams->crcParityBits) | (A[n-1]>>(64-polarParams->crcParityBits));
for (n=0;n<quadwlen;n++) if (n==0) B[n] = (Aprime[n] << polarParams->crcParityBits) | tcrc;
else B[n] = (Aprime[n] << polarParams->crcParityBits) | (Aprime[n-1]>>(64-polarParams->crcParityBits));
#ifdef DEBUG_POLAR_MATLAB
// B = pbchB
for (int i = 0; i < quadwlen; i++) printf("[polar_encoder_fast]B[%d] = 0x%llx\n", i, (unsigned long long)(B[i]));
#endif
uint8_t *Bbyte = (uint8_t*)B; uint8_t *Bbyte = (uint8_t*)B;
// for each byte of B, lookup in corresponding table for 64-bit word corresponding to that byte and its position // for each byte of B, lookup in corresponding table for 64-bit word corresponding to that byte and its position
if (polarParams->K<65) if (polarParams->K<65)
...@@ -464,10 +489,15 @@ void polar_encoder_fast(uint64_t *A, ...@@ -464,10 +489,15 @@ void polar_encoder_fast(uint64_t *A,
} }
} }
#ifdef DEBUG_POLAR_MATLAB
// Cprime = pbchCprime
for (int i = 0; i < quadwlen; i++) printf("[polar_encoder_fast]C'[%d]= 0x%llx\n", i, (unsigned long long)(Cprime[i]));
#endif
#ifdef DEBUG_POLAR_ENCODER #ifdef DEBUG_POLAR_ENCODER
if (polarParams->K<65) if (polarParams->K<65)
printf("A %llx B %llx Cprime %llx (payload bits %d,crc %x)\n", printf("A %llx B %llx Cprime %llx (payload bits %d,crc %x)\n",
(unsigned long long)(A[0]&(((uint64_t)1<<bitlen)-1)), (unsigned long long)(Aprime[0]&(((uint64_t)1<<bitlen)-1)),
(unsigned long long)(B[0]), (unsigned long long)(B[0]),
(unsigned long long)(Cprime[0]), (unsigned long long)(Cprime[0]),
polarParams->payloadBits, polarParams->payloadBits,
...@@ -475,52 +505,35 @@ void polar_encoder_fast(uint64_t *A, ...@@ -475,52 +505,35 @@ void polar_encoder_fast(uint64_t *A,
else if (polarParams->K<129) { else if (polarParams->K<129) {
if (bitlen<64) if (bitlen<64)
printf("A %llx B %llx|%llx Cprime %llx|%llx (payload bits %d,crc %x)\n", printf("A %llx B %llx|%llx Cprime %llx|%llx (payload bits %d,crc %x)\n",
(unsigned long long)(A[0]&(((uint64_t)1<<bitlen)-1)), (unsigned long long)(Aprime[0]&(((uint64_t)1<<bitlen)-1)),
(unsigned long long)(B[1]),(unsigned long long)(B[0]), (unsigned long long)(B[1]),(unsigned long long)(B[0]),
(unsigned long long)(Cprime[1]),(unsigned long long)(Cprime[0]), (unsigned long long)(Cprime[1]),(unsigned long long)(Cprime[0]),
polarParams->payloadBits, polarParams->payloadBits,
tcrc); tcrc);
else else
printf("A %llx|%llx B %llx|%llx Cprime %llx|%llx (payload bits %d,crc %x)\n", printf("A %llx|%llx B %llx|%llx Cprime %llx|%llx (payload bits %d,crc %x)\n",
(unsigned long long)(A[1]&(((uint64_t)1<<(bitlen-64))-1)),(unsigned long long)(A[0]), (unsigned long long)(Aprime[1]&(((uint64_t)1<<(bitlen-64))-1)),(unsigned long long)(Aprime[0]),
(unsigned long long)(B[1]),(unsigned long long)(B[0]), (unsigned long long)(B[1]),(unsigned long long)(B[0]),
(unsigned long long)(Cprime[1]),(unsigned long long)(Cprime[0]), (unsigned long long)(Cprime[1]),(unsigned long long)(Cprime[0]),
polarParams->payloadBits, polarParams->payloadBits,
crc24c((uint8_t*)A,bitlen)>>8); crc24c((uint8_t*)Aprime,bitlen)>>8);
} }
#endif #endif
/* printf("Bbytes : %x.%x.%x.%x.%x.%x.%x.%x\n",Bbyte[0],Bbyte[1],Bbyte[2],Bbyte[3],Bbyte[4],Bbyte[5],Bbyte[6],Bbyte[7]);
printf("%llx,%llx,%llx,%llx,%llx,%llx,%llx,%llx\n",polarParams->cprime_tab[0][Bbyte[0]] ,
polarParams->cprime_tab[1][Bbyte[1]] ,
polarParams->cprime_tab[2][Bbyte[2]] ,
polarParams->cprime_tab[3][Bbyte[3]] ,
polarParams->cprime_tab[4][Bbyte[4]] ,
polarParams->cprime_tab[5][Bbyte[5]] ,
polarParams->cprime_tab[6][Bbyte[6]] ,
polarParams->cprime_tab[7][Bbyte[7]]);*/
// now do Gu product (here using 64-bit XORs, we can also do with SIMD after) // now do Gu product (here using 64-bit XORs, we can also do with SIMD after)
// here we're reading out the bits LSB -> MSB, is this correct w.r.t. 3GPP ? // here we're reading out the bits LSB -> MSB, is this correct w.r.t. 3GPP ?
uint64_t Cprime_i; uint64_t Cprime_i;
/* printf("%llx Cprime_0 (%llx) G %llx,%llx,%llx,%llx,%llx,%llx,%llx,%llx\n",Cprime_i,Cprime &1,
polarParams->G_N_tab[0][0],
polarParams->G_N_tab[0][1],
polarParams->G_N_tab[0][2],
polarParams->G_N_tab[0][3],
polarParams->G_N_tab[0][4],
polarParams->G_N_tab[0][5],
polarParams->G_N_tab[0][6],
polarParams->G_N_tab[0][7]);*/
uint64_t D[8]={0,0,0,0,0,0,0,0}; uint64_t D[8]={0,0,0,0,0,0,0,0};
int off=0; int off=0;
int len=polarParams->K; int len=polarParams->K;
for (int j=0;j<(1+(polarParams->K>>6));j++,off+=64,len-=64) { for (int j=0;j<(1+(polarParams->K>>6));j++,off+=64,len-=64) {
for (int i=0;i<((len>63) ? 64 : len);i++) { for (int i=0;i<((len>63) ? 64 : len);i++) {
Cprime_i = -((Cprime[j]>>i)&1); // this converts bit 0 as, 0 => 0000x00, 1 => 1111x11 Cprime_i = -((Cprime[j]>>i)&1); // this converts bit 0 as, 0 => 0000x00, 1 => 1111x11
/*
#ifdef DEBUG_POLAR_ENCODER #ifdef DEBUG_POLAR_ENCODER
printf("%llx Cprime_%d (%llx) G %llx,%llx,%llx,%llx,%llx,%llx,%llx,%llx\n", printf("%llx Cprime_%d (%llx) G %llx,%llx,%llx,%llx,%llx,%llx,%llx,%llx\n",
Cprime_i,off+i,(Cprime[j]>>i) &1, Cprime_i,off+i,(Cprime[j]>>i) &1,
polarParams->G_N_tab[off+i][0], polarParams->G_N_tab[off+i][0],
...@@ -531,8 +544,8 @@ void polar_encoder_fast(uint64_t *A, ...@@ -531,8 +544,8 @@ void polar_encoder_fast(uint64_t *A,
polarParams->G_N_tab[off+i][5], polarParams->G_N_tab[off+i][5],
polarParams->G_N_tab[off+i][6], polarParams->G_N_tab[off+i][6],
polarParams->G_N_tab[off+i][7]); polarParams->G_N_tab[off+i][7]);
#endif #endif
*/
uint64_t *Gi=polarParams->G_N_tab[off+i]; uint64_t *Gi=polarParams->G_N_tab[off+i];
D[0] ^= (Cprime_i & Gi[0]); D[0] ^= (Cprime_i & Gi[0]);
D[1] ^= (Cprime_i & Gi[1]); D[1] ^= (Cprime_i & Gi[1]);
...@@ -545,17 +558,17 @@ void polar_encoder_fast(uint64_t *A, ...@@ -545,17 +558,17 @@ void polar_encoder_fast(uint64_t *A,
} }
} }
#ifdef DEBUG_POLAR_ENCODER #ifdef DEBUG_POLAR_ENCODER
printf("D %llx,%llx,%llx,%llx,%llx,%llx,%llx,%llx\n", printf("D %llx,%llx,%llx,%llx,%llx,%llx,%llx,%llx\n", D[0], D[1], D[2], D[3], D[4], D[5], D[6], D[7]);
D[0],
D[1],
D[2],
D[3],
D[4],
D[5],
D[6],
D[7]);
#endif #endif
polar_rate_matching(polarParams,(void*)D,(void*)out); #ifdef DEBUG_POLAR_MATLAB
// D = pbchD
for (int i = 0; i < 8; i++) printf("[polar_encoder_fast]D[%d] = 0x%016llx\n", i, (unsigned long long)(D[i]));
#endif
polar_rate_matching(polarParams,(void*)D,(void*)out);
#ifdef DEBUG_POLAR_MATLAB
// out = pbchF
for (int i = 0; i < (NR_POLAR_PBCH_E/32); i++) printf("[polar_encoder_fast]F[%d] = 0x%08lx\n", i, (unsigned long)(out[i]));
#endif
} }
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "PHY/defs_gNB.h" #include "PHY/defs_gNB.h"
#include "PHY/defs_nr_UE.h" #include "PHY/defs_nr_UE.h"
#include "PHY/CODING/coding_defs.h"
//#define RM_DEBUG 1 //#define RM_DEBUG 1
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include "SCHED_NR_UE/pucch_uci_ue_nr.h" #include "SCHED_NR_UE/pucch_uci_ue_nr.h"
#include "SCHED_NR_UE/pucch_power_control_ue_nr.h" #include "SCHED_NR_UE/pucch_power_control_ue_nr.h"
int16_t get_PL(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
/**************** defines **************************************/ /**************** defines **************************************/
/**************** variables **************************************/ /**************** variables **************************************/
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "PHY/NR_REFSIG/ss_pbch_nr.h" #include "PHY/NR_REFSIG/ss_pbch_nr.h"
#include "PHY/defs_nr_UE.h" #include "PHY/defs_nr_UE.h"
#include "PHY/NR_UE_TRANSPORT/pucch_nr.h"
#ifndef NO_RAT_NR #ifndef NO_RAT_NR
...@@ -51,57 +52,7 @@ ...@@ -51,57 +52,7 @@
int8_t nr_ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint8_t eNB_id, uint16_t rnti, sub_frame_t subframe); int8_t nr_ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint8_t eNB_id, uint16_t rnti, sub_frame_t subframe);
uint8_t is_cqi_TXOp(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t gNB_id); uint8_t is_cqi_TXOp(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t gNB_id);
uint8_t is_ri_TXOp(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t gNB_id); uint8_t is_ri_TXOp(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t gNB_id);
/*
void nr_generate_pucch0(int32_t **txdataF,
NR_DL_FRAME_PARMS *frame_parms,
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
int16_t amp,
int nr_tti_tx,
uint8_t mcs,
uint8_t nrofSymbols,
uint8_t startingSymbolIndex,
uint16_t startingPRB);
void nr_generate_pucch1(int32_t **txdataF,
NR_DL_FRAME_PARMS *frame_parms,
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
uint64_t payload,
int16_t amp,
int nr_tti_tx,
uint8_t nrofSymbols,
uint8_t startingSymbolIndex,
uint16_t startingPRB,
uint16_t startingPRB_intraSlotHopping,
uint8_t timeDomainOCC,
uint8_t nr_bit);
void nr_generate_pucch2(int32_t **txdataF,
NR_DL_FRAME_PARMS *frame_parms,
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
uint64_t payload,
int16_t amp,
int nr_tti_tx,
uint8_t nrofSymbols,
uint8_t startingSymbolIndex,
uint8_t nrofPRB,
uint16_t startingPRB,
uint8_t nr_bit);
void nr_generate_pucch3_4(int32_t **txdataF,
NR_DL_FRAME_PARMS *frame_parms,
pucch_format_nr_t fmt,
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
uint64_t payload,
int16_t amp,
int nr_tti_tx,
uint8_t nrofSymbols,
uint8_t startingSymbolIndex,
uint8_t nrofPRB,
uint16_t startingPRB,
uint8_t nr_bit,
uint8_t occ_length_format4,
uint8_t occ_index_format4);
*/
/**************** variables **************************************/ /**************** variables **************************************/
...@@ -556,7 +507,8 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ ...@@ -556,7 +507,8 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
switch(format) { switch(format) {
case pucch_format0_nr: case pucch_format0_nr:
{ {
nr_generate_pucch0(ue,ue->common_vars.txdataF, nr_generate_pucch0(ue,
ue->common_vars.txdataF,
&ue->frame_parms, &ue->frame_parms,
&ue->pucch_config_dedicated_nr[gNB_id], &ue->pucch_config_dedicated_nr[gNB_id],
tx_amp, tx_amp,
...@@ -570,7 +522,8 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ ...@@ -570,7 +522,8 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
} }
case pucch_format1_nr: case pucch_format1_nr:
{ {
nr_generate_pucch1(ue,ue->common_vars.txdataF, nr_generate_pucch1(ue,
ue->common_vars.txdataF,
&ue->frame_parms, &ue->frame_parms,
&ue->pucch_config_dedicated_nr[gNB_id], &ue->pucch_config_dedicated_nr[gNB_id],
pucch_payload, pucch_payload,
......
...@@ -145,8 +145,7 @@ int main(int argc, char **argv) { ...@@ -145,8 +145,7 @@ int main(int argc, char **argv) {
//uint16_t NB_RB=25; //uint16_t NB_RB=25;
SCM_t channel_model = AWGN; //Rayleigh1_anticorr; SCM_t channel_model = AWGN; //Rayleigh1_anticorr;
uint8_t N_RB_DL = 106, mu = 1; uint8_t N_RB_DL = 106, mu = 1;
unsigned char frame_type = 0; unsigned char frame_type = 0, pbch_phase = 0;
unsigned char pbch_phase = 0;
int frame = 0, subframe = 0; int frame = 0, subframe = 0;
int frame_length_complex_samples; int frame_length_complex_samples;
//int frame_length_complex_samples_no_prefix; //int frame_length_complex_samples_no_prefix;
...@@ -341,8 +340,8 @@ int main(int argc, char **argv) { ...@@ -341,8 +340,8 @@ 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 interfering 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 interfering eNB (in dB) - cell_id mod 3 = 2\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");
...@@ -482,13 +481,10 @@ int main(int argc, char **argv) { ...@@ -482,13 +481,10 @@ int main(int argc, char **argv) {
short *channel_output_fixed = malloc16(sizeof(short) * 16 * 68 * 384); short *channel_output_fixed = malloc16(sizeof(short) * 16 * 68 * 384);
short *channel_output_uncoded = malloc16(sizeof(unsigned short) * 16 * 68 * 384); short *channel_output_uncoded = malloc16(sizeof(unsigned short) * 16 * 68 * 384);
double errors_bit_uncoded = 0; double errors_bit_uncoded = 0;
unsigned char *estimated_output; //unsigned char *estimated_output = malloc16(sizeof(unsigned char) * 16 * 68 * 384);
unsigned char *estimated_output_bit; unsigned char *estimated_output_bit = malloc16(sizeof(unsigned char) * 16 * 68 * 384);
unsigned char *test_input_bit; unsigned char *test_input_bit = malloc16(sizeof(unsigned char) * 16 * 68 * 384);
unsigned int errors_bit = 0; unsigned int errors_bit = 0;
test_input_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
estimated_output = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
estimated_output_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
NR_UE_DLSCH_t *dlsch0_ue = UE->dlsch[UE->current_thread_id[subframe]][0][0]; NR_UE_DLSCH_t *dlsch0_ue = UE->dlsch[UE->current_thread_id[subframe]][0][0];
NR_DL_UE_HARQ_t *harq_process = dlsch0_ue->harq_processes[harq_pid]; NR_DL_UE_HARQ_t *harq_process = dlsch0_ue->harq_processes[harq_pid];
harq_process->mcs = Imcs; harq_process->mcs = Imcs;
...@@ -503,7 +499,7 @@ int main(int argc, char **argv) { ...@@ -503,7 +499,7 @@ int main(int argc, char **argv) {
for (i = 0; i < TBS / 8; i++) for (i = 0; i < TBS / 8; i++)
test_input[i] = (unsigned char) rand(); test_input[i] = (unsigned char) rand();
estimated_output = harq_process->b; //estimated_output = harq_process->b;
#ifdef DEBUG_DLSCHSIM #ifdef DEBUG_DLSCHSIM
for (i = 0; i < TBS / 8; i++) printf("test_input[i]=%d \n",test_input[i]); for (i = 0; i < TBS / 8; i++) printf("test_input[i]=%d \n",test_input[i]);
......
...@@ -42,10 +42,11 @@ ...@@ -42,10 +42,11 @@
#include "PHY/MODULATION/modulation_UE.h" #include "PHY/MODULATION/modulation_UE.h"
#include "PHY/INIT/phy_init.h" #include "PHY/INIT/phy_init.h"
#include "PHY/NR_TRANSPORT/nr_transport.h" #include "PHY/NR_TRANSPORT/nr_transport.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" //#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
#include "SCHED_NR/sched_nr.h" #include "SCHED_NR/sched_nr.h"
#include "SCHED_NR_UE/fapi_nr_ue_l1.h" #include "SCHED_NR_UE/fapi_nr_ue_l1.h"
#include "SCHED_NR/fapi_nr_l1.h"
#include "LAYER2/NR_MAC_gNB/nr_mac_gNB.h" #include "LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
#include "LAYER2/NR_MAC_UE/mac_defs.h" #include "LAYER2/NR_MAC_UE/mac_defs.h"
...@@ -54,6 +55,10 @@ ...@@ -54,6 +55,10 @@
#include "NR_PHY_INTERFACE/NR_IF_Module.h" #include "NR_PHY_INTERFACE/NR_IF_Module.h"
#include "NR_UE_PHY_INTERFACE/NR_IF_Module.h" #include "NR_UE_PHY_INTERFACE/NR_IF_Module.h"
#include "LAYER2/NR_MAC_UE/mac_proto.h"
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
#include "RRC/NR/MESSAGES/asn1_msg.h"
PHY_VARS_gNB *gNB; PHY_VARS_gNB *gNB;
PHY_VARS_NR_UE *UE; PHY_VARS_NR_UE *UE;
...@@ -78,7 +83,7 @@ int32_t get_uldl_offset(int nr_bandP) {return(0);} ...@@ -78,7 +83,7 @@ int32_t get_uldl_offset(int nr_bandP) {return(0);}
NR_IF_Module_t *NR_IF_Module_init(int Mod_id){return(NULL);} NR_IF_Module_t *NR_IF_Module_init(int Mod_id){return(NULL);}
int8_t dummy_nr_ue_dl_indication(nr_downlink_indication_t *dl_info){return(0);} int8_t dummy_nr_ue_dl_indication(nr_downlink_indication_t *dl_info){return(0);}
int8_t dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info){return(0);} int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info){return(0);}
lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe) { return(SF_DL);} lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe) { return(SF_DL);}
...@@ -99,13 +104,6 @@ int rlc_module_init (void) {return(0);} ...@@ -99,13 +104,6 @@ int rlc_module_init (void) {return(0);}
void pdcp_layer_init(void) {} void pdcp_layer_init(void) {}
int rrc_init_nr_global_param(void){return(0);} int rrc_init_nr_global_param(void){return(0);}
void config_common(int Mod_idP,
int CC_idP,
int nr_bandP,
uint64_t dl_CarrierFreqP,
uint32_t dl_BandwidthP
);
// needed for some functions // needed for some functions
PHY_VARS_NR_UE ***PHY_vars_UE_g; PHY_VARS_NR_UE ***PHY_vars_UE_g;
...@@ -115,40 +113,39 @@ int main(int argc, char **argv) ...@@ -115,40 +113,39 @@ int main(int argc, char **argv)
{ {
char c; char c;
int i,aa;
int i,l,aa;
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, 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=0,n_alamouti=0;
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;
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;
unsigned char frame_type = 0; unsigned char frame_type = 0;
...@@ -358,8 +355,8 @@ int main(int argc, char **argv) ...@@ -358,8 +355,8 @@ 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 interfering 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 interfering eNB (in dB) - cell_id mod 3 = 2\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");
...@@ -497,7 +494,7 @@ int main(int argc, char **argv) ...@@ -497,7 +494,7 @@ int main(int argc, char **argv)
gNB_mac = RC.nrmac[0]; gNB_mac = RC.nrmac[0];
config_common(0,0,78,(uint64_t)3640000000L,N_RB_DL); config_common(0,0,78,(uint64_t)3640000000L,N_RB_DL);
config_nr_mib(0,0,1,kHz30,0,0,0,0); config_nr_mib(0,0,1,kHz30,0,0,0,0,0);
nr_l2_init_ue(); nr_l2_init_ue();
UE_mac = get_mac_inst(0); UE_mac = get_mac_inst(0);
...@@ -640,8 +637,8 @@ int main(int argc, char **argv) ...@@ -640,8 +637,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++) {
......
...@@ -68,7 +68,7 @@ int8_t nr_ue_process_dlsch(module_id_t module_id, int cc_id, uint8_t gNB_index, ...@@ -68,7 +68,7 @@ int8_t nr_ue_process_dlsch(module_id_t module_id, int cc_id, uint8_t gNB_index,
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;
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "LAYER2/MAC/mac_extern.h" #include "LAYER2/MAC/mac_extern.h"
#include "LAYER2/MAC/mac_proto.h" #include "LAYER2/MAC/mac_proto.h"
#include "LAYER2/NR_MAC_gNB/mac_proto.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h"
#include "openair1/PHY/LTE_TRANSPORT/transport_proto.h"
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
#include "common/utils/LOG/vcd_signal_dumper.h" #include "common/utils/LOG/vcd_signal_dumper.h"
#include "UTIL/OPT/opt.h" #include "UTIL/OPT/opt.h"
...@@ -324,7 +325,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -324,7 +325,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,
...@@ -382,7 +383,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -382,7 +383,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
} }
for (int ii=0; ii<MAX_MOBILES_PER_GNB; ii++) { for (int ii=0; ii<MAX_MOBILES_PER_GNB; ii++) {
LTE_eNB_DLSCH_t *dlsch = RC.gNB[module_idP][CC_id]->dlsch[ii][0]; NR_gNB_DLSCH_t *dlsch = RC.gNB[module_idP][CC_id]->dlsch[ii][0];
if((dlsch != NULL) && (dlsch->rnti == rnti)){ if((dlsch != NULL) && (dlsch->rnti == rnti)){
LOG_I(MAC, "clean_eNb_dlsch UE %x \n", rnti); LOG_I(MAC, "clean_eNb_dlsch UE %x \n", rnti);
clean_eNb_dlsch(dlsch); clean_eNb_dlsch(dlsch);
......
...@@ -36,6 +36,28 @@ ...@@ -36,6 +36,28 @@
void mac_top_init_gNB(void); void mac_top_init_gNB(void);
uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint32_t bw);
uint64_t from_nrarfcn(int nr_bandP, uint32_t dl_nrarfcn);
void config_nr_mib(int Mod_idP,
int CC_idP,
int p_gNBP,
int subCarrierSpacingCommon,
uint32_t ssb_SubcarrierOffset,
int dmrs_TypeA_Position,
uint32_t pdcch_ConfigSIB1,
int cellBarred,
int intraFreqReselection
);
void config_common(int Mod_idP,
int CC_idP,
int nr_bandP,
uint64_t dl_CarrierFreqP,
uint32_t dl_BandwidthP
);
int rrc_mac_config_req_gNB(module_id_t Mod_idP, int rrc_mac_config_req_gNB(module_id_t Mod_idP,
int CC_id, int CC_id,
int p_gNB, int p_gNB,
......
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