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);
......
...@@ -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
......
...@@ -703,7 +703,7 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB, ...@@ -703,7 +703,7 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB,
int dlsch_encoding(PHY_VARS_eNB *eNB, int dlsch_encoding(PHY_VARS_eNB *eNB,
unsigned char *a, unsigned char *a,
uint8_t num_pdcch_symbols, uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch, LTE_eNB_DLSCH_t *dlsch,
int frame, int frame,
......
...@@ -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,11 +383,11 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -382,11 +383,11 @@ 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);
} }
} }
for(int j = 0; j < 10; j++){ for(int j = 0; j < 10; j++){
......
...@@ -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