Merge remote-tracking branch 'origin/code-cleanup-2021oct24' into integration_2021_wk45_b

This commit is contained in:
hardy
2021-11-08 13:12:52 +01:00
79 changed files with 27 additions and 3325 deletions
-8
View File
@@ -30,14 +30,6 @@
#include <stdint.h> // for uint8/16/32_t
/* check if this ifndef is required for NB-IoT ?!
//#ifndef NO_OPENAIR1
//#include "PHY/defs_NB_IoT.h"
//#else
//#include "PHY/TOOLS/time_meas.h"
//#endif
*/
#define CRC24_A_NB_IoT 0
#define CRC24_B_NB_IoT 1
#define CRC16_NB_IoT 2
@@ -34,7 +34,6 @@
#include <stdlib.h>
#include "nrLDPC_types.h"
#ifndef malloc32_clear
/**
\brief Allocates 32 byte aligned memory and initializes to zero
\param size Input size in bytes
@@ -46,7 +45,6 @@ static inline void* malloc32_clear(size_t size)
memset(ptr, 0, size);
return ptr;
}
#endif
/**
\brief Allocates and initializes the internal decoder processing buffers
-2
View File
@@ -50,8 +50,6 @@
//#define DEBUG_DCI_DECODING 1
//#define DEBUG_PHY
//#undef ALL_AGGREGATION
//extern uint16_t phich_reg[MAX_NUM_PHICH_GROUPS][3];
//extern uint16_t pcfich_reg[4];
+1 -4
View File
@@ -32,11 +32,8 @@
#ifndef __DCI_NB_IOT_H__
#define __DCI_NB_IOT_H__
//#ifndef USER_MODE
//#include "PHY/types.h"
//#else
#include <stdint.h>
//#endif
typedef enum
{
-4
View File
@@ -36,10 +36,8 @@
#include "PHY/extern.h"
#include "SCHED/extern.h"
#ifdef OPENAIR2
#include "openair2/LAYER2/MAC/proto.h"
#include "openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#endif
extern int mac_get_rrc_status(uint8_t Mod_id,uint8_t eNB_flag,uint8_t index);
@@ -434,10 +432,8 @@ int dump_ue_stats(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,char *buffer, int length
break;
}
#ifdef OPENAIR2
RRC_status = mac_UE_get_rrc_status(ue->Mod_id, 0);
len += sprintf(&buffer[len],"[UE PROC] RRC status = %d\n",RRC_status);
#endif
len += sprintf(&buffer[len], "[UE PROC] Transmission Mode %d \n",ue->transmission_mode[eNB]);
len += sprintf(&buffer[len], "[UE PROC] PBCH err conseq %d, PBCH error total %d, PBCH FER %d\n",
ue->pbch_vars[eNB]->pdu_errors_conseq,
+1 -1
View File
@@ -321,4 +321,4 @@ HLC_subband_cqi_mcs_CBA_20MHz_NB_IoT;
#define MAX_ACK_PAYLOAD_NB_IoT 18
#define MAX_RI_PAYLOAD_NB_IoT 6
#endif
#endif
-9
View File
@@ -50,9 +50,6 @@
//#define DEBUG_DCI_DECODING 1
//#define DEBUG_PHY
//#undef ALL_AGGREGATION
uint16_t extract_crc(uint8_t *dci,uint8_t dci_len)
{
@@ -2802,7 +2799,6 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
if (dci_cnt>old_dci_cnt)
return(dci_cnt);
//#ifdef ALL_AGGREGATION
// Now check UE_SPEC format 1 search spaces at aggregation 8
old_dci_cnt=dci_cnt;
dci_decoding_procedure0(pdcch_vars,0,mode,subframe,
@@ -2836,7 +2832,6 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
if (dci_cnt>old_dci_cnt)
return(dci_cnt);
//#endif //ALL_AGGREGATION
} else if (tmode == 3) {
@@ -2946,7 +2941,6 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
if (dci_cnt>old_dci_cnt)
return(dci_cnt);
//#ifdef ALL_AGGREGATION
// Now check UE_SPEC format 2_2A search spaces at aggregation 8
LOG_D(PHY," Now check UE_SPEC format 2_2A search spaces at aggregation 8 dci length: %d[bits] %d[bytes]\n",format2A_size_bits,format2A_size_bytes);
old_dci_cnt=dci_cnt;
@@ -3082,7 +3076,6 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
if (dci_cnt>old_dci_cnt)
return(dci_cnt);
//#ifdef ALL_AGGREGATION
// Now check UE_SPEC format 2_2A search spaces at aggregation 8
old_dci_cnt=dci_cnt;
dci_decoding_procedure0(pdcch_vars,0,mode,
@@ -3214,7 +3207,6 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
if (dci_cnt>old_dci_cnt)
return(dci_cnt);
//#ifdef ALL_AGGREGATION
// Now check UE_SPEC format 1E_2A_M10PRB search spaces at aggregation 8
old_dci_cnt=dci_cnt;
@@ -3249,7 +3241,6 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
if (dci_cnt>old_dci_cnt)
return(dci_cnt);
//#endif //ALL_AGGREGATION
}
@@ -51,7 +51,6 @@
#include <cblas.h>
#include "linear_preprocessing_rec.h"
#define NOCYGWIN_STATIC
//#define DEBUG_MMSE
@@ -42,7 +42,6 @@
//#define DEBUG_ULSCH_MODULATION
#ifndef OFDMA_ULSCH
void dft_lte(int32_t *z,int32_t *d, int32_t Msc_PUSCH, uint8_t Nsymb)
{
@@ -371,7 +370,6 @@ void dft_lte(int32_t *z,int32_t *d, int32_t Msc_PUSCH, uint8_t Nsymb)
// printf("\n");
}
#endif
void ulsch_modulation(int32_t **txdataF,
short amp,
uint32_t frame,
@@ -690,57 +688,10 @@ void ulsch_modulation(int32_t **txdataF,
// Transform Precoding
#ifdef OFDMA_ULSCH
for (i=0; i<ulsch_Msymb; i++) {
ulsch->z[i] = ulsch->d[i];
}
#else
dft_lte(ulsch->z,ulsch->d,Msc_PUSCH,ulsch->Nsymb_pusch);
#endif
DevAssert(txdataF);
#ifdef OFDMA_ULSCH
re_offset0 = frame_parms->first_carrier_offset + (ulsch->harq_processes[harq_pid]->first_rb*12);
if (re_offset0>frame_parms->ofdm_symbol_size) {
re_offset0 -= frame_parms->ofdm_symbol_size;
// re_offset0++;
}
// printf("re_offset0 %d\n",re_offset0);
for (j=0,l=0; l<(nsymb-ulsch->srs_active); l++) {
re_offset = re_offset0;
symbol_offset = (int)frame_parms->ofdm_symbol_size*(l+(subframe*nsymb));
#ifdef DEBUG_ULSCH_MODULATION
printf("symbol %d (subframe %d): symbol_offset %d\n",l,subframe,symbol_offset);
#endif
txptr = &txdataF[0][symbol_offset];
if (((frame_parms->Ncp == 0) && ((l==3) || (l==10)))||
((frame_parms->Ncp == 1) && ((l==2) || (l==8)))) {
}
// Skip reference symbols
else {
// printf("copying %d REs\n",Msc_PUSCH);
for (i=0; i<Msc_PUSCH; i++,j++) {
#ifdef DEBUG_ULSCH_MODULATION
printf("re_offset %d (%p): %d,%d\n", re_offset,&ulsch->z[j],((int16_t*)&ulsch->z[j])[0],((int16_t*)&ulsch->z[j])[1]);
#endif
txptr[re_offset++] = ulsch->z[j];
if (re_offset==frame_parms->ofdm_symbol_size)
re_offset = 0;
}
}
}
# else // OFDMA_ULSCH = 0
re_offset0 = frame_parms->first_carrier_offset + (ulsch->harq_processes[harq_pid]->first_rb*12);
if (re_offset0>frame_parms->ofdm_symbol_size) {
@@ -777,8 +728,5 @@ void ulsch_modulation(int32_t **txdataF,
}
}
#endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_MODULATION, VCD_FUNCTION_OUT);
}
+3 -907
View File
@@ -30,11 +30,9 @@
* \warning
*/
#ifdef USER_MODE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "executables/softmodem-common.h"
@@ -61,7 +59,6 @@ char nr_dci_format_string[8][30] = {
//#define DEBUG_DCI_DECODING 1
//#define NR_LTE_PDCCH_DCI_SWITCH
#define NR_PDCCH_DCI_RUN // activates new nr functions
//#define NR_PDCCH_DCI_DEBUG // activates NR_PDCCH_DCI_DEBUG logs
#ifdef NR_PDCCH_DCI_DEBUG
#define LOG_DNL(a, ...) printf("\n\t\t<-NR_PDCCH_DCI_DEBUG (%s)-> " a, __func__, ##__VA_ARGS__ )
@@ -81,7 +78,6 @@ char nr_dci_format_string[8][30] = {
#define LOG_I(A,B...) printf(B)
#endif
#ifdef NR_PDCCH_DCI_RUN
//static const int16_t conjugate[8]__attribute__((aligned(32))) = {-1,1,-1,1,-1,1,-1,1};
@@ -209,9 +205,6 @@ void nr_pdcch_demapping_deinterleaving(uint32_t *llr,
}
}
#endif
#ifdef NR_PDCCH_DCI_RUN
int32_t nr_pdcch_llr(NR_DL_FRAME_PARMS *frame_parms, int32_t **rxdataF_comp,
int16_t *pdcch_llr, uint8_t symbol,uint32_t coreset_nbr_rb) {
int16_t *rxF = (int16_t *) &rxdataF_comp[0][(symbol * coreset_nbr_rb * 12)];
@@ -242,7 +235,6 @@ int32_t nr_pdcch_llr(NR_DL_FRAME_PARMS *frame_parms, int32_t **rxdataF_comp,
return (0);
}
#endif
#if 0
@@ -346,7 +338,6 @@ void nr_pdcch_channel_level(int32_t **dl_ch_estimates_ext,
#ifdef NR_PDCCH_DCI_RUN
// This function will extract the mapped DM-RS PDCCH REs as per 38.211 Section 7.4.1.3.2 (Mapping to physical resources)
void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
int32_t **dl_ch_estimates,
@@ -542,9 +533,6 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
}
}
#endif
#define print_shorts(s,x) printf("%s %d,%d,%d,%d,%d,%d,%d,%d\n",s,(x)[0],(x)[1],(x)[2],(x)[3],(x)[4],(x)[5],(x)[6],(x)[7])
void nr_pdcch_channel_compensation(int32_t **rxdataF_ext,
@@ -694,24 +682,6 @@ void nr_pdcch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms,
#endif
}
#if 0
void pdcch_siso(NR_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
uint8_t l) {
uint8_t rb,re,jj,ii;
jj=0;
ii=0;
for (rb=0; rb<frame_parms->N_RB_DL; rb++) {
for (re=0; re<12; re++) {
rxdataF_comp[0][jj++] = rxdataF_comp[0][ii];
ii++;
}
}
}
#endif
#ifdef NR_PDCCH_DCI_RUN
int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15) {
@@ -824,36 +794,7 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
return (0);
}
#endif
#if 0
void nr_pdcch_scrambling(NR_DL_FRAME_PARMS *frame_parms,
uint8_t nr_slot_rx,
uint8_t *e,
uint32_t length) {
int i;
uint8_t reset;
uint32_t x1, x2, s=0;
reset = 1;
// x1 is set in lte_gold_generic
x2 = (nr_slot_rx<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.8.2
for (i=0; i<length; i++) {
if ((i&0x1f)==0) {
s = lte_gold_generic(&x1, &x2, reset);
//printf("lte_gold[%d]=%x\n",i,s);
reset = 0;
}
// printf("scrambling %d : e %d, c %d\n",i,e[i],((s>>(i&0x1f))&1));
if (e[i] != 2) // <NIL> element is 2
e[i] = (e[i]&1) ^ ((s>>(i&0x1f))&1);
}
}
#endif
#ifdef NR_PDCCH_DCI_RUN
void nr_pdcch_unscrambling(int16_t *z,
uint16_t scrambling_RNTI,
@@ -883,10 +824,7 @@ void nr_pdcch_unscrambling(int16_t *z,
}
}
#endif
#ifdef NR_PDCCH_DCI_RUN
/* This function compares the received DCI bits with
* re-encoded DCI bits and returns the number of mismatched bits
*/
@@ -997,846 +935,4 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
return(dci_ind->number_of_dcis);
}
/*
void nr_dci_decoding_procedure0(int s,
int p,
int coreset_time_dur,
uint16_t coreset_nbr_rb,
NR_UE_PDCCH **pdcch_vars,
int do_common,
uint8_t nr_slot_rx,
NR_DCI_ALLOC_t *dci_alloc,
int16_t eNB_id,
uint8_t current_thread_id,
NR_DL_FRAME_PARMS *frame_parms,
//uint8_t mi,
uint16_t crc_scrambled_values[TOTAL_NBR_SCRAMBLED_VALUES],
uint8_t L,
NR_UE_SEARCHSPACE_CSS_DCI_FORMAT_t format_css,
NR_UE_SEARCHSPACE_USS_DCI_FORMAT_t format_uss,
uint8_t sizeof_bits,
uint8_t sizeof_bytes,
uint8_t *dci_cnt,
crc_scrambled_t *crc_scrambled,
format_found_t *format_found,
uint16_t pdcch_DMRS_scrambling_id,
uint32_t *CCEmap0,
uint32_t *CCEmap1,
uint32_t *CCEmap2) {
uint32_t crc, CCEind, nCCE[3];
uint32_t *CCEmap = NULL, CCEmap_mask = 0;
uint8_t L2 = (1 << L);
unsigned int Yk, nb_candidates = 0, i, m;
unsigned int CCEmap_cand;
uint32_t decoderState=0;
// A[p], p is the current active CORESET
uint16_t A[3]= {39827,39829,39839};
//Table 10.1-2: Maximum number of PDCCH candidates per slot and per serving cell as a function of the subcarrier spacing value 2^mu*15 KHz, mu {0,1,2,3}
uint8_t m_max_slot_pdcch_Table10_1_2 [4] = {44,36,22,20};
//Table 10.1-3: Maximum number of non-overlapped CCEs per slot and per serving cell as a function of the subcarrier spacing value 2^mu*15 KHz, mu {0,1,2,3}
//uint8_t cce_max_slot_pdcch_Table10_1_3 [4] = {56,56,48,32};
int coreset_nbr_cce_per_symbol=0;
LOG_DDD("format_found is %d \n", *format_found);
//if (mode == NO_DCI) {
// #ifdef NR_PDCCH_DCI_DEBUG
// LOG_DDD("skip DCI decoding: expect no DCIs at nr_slot_rx %d in current searchSpace\n", nr_slot_rx);
// #endif
// return;
//}
LOG_DDD("frequencyDomainResources=%lx, duration=%d\n",
pdcch_vars[eNB_id]->coreset[p].frequencyDomainResources, pdcch_vars[eNB_id]->coreset[p].duration);
// nCCE = get_nCCE(pdcch_vars[eNB_id]->num_pdcch_symbols, frame_parms, mi);
for (int i = 0; i < 45; i++) {
// this loop counts each bit of the bit map coreset_freq_dom, and increments nbr_RB_coreset for each bit set to '1'
if (((pdcch_vars[eNB_id]->coreset[p].frequencyDomainResources & 0x1FFFFFFFFFFF) >> i) & 0x1) coreset_nbr_cce_per_symbol++;
}
nCCE[p] = pdcch_vars[eNB_id]->coreset[p].duration*coreset_nbr_cce_per_symbol; // 1 CCE = 6 RB
// p is the current CORESET we are currently monitoring (among the 3 possible CORESETs in a BWP)
// the number of CCE in the current CORESET is:
// the number of symbols in the CORESET (pdcch_vars[eNB_id]->coreset[p].duration)
// multiplied by the number of bits set to '1' in the frequencyDomainResources bitmap
// (1 bit set to '1' corresponds to 6 RB and 1 CCE = 6 RB)
LOG_DDD("nCCE[%d]=%d\n",p,nCCE[p]);
// if (nCCE > get_nCCE(3, frame_parms, 1)) {
//LOG_D(PHY,
//"skip DCI decoding: nCCE=%d > get_nCCE(3,frame_parms,1)=%d\n",
//nCCE, get_nCCE(3, frame_parms, 1));
//return;
// }
// if (nCCE < L2) {
// LOG_D(PHY, "skip DCI decoding: nCCE=%d < L2=%d\n", nCCE, L2);
// return;
// }
// if (mode == NO_DCI) {
// LOG_D(PHY, "skip DCI decoding: expect no DCIs at nr_slot_rx %d\n",
// nr_slot_rx);
// return;
// }
if (do_common == 1) {
Yk = 0;
if (pdcch_vars[eNB_id]->searchSpace[s].searchSpaceType.common_dci_formats == cformat2_0) {
// for dci_format_2_0, the nb_candidates is obtained from a different variable
switch (L2) {
case 1:
nb_candidates = pdcch_vars[eNB_id]->searchSpace[s].searchSpaceType.sfi_nrofCandidates_aggrlevel1;
break;
case 2:
nb_candidates = pdcch_vars[eNB_id]->searchSpace[s].searchSpaceType.sfi_nrofCandidates_aggrlevel2;
break;
case 4:
nb_candidates = pdcch_vars[eNB_id]->searchSpace[s].searchSpaceType.sfi_nrofCandidates_aggrlevel4;
break;
case 8:
nb_candidates = pdcch_vars[eNB_id]->searchSpace[s].searchSpaceType.sfi_nrofCandidates_aggrlevel8;
break;
case 16:
nb_candidates = pdcch_vars[eNB_id]->searchSpace[s].searchSpaceType.sfi_nrofCandidates_aggrlevel16;
break;
default:
break;
}
} else if (pdcch_vars[eNB_id]->searchSpace[s].searchSpaceType.common_dci_formats == cformat2_3) {
// for dci_format_2_3, the nb_candidates is obtained from a different variable
nb_candidates = pdcch_vars[eNB_id]->searchSpace[s].searchSpaceType.srs_nrofCandidates;
} else {
nb_candidates = (L2 == 4) ? 4 : ((L2 == 8)? 2 : 1); // according to Table 10.1-1 (38.213 section 10.1)
LOG_DDD("we are in common searchSpace and nb_candidates=%u for L2=%d\n", nb_candidates, L2);
}
} else {
switch (L2) {
case 1:
nb_candidates = pdcch_vars[eNB_id]->searchSpace[s].nrofCandidates_aggrlevel1;
break;
case 2:
nb_candidates = pdcch_vars[eNB_id]->searchSpace[s].nrofCandidates_aggrlevel2;
break;
case 4:
nb_candidates = pdcch_vars[eNB_id]->searchSpace[s].nrofCandidates_aggrlevel4;
break;
case 8:
nb_candidates = pdcch_vars[eNB_id]->searchSpace[s].nrofCandidates_aggrlevel8;
break;
case 16:
nb_candidates = pdcch_vars[eNB_id]->searchSpace[s].nrofCandidates_aggrlevel16;
break;
default:
break;
}
// Find first available in ue specific search space
// according to procedure in Section 10.1 of 38.213
// compute Yk
Yk = (unsigned int) pdcch_vars[eNB_id]->crnti;
for (i = 0; i <= nr_slot_rx; i++)
Yk = (Yk * A[p%3]) % 65537;
}
LOG_DDD("L2(%d) | nCCE[%d](%d) | Yk(%u) | nb_candidates(%u)\n", L2, p, nCCE[p], Yk, nb_candidates);
// for (CCEind=0;
// CCEind<nCCE2;
// CCEind+=(1<<L)) {
// if (nb_candidates * L2 > nCCE[p])
// nb_candidates = nCCE[p] / L2;
// In the next code line there is maybe a bug. The spec is not comparing Table 10.1-2 with nb_candidates, but with total number of candidates for all s and all p
int m_p_s_L_max = (m_max_slot_pdcch_Table10_1_2[1]<=nb_candidates ? m_max_slot_pdcch_Table10_1_2[1] : nb_candidates);
if (L==4) m_p_s_L_max=1; // Table 10.1-2 is not defined for L=4
if(0 <= L && L < 4) LOG_DDD("m_max_slot_pdcch_Table10_1_2(%d)=%d\n",L,m_max_slot_pdcch_Table10_1_2[L]);
for (m = 0; m < nb_candidates; m++) {
int n_ci = 0;
if (nCCE[p] < L2) return;
LOG_DDD("debug1(%d)=nCCE[p]/L2 | nCCE[%d](%d) | L2(%d)\n",nCCE[p] / L2,p,nCCE[p],L2);
LOG_DDD("debug2(%d)=L2*m_p_s_L_max | L2(%d) | m_p_s_L_max(%d)\n",L2*m_p_s_L_max,L2,m_p_s_L_max);
CCEind = (((Yk + (uint16_t)(floor((m*nCCE[p])/(L2*m_p_s_L_max))) + n_ci) % (uint16_t)(floor(nCCE[p] / L2))) * L2);
LOG_DDD("CCEind(%u) = (((Yk(%u) + ((m(%u)*nCCE[p](%u))/(L2(%d)*m_p_s_L_max(%d)))) %% (nCCE[p] / L2)) * L2)\n",
CCEind,Yk,m,nCCE[p],L2,m_p_s_L_max);
LOG_DDD("n_candidate(m)=%u | CCEind=%u |",m,CCEind);
if (CCEind < 32)
CCEmap = CCEmap0;
else if (CCEind < 64)
CCEmap = CCEmap1;
else if (CCEind < 96)
CCEmap = CCEmap2;
else AssertFatal(1==0,"Illegal CCEind %u (Yk %u, m %u, nCCE %u, L2 %u\n", CCEind, Yk, m, nCCE[p], L2);
switch (L2) {
case 1:
CCEmap_mask = (1 << (CCEind & 0x1f));
break;
case 2:
CCEmap_mask = (3 << (CCEind & 0x1f));
break;
case 4:
CCEmap_mask = (0xf << (CCEind & 0x1f));
break;
case 8:
CCEmap_mask = (0xff << (CCEind & 0x1f));
break;
case 16:
CCEmap_mask = (0xfff << (CCEind & 0x1f));
break;
default:
LOG_E(PHY, "Illegal L2 value %d\n", L2);
//mac_xface->macphy_exit("Illegal L2\n");
return; // not reached
}
CCEmap_cand = (*CCEmap) & CCEmap_mask;
// CCE is not allocated yet
LOG_DDD("CCEmap_cand=%u \n",CCEmap_cand);
if (CCEmap_cand == 0) {
#ifdef DEBUG_DCI_DECODING
if (do_common == 1)
LOG_I(PHY,"[DCI search nPdcch %d - common] Attempting candidate %d Aggregation Level %d DCI length %d at CCE %d/%d (CCEmap %x,CCEmap_cand %x)\n",
pdcch_vars[eNB_id]->num_pdcch_symbols,m,L2,sizeof_bits,CCEind,nCCE,*CCEmap,CCEmap_mask);
else
LOG_I(PHY,"[DCI search nPdcch %d - ue spec] Attempting candidate %d Aggregation Level %d DCI length %d at CCE %d/%d (CCEmap %x,CCEmap_cand %x) format %d\n",
pdcch_vars[eNB_id]->num_pdcch_symbols,m,L2,sizeof_bits,CCEind,nCCE,*CCEmap,CCEmap_mask,format_uss);
#endif
LOG_DDD("... we enter function dci_decoding(sizeof_bits=%d L=%d) -----\n",sizeof_bits,L);
LOG_DDD("... we have to replace this part of the code by polar decoding\n");
// for (int m=0; m < (nCCE[p]*6*9*2); m++)
LOG_DDD("(polar decoding)-> polar intput (with coreset_time_dur=%d, coreset_nbr_rb=%d, p=%d, CCEind=%u): \n",
coreset_time_dur,coreset_nbr_rb,p,CCEind);
//int reg_p=0,reg_e=0;
//for (int m=0; m < (L2*6); m++){
//reg_p = (((int)floor(m/coreset_time_dur))+((m%coreset_time_dur)*(L2*6/coreset_time_dur)))*9*2;
//reg_e = m*9*2;
//for (int i=0; i<9*2; i++){
//polar_input[reg_p+i] = (pdcch_vars[eNB_id]->e_rx[((CCEind*9*6*2) + reg_e + i)]>0) ? (1.0):(-1.0);
//polar_input[reg_e+i] = (pdcch_vars[eNB_id]->e_rx[((CCEind*9*6*2) + reg_e + i)]>0) ? (1/sqrt(2)):((-1)/sqrt(2));
//printf("\t m=%d \tpolar_input[%d]=%lf <-> e_rx[%d]=%d\n",m,reg_e+i,polar_input[reg_e+i],
// ((CCEind*9*6*2) + reg_e + i),pdcch_vars[eNB_id]->e_rx[((CCEind*9*6*2) + reg_e + i)]);
//printf("\t m=%d \tpolar_input[%d]=%lf <-> e_rx[%d]=%d\n",m,reg_p+i,polar_input[reg_p+i],
// ((CCEind*9*6*2) + reg_e + i),pdcch_vars[eNB_id]->e_rx[((CCEind*9*6*2) + reg_e + i)]);
//}
//}
//#ifdef NR_PDCCH_DCI_DEBUG
//printf("\n");
//int j=0;
//uint32_t polar_hex[27] = {0};
//for (int i=0; i<L2*9*6*2; i++){2
//if ((i%32 == 0) && (i!=0)) j++;
//polar_hex[j] = (polar_hex[j]<<1) + ((polar_input[i]==-1)? 1:0);
//polar_hex[j] = polar_hex[j] + (((polar_input[i]==((-1)/sqrt(2)))?1:0)<<(i%32));
//}
//for (j=0;j<27;j++) LOG_DDD("polar_hex[%d]=%x\n",j,polar_hex[j]);
//#endif
uint64_t dci_estimation[2]= {0};
const t_nrPolar_params *currentPtrDCI=nr_polar_params(1, sizeof_bits, L2,1);
decoderState = polar_decoder_int16(&pdcch_vars[eNB_id]->e_rx[CCEind*9*6*2],
dci_estimation,
1,
currentPtrDCI);
crc = decoderState;
//crc = (crc16(&dci_decoded_output[current_thread_id][0], sizeof_bits) >> 16) ^ extract_crc(&dci_decoded_output[current_thread_id][0], sizeof_bits);
LOG_DDD("... we end function dci_decoding() with crc=%x\n",crc);
LOG_DDD("... we have to replace this part of the code by polar decoding\n");
#ifdef DEBUG_DCI_DECODING
LOG_DDD("(nr_dci_decoding_procedure0: crc =>%d\n",crc);
#endif //uint16_t tc_rnti, uint16_t int_rnti, uint16_t sfi_rnti, uint16_t tpc_pusch_rnti, uint16_t tpc_pucch_rnti, uint16_t tpc_srs__rnti
LOG_DDD("format_found=%d\n",*format_found);
LOG_DDD("crc_scrambled=%d\n",*crc_scrambled);
if (crc == crc_scrambled_values[_C_RNTI_]) {
*crc_scrambled =_c_rnti;
*format_found=1;
}
if (crc == crc_scrambled_values[_CS_RNTI_]) {
*crc_scrambled =_cs_rnti;
*format_found=1;
}
if (crc == crc_scrambled_values[_NEW_RNTI_]) {
*crc_scrambled =_new_rnti;
*format_found=1;
}
if (crc == crc_scrambled_values[_TC_RNTI_]) {
*crc_scrambled =_tc_rnti;
*format_found=_format_1_0_found;
}
if (crc == crc_scrambled_values[_P_RNTI_]) {
*crc_scrambled =_p_rnti;
*format_found=_format_1_0_found;
}
if (crc == crc_scrambled_values[_SI_RNTI_]) {
*crc_scrambled =_si_rnti;
*format_found=_format_1_0_found;
}
if (crc == crc_scrambled_values[_RA_RNTI_]) {
*crc_scrambled =_ra_rnti;
*format_found=_format_1_0_found;
}
if (crc == crc_scrambled_values[_SP_CSI_RNTI_]) {
*crc_scrambled =_sp_csi_rnti;
*format_found=_format_0_1_found;
}
if (crc == crc_scrambled_values[_SFI_RNTI_]) {
*crc_scrambled =_sfi_rnti;
*format_found=_format_2_0_found;
}
if (crc == crc_scrambled_values[_INT_RNTI_]) {
*crc_scrambled =_int_rnti;
*format_found=_format_2_1_found;
}
if (crc == crc_scrambled_values[_TPC_PUSCH_RNTI_]) {
*crc_scrambled =_tpc_pusch_rnti;
*format_found=_format_2_2_found;
}
if (crc == crc_scrambled_values[_TPC_PUCCH_RNTI_]) {
*crc_scrambled =_tpc_pucch_rnti;
*format_found=_format_2_2_found;
}
if (crc == crc_scrambled_values[_TPC_SRS_RNTI_]) {
*crc_scrambled =_tpc_srs_rnti;
*format_found=_format_2_3_found;
}
LOG_DDD("format_found=%d\n",*format_found);
LOG_DDD("crc_scrambled=%d\n",*crc_scrambled);
if (*format_found!=255) {
dci_alloc[*dci_cnt].dci_length = sizeof_bits;
dci_alloc[*dci_cnt].rnti = crc;
dci_alloc[*dci_cnt].L = L;
dci_alloc[*dci_cnt].firstCCE = CCEind;
memcpy(&dci_alloc[*dci_cnt].dci_pdu[0],dci_estimation,8);
LOG_DDD("rnti matches -> DCI FOUND !!! crc =>0x%x, sizeof_bits %d, sizeof_bytes %d \n",
dci_alloc[*dci_cnt].rnti, dci_alloc[*dci_cnt].dci_length, sizeof_bytes);
LOG_DDD("dci_cnt %d (format_css %d crc_scrambled %d) L %d, firstCCE %d pdu[0] 0x%lx pdu[1] 0x%lx \n",
*dci_cnt, format_css,*crc_scrambled,dci_alloc[*dci_cnt].L, dci_alloc[*dci_cnt].firstCCE,dci_alloc[*dci_cnt].dci_pdu[0],dci_alloc[*dci_cnt].dci_pdu[1]);
if ((format_css == cformat0_0_and_1_0) || (format_uss == uformat0_0_and_1_0)) {
if ((*crc_scrambled == _p_rnti) || (*crc_scrambled == _si_rnti) || (*crc_scrambled == _ra_rnti)) {
dci_alloc[*dci_cnt].format = format1_0;
*dci_cnt = *dci_cnt + 1;
*format_found=_format_1_0_found;
// LOG_DDD("a format1_0=%d and dci_cnt=%d\n",*format_found,*dci_cnt);
} else {
if ((dci_estimation[0]&1) == 0) {
dci_alloc[*dci_cnt].format = format0_0;
*dci_cnt = *dci_cnt + 1;
*format_found=_format_0_0_found;
// LOG_DDD("b format0_0=%d and dci_cnt=%d\n",*format_found,*dci_cnt);
}
if ((dci_estimation[0]&1) == 1) {
dci_alloc[*dci_cnt].format = format1_0;
*dci_cnt = *dci_cnt + 1;
*format_found=_format_1_0_found;
// LOG_DDD("c format1_0=%d and dci_cnt=%d\n",*format_found,*dci_cnt);
}
}
}
if (format_css == cformat2_0) {
dci_alloc[*dci_cnt].format = format2_0;
*dci_cnt = *dci_cnt + 1;
*format_found=_format_2_0_found;
}
if (format_css == cformat2_1) {
dci_alloc[*dci_cnt].format = format2_1;
*dci_cnt = *dci_cnt + 1;
*format_found=_format_2_1_found;
}
if (format_css == cformat2_2) {
dci_alloc[*dci_cnt].format = format2_2;
*dci_cnt = *dci_cnt + 1;
*format_found=_format_2_2_found;
}
if (format_css == cformat2_3) {
dci_alloc[*dci_cnt].format = format2_3;
*dci_cnt = *dci_cnt + 1;
*format_found=_format_2_3_found;
}
if (format_uss == uformat0_1_and_1_1) {
if ((dci_estimation[0]&1) == 0) {
dci_alloc[*dci_cnt].format = format0_1;
*dci_cnt = *dci_cnt + 1;
*format_found=_format_0_1_found;
}
if ((dci_estimation[0]&1) == 1) {
dci_alloc[*dci_cnt].format = format1_1;
*dci_cnt = *dci_cnt + 1;
*format_found=_format_1_1_found;
}
}
// store first nCCE of group for PUCCH transmission of ACK/NAK
pdcch_vars[eNB_id]->nCCE[nr_slot_rx] = CCEind;
// if (crc == si_rnti) {
// dci_alloc[*dci_cnt].format = format_si;
// *dci_cnt = *dci_cnt + 1;
// } else if (crc == p_rnti) {
// dci_alloc[*dci_cnt].format = format_p;
// *dci_cnt = *dci_cnt + 1;
// } else if (crc == ra_rnti) {
// dci_alloc[*dci_cnt].format = format_ra;
// // store first nCCE of group for PUCCH transmission of ACK/NAK
// pdcch_vars[eNB_id]->nCCE[nr_slot_rx] = CCEind;
// *dci_cnt = *dci_cnt + 1;
// } else if (crc == pdcch_vars[eNB_id]->crnti) {
// if ((mode & UL_DCI) && (format_c == format0)
// && ((dci_decoded_output[current_thread_id][0] & 0x80)
// == 0)) { // check if pdu is format 0 or 1A
// if (*format0_found == 0) {
// dci_alloc[*dci_cnt].format = format0;
// *format0_found = 1;
// *dci_cnt = *dci_cnt + 1;
// pdcch_vars[eNB_id]->nCCE[nr_slot_rx] = CCEind;
// }
// } else if (format_c == format0) { // this is a format 1A DCI
// dci_alloc[*dci_cnt].format = format1A;
// *dci_cnt = *dci_cnt + 1;
// pdcch_vars[eNB_id]->nCCE[nr_slot_rx] = CCEind;
// } else {
// // store first nCCE of group for PUCCH transmission of ACK/NAK
// if (*format_c_found == 0) {
// dci_alloc[*dci_cnt].format = format_c;
// *dci_cnt = *dci_cnt + 1;
// *format_c_found = 1;
// pdcch_vars[eNB_id]->nCCE[nr_slot_rx] = CCEind;
// }
// }
// }
//LOG_I(PHY,"DCI decoding CRNTI [format: %d, nCCE[nr_slot_rx: %d]: %d ], AggregationLevel %d \n",format_c, nr_slot_rx, pdcch_vars[eNB_id]->nCCE[nr_slot_rx],L2);
// memcpy(&dci_alloc[*dci_cnt].dci_pdu[0],dci_decoded_output,sizeof_bytes);
switch (1 << L) {
case 1:
*CCEmap |= (1 << (CCEind & 0x1f));
break;
case 2:
*CCEmap |= (1 << (CCEind & 0x1f));
break;
case 4:
*CCEmap |= (1 << (CCEind & 0x1f));
break;
case 8:
*CCEmap |= (1 << (CCEind & 0x1f));
break;
case 16:
*CCEmap |= (1 << (CCEind & 0x1f));
break;
}
#ifdef DEBUG_DCI_DECODING
LOG_I(PHY,"[DCI search] Found DCI %d rnti %x Aggregation %d length %d format %d in CCE %d (CCEmap %x) candidate %d / %d \n",
*dci_cnt,crc,1<<L,sizeof_bits,dci_alloc[*dci_cnt-1].format,CCEind,*CCEmap,m,nb_candidates );
// nr_extract_dci_into(
// dump_dci(frame_parms,&dci_alloc[*dci_cnt-1]);
#endif
return;
} // rnti match
} else { // CCEmap_cand == 0
printf("\n");
}
// if ( agregationLevel != 0xFF &&
// (format_c == format0 && m==0 && si_rnti != SI_RNTI))
// {
// //Only valid for OAI : Save some processing time when looking for DCI format0. From the log we see the DCI only on candidate 0.
// return;
// }
} // candidate loop
LOG_DDD("end candidate loop\n");
}
*/
#endif
#if 0
uint8_t nr_dci_decoding_procedure(int s,
int p,
PHY_VARS_NR_UE *ue,
NR_DCI_ALLOC_t *dci_alloc,
NR_SEARCHSPACE_TYPE_t searchSpacetype,
int16_t eNB_id,
uint8_t nr_slot_rx,
uint8_t dci_fields_sizes_cnt[MAX_NR_DCI_DECODED_SLOT][NBR_NR_DCI_FIELDS][NBR_NR_FORMATS],
uint16_t n_RB_ULBWP,
uint16_t n_RB_DLBWP,
crc_scrambled_t *crc_scrambled,
format_found_t *format_found,
uint16_t crc_scrambled_values[TOTAL_NBR_SCRAMBLED_VALUES]) {
// uint8_t dci_fields_sizes[NBR_NR_DCI_FIELDS][NBR_NR_FORMATS],
LOG_DD("(nr_dci_decoding_procedure) nr_slot_rx=%d n_RB_ULBWP=%d n_RB_DLBWP=%d format_found=%d\n",
nr_slot_rx,n_RB_ULBWP,n_RB_DLBWP,*format_found);
int do_common = (int)searchSpacetype;
uint8_t dci_fields_sizes[NBR_NR_DCI_FIELDS][NBR_NR_FORMATS];
crc_scrambled_t crc_scrambled_ = *crc_scrambled;
format_found_t format_found_ = *format_found;
uint8_t dci_cnt = 0, old_dci_cnt = 0;
uint32_t CCEmap0 = 0, CCEmap1 = 0, CCEmap2 = 0;
NR_UE_PDCCH **pdcch_vars = ue->pdcch_vars[ue->current_thread_id[nr_slot_rx]];
NR_UE_PDCCH *pdcch_vars2 = ue->pdcch_vars[ue->current_thread_id[nr_slot_rx]][eNB_id];
uint16_t pdcch_DMRS_scrambling_id = pdcch_vars2->coreset[p].pdcchDMRSScramblingID;
uint64_t coreset_freq_dom = pdcch_vars2->coreset[p].frequencyDomainResources;
int coreset_time_dur = pdcch_vars2->coreset[p].duration;
uint16_t coreset_nbr_rb=0;
for (int i = 0; i < 45; i++) {
// this loop counts each bit of the bit map coreset_freq_dom, and increments nbr_RB_coreset for each bit set to '1'
if (((coreset_freq_dom & 0x1FFFFFFFFFFF) >> i) & 0x1) coreset_nbr_rb++;
}
coreset_nbr_rb = 6 * coreset_nbr_rb;
// coreset_time_dur,coreset_nbr_rb,
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
//uint8_t mi;// = get_mi(&ue->frame_parms, nr_slot_rx);
//uint8_t tmode = ue->transmission_mode[eNB_id];
//uint8_t frame_type = frame_parms->frame_type;
uint8_t format_0_0_1_0_size_bits = 0, format_0_0_1_0_size_bytes = 0; //FIXME
uint8_t format_0_1_1_1_size_bits = 0, format_0_1_1_1_size_bytes = 0; //FIXME
uint8_t format_2_0_size_bits = 0, format_2_0_size_bytes = 0; //FIXME
uint8_t format_2_1_size_bits = 0, format_2_1_size_bytes = 0; //FIXME
uint8_t format_2_2_size_bits = 0, format_2_2_size_bytes = 0; //FIXME
uint8_t format_2_3_size_bits = 0, format_2_3_size_bytes = 0; //FIXME
/*
*
* The implementation of this function will depend on the information given by the searchSpace IE
*
* In LTE the UE has no knowledge about:
* - the type of search (common or ue-specific)
* - the DCI format it is going to be decoded when performing the PDCCH monitoring
* So the blind decoding has to be done for common and ue-specific searchSpaces for each aggregation level and for each dci format
*
* In NR the UE has a knowledge about the search Space type and the DCI format it is going to be decoded,
* so in the blind decoding we can call the function nr_dci_decoding_procedure0 with the searchSpace type and the dci format parameter
* We will call this function as many times as aggregation levels indicated in searchSpace
* Implementation according to 38.213 v15.1.0 Section 10.
*
*/
NR_UE_SEARCHSPACE_CSS_DCI_FORMAT_t css_dci_format = pdcch_vars2->searchSpace[s].searchSpaceType.common_dci_formats; //FIXME!!!
NR_UE_SEARCHSPACE_USS_DCI_FORMAT_t uss_dci_format = pdcch_vars2->searchSpace[s].searchSpaceType.ue_specific_dci_formats; //FIXME!!!
// The following initialization is only for test purposes. To be removed
// NR_UE_SEARCHSPACE_CSS_DCI_FORMAT_t
css_dci_format = cformat0_0_and_1_0;
//NR_UE_SEARCHSPACE_USS_DCI_FORMAT_t
uss_dci_format = uformat0_0_and_1_0;
/*
* Possible overlap between RE for SS/PBCH blocks (described in section 10, 38.213) has not been implemented yet
* This can be implemented by setting variable 'mode = NO_DCI' when overlap occurs
*/
//dci_detect_mode_t mode = 3; //dci_detect_mode_select(&ue->frame_parms, nr_slot_rx);
LOG_DD("searSpaceType=%d\n",do_common);
LOG_DD("%s_dci_format=%d\n",do_common?"uss":"css",css_dci_format);
// A set of PDCCH candidates for a UE to monitor is defined in terms of PDCCH search spaces
if (do_common==0) { // COMMON SearchSpaceType assigned to current SearchSpace/CORESET
// Type0-PDCCH common search space for a DCI format with CRC scrambled by a SI-RNTI
// number of consecutive resource blocks and a number of consecutive symbols for
// the control resource set of the Type0-PDCCH common search space from
// the four most significant bits of RMSI-PDCCH-Config as described in Tables 13-1 through 13-10
// and determines PDCCH monitoring occasions
// from the four least significant bits of RMSI-PDCCH-Config,
// included in MasterInformationBlock, as described in Tables 13-11 through 13-15
// Type0A-PDCCH common search space for a DCI format with CRC scrambled by a SI-RNTI
// Type1-PDCCH common search space for a DCI format with CRC scrambled by a RA-RNTI, or a TC-RNTI, or a C-RNTI
// Type2-PDCCH common search space for a DCI format with CRC scrambled by a P-RNTI
if (css_dci_format == cformat0_0_and_1_0) {
// 38.213 v15.1.0 Table 10.1-1: CCE aggregation levels and maximum number of PDCCH candidates per CCE
// aggregation level for Type0/Type0A/Type2-PDCCH common search space
// CCE Aggregation Level Number of Candidates
// 4 4
// 8 2
// 16 1
// FIXME
// We shall consider Table 10.1-1 to calculate the blind decoding only for Type0/Type0A/Type2-PDCCH
// Shall we consider the nrofCandidates in SearSpace IE that considers Aggregation Levels 1,2,4,8,16? Our implementation considers Table 10.1-1
// blind decoding (Type0-PDCCH,Type0A-PDCCH,Type1-PDCCH,Type2-PDCCH)
// for format0_0 => we are NOT implementing format0_0 for common search spaces. FIXME!
// for format0_0 and format1_0, first we calculate dci pdu size
format_0_0_1_0_size_bits = nr_dci_format_size(ue,eNB_id,nr_slot_rx,p,_c_rnti,n_RB_ULBWP,n_RB_DLBWP,dci_fields_sizes,0);
format_0_0_1_0_size_bytes = (format_0_0_1_0_size_bits%8 == 0) ? (uint8_t)floor(format_0_0_1_0_size_bits/8) : (uint8_t)(floor(format_0_0_1_0_size_bits/8) + 1);
LOG_DD("calculating dci format size for common searchSpaces with format css_dci_format=%d, format_0_0_1_0_size_bits=%d, format_0_0_1_0_size_bytes=%d\n",
css_dci_format,format_0_0_1_0_size_bits,format_0_0_1_0_size_bytes);
for (int aggregationLevel = 0; aggregationLevel<5 ; aggregationLevel++) { // We fix aggregationLevel to 3 for testing=> nbr of CCE=8
//for (int aggregationLevel = 2; aggregationLevel<5 ; aggregationLevel++) {
// for aggregation level aggregationLevel. The number of candidates (for L2= 2^aggregationLevel) will be calculated in function nr_dci_decoding_procedure0
LOG_DD("common searchSpaces with format css_dci_format=%d and aggregation_level=%d\n",
css_dci_format,(1<<aggregationLevel));
old_dci_cnt = dci_cnt;
nr_dci_decoding_procedure0(s,p,coreset_time_dur,coreset_nbr_rb,pdcch_vars, 1, nr_slot_rx, dci_alloc, eNB_id, ue->current_thread_id[nr_slot_rx], frame_parms,
crc_scrambled_values, aggregationLevel,
cformat0_0_and_1_0, uformat0_0_and_1_0,
format_0_0_1_0_size_bits, format_0_0_1_0_size_bytes, &dci_cnt,
&crc_scrambled_, &format_found_, pdcch_DMRS_scrambling_id,&CCEmap0, &CCEmap1, &CCEmap2);
if (dci_cnt != old_dci_cnt) {
// we will exit the loop as we have found the DCI
aggregationLevel = 5;
format_0_0_1_0_size_bits = nr_dci_format_size(ue,eNB_id,nr_slot_rx,p,crc_scrambled_,n_RB_ULBWP,n_RB_DLBWP,dci_fields_sizes,
0); // after decoding dci successfully we recalculate dci pdu size with correct crc scrambled to get the right field sizes
old_dci_cnt = dci_cnt;
for (int i=0; i<NBR_NR_DCI_FIELDS; i++)
for (int j=0; j<NBR_NR_FORMATS; j++)
dci_fields_sizes_cnt[dci_cnt-1][i][j]=dci_fields_sizes[i][j];
}
}
}
// Type3-PDCCH common search space for a DCI format with CRC scrambled by INT-RNTI, or SFI-RNTI,
// or TPC-PUSCH-RNTI, or TPC-PUCCH-RNTI, or TPC-SRS-RNTI, or C-RNTI, or CS-RNTI(s), or SP-CSI-RNTI
if (css_dci_format == cformat2_0) {
// for format2_0, first we calculate dci pdu size
format_2_0_size_bits = nr_dci_format_size(ue,eNB_id,nr_slot_rx,p,_sfi_rnti,n_RB_ULBWP,n_RB_DLBWP,dci_fields_sizes,4);
format_2_0_size_bytes = (format_2_0_size_bits%8 == 0) ? (uint8_t)floor(format_2_0_size_bits/8) : (uint8_t)(floor(format_2_0_size_bits/8) + 1);
LOG_DD("calculating dci format size for common searchSpaces with format css_dci_format=%d, format2_0_size_bits=%d, format2_0_size_bytes=%d\n",
css_dci_format,format_2_0_size_bits,format_2_0_size_bytes);
for (int aggregationLevelSFI = 0; aggregationLevelSFI<5 ; aggregationLevelSFI++) {
LOG_DD("common searchSpaces with format css_dci_format=%d and aggregation_level=%d\n",
css_dci_format,(1<<aggregationLevelSFI));
// for aggregation level 'aggregationLevelSFI'. The number of candidates (nrofCandidates-SFI) will be calculated in function nr_dci_decoding_procedure0
old_dci_cnt = dci_cnt;
nr_dci_decoding_procedure0(s,p,coreset_time_dur,coreset_nbr_rb,pdcch_vars, 1, nr_slot_rx, dci_alloc, eNB_id, ue->current_thread_id[nr_slot_rx], frame_parms,
crc_scrambled_values, aggregationLevelSFI,
cformat2_0, uformat0_0_and_1_0,
format_2_0_size_bits, format_2_0_size_bytes, &dci_cnt,
&crc_scrambled_, &format_found_,pdcch_DMRS_scrambling_id, &CCEmap0, &CCEmap1, &CCEmap2);
if (dci_cnt != old_dci_cnt) {
// we will exit the loop as we have found the DCI
aggregationLevelSFI = 5;
old_dci_cnt = dci_cnt;
for (int i=0; i<NBR_NR_DCI_FIELDS; i++)
for (int j=0; j<NBR_NR_FORMATS; j++)
dci_fields_sizes_cnt[dci_cnt-1][i][j]=dci_fields_sizes[i][j];
}
}
}
if (css_dci_format == cformat2_1) {
// for format2_1, first we calculate dci pdu size
format_2_1_size_bits = nr_dci_format_size(ue,eNB_id,nr_slot_rx,p,_int_rnti,n_RB_ULBWP,n_RB_DLBWP,dci_fields_sizes,5);
format_2_1_size_bytes = (format_2_1_size_bits%8 == 0) ? (uint8_t)floor(format_2_1_size_bits/8) : (uint8_t)(floor(format_2_1_size_bits/8) + 1);
LOG_DD("calculating dci format size for common searchSpaces with format css_dci_format=%d, format2_1_size_bits=%d, format2_1_size_bytes=%d\n",
css_dci_format,format_2_1_size_bits,format_2_1_size_bytes);
for (int aggregationLevel = 0; aggregationLevel<5 ; aggregationLevel++) {
LOG_DD("common searchSpaces with format css_dci_format=%d and aggregation_level=%d\n",
css_dci_format,(1<<aggregationLevel));
// for aggregation level 'aggregationLevelSFI'. The number of candidates (nrofCandidates-SFI) will be calculated in function nr_dci_decoding_procedure0
old_dci_cnt = dci_cnt;
nr_dci_decoding_procedure0(s,p,coreset_time_dur,coreset_nbr_rb,pdcch_vars, 1, nr_slot_rx, dci_alloc, eNB_id, ue->current_thread_id[nr_slot_rx], frame_parms,
crc_scrambled_values, aggregationLevel,
cformat2_1, uformat0_0_and_1_0,
format_2_1_size_bits, format_2_1_size_bytes, &dci_cnt,
&crc_scrambled_, &format_found_,pdcch_DMRS_scrambling_id, &CCEmap0, &CCEmap1, &CCEmap2);
if (dci_cnt != old_dci_cnt) {
// we will exit the loop as we have found the DCI
aggregationLevel = 5;
old_dci_cnt = dci_cnt;
for (int i=0; i<NBR_NR_DCI_FIELDS; i++)
for (int j=0; j<NBR_NR_FORMATS; j++)
dci_fields_sizes_cnt[dci_cnt-1][i][j]=dci_fields_sizes[i][j];
}
}
}
if (css_dci_format == cformat2_2) {
// for format2_2, first we calculate dci pdu size
format_2_2_size_bits = nr_dci_format_size(ue,eNB_id,nr_slot_rx,p,_tpc_pucch_rnti,n_RB_ULBWP,n_RB_DLBWP,dci_fields_sizes,6);
format_2_2_size_bytes = (format_2_2_size_bits%8 == 0) ? (uint8_t)floor(format_2_2_size_bits/8) : (uint8_t)(floor(format_2_2_size_bits/8) + 1);
LOG_DD("calculating dci format size for common searchSpaces with format css_dci_format=%d, format2_2_size_bits=%d, format2_2_size_bytes=%d\n",
css_dci_format,format_2_2_size_bits,format_2_2_size_bytes);
for (int aggregationLevel = 0; aggregationLevel<5 ; aggregationLevel++) {
LOG_DD("common searchSpaces with format css_dci_format=%d and aggregation_level=%d\n",
css_dci_format,(1<<aggregationLevel));
// for aggregation level 'aggregationLevelSFI'. The number of candidates (nrofCandidates-SFI) will be calculated in function nr_dci_decoding_procedure0
old_dci_cnt = dci_cnt;
nr_dci_decoding_procedure0(s,p,coreset_time_dur,coreset_nbr_rb,pdcch_vars, 1, nr_slot_rx, dci_alloc, eNB_id, ue->current_thread_id[nr_slot_rx], frame_parms,
crc_scrambled_values, aggregationLevel,
cformat2_2, uformat0_0_and_1_0,
format_2_2_size_bits, format_2_2_size_bytes, &dci_cnt,
&crc_scrambled_, &format_found_,pdcch_DMRS_scrambling_id, &CCEmap0, &CCEmap1, &CCEmap2);
if (dci_cnt != old_dci_cnt) {
// we will exit the loop as we have found the DCI
aggregationLevel = 5;
old_dci_cnt = dci_cnt;
for (int i=0; i<NBR_NR_DCI_FIELDS; i++)
for (int j=0; j<NBR_NR_FORMATS; j++)
dci_fields_sizes_cnt[dci_cnt-1][i][j]=dci_fields_sizes[i][j];
}
}
}
if (css_dci_format == cformat2_3) {
// for format2_1, first we calculate dci pdu size
format_2_3_size_bits = nr_dci_format_size(ue,eNB_id,nr_slot_rx,p,_tpc_srs_rnti,n_RB_ULBWP,n_RB_DLBWP,dci_fields_sizes,7);
format_2_3_size_bytes = (format_2_3_size_bits%8 == 0) ? (uint8_t)floor(format_2_3_size_bits/8) : (uint8_t)(floor(format_2_3_size_bits/8) + 1);
LOG_DD("calculating dci format size for common searchSpaces with format css_dci_format=%d, format2_3_size_bits=%d, format2_3_size_bytes=%d\n",
css_dci_format,format_2_3_size_bits,format_2_3_size_bytes);
for (int aggregationLevel = 0; aggregationLevel<5 ; aggregationLevel++) {
LOG_DD("common searchSpaces with format css_dci_format=%d and aggregation_level=%d\n",
css_dci_format,(1<<aggregationLevel));
// for aggregation level 'aggregationLevelSFI'. The number of candidates (nrofCandidates-SFI) will be calculated in function nr_dci_decoding_procedure0
old_dci_cnt = dci_cnt;
nr_dci_decoding_procedure0(s,p,coreset_time_dur,coreset_nbr_rb,pdcch_vars, 1, nr_slot_rx, dci_alloc, eNB_id, ue->current_thread_id[nr_slot_rx], frame_parms,
crc_scrambled_values, aggregationLevel,
cformat2_3, uformat0_0_and_1_0,
format_2_3_size_bits, format_2_3_size_bytes, &dci_cnt,
&crc_scrambled_, &format_found_,pdcch_DMRS_scrambling_id, &CCEmap0, &CCEmap1, &CCEmap2);
if (dci_cnt != old_dci_cnt) {
// we will exit the loop as we have found the DCI
aggregationLevel = 5;
old_dci_cnt = dci_cnt;
for (int i=0; i<NBR_NR_DCI_FIELDS; i++)
for (int j=0; j<NBR_NR_FORMATS; j++)
dci_fields_sizes_cnt[dci_cnt-1][i][j]=dci_fields_sizes[i][j];
}
}
}
} else { // UE-SPECIFIC SearchSpaceType assigned to current SearchSpace/CORESET
// UE-specific search space for a DCI format with CRC scrambled by C-RNTI, or CS-RNTI(s), or SP-CSI-RNTI
if (uss_dci_format == uformat0_0_and_1_0) {
// for format0_0 and format1_0, first we calculate dci pdu size
format_0_0_1_0_size_bits = nr_dci_format_size(ue,eNB_id,nr_slot_rx,p,_c_rnti,n_RB_ULBWP,n_RB_DLBWP,dci_fields_sizes,0);
format_0_0_1_0_size_bytes = (format_0_0_1_0_size_bits%8 == 0) ? (uint8_t)floor(format_0_0_1_0_size_bits/8) : (uint8_t)(floor(format_0_0_1_0_size_bits/8) + 1);
LOG_DD("calculating dci format size for UE-specific searchSpaces with format uss_dci_format=%d, format_0_0_1_0_size_bits=%d, format_0_0_1_0_size_bytes=%d\n",
css_dci_format,format_0_0_1_0_size_bits,format_0_0_1_0_size_bytes);
for (int aggregationLevel = 0; aggregationLevel<5 ; aggregationLevel++) { // We fix aggregationLevel to 3 for testing=> nbr of CCE=8
//for (int aggregationLevel = 2; aggregationLevel<5 ; aggregationLevel++) {
// for aggregation level aggregationLevel. The number of candidates (for L2= 2^aggregationLevel) will be calculated in function nr_dci_decoding_procedure0
LOG_DD("common searchSpaces with format css_dci_format=%d and aggregation_level=%d\n",
css_dci_format,(1<<aggregationLevel));
old_dci_cnt = dci_cnt;
nr_dci_decoding_procedure0(s,p,coreset_time_dur,coreset_nbr_rb,pdcch_vars, 0, nr_slot_rx, dci_alloc, eNB_id, ue->current_thread_id[nr_slot_rx], frame_parms,
crc_scrambled_values, aggregationLevel,
cformat0_0_and_1_0, uformat0_0_and_1_0,
format_0_0_1_0_size_bits, format_0_0_1_0_size_bytes, &dci_cnt,
&crc_scrambled_, &format_found_,pdcch_DMRS_scrambling_id, &CCEmap0, &CCEmap1, &CCEmap2);
if (dci_cnt != old_dci_cnt) {
// we will exit the loop as we have found the DCI
aggregationLevel = 5;
old_dci_cnt = dci_cnt;
for (int i=0; i<NBR_NR_DCI_FIELDS; i++)
for (int j=0; j<NBR_NR_FORMATS; j++)
dci_fields_sizes_cnt[dci_cnt-1][i][j]=dci_fields_sizes[i][j];
}
}
}
if (uss_dci_format == uformat0_1_and_1_1) {
// for format0_0 and format1_0, first we calculate dci pdu size
format_0_1_1_1_size_bits = nr_dci_format_size(ue,eNB_id,nr_slot_rx,p,_c_rnti,n_RB_ULBWP,n_RB_DLBWP,dci_fields_sizes,1);
format_0_1_1_1_size_bytes = (format_0_1_1_1_size_bits%8 == 0) ? (uint8_t)floor(format_0_1_1_1_size_bits/8) : (uint8_t)(floor(format_0_1_1_1_size_bits/8) + 1);
LOG_DD("calculating dci format size for UE-specific searchSpaces with format uss_dci_format=%d, format_0_1_1_1_size_bits=%d, format_0_1_1_1_size_bytes=%d\n",
css_dci_format,format_0_1_1_1_size_bits,format_0_1_1_1_size_bytes);
for (int aggregationLevel = 0; aggregationLevel<5 ; aggregationLevel++) { // We fix aggregationLevel to 3 for testing=> nbr of CCE=8
//for (int aggregationLevel = 2; aggregationLevel<5 ; aggregationLevel++) {
// for aggregation level aggregationLevel. The number of candidates (for L2= 2^aggregationLevel) will be calculated in function nr_dci_decoding_procedure0
LOG_DD("common searchSpaces with format css_dci_format=%d and aggregation_level=%d\n",
css_dci_format,(1<<aggregationLevel));
old_dci_cnt = dci_cnt;
nr_dci_decoding_procedure0(s,p,coreset_time_dur,coreset_nbr_rb,pdcch_vars, 0, nr_slot_rx, dci_alloc, eNB_id, ue->current_thread_id[nr_slot_rx], frame_parms,
crc_scrambled_values, aggregationLevel,
cformat0_0_and_1_0, uformat0_1_and_1_1,
format_0_1_1_1_size_bits, format_0_1_1_1_size_bytes, &dci_cnt,
&crc_scrambled_, &format_found_,pdcch_DMRS_scrambling_id, &CCEmap0, &CCEmap1, &CCEmap2);
if (dci_cnt != old_dci_cnt) {
// we will exit the loop as we have found the DCI
aggregationLevel = 5;
old_dci_cnt = dci_cnt;
for (int i=0; i<NBR_NR_DCI_FIELDS; i++)
for (int j=0; j<NBR_NR_FORMATS; j++)
dci_fields_sizes_cnt[dci_cnt-1][i][j]=dci_fields_sizes[i][j];
}
}
}
}
*crc_scrambled = crc_scrambled_;
*format_found = format_found_;
LOG_DD("at the end crc_scrambled=%d and format_found=%d\n",*crc_scrambled,*format_found);
LOG_DD("at the end dci_cnt=%d \n",dci_cnt);
return(dci_cnt);
}
#endif
-6
View File
@@ -33,13 +33,7 @@
#ifndef __PHY_NR_UE_TRANSPORT_DCI_NR__H__
#define __PHY_NR_UE_TRANSPORT_DCI_NR__H__
#ifndef USER_MODE
#include "PHY/types.h"
#else
#include <stdint.h>
#endif
#define MAX_DCI_SIZE_BITS 45
@@ -43,12 +43,6 @@
#include "PHY/NR_REFSIG/dmrs_nr.h"
#include "common/utils/nr/nr_common.h"
#ifndef USER_MODE
#define NOCYGWIN_STATIC static
#else
#define NOCYGWIN_STATIC
#endif
/* dynamic shift for LLR computation for TM3/4
* set as command line argument, see lte-softmodem.c
* default value: 0
-2
View File
@@ -40,9 +40,7 @@
//#define DEBUG_PBCH
//#define DEBUG_PBCH_ENCODING
#ifdef OPENAIR2
//#include "PHY_INTERFACE/defs.h"
#endif
#define PBCH_A 24
-16
View File
@@ -69,18 +69,12 @@ void reset_stats(FL_OBJECT *button, long arg) {
static void *scope_thread_eNB(void *arg) {
# ifdef ENABLE_XFORMS_WRITE_STATS
FILE *eNB_stats;
# endif
struct sched_param sched_param;
int UE_id, CC_id;
int ue_cnt=0;
sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1;
sched_setscheduler(0, SCHED_FIFO,&sched_param);
printf("Scope thread has priority %d\n",sched_param.sched_priority);
# ifdef ENABLE_XFORMS_WRITE_STATS
eNB_stats = fopen("eNB_stats.txt", "w");
#endif
while (!oai_exit) {
ue_cnt=0;
@@ -99,16 +93,6 @@ static void *scope_thread_eNB(void *arg) {
usleep(100*1000);
}
// printf("%s",stats_buffer);
# ifdef ENABLE_XFORMS_WRITE_STATS
if (eNB_stats) {
rewind (eNB_stats);
fwrite (stats_buffer, 1, len, eNB_stats);
fclose (eNB_stats);
}
# endif
pthread_exit((void *)arg);
}
-16
View File
@@ -72,16 +72,10 @@ void reset_stats(FL_OBJECT *button, long arg) {
static void *scope_thread_UE(void *arg) {
char stats_buffer[16384];
# ifdef ENABLE_XFORMS_WRITE_STATS
FILE *UE_stats, *eNB_stats;
# endif
struct sched_param sched_param;
sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1;
sched_setscheduler(0, SCHED_FIFO,&sched_param);
printf("Scope thread has priority %d\n",sched_param.sched_priority);
# ifdef ENABLE_XFORMS_WRITE_STATS
UE_stats = fopen("UE_stats.txt", "w");
#endif
while (!oai_exit) {
// dump_ue_stats (PHY_vars_UE_g[0][0], &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0],stats_buffer, 0, mode,rx_input_level_dBm);
@@ -94,16 +88,6 @@ static void *scope_thread_UE(void *arg) {
0,7);
// printf("%s",stats_buffer);
}
# ifdef ENABLE_XFORMS_WRITE_STATS
if (UE_stats) {
rewind (UE_stats);
fwrite (stats_buffer, 1, len, UE_stats);
fclose (UE_stats);
}
# endif
pthread_exit((void *)arg);
}
-3
View File
@@ -517,9 +517,6 @@ void phy_scope_gNB(OAI_phy_scope_t *form,
}
static void *scope_thread_gNB(void *arg) {
scopeData_t *p=(scopeData_t *) arg;
//# ifdef ENABLE_XFORMS_WRITE_STATS
// FILE *gNB_stats = fopen("gNB_stats.txt", "w");
//#endif
size_t stksize=0;
pthread_attr_t atr;
pthread_attr_init(&atr);
-17
View File
@@ -48,7 +48,6 @@
#ifdef MEX
#define msg mexPrintf
#else
#ifdef OPENAIR2
#if ENABLE_RAL
#include "collection/hashtable/hashtable.h"
#include "COMMON/ral_messages_types.h"
@@ -56,9 +55,6 @@
#endif
#include "common/utils/LOG/log.h"
#define msg(aRGS...) LOG_D(PHY, ##aRGS)
#else
#define msg printf
#endif
#endif
//use msg in the real-time thread context
#define msg_nrt printf
@@ -196,19 +192,6 @@ typedef struct {
NB_IoT_UE_DLSCH_t *dlsch_rn_MCH[10];
} PHY_VARS_RN_NB_IoT;
/*
#ifdef OCP_FRAMEWORK
#include <enums.h>
#else
//typedef enum {normal_txrx=0,rx_calib_ue=1,rx_calib_ue_med=2,rx_calib_ue_byp=3,debug_prach=4,no_L2_connect=5,calib_prach_tx=6,rx_dump_frame=7,loop_through_memory=8} runmode_t;
*/
// enum transmission_access_mode {
// NO_ACCESS=0,
// POSTPONED_ACCESS,
// CANCELED_ACCESS,
// UNKNOWN_ACCESS,
// SCHEDULED_ACCESS,
// CBA_ACCESS};
typedef enum {
eNodeB_3GPP_NB_IoT=0, // classical eNodeB function
-4
View File
@@ -87,7 +87,6 @@
#define LOG_W(x, ...) mexPrintf(__VA_ARGS__)
#define LOG_M(x, ...) mexPrintf(__VA_ARGS__)
#else
#ifdef OPENAIR2
#if ENABLE_RAL
#include "collection/hashtable/hashtable.h"
#include "COMMON/ral_messages_types.h"
@@ -95,9 +94,6 @@
#endif
#include "common/utils/LOG/log.h"
#define msg(aRGS...) LOG_D(PHY, ##aRGS)
#else
#define msg printf
#endif
#endif
-4
View File
@@ -51,16 +51,12 @@
#ifdef MEX
#define msg mexPrintf
#else
#ifdef OPENAIR2
#if ENABLE_RAL
#include "common/utils/hashtable/hashtable.h"
#include "COMMON/ral_messages_types.h"
#include "UTIL/queue.h"
#endif
#define msg(aRGS...) LOG_D(PHY, ##aRGS)
#else
#define msg printf
#endif
#endif
//use msg in the real-time thread context
#define msg_nrt printf
-6
View File
@@ -55,12 +55,6 @@ extern char mode_string[4][20];
extern unsigned char NB_RU;
#ifndef OPENAIR2
extern unsigned char NB_eNB_INST;
extern uint16_t NB_UE_INST;
extern unsigned char NB_RN_INST;
#endif
extern int flag_LA;
extern double sinr_bler_map[MCS_COUNT][2][MCS_TABLE_LENGTH_MAX];
extern double sinr_bler_map_up[MCS_COUNT][2][16];
-6
View File
@@ -63,12 +63,6 @@ extern char mode_string[4][20];
extern unsigned char NB_RU;
#ifndef OPENAIR2
extern unsigned char NB_eNB_INST;
extern uint16_t NB_UE_INST;
extern unsigned char NB_RN_INST;
#endif
extern int flag_LA;
extern double sinr_bler_map[MCS_COUNT][2][MCS_TABLE_LENGTH_MAX];
extern double sinr_bler_map_up[MCS_COUNT][2][16];
-6
View File
@@ -53,12 +53,6 @@ extern int flagMag;
extern char mode_string[4][20];
#ifndef OPENAIR2
extern unsigned char NB_eNB_INST;
extern uint16_t NB_UE_INST;
extern unsigned char NB_RN_INST;
#endif
extern int flag_LA;
extern double sinr_bler_map[MCS_COUNT][2][MCS_TABLE_LENGTH_MAX];
extern double sinr_bler_map_up[MCS_COUNT][2][16];
-7
View File
@@ -55,13 +55,6 @@ const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
unsigned char NB_RU=0;
#ifndef OPENAIR2
//unsigned char NB_eNB_INST=0;
//uint16_t NB_UE_INST=0;
//unsigned char NB_RN_INST=0;
//unsigned char NB_INST=0;
#endif
int number_of_cards;
-7
View File
@@ -57,13 +57,6 @@ const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
unsigned char NB_RU=0;
#ifndef OPENAIR2
unsigned char NB_eNB_INST=0;
uint16_t NB_UE_INST=0;
unsigned char NB_RN_INST=0;
unsigned char NB_INST=0;
#endif
int number_of_cards;
-8
View File
@@ -47,14 +47,6 @@ const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
#include "SIMULATION/ETH_TRANSPORT/vars.h"
#ifndef OPENAIR2
unsigned char NB_eNB_INST=0;
uint16_t NB_UE_INST=0;
unsigned char NB_RN_INST=0;
unsigned char NB_INST=0;
#endif
int number_of_cards;
-5
View File
@@ -22,11 +22,6 @@
#ifndef __openair_TYPES_NB_IOT_H__
#define __openair_TYPES_NB_IOT_H__
#ifdef USER_MODE
#include <stdint.h>
#else
#include <linux/types.h>
#endif
#endif /*__openair_TYPES_NB_IOT_H__ */
+1 -1
View File
@@ -44,4 +44,4 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response);
int8_t nr_ue_phy_config_request(nr_phy_config_t *phy_config);
#endif
#endif
+4 -4
View File
@@ -19,10 +19,10 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<string.h>
#include<gpib/ib.h>
#include"gpib_send.h"
#include <stdio.h>
#include <string.h>
#include <gpib/ib.h>
#include "gpib_send.h"
void gpib_send(unsigned int gpib_board, unsigned int gpib_device, char *command_string )
{
unsigned short addlist[2] = {gpib_device, NOADDR};