Commit 75f131ad authored by yilmazt's avatar yilmazt

--phy_simulators warning removals, except for nr_dlsim. Polar coding old...

--phy_simulators warning removals, except for nr_dlsim. Polar coding old implementation's approximation and a priori information options needs to be corrected or removed
parent 2624dca2
......@@ -26,12 +26,13 @@ int main(int argc, char *argv[]) {
double SNR, SNR_lin;
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.
uint16_t testLength = NR_POLAR_PBCH_PAYLOAD_BITS, coderLength = NR_POLAR_PBCH_E, blockErrorCumulative=0, bitErrorCumulative=0;
uint16_t testLength = NR_POLAR_PBCH_PAYLOAD_BITS, coderLength = NR_POLAR_PBCH_E;
uint16_t blockErrorCumulative=0, bitErrorCumulative=0, aPrioriLength=0;
double timeEncoderCumulative = 0, timeDecoderCumulative = 0;
uint8_t aggregation_level = 8, decoderListSize = 8, pathMetricAppr = 0, logFlag = 0;
uint8_t aggregation_level = 8, decoderListSize = 8, pathMetricAppr = 0, logFlag = 0, aPrioriFlag=0;
uint16_t rnti=0;
while ((arguments = getopt (argc, argv, "s:d:f:m:i:l:a:hqgFL:K:")) != -1)
while ((arguments = getopt (argc, argv, "s:d:f:m:i:l:a:p:hqgFL:k:")) != -1)
switch (arguments) {
case 's':
SNRstart = atof(optarg);
......@@ -63,6 +64,8 @@ int main(int argc, char *argv[]) {
pathMetricAppr = (uint8_t) atoi(optarg);
break;
case 'q':
decoder_int16 = 1;
break;
......@@ -86,7 +89,7 @@ int main(int argc, char *argv[]) {
}
break;
case 'K':
case 'k':
testLength=atoi(optarg);
if (testLength < 12 || testLength > 60) {
printf("Illegal packet bitlength %d \n",testLength);
......@@ -94,10 +97,19 @@ int main(int argc, char *argv[]) {
}
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':
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"
"-L aggregation level (for DCI)\n-K packet_length (bits) for DCI/UCI\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");
exit(-1);
break;
......@@ -171,6 +183,12 @@ if (logFlag){
double modulatedInput[coderLength]; //channel input
double channelOutput[coderLength]; //add noise
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);
#ifdef DEBUG_DCI_POLAR_PARAMS
......@@ -214,11 +232,6 @@ if (logFlag){
return 0;
#endif
// We assume no a priori knowledge available about the payload.
double aPrioriArray[currentPtr->payloadBits];
for (int i=0; i<currentPtr->payloadBits; i++) aPrioriArray[i] = NAN;
for (SNR = SNRstart; SNR <= SNRstop; SNR += SNRinc) {
printf("SNR %f\n",SNR);
SNR_lin = pow(10, SNR/10);
......@@ -232,10 +245,22 @@ if (logFlag){
}
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
//testInput[0] = 0x360f8a5c;
printf("testInput: [0]->0x%08x\n", testInput[0]);
//for (int i=0; i<32; i++) printf("%d-",(testInput[0]>>i)&1); printf("\n");
for (int i=0; i<32; i++) printf("testInput:%d-testInputByte:%d-aPrioriArray:%f\n",(testInput[0]>>i)&1, testInputByte[i], aPrioriArray[i]);
#endif
int len_mod64=currentPtr->payloadBits&63;
((uint64_t *)testInput)[currentPtr->payloadBits/64]&=((((uint64_t)1)<<len_mod64)-1);
......@@ -281,19 +306,29 @@ if (logFlag){
if (decoder_int16==1) {
decoderState = polar_decoder_int16(channelOutput_int16, (uint64_t *)estimatedOutput, currentPtr);
} else { //0 --> PBCH, 1 --> DCI, -1 --> UCI
if (polarMessageType == 0)
decoderState = polar_decoder(channelOutput,
estimatedOutput,
currentPtr,
decoderListSize,
NR_POLAR_DECODER_PATH_METRIC_APPROXIMATION);
else if (polarMessageType == 1)
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,
estimatedOutput,
currentPtr,
decoderListSize,
NR_POLAR_DECODER_PATH_METRIC_APPROXIMATION);
}
} else if (polarMessageType == 1) {
decoderState = polar_decoder_dci(channelOutput,
estimatedOutput,
currentPtr,
decoderListSize,
NR_POLAR_DECODER_PATH_METRIC_APPROXIMATION,
rnti);
}
}
stop_meas(&timeDecoder);
......
......@@ -97,12 +97,12 @@ void updatePathMetric(double *pathMetric,
uint8_t approximation)
{
if (approximation) { //eq. (12)
for (uint8_t i=0; i<listSize; i++) {
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;
for (uint8_t i=0; i<listSize; i++) pathMetric[i] += log ( 1 + exp(multiplier*llr[row][0][i]) ) ;
for (uint8_t i=0; i<2*listSize; i++) pathMetric[i] += log ( 1 + exp(multiplier*llr[row][0][i]) ) ;
}
}
......@@ -267,7 +267,7 @@ void build_decoder_tree(t_nrPolar_params *polarParams)
#define _mm_subs_pi16(a,b) vsub_s16(a,b)
#endif
void applyFtoleft(t_nrPolar_params *pp, decoder_node_t *node) {
void applyFtoleft(const t_nrPolar_params *pp, decoder_node_t *node) {
int16_t *alpha_v=node->alpha;
int16_t *alpha_l=node->left->alpha;
int16_t *betal = node->left->beta;
......@@ -390,7 +390,7 @@ void applyFtoleft(t_nrPolar_params *pp, decoder_node_t *node) {
}
}
void applyGtoright(t_nrPolar_params *pp,decoder_node_t *node) {
void applyGtoright(const t_nrPolar_params *pp,decoder_node_t *node) {
int16_t *alpha_v=node->alpha;
int16_t *alpha_r=node->right->alpha;
......@@ -461,7 +461,7 @@ void applyGtoright(t_nrPolar_params *pp,decoder_node_t *node) {
int16_t all1[16] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
void computeBeta(t_nrPolar_params *pp,decoder_node_t *node) {
void computeBeta(const t_nrPolar_params *pp,decoder_node_t *node) {
int16_t *betav = node->beta;
int16_t *betal = node->left->beta;
......
......@@ -175,8 +175,17 @@ int8_t polar_decoder_dci(double *input,
uint8_t pathMetricAppr,
uint16_t n_RNTI);
void generic_polar_decoder(const t_nrPolar_params *,
decoder_node_t *);
void generic_polar_decoder(const t_nrPolar_params *pp,
decoder_node_t *node);
void applyFtoleft(const t_nrPolar_params *pp,
decoder_node_t *node);
void applyGtoright(const t_nrPolar_params *pp,
decoder_node_t *node);
void computeBeta(const t_nrPolar_params *pp,
decoder_node_t *node);
void build_decoder_tree(t_nrPolar_params *pp);
void build_polar_tables(t_nrPolar_params *polarParams);
......
......@@ -355,7 +355,9 @@ void phy_config_dedicated_scell_ue(uint8_t Mod_id,
#endif
void phy_config_harq_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
void phy_config_harq_ue(module_id_t Mod_id,
int CC_id,
uint8_t eNB_id,
uint16_t max_harq_tx )
{
......
......@@ -357,8 +357,10 @@ void phy_config_dedicated_scell_ue(uint8_t Mod_id,
}
#endif
void phy_config_harq_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
uint16_t max_harq_tx )
void phy_config_harq_ue(module_id_t Mod_id,
int CC_id,
uint8_t eNB_id,
uint16_t max_harq_tx)
{
int num_of_threads,num_of_code_words;
......
......@@ -194,7 +194,7 @@ typedef struct {
/// allocated CBA RNTI
uint16_t cba_rnti[4];//NUM_MAX_CBA_GROUP];
/// UL max-harq-retransmission
uint8_t Mlimit;
uint16_t Mlimit;
} LTE_UE_ULSCH_t;
......
......@@ -31,6 +31,7 @@
*/
#include "nr_dci.h"
#include "nr_dlsch.h"
//#define DEBUG_PDCCH_DMRS
//#define DEBUG_DCI
......
......@@ -64,8 +64,7 @@ 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) {
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);
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);
C = N_reg/(bsize*R);
}
......
......@@ -282,8 +282,8 @@ int nr_dlsch_encoding(unsigned char *a,
uint32_t A, Z, F=0;
uint32_t *pz = &Z;
uint8_t mod_order = rel15.modulation_order;
uint16_t Kr=0,r,r_offset=0,Kr_bytes;
uint8_t *d_tmp[MAX_NUM_DLSCH_SEGMENTS];
uint16_t Kr=0,r,r_offset=0;
//uint8_t *d_tmp[MAX_NUM_DLSCH_SEGMENTS];
uint8_t BG=1;
uint32_t E;
uint8_t Ilbrm = 0;
......@@ -354,13 +354,16 @@ int nr_dlsch_encoding(unsigned char *a,
}
Kr = dlsch->harq_processes[harq_pid]->K;
#ifdef DEBUG_DLSCH_CODING
uint16_t Kr_bytes;
Kr_bytes = Kr>>3;
#endif
//printf("segment Z %d k %d Kr %d BG %d\n", *pz,dlsch->harq_processes[harq_pid]->K,Kr,BG);
//start_meas(te_stats);
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
d_tmp[r] = &dlsch->harq_processes[harq_pid]->d[r][0];
//d_tmp[r] = &dlsch->harq_processes[harq_pid]->d[r][0];
//channel_input[r] = &dlsch->harq_processes[harq_pid]->d[r][0];
#ifdef DEBUG_DLSCH_CODING
printf("Encoder: B %d F %d \n",dlsch->harq_processes[harq_pid]->B, dlsch->harq_processes[harq_pid]->F);
......@@ -393,7 +396,6 @@ int nr_dlsch_encoding(unsigned char *a,
//stop_meas(te_stats);
//printf("end ldpc encoder -- output\n");
//write_output("enc_input0.m","enc_in0",&dlsch->harq_processes[harq_pid]->c[0][0],Kr_bytes,1,4);
#ifdef DEBUG_DLSCH_CODING
write_output("enc_input0.m","enc_in0",&dlsch->harq_processes[harq_pid]->c[0][0],Kr_bytes,1,4);
write_output("enc_output0.m","enc0",&dlsch->harq_processes[harq_pid]->d[0][0],(3*8*Kr_bytes)+12,1,4);
......
......@@ -112,12 +112,9 @@ void nr_get_tbs(nfapi_nr_dl_config_dlsch_pdu *dlsch_pdu,
nfapi_nr_dl_config_pdcch_parameters_rel15_t params_rel15 = dci_pdu.pdcch_params_rel15;
nfapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_rel15 = &dlsch_pdu->dlsch_pdu_rel15;
uint8_t rnti_type = params_rel15.rnti_type;
uint8_t dci_format = params_rel15.dci_format;
uint8_t ss_type = params_rel15.search_space_type;
uint8_t N_PRB_oh = ((rnti_type==NFAPI_NR_RNTI_SI)||(rnti_type==NFAPI_NR_RNTI_RA)||(rnti_type==NFAPI_NR_RNTI_P))? 0 : \
(config.pdsch_config.x_overhead.value);
uint8_t N_PRB_DMRS = (config.pdsch_config.dmrs_type.value == NFAPI_NR_DMRS_TYPE1)?6:4; //This only works for antenna port 1000
uint8_t mcs_table = config.pdsch_config.mcs_table.value;
uint8_t N_sh_symb = dlsch_rel15->nb_symbols;
uint8_t Imcs = dlsch_rel15->mcs_idx;
uint16_t N_RE_prime = NR_NB_SC_PER_RB*N_sh_symb - N_PRB_DMRS - N_PRB_oh;
......@@ -126,7 +123,11 @@ void nr_get_tbs(nfapi_nr_dl_config_dlsch_pdu *dlsch_pdu,
uint16_t N_RE, Ninfo, Ninfo_prime, C, TBS=0, R;
uint8_t table_idx, Qm, n, scale;
table_idx = 1; //get_table_idx(mcs_table, dci_format, rnti_type, ss_type);
/*uint8_t mcs_table = config.pdsch_config.mcs_table.value;
uint8_t ss_type = params_rel15.search_space_type;
uint8_t dci_format = params_rel15.dci_format;
get_table_idx(mcs_table, dci_format, rnti_type, ss_type);*/
table_idx = 1;
scale = ((table_idx==2)&&((Imcs==20)||(Imcs==26)))?11:10;
N_RE = min(156, N_RE_prime)*dlsch_rel15->n_prb;
......
......@@ -332,7 +332,9 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
//uint8_t rb_count_bit;
uint8_t i, j, aarx, bitcnt_coreset_freq_dom=0;
int32_t *dl_ch0, *dl_ch0_ext, *rxF, *rxF_ext;
#ifdef NR_PDCCH_DCI_DEBUG
int nushiftmod3 = frame_parms->nushift % 3;
#endif
uint8_t symbol_mod;
symbol_mod = (symbol >= (7 - frame_parms->Ncp)) ? symbol - (7 - frame_parms->Ncp) : symbol;
c_rb = n_BWP_start; // c_rb is the common resource block: RB within the BWP
......@@ -809,8 +811,6 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
// indicates the number of active CORESETs for the current BWP to decode PDCCH: max is 3 (this variable is not useful here, to be removed)
//uint8_t coreset_nbr_act;
// indicates the number of REG contained in the PDCCH (number of RBs * number of symbols, in CORESET)
uint8_t coreset_nbr_reg;
uint32_t coreset_C;
uint32_t coreset_nbr_rb = 0;
// for (int j=0; j < coreset_nbr_act; j++) {
// for each active CORESET (max number of active CORESETs in a BWP is 3),
......@@ -829,9 +829,9 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
#ifdef NR_PDCCH_DCI_DEBUG
printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> coreset_freq_dom=(%ld,%lx), coreset_nbr_rb=%d\n", coreset_freq_dom,coreset_freq_dom,coreset_nbr_rb);
#endif
coreset_nbr_reg = coreset_time_dur * coreset_nbr_rb;
coreset_C = (uint32_t)(coreset_nbr_reg / (reg_bundle_size_L * coreset_interleaver_size_R));
#ifdef NR_PDCCH_DCI_DEBUG
uint8_t coreset_nbr_reg = coreset_time_dur * coreset_nbr_rb;
uint32_t coreset_C = (uint32_t)(coreset_nbr_reg / (reg_bundle_size_L * coreset_interleaver_size_R));
printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> coreset_nbr_rb=%d, coreset_nbr_reg=%d, coreset_C=(%d/(%d*%d))=%d\n",
coreset_nbr_rb, coreset_nbr_reg, coreset_nbr_reg, reg_bundle_size_L,coreset_interleaver_size_R, coreset_C);
#endif
......
......@@ -231,7 +231,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
int16_t z [68*384];
int8_t l [68*384];
//__m128i l;
int16_t inv_d [68*384];
//int16_t inv_d [68*384];
uint8_t kc;
uint8_t Ilbrm = 0;
uint32_t Tbslbrm = 950984;
......
......@@ -1118,9 +1118,10 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
if (rx_type==rx_IC_dual_stream) {
nr_dlsch_layer_demapping(pdsch_vars[eNB_id]->llr,
dlsch[0]->harq_processes[harq_pid]->Nl,
dlsch[0]->harq_processes[harq_pid]->G,
pdsch_vars[eNB_id]->layer_llr);
dlsch[0]->harq_processes[harq_pid]->Nl,
dlsch[0]->harq_processes[harq_pid]->Qm,
dlsch[0]->harq_processes[harq_pid]->G,
pdsch_vars[eNB_id]->layer_llr);
}
#if UE_TIMING_TRACE
......@@ -2590,17 +2591,18 @@ unsigned short nr_dlsch_extract_rbs_dual(int **rxdataF,
int prb,nb_rb=0;
unsigned short k;
//int prb_off,prb_off2;
int skip_half=0,l;//sss_symb,pss_symb=0,nsymb
//int skip_half=0,l,sss_symb,pss_symb=0,nsymb;
int i,aarx;
int32_t *dl_ch0,*dl_ch0p,*dl_ch0_ext,*dl_ch1,*dl_ch1p,*dl_ch1_ext,*rxF,*rxF_ext;
int symbol_mod,pilots=0,j=0;
unsigned char *pmi_loc;
int pilots=0,j=0;
//int symbol_mod;
//unsigned char *pmi_loc;
pilots = (symbol==2) ? 1 : 0; //to updated from config
k = frame_parms->first_carrier_offset + 516; //0
//nsymb = (frame_parms->Ncp==NORMAL) ? 14:12;
l=symbol;
//l=symbol;
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
......@@ -2612,7 +2614,7 @@ unsigned short nr_dlsch_extract_rbs_dual(int **rxdataF,
dl_ch1 = &dl_ch_estimates[2+aarx][0];
}
pmi_loc = pmi_ext;
//pmi_loc = pmi_ext;
// pointers to extracted RX signals and channel estimates
rxF_ext = &rxdataF_ext[aarx][symbol*(nb_rb_pdsch*12)];
......@@ -2620,13 +2622,13 @@ unsigned short nr_dlsch_extract_rbs_dual(int **rxdataF,
dl_ch1_ext = &dl_ch_estimates_ext[2+aarx][symbol*(nb_rb_pdsch*12)];
for (prb=0; prb<frame_parms->N_RB_DL; prb++) {
skip_half=0;
//skip_half=0;
if ((frame_parms->N_RB_DL&1) == 0) { // even number of RBs
// For second half of RBs skip DC carrier
if (k>=frame_parms->ofdm_symbol_size) {
rxF = &rxdataF[aarx][(symbol*(frame_parms->ofdm_symbol_size))];
rxF = &rxdataF[aarx][(symbol*(frame_parms->ofdm_symbol_size))];
k=k-(frame_parms->ofdm_symbol_size);
}
......
......@@ -1793,6 +1793,21 @@ int nr_extract_dci_info(PHY_VARS_NR_UE *ue,
uint16_t n_RB_DLBWP,
uint16_t crc_scrambled_values[TOTAL_NBR_SCRAMBLED_VALUES]);
void nr_dlsch_dual_stream_correlation_core(int **dl_ch_estimates_ext,
int **dl_ch_estimates_ext_i,
int **dl_ch_rho_ext,
unsigned char n_tx,
unsigned char n_rx,
unsigned char output_shift,
int length,
int start_point);
void nr_dlsch_layer_demapping(int16_t **llr_cw,
uint8_t Nl,
uint8_t mod_order,
uint16_t length,
int16_t **llr_layers);
/**@}*/
#endif
......@@ -246,7 +246,7 @@ typedef struct {
/// allocated CBA RNTI
//uint16_t cba_rnti[4];//NUM_MAX_CBA_GROUP];
/// UL max-harq-retransmission
uint8_t Mlimit;
uint16_t Mlimit;
} NR_UE_ULSCH_t;
typedef struct {
......
......@@ -204,8 +204,8 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
uint32_t A, Z, F;
uint32_t *pz;
uint8_t mod_order;
uint16_t Kr,r,r_offset,Kr_bytes;
uint8_t *d_tmp[MAX_NUM_DLSCH_SEGMENTS];
uint16_t Kr,r,r_offset;
//uint8_t *d_tmp[MAX_NUM_DLSCH_SEGMENTS];
uint8_t BG;
uint32_t E;
uint8_t Ilbrm;
......@@ -311,8 +311,10 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
}
Kr = harq_process->K;
#ifdef DEBUG_DLSCH_CODING
uint16_t Kr_bytes;
Kr_bytes = Kr>>3;
#endif
///////////
/////////////////////////////////////////////////////////////////////////////////////
......@@ -325,7 +327,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
//start_meas(te_stats);
for (r=0; r<harq_process->C; r++) {
d_tmp[r] = &harq_process->d[r][0];
//d_tmp[r] = &harq_process->d[r][0];
//channel_input[r] = &harq_process->d[r][0];
#ifdef DEBUG_DLSCH_CODING
printf("Encoder: B %d F %d \n",harq_process->B, harq_process->F);
......@@ -357,7 +359,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
//stop_meas(te_stats);
//printf("end ldpc encoder -- output\n");
//write_output("ulsch_enc_input0.m","enc_in0",&harq_process->c[0][0],Kr_bytes,1,4);
#ifdef DEBUG_DLSCH_CODING
write_output("ulsch_enc_input0.m","enc_in0",&harq_process->c[0][0],Kr_bytes,1,4);
write_output("ulsch_enc_output0.m","enc0",&harq_process->d[0][0],(3*8*Kr_bytes)+12,1,4);
......
......@@ -990,7 +990,7 @@ void nr_uci_encoding(uint64_t payload,
// A is the payload size, to be provided in function call
uint8_t A = nr_bit;
// L is the CRC size
uint8_t L;
//uint8_t L;
// E is the rate matching output sequence length as given in TS 38.212 subclause 6.3.1.4.1
uint16_t E=0,E_init;
......@@ -1047,7 +1047,7 @@ void nr_uci_encoding(uint64_t payload,
}
*M_bit = E;
int I_seg;
//int I_seg;
#ifdef DEBUG_NR_PUCCH_TX
printf("\t\t [nr_uci_encoding] start function with fmt=%d, encoding A=%d bits into M_bit=%d (where nrofSymbols=%d,nrofPRB=%d)\n",fmt,A,*M_bit,nrofSymbols,nrofPRB);
#endif
......@@ -1057,19 +1057,19 @@ void nr_uci_encoding(uint64_t payload,
// CRC bits are not attached, and coding small block lengths (subclause 5.3.3)
} else if (A>=12) {
// procedure in subclause 6.3.1.2.1 (UCI encoded by Polar code -> subclause 6.3.1.3.1)
if ((A>=360 && E>=1088)||(A>=1013)) {
/*if ((A>=360 && E>=1088)||(A>=1013)) {
I_seg = 1;
} else {
I_seg = 0;
}
}*/
if (A>=20) {
/*if (A>=20) {
// parity bits (subclause 5.2.1) computed by setting L=11 and using generator polynomial gCRC11(D) (subclause 5.1)
L=11;
} else if (A<=19) {
// parity bits (subclause 5.2.1) computed by setting L=6 and using generator polynomial gCRC6(D) (subclause 5.1)
L=6;
}
}*/
// code block segmentation and CRC attachment is performed according to subclause 5.2.1
// polar coding subclause 5.3.1
......
......@@ -131,21 +131,22 @@ int main(int argc, char **argv) {
// int sync_pos, sync_pos_slot;
// FILE *rx_frame_file;
FILE *output_fd = NULL;
uint8_t write_output_file = 0;
//uint8_t write_output_file = 0;
// int subframe_offset;
// char fname[40], vname[40];
int trial, n_trials = 1, n_errors = 0, n_false_positive = 0;
uint8_t transmission_mode = 1, n_tx = 1, n_rx = 1;
uint8_t n_tx = 1, n_rx = 1;
//uint8_t transmission_mode = 1;
uint16_t Nid_cell = 0;
channel_desc_t *gNB2UE;
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;
//char input_val_str[50],input_val_str2[50];
//uint16_t NB_RB=25;
SCM_t channel_model = AWGN; //Rayleigh1_anticorr;
uint16_t N_RB_DL = 106, mu = 1;
unsigned char frame_type = 0;
//unsigned char frame_type = 0;
unsigned char pbch_phase = 0;
int frame = 0, subframe = 0;
int frame_length_complex_samples;
......@@ -176,7 +177,7 @@ int main(int argc, char **argv) {
while ((c = getopt(argc, argv, "df:hpg:i:j:n:l:m:r:s:S:y:z:M:N:F:R:P:L:")) != -1) {
switch (c) {
case 'f':
/*case 'f':
write_output_file = 1;
output_fd = fopen(optarg, "w");
......@@ -185,11 +186,11 @@ int main(int argc, char **argv) {
exit(-1);
}
break;
break;*/
case 'd':
/*case 'd':
frame_type = 1;
break;
break;*/
case 'g':
switch ((char) *optarg) {
......@@ -228,13 +229,13 @@ int main(int argc, char **argv) {
break;
case 'i':
/*case 'i':
interf1 = atoi(optarg);
break;
case 'j':
interf2 = atoi(optarg);
break;
break;*/
case 'n':
n_trials = atoi(optarg);
......@@ -331,33 +332,33 @@ int main(int argc, char **argv) {
nb_rb = atoi(optarg);
break;
case 'x':
/*case 'x':
transmission_mode = atoi(optarg);
break;
break;*/
default:
case 'h':
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]);
printf("-h This message\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("-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("-t Delay spread for multipath channel\n");
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
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("-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("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
printf("-M Multiple SSB positions in burst\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("-M Multiple SSB positions in burst\n");
printf("-N Nid_cell\n");
printf("-R N_RB_DL\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("-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("-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 Input filename (.txt format) for RX conformance testing\n");
exit(-1);
break;
......@@ -493,7 +494,7 @@ int main(int argc, char **argv) {
short *channel_output_fixed = malloc16(sizeof(short) * 16 * 68 * 384);
short *channel_output_uncoded = malloc16(sizeof(unsigned short) * 16 * 68 * 384);
double errors_bit_uncoded = 0;
unsigned char *estimated_output;
//unsigned char *estimated_output;
unsigned char *estimated_output_bit;
unsigned char *test_input_bit;
unsigned int errors_bit = 0;
......@@ -514,7 +515,7 @@ int main(int argc, char **argv) {
for (i = 0; i < TBS / 8; i++)
test_input[i] = (unsigned char) rand();
estimated_output = harq_process->b;
//estimated_output = harq_process->b;
#ifdef DEBUG_DLSCHSIM
for (i = 0; i < TBS / 8; i++) printf("test_input[i]=%d \n",test_input[i]);
......
......@@ -92,13 +92,13 @@ int main(int argc, char **argv)
uint8_t snr1set=0;
int **txdata;
double **s_re,**s_im,**r_re,**r_im;
double iqim = 0.0;
//double iqim = 0.0;
double ip =0.0;
unsigned char pbch_pdu[6];
//unsigned char pbch_pdu[6];
// int sync_pos, sync_pos_slot;
// FILE *rx_frame_file;
FILE *output_fd = NULL;
uint8_t write_output_file=0;
//uint8_t write_output_file=0;
//int result;
//int freq_offset;
// int subframe_offset;
......@@ -110,8 +110,8 @@ int main(int argc, char **argv)
channel_desc_t *gNB2UE;
uint8_t extended_prefix_flag=0;
int8_t interf1=-21,interf2=-21;
//uint8_t extended_prefix_flag=0;
//int8_t interf1=-21,interf2=-21;
FILE *input_fd=NULL,*pbch_file_fd=NULL;
......@@ -126,7 +126,7 @@ int main(int argc, char **argv)
int N_RB_DL=273,mu=1;
unsigned char frame_type = 0;
//unsigned char frame_type = 0;
unsigned char pbch_phase = 0;
int frame=0;
......@@ -152,7 +152,7 @@ int main(int argc, char **argv)
while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:o:s:S:t:x:y:z:M:N:F:GR:dP:IL:")) != -1) {
switch (c) {
case 'f':
/*case 'f':
write_output_file=1;
output_fd = fopen(optarg,"w");
......@@ -161,11 +161,11 @@ int main(int argc, char **argv)
exit(-1);
}
break;
break;*/
case 'd':
/*case 'd':
frame_type = 1;
break;
break;*/
case 'g':
switch((char)*optarg) {
......@@ -204,13 +204,13 @@ int main(int argc, char **argv)
break;
case 'i':
/*case 'i':
interf1=atoi(optarg);
break;
case 'j':
interf2=atoi(optarg);
break;
break;*/
case 'n':
n_trials = atoi(optarg);
......@@ -237,9 +237,9 @@ int main(int argc, char **argv)
Td= atof(optarg);
break;
*/
case 'p':
/*case 'p':
extended_prefix_flag=1;
break;
break;*/
/*
case 'r':
......@@ -326,8 +326,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",
argv[0]);
printf("-h This message\n");
printf("-p Use extended prefix mode\n");
printf("-d Use TDD\n");
//printf("-p Use extended prefix mode\n");
//printf("-d Use TDD\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 Ending SNR, runs from SNR0 to SNR1\n");
......@@ -336,16 +336,16 @@ int main(int argc, char **argv)
printf("-x Transmission mode (1,2,6 for the moment)\n");
printf("-y Number of TX antennas used in eNB\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("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\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("-o Carrier frequency offset in Hz\n");
printf("-M Multiple SSB positions in burst\n");
printf("-N Nid_cell\n");
printf("-R N_RB_DL\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("-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("-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 Input filename (.txt format) for RX conformance testing\n");
exit (-1);
break;
......@@ -537,10 +537,9 @@ int main(int argc, char **argv)
if (output_fd)
fwrite(txdata[0],sizeof(int32_t),frame_length_complex_samples,output_fd);
int txlev = signal_energy(&txdata[0][5*frame_parms->ofdm_symbol_size + 4*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0],
frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples);
// printf("txlev %d (%f)\n",txlev,10*log10(txlev));
/*int txlev = signal_energy(&txdata[0][5*frame_parms->ofdm_symbol_size + 4*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0],
frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples);
printf("txlev %d (%f)\n",txlev,10*log10(txlev));*/
for (i=0; i<frame_length_complex_samples; i++) {
......@@ -689,6 +688,3 @@ int main(int argc, char **argv)
return(n_errors);
}
......@@ -133,21 +133,22 @@ int main(int argc, char **argv) {
// int sync_pos, sync_pos_slot;
// FILE *rx_frame_file;
FILE *output_fd = NULL;
uint8_t write_output_file = 0;
//uint8_t write_output_file = 0;
// int subframe_offset;
// char fname[40], vname[40];
int trial, n_trials = 1, n_errors = 0, n_false_positive = 0;
uint8_t transmission_mode = 1, n_tx = 1, n_rx = 1;
uint8_t n_tx = 1, n_rx = 1;
//uint8_t transmission_mode = 1;
uint16_t Nid_cell = 0;
channel_desc_t *gNB2UE;
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;
//char input_val_str[50],input_val_str2[50];
//uint16_t NB_RB=25;
SCM_t channel_model = AWGN; //Rayleigh1_anticorr;
uint16_t N_RB_DL = 106, N_RB_UL = 106, mu = 1;
unsigned char frame_type = 0;
//unsigned char frame_type = 0;
unsigned char pbch_phase = 0;
int frame = 0, subframe = 0;
int frame_length_complex_samples;
......@@ -178,7 +179,7 @@ int main(int argc, char **argv) {
while ((c = getopt(argc, argv, "df:hpg:i:j:n:l:m:r:s:S:y:z:M:N:F:R:P:")) != -1) {
switch (c) {
case 'f':
/*case 'f':
write_output_file = 1;
output_fd = fopen(optarg, "w");
......@@ -187,11 +188,11 @@ int main(int argc, char **argv) {
exit(-1);
}
break;
break;*/
case 'd':
/*case 'd':
frame_type = 1;
break;
break;*/
case 'g':
switch ((char) *optarg) {
......@@ -230,13 +231,13 @@ int main(int argc, char **argv) {
break;
case 'i':
/*case 'i':
interf1 = atoi(optarg);
break;
case 'j':
interf2 = atoi(optarg);
break;
break;*/
case 'n':
n_trials = atoi(optarg);
......@@ -330,33 +331,33 @@ int main(int argc, char **argv) {
nb_rb = atoi(optarg);
break;
case 'x':
/*case 'x':
transmission_mode = atoi(optarg);
break;
break;*/
default:
case 'h':
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]);
printf("-h This message\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("-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("-t Delay spread for multipath channel\n");
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
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("-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("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\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("-M Multiple SSB positions in burst\n");
printf("-N Nid_cell\n");
printf("-R N_RB_DL\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("-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("-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 Input filename (.txt format) for RX conformance testing\n");
exit(-1);
break;
......
......@@ -238,8 +238,7 @@ rrc_mac_config_req_ue(module_id_t Mod_idP,
}
if(nfapi_mode!=3)
phy_config_harq_ue(Mod_idP, 0, eNB_index,
UE_mac_inst[Mod_idP].
scheduling_info.maxHARQ_Tx);
UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx);
if (mac_MainConfig->ul_SCH_Config->retxBSR_Timer) {
UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer =
......
......@@ -48,6 +48,7 @@
#include "pdcp.h"
#include "openair1/PHY/defs_gNB.h"
#include "openair1/PHY/NR_TRANSPORT/nr_dlsch.h"
//Agent-related headers
#include "flexran_agent_extern.h"
......
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