Commit d3478a9f authored by Raphael Defosseux's avatar Raphael Defosseux

Merge remote-tracking branch 'origin/472-add-pusch-dmrs-modes' into integration-develop-nr-2020w03

parents c82fd2e4 7de6a7f2
......@@ -1478,6 +1478,7 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_dmrs_rx.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/dmrs_nr.c
${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/filt16a_32.c
${OPENAIR1_DIR}/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c
${OPENAIR1_DIR}/PHY/NR_ESTIMATION/nr_adjust_sync_gNB.c
......@@ -1506,7 +1507,6 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/pss_nr.c
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/sss_nr.c
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/cic_filter_nr.c
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/dmrs_nr.c
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_pbch.c
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
......@@ -1524,6 +1524,7 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/ul_ref_seq_nr.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_dmrs_rx.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/dmrs_nr.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold_ue.c
${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/filt16a_32.c
${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
......
......@@ -386,7 +386,7 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
nb_rb = 50;
start_rb = 0;
nb_symb_sch = 12;
start_symbol = 2;
start_symbol = 0;
precod_nbr_layers = 1;
mcs = 9;
harq_pid = 0;
......@@ -739,7 +739,7 @@ void *UE_thread(void *arg) {
readBlockSize,
UE->frame_parms.nb_antennas_rx),"");
if (slot_nr==18)
if (slot_nr == (20+NR_UPLINK_SLOT-DURATION_RX_TO_TX - 1)%20)
AssertFatal( writeBlockSize ==
UE->rfdevice.trx_write_func(&UE->rfdevice,
timestamp+
......@@ -749,7 +749,19 @@ if (slot_nr==18)
txp,
writeBlockSize,
UE->frame_parms.nb_antennas_tx,
4),"");
2),"");
if (slot_nr == (20+NR_UPLINK_SLOT-DURATION_RX_TO_TX)%20)
AssertFatal( writeBlockSize ==
UE->rfdevice.trx_write_func(&UE->rfdevice,
timestamp+
(DURATION_RX_TO_TX*UE->frame_parms.samples_per_slot) -
UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0 -
openair0_cfg[0].tx_sample_advance,
txp,
writeBlockSize,
UE->frame_parms.nb_antennas_tx,
3),"");
if( slot_nr==(nb_slot_frame-1)) {
// read in first symbol of next frame and adjust for timing drift
......
......@@ -565,7 +565,7 @@ void init_openair0(void) {
} else if (numerology==1) {
if (frame_parms[0]->threequarter_fs) {
openair0_cfg[card].sample_rate=46.08e6;
openair0_cfg[card].samples_per_frame = 480800;
openair0_cfg[card].samples_per_frame = 460800;
}
else {
openair0_cfg[card].sample_rate=61.44e6;
......
......@@ -690,7 +690,6 @@ typedef struct {
uint8_t frame_offset;
uint16_t number_symbols;
uint16_t start_symbol;
uint8_t nb_re_dmrs;
uint8_t length_dmrs;
nr_pusch_freq_hopping_t pusch_freq_hopping;
uint8_t mcs;
......
......@@ -153,13 +153,25 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
}
}
//------------- config PUSCH DMRS parameters(to be updated from RRC)--------------//
gNB->dmrs_UplinkConfig.pusch_dmrs_type = pusch_dmrs_type1;
gNB->dmrs_UplinkConfig.pusch_dmrs_AdditionalPosition = pusch_dmrs_pos0;
gNB->dmrs_UplinkConfig.pusch_maxLength = pusch_len1;
//--------------------------------------------------------------------------------//
nr_init_pdsch_dmrs(gNB, cfg->sch_config.physical_cell_id.value);
// default values until overwritten by RRCConnectionReconfiguration
for (i=0;i<MAX_NR_OF_UL_ALLOCATIONS;i++){
gNB->pusch_config.pusch_TimeDomainResourceAllocation[i] = (PUSCH_TimeDomainResourceAllocation_t *)malloc16(sizeof(PUSCH_TimeDomainResourceAllocation_t));
gNB->pusch_config.pusch_TimeDomainResourceAllocation[i]->mappingType = typeB;
}
/// Transport init necessary for NR synchro
init_nr_transport(gNB);
gNB->first_run_I0_measurements =
1; ///This flag used to be static. With multiple gNBs this does no longer work, hence we put it in the structure. However it has to be initialized with 1, which is performed here.
gNB->first_run_I0_measurements = 1; ///This flag used to be static. With multiple gNBs this does no longer work, hence we put it in the structure. However it has to be initialized with 1, which is performed here.
common_vars->rxdata = (int32_t **)malloc16(15*sizeof(int32_t*));
common_vars->txdataF = (int32_t **)malloc16(15*sizeof(int32_t*));
common_vars->rxdataF = (int32_t **)malloc16(15*sizeof(int32_t*));
......@@ -507,10 +519,9 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
rel15_ul->rnti = 0x1234;
rel15_ul->ulsch_pdu_rel15.start_rb = 0;
rel15_ul->ulsch_pdu_rel15.number_rbs = 50;
rel15_ul->ulsch_pdu_rel15.start_symbol = 2;
rel15_ul->ulsch_pdu_rel15.number_symbols = 12;
rel15_ul->ulsch_pdu_rel15.nb_re_dmrs = 6;
rel15_ul->ulsch_pdu_rel15.length_dmrs = 1;
rel15_ul->ulsch_pdu_rel15.start_symbol = 0;
rel15_ul->ulsch_pdu_rel15.number_symbols = 14;
rel15_ul->ulsch_pdu_rel15.length_dmrs = gNB->dmrs_UplinkConfig.pusch_maxLength;
rel15_ul->ulsch_pdu_rel15.Qm = 2;
rel15_ul->ulsch_pdu_rel15.R = 679;
rel15_ul->ulsch_pdu_rel15.mcs = 9;
......
......@@ -702,7 +702,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
for (i=0; i<MAX_NR_OF_UL_ALLOCATIONS; i++) {
ue->pusch_config.pusch_TimeDomainResourceAllocation[i] = (PUSCH_TimeDomainResourceAllocation_t *)malloc16(sizeof(PUSCH_TimeDomainResourceAllocation_t));
ue->pusch_config.pusch_TimeDomainResourceAllocation[i]->mappingType = typeA;
ue->pusch_config.pusch_TimeDomainResourceAllocation[i]->mappingType = typeB;
}
//------------- config DMRS parameters--------------//
......
......@@ -23,6 +23,7 @@
#include <string.h>
#include "nr_ul_estimation.h"
#include "PHY/sse_intrin.h"
#include "PHY/NR_REFSIG/nr_refsig.h"
#include "PHY/NR_UE_ESTIMATION/filt16a_32.h"
......@@ -35,18 +36,19 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
unsigned short p,
unsigned char symbol,
unsigned short bwp_start_subcarrier,
unsigned short nb_rb_pusch)
unsigned short nb_rb_pusch,
dmrs_UplinkConfig_t *dmrs_UplinkConfig)
{
int pilot[3280] __attribute__((aligned(16)));
unsigned char aarx;
unsigned short k;
unsigned int pilot_cnt;
int16_t ch[2],*pil,*rxF,*ul_ch;
unsigned int pilot_cnt,re_cnt;
int16_t ch[2],ch_r[2],ch_l[2],*pil,*rxF,*ul_ch;
int16_t *fl,*fm,*fr,*fml,*fmr,*fmm,*fdcl,*fdcr,*fdclh,*fdcrh;
int ch_offset,symbol_offset, length_dmrs, UE_id = 0;
unsigned short n_idDMRS[2] = {0,1}; //to update from pusch config
int32_t temp_in_ifft_0[8192*2] __attribute__((aligned(32)));
int32_t **ul_ch_estimates_time = gNB->pusch_vars[UE_id]->ul_ch_estimates_time;
__m128i *ul_ch_128;
#ifdef DEBUG_CH
FILE *debug_ch_est;
......@@ -115,21 +117,21 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
//------------------generate DMRS------------------//
length_dmrs = 1; //to update from pusch config
length_dmrs = gNB->dmrs_UplinkConfig.pusch_maxLength;
nr_gold_pusch(gNB, symbol, n_idDMRS, length_dmrs);
nr_pusch_dmrs_rx(gNB, Ns, gNB->nr_gold_pusch[gNB_offset][Ns][0], &pilot[0], 1000, 0, nb_rb_pusch);
nr_pusch_dmrs_rx(gNB, Ns, gNB->nr_gold_pusch[gNB_offset][Ns][0], &pilot[0], 1000, 0, nb_rb_pusch, dmrs_UplinkConfig->pusch_dmrs_type);
//------------------------------------------------//
for (aarx=0; aarx<gNB->frame_parms.nb_antennas_rx; aarx++) {
pil = (int16_t *)&pilot[0];
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+nushift)];
ul_ch = (int16_t *)&ul_ch_estimates[aarx][ch_offset];
pil = (int16_t *)&pilot[0];
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+nushift)];
ul_ch = (int16_t *)&ul_ch_estimates[aarx][ch_offset];
memset(ul_ch,0,4*(gNB->frame_parms.ofdm_symbol_size));
memset(ul_ch,0,4*(gNB->frame_parms.ofdm_symbol_size));
#ifdef DEBUG_PUSCH
printf("ch est pilot addr %p RB_DL %d\n",&pilot[0], gNB->frame_parms.N_RB_UL);
......@@ -139,6 +141,9 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
#endif
//if ((gNB->frame_parms.N_RB_UL&1)==0) {
if (dmrs_UplinkConfig->pusch_dmrs_type == pusch_dmrs_type1){
// Treat first 2 pilots specially (left edge)
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
......@@ -148,6 +153,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
printf("pilot 0 : rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],&rxF[0],ch[0],ch[1],pil[0],pil[1]);
printf("data 0 : rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",rxF[2],rxF[3],&rxF[2],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(fl,
ch,
ul_ch,
......@@ -196,28 +202,33 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_CH
fprintf(debug_ch_est, "pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
//printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(fm,
#ifdef DEBUG_PUSCH
printf("pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(fml,
ch,
ul_ch,
8);
pil+=2;
re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
//printf("ul_ch addr %p\n",ul_ch);
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_PUSCH
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
#ifdef DEBUG_PUSCH
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(fmm,
ch,
ul_ch,
8);
//for (int i= 0; i<16; i++)
//printf("ul_ch addr %p %d\n", ul_ch+i, *(ul_ch+i));
pil+=2;
re_offset = (re_offset+2) % gNB->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
......@@ -332,65 +343,153 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
printf("%d\n",idxP);
}
#endif
} else { //pusch_dmrs_type2 |p_r,p_l,d,d,d,d,p_r,p_l,d,d,d,d|
// Treat first DMRS specially (left edge)
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ul_ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ul_ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
pil+=2;
ul_ch+=2;
re_offset = (re_offset + 1)%gNB->frame_parms.ofdm_symbol_size;
ch_offset++;
for (re_cnt = 1; re_cnt < (nb_rb_pusch*NR_NB_SC_PER_RB) - 5; re_cnt+=6){
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_l[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch_l[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
ul_ch[0] = ch_l[0];
ul_ch[1] = ch_l[1];
pil+=2;
ul_ch+=2;
ch_offset++;
multadd_real_four_symbols_vector_complex_scalar(filt8_ml2,
ch_l,
ul_ch);
re_offset = (re_offset+5)%gNB->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_r[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch_r[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
multadd_real_four_symbols_vector_complex_scalar(filt8_mr2,
ch_r,
ul_ch);
//for (int re_idx = 0; re_idx < 8; re_idx+=2)
//printf("ul_ch = %d + j*%d\n", ul_ch[re_idx], ul_ch[re_idx+1]);
ul_ch+=8;
ch_offset+=4;
ul_ch[0] = ch_r[0];
ul_ch[1] = ch_r[1];
pil+=2;
ul_ch+=2;
ch_offset++;
re_offset = (re_offset + 1)%gNB->frame_parms.ofdm_symbol_size;
}
// Treat last pilot specially (right edge)
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_l[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch_l[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
ul_ch[0] = ch_l[0];
ul_ch[1] = ch_l[1];
ul_ch+=2;
ch_offset++;
multadd_real_four_symbols_vector_complex_scalar(filt8_rr1,
ch_l,
ul_ch);
multadd_real_four_symbols_vector_complex_scalar(filt8_rr2,
ch_r,
ul_ch);
ul_ch_128 = (__m128i *)&ul_ch_estimates[aarx][ch_offset];
ul_ch_128[0] = _mm_slli_epi16 (ul_ch_128[0], 2);
}
// Convert to time domain
memset(temp_in_ifft_0, 0, gNB->frame_parms.ofdm_symbol_size*sizeof(int32_t));
memcpy(temp_in_ifft_0, &ul_ch_estimates[aarx][symbol_offset], nb_rb_pusch * NR_NB_SC_PER_RB * sizeof(int32_t));
switch (gNB->frame_parms.ofdm_symbol_size) {
case 128:
idft128((int16_t*) temp_in_ifft_0,
(int16_t*) ul_ch_estimates_time[aarx],
1);
break;
case 256:
idft256((int16_t*) temp_in_ifft_0,
(int16_t*) ul_ch_estimates_time[aarx],
1);
break;
case 512:
idft512((int16_t*) temp_in_ifft_0,
(int16_t*) ul_ch_estimates_time[aarx],
1);
break;
case 1024:
idft1024((int16_t*) temp_in_ifft_0,
(int16_t*) ul_ch_estimates_time[aarx],
1);
break;
case 1536:
idft1536((int16_t*) temp_in_ifft_0,
(int16_t*) ul_ch_estimates_time[aarx],
1);
break;
case 2048:
idft2048((int16_t*) temp_in_ifft_0,
(int16_t*) ul_ch_estimates_time[aarx],
1);
break;
case 4096:
idft4096((int16_t*) temp_in_ifft_0,
(int16_t*) ul_ch_estimates_time[aarx],
1);
break;
case 8192:
idft8192((int16_t*) temp_in_ifft_0,
(int16_t*) ul_ch_estimates_time[aarx],
1);
break;
default:
idft512((int16_t*) temp_in_ifft_0,
(int16_t*) ul_ch_estimates_time[aarx],
1);
break;
}
switch (gNB->frame_parms.ofdm_symbol_size) {
case 128:
idft128((int16_t*) &ul_ch_estimates[aarx][symbol_offset],
(int16_t*) ul_ch_estimates_time[aarx],
1);
break;
case 256:
idft256((int16_t*) &ul_ch_estimates[aarx][symbol_offset],
(int16_t*) ul_ch_estimates_time[aarx],
1);
break;
case 512:
idft512((int16_t*) &ul_ch_estimates[aarx][symbol_offset],
(int16_t*) ul_ch_estimates_time[aarx],
1);
break;
case 1024:
idft1024((int16_t*) &ul_ch_estimates[aarx][symbol_offset],
(int16_t*) ul_ch_estimates_time[aarx],
1);
break;
case 1536:
idft1536((int16_t*) &ul_ch_estimates[aarx][symbol_offset],
(int16_t*) ul_ch_estimates_time[aarx],
1);
break;
case 2048:
idft2048((int16_t*) &ul_ch_estimates[aarx][symbol_offset],
(int16_t*) ul_ch_estimates_time[aarx],
1);
break;
case 4096:
idft4096((int16_t*) &ul_ch_estimates[aarx][symbol_offset],
(int16_t*) ul_ch_estimates_time[aarx],
1);
break;
case 8192:
idft8192((int16_t*) &ul_ch_estimates[aarx][symbol_offset],
(int16_t*) ul_ch_estimates_time[aarx],
1);
break;
default:
idft512((int16_t*) &ul_ch_estimates[aarx][symbol_offset],
(int16_t*) ul_ch_estimates_time[aarx],
1);
break;
}
}
#ifdef DEBUG_CH
......
......@@ -45,7 +45,8 @@
unsigned short p,
unsigned char symbol,
unsigned short bwp_start_subcarrier,
unsigned short nb_rb_pusch);
unsigned short nb_rb_pusch,
dmrs_UplinkConfig_t *dmrs_UplinkConfig);
int nr_est_timing_advance_pusch(PHY_VARS_gNB* phy_vars_gNB, int UE_id);
......
......@@ -33,6 +33,147 @@
#include "PHY/NR_REFSIG/ss_pbch_nr.h"
#include "PHY/NR_REFSIG/dmrs_nr.h"
/***********************************************************************/
// TS 38.211 Table 6.4.1.1.3-3: PUSCH DMRS positions l' within a slot for single-symbol DMRS and intra-slot frequency hopping disabled.
// The first 4 colomns are PUSCH mapping type A and the last 4 colomns are PUSCH mapping type B.
// When l' = l0, it is represented by 1
// E.g. when symbol duration is 12 in colomn 7, value 1057 ('10000100001') which means l' = l0, 5, 10.
int32_t table_6_4_1_1_3_3_pusch_dmrs_positions_l [12][8] = { // Duration in symbols
{-1, -1, -1, -1, 1, 1, 1, 1}, //<4 // (DMRS l' position)
{1, 1, 1, 1, 1, 1, 1, 1}, //4 // (DMRS l' position)
{1, 1, 1, 1, 1, 5, 5, 5}, //5 // (DMRS l' position)
{1, 1, 1, 1, 1, 5, 5, 5}, //6 // (DMRS l' position)
{1, 1, 1, 1, 1, 5, 5, 5}, //7 // (DMRS l' position)
{1, 129, 129, 129, 1, 65, 73, 73}, //8 // (DMRS l' position)
{1, 129, 129, 129, 1, 65, 73, 73}, //9 // (DMRS l' position)
{1, 513, 577, 577, 1, 257, 273, 585}, //10 // (DMRS l' position)
{1, 513, 577, 577, 1, 257, 273, 585}, //11 // (DMRS l' position)
{1, 513, 577, 2337, 1, 1025, 1057, 585}, //12 // (DMRS l' position)
{1, 2049, 2177, 2337, 1, 1025, 1057, 585}, //13 // (DMRS l' position)
{1, 2049, 2177, 2337, 1, 1025, 1057, 585}, //14 // (DMRS l' position)
};
// TS 38.211 Table 6.4.1.1.3-4: PUSCH DMRS positions l' within a slot for double-symbol DMRS and intra-slot frequency hopping disabled.
// The first 4 colomns are PUSCH mapping type A and the last 4 colomns are PUSCH mapping type B.
// When l' = l0, it is represented by 1
int32_t table_6_4_1_1_3_4_pusch_dmrs_positions_l [12][8] = { // Duration in symbols
{-1, -1, -1, -1, -1, -1, -1, -1}, //<4 // (DMRS l' position)
{1, 1, -1, -1, -1, -1, -1, -1}, //4 // (DMRS l' position)
{1, 1, -1, -1, 1, 1, -1, -1}, //5 // (DMRS l' position)
{1, 1, -1, -1, 1, 1, -1, -1}, //6 // (DMRS l' position)
{1, 1, -1, -1, 1, 1, -1, -1}, //7 // (DMRS l' position)
{1, 1, -1, -1, 1, 33, -1, -1}, //8 // (DMRS l' position)
{1, 1, -1, -1, 1, 33, -1, -1}, //9 // (DMRS l' position)
{1, 257, -1, -1, 1, 129, -1, -1}, //10 // (DMRS l' position)
{1, 257, -1, -1, 1, 129, -1, -1}, //11 // (DMRS l' position)
{1, 257, -1, -1, 1, 513, -1, -1}, //12 // (DMRS l' position)
{1, 1025, -1, -1, 1, 513, -1, -1}, //13 // (DMRS l' position)
{1, 1025, -1, -1, 1, 513, -1, -1}, //14 // (DMRS l' position)
};
int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength) {
uint8_t row, colomn;
int32_t l_prime;
colomn = additional_pos;
if (mapping_type == typeB)
colomn += 4;
if (duration_in_symbols < 4)
row = 0;
else
row = duration_in_symbols - 3;
if (pusch_maxLength == pusch_len1)
l_prime = table_6_4_1_1_3_3_pusch_dmrs_positions_l[row][colomn];
else
l_prime = table_6_4_1_1_3_4_pusch_dmrs_positions_l[row][colomn];
AssertFatal(l_prime>0,"invalid l_prime < 0\n");
return l_prime;
}
/*******************************************************************
*
* NAME : is_dmrs_symbol
*
* PARAMETERS : l ofdm symbol index within slot
* k subcarrier index
* start_sc first subcarrier index
* k_prime index alternating 0 and 1
* n index starting 0,1,...
* delta see Table 6.4.1.1.3
* duration_in_symbols number of scheduled PUSCH ofdm symbols
* dmrs_UplinkConfig DMRS uplink configuration
* mapping_type PUSCH mapping type (A or B)
* ofdm_symbol_size IFFT size
*
* RETURN : 0 if symbol(k,l) is data, or 1 if symbol(k,l) is dmrs
*
* DESCRIPTION : 3GPP TS 38.211 6.4.1.1 Demodulation reference signal for PUSCH
*
*********************************************************************/
uint8_t is_dmrs_symbol(uint8_t l,
uint16_t k,
uint16_t start_sc,
uint8_t k_prime,
uint16_t n,
uint8_t delta,
uint8_t duration_in_symbols,
dmrs_UplinkConfig_t *dmrs_UplinkConfig,
uint8_t mapping_type,
uint16_t ofdm_symbol_size) {
uint8_t is_dmrs_freq, is_dmrs_time, dmrs_type, l0;
int32_t l_prime_mask;
pusch_dmrs_AdditionalPosition_t additional_pos;
is_dmrs_freq = 0;
is_dmrs_time = 0;
dmrs_type = dmrs_UplinkConfig->pusch_dmrs_type;
additional_pos = dmrs_UplinkConfig->pusch_dmrs_AdditionalPosition;
l0 = get_l0_ul(mapping_type, 2);
l_prime_mask = get_l_prime(duration_in_symbols, mapping_type, additional_pos, dmrs_UplinkConfig->pusch_maxLength);
if (k == ((start_sc+get_dmrs_freq_idx_ul(n, k_prime, delta, dmrs_type))%ofdm_symbol_size))
is_dmrs_freq = 1;
if (l_prime_mask == 1){
if (l == l0)
is_dmrs_time = 1;
} else if ( (l==l0) || (((l_prime_mask>>l)&1) == 1 && l!=0) )
is_dmrs_time = 1;
if (dmrs_UplinkConfig->pusch_maxLength == pusch_len2){
if (((l_prime_mask>>(l-1))&1) == 1 && l!=0 && l!=1)
is_dmrs_time = 1;
if (l-1 == l0)
is_dmrs_time = 1;
}
if (is_dmrs_time && is_dmrs_freq)
return 1;
else
return 0;
}
/*******************************************************************
*
* NAME : pseudo_random_gold_sequence
......
......@@ -57,6 +57,19 @@ void generate_dmrs_pbch(uint32_t dmrs_pbch_bitmap[DMRS_PBCH_I_SSB][DMRS_PBCH_N_H
uint8_t get_l0_ul(uint8_t mapping_type, uint8_t dmrs_typeA_position);
uint16_t get_dmrs_freq_idx_ul(uint16_t n, uint8_t k_prime, uint8_t delta, uint8_t dmrs_type);
int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength);
uint8_t is_dmrs_symbol(uint8_t l,
uint16_t k,
uint16_t start_sc,
uint8_t k_prime,
uint16_t n,
uint8_t delta,
uint8_t duration_in_symbols,
dmrs_UplinkConfig_t *dmrs_UplinkConfig,
uint8_t mapping_type,
uint16_t ofdm_symbol_size);
#undef EXTERN
#endif /* DMRS_NR_H */
......
......@@ -56,9 +56,10 @@ int nr_pusch_dmrs_rx(PHY_VARS_gNB *gNB,
int32_t *output,
unsigned short p,
unsigned char lp,
unsigned short nb_pusch_rb)
unsigned short nb_pusch_rb,
uint8_t dmrs_type)
{
int8_t w,config_type;
int8_t w;
short *mod_table;
unsigned char idx=0;
......@@ -66,18 +67,16 @@ int nr_pusch_dmrs_rx(PHY_VARS_gNB *gNB,
array_of_w *wf;
array_of_w *wt;
config_type = 0; //to be updated by higher layer
wf = (dmrs_type==pusch_dmrs_type1) ? wf1 : wf2;
wt = (dmrs_type==pusch_dmrs_type1) ? wt1 : wt2;
wf = (config_type==0) ? wf1 : wf2;
wt = (config_type==0) ? wt1 : wt2;
if (dmrs_type > 2)
LOG_E(PHY,"Bad PUSCH DMRS config type %d\n", dmrs_type);
if (config_type > 1)
LOG_E(PHY,"Bad PUSCH DMRS config type %d\n", config_type);
if ((p>=1000) && (p<((config_type==0) ? 1008 : 1012))) {
if ((p>=1000) && (p<((dmrs_type==pusch_dmrs_type1) ? 1008 : 1012))) {
if (gNB->frame_parms.Ncp == NORMAL) {
for (int i=0; i<nb_pusch_rb*((config_type==0) ? 6:4); i++) {
for (int i=0; i<nb_pusch_rb*((dmrs_type==pusch_dmrs_type1) ? 6:4); i++) {
w = (wf[p-1000][i&1])*(wt[p-1000][lp]);
mod_table = (w==1) ? nr_rx_mod_table : nr_rx_nmod_table;
......@@ -86,7 +85,7 @@ int nr_pusch_dmrs_rx(PHY_VARS_gNB *gNB,
((int16_t*)output)[i<<1] = mod_table[(NR_MOD_TABLE_QPSK_OFFSET + idx)<<1];
((int16_t*)output)[(i<<1)+1] = mod_table[((NR_MOD_TABLE_QPSK_OFFSET + idx)<<1) + 1];
#ifdef DEBUG_PUSCH
printf("nr_pusch_dmrs_rx dmrs config type %d port %d nb_pusch_rb %d\n", config_type, p, nb_pusch_rb);
printf("nr_pusch_dmrs_rx dmrs config type %d port %d nb_pusch_rb %d\n", dmrs_type, p, nb_pusch_rb);
printf("wf[%d] = %d wt[%d]= %d\n", i&1, wf[p-1000][i&1], lp, wt[p-1000][lp]);
printf("i %d idx %d pusch gold %u b0-b1 %d-%d mod_dmrs %d %d\n", i, idx, nr_gold_pusch[(i<<1)>>5], (((nr_gold_pusch[(i<<1)>>5])>>((i<<1)&0x1f))&1),
(((nr_gold_pusch[((i<<1)+1)>>5])>>(((i<<1)+1)&0x1f))&1), ((int16_t*)output)[i<<1], ((int16_t*)output)[(i<<1)+1]);
......
......@@ -47,5 +47,6 @@ int nr_pusch_dmrs_rx(PHY_VARS_gNB *gNB,
int32_t *output,
unsigned short p,
unsigned char lp,
unsigned short nb_pusch_rb);
unsigned short nb_pusch_rb,
uint8_t dmrs_type);
#endif
......@@ -338,8 +338,7 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB,
rel15_ul->ulsch_pdu_rel15.number_rbs = ulsch_pdu->rb_size;
rel15_ul->ulsch_pdu_rel15.start_symbol = ulsch_pdu->start_symbol_index;
rel15_ul->ulsch_pdu_rel15.number_symbols = ulsch_pdu->nr_of_symbols;
rel15_ul->ulsch_pdu_rel15.nb_re_dmrs = 6; //where should this come from?
rel15_ul->ulsch_pdu_rel15.length_dmrs = 1; //where should this come from?
rel15_ul->ulsch_pdu_rel15.length_dmrs = gNB->dmrs_UplinkConfig.pusch_maxLength;
rel15_ul->ulsch_pdu_rel15.Qm = ulsch_pdu->qam_mod_order;
rel15_ul->ulsch_pdu_rel15.mcs = ulsch_pdu->mcs_index;
rel15_ul->ulsch_pdu_rel15.rv = ulsch_pdu->pusch_data.rv_index;
......
......@@ -32,7 +32,6 @@
#include "nr_sch_dmrs.h"
/*Table 7.4.1.1.2-1 and 7.4.1.1.2-2 38211 Columns: ap - CDM group - Delta - Wf(0) - Wf(1) - Wt(0) - Wt(1)*/
/*Table 6.4.1.1.3-1 is identical to Table 7.4.1.1.2-1 and Table 6.4.1.1.3-2 is identical to Table 7.4.1.1.2-2. UL DMRS can reuse these tables*/
int8_t pdsch_dmrs_1[8][7] = {{0,0,0,1,1,1,1},
......@@ -57,11 +56,6 @@ int8_t pdsch_dmrs_2[12][7] = {{0,0,0,1,1,1,1},
{10,2,4,1,1,1,-1},
{11,2,4,1,-1,1,-1}};
void get_l_prime(uint8_t *l_prime, uint8_t n_symbs) {
for (int i=0; i<n_symbs; i++)
*(l_prime+i) = i;
}
void get_antenna_ports(uint8_t *ap, uint8_t n_symbs, uint8_t config) {
if (config == NFAPI_NR_DMRS_TYPE1)
for (int i=0; i<(4+((n_symbs-1)<<2)); i++)
......
......@@ -30,13 +30,14 @@
* \warning
*/
#ifndef NR_SCH_DMRS_H
#define NR_SCH_DMRS_H
#include "PHY/defs_nr_common.h"
#define NR_PDSCH_DMRS_ANTENNA_PORT0 1000
#define NR_PDSCH_DMRS_NB_ANTENNA_PORTS 12
void get_l_prime(uint8_t *l_prime, uint8_t n_symbs);
void get_antenna_ports(uint8_t *ap, uint8_t n_symbs, uint8_t config);
void get_Wt(int8_t *Wt, uint8_t ap, uint8_t config);
......@@ -48,3 +49,5 @@ uint8_t get_delta(uint8_t ap, uint8_t config);
uint16_t get_dmrs_freq_idx(uint16_t n, uint8_t k_prime, uint8_t delta, uint8_t dmrs_type);
uint8_t get_l0(uint8_t mapping_type, uint8_t dmrs_typeA_position);
#endif
......@@ -62,6 +62,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
@param start_rb The starting RB in the RB allocation (used for Resource Allocation Type 1 in NR)
@param nb_rb_pusch The number of RBs allocated (used for Resource Allocation Type 1 in NR)
@param frame_parms, Pointer to frame descriptor structure
@param is_dmrs_symbol, flag to indicate wether this OFDM symbol contains DMRS symbols or not.
*/
void nr_ulsch_extract_rbs_single(int **rxdataF,
......@@ -73,14 +74,19 @@ void nr_ulsch_extract_rbs_single(int **rxdataF,
unsigned char symbol,
unsigned short start_rb,
unsigned short nb_rb_pusch,
NR_DL_FRAME_PARMS *frame_parms);
NR_DL_FRAME_PARMS *frame_parms,
uint8_t dmrs_symbol,
uint16_t number_symbols,
uint8_t mapping_type,
dmrs_UplinkConfig_t *dmrs_UplinkConfig);
void nr_ulsch_scale_channel(int32_t **ul_ch_estimates_ext,
NR_DL_FRAME_PARMS *frame_parms,
NR_gNB_ULSCH_t **ulsch_gNB,
uint8_t symbol,
uint8_t start_symbol,
uint16_t nb_rb);
uint16_t nb_rb,
pusch_dmrs_type_t pusch_dmrs_type);
/** \brief This function computes the average channel level over all allocated RBs and antennas (TX/RX) in order to compute output shift for compensated signal
......@@ -118,7 +124,7 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext,
int **rho,
NR_DL_FRAME_PARMS *frame_parms,
unsigned char symbol,
uint8_t pilots,
uint8_t is_dmrs_symbol,
unsigned char mod_order,
unsigned short nb_rb,
unsigned char output_shift);
......
......@@ -43,6 +43,7 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations,uint8_t N_RB_UL, uint8
@param ulsch_llr, Pointer to received llr in ulsch
@param frame_parms, Pointer to frame descriptor structure
@param nb_symb_sch, number of symbols used in the uplink shared channel
@param nb_re_dmrs, number of DMRS resource elements in one RB
@param nr_tti_rx, current received TTI
@param harq_pid, harq process id
@param is_crnti
......@@ -54,6 +55,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
NR_DL_FRAME_PARMS *frame_parms,
uint32_t frame,
uint16_t nb_symb_sch,
uint16_t nb_re_dmrs,
uint8_t nr_tti_rx,
uint8_t harq_pid,
uint8_t is_crnti);
......
......@@ -279,6 +279,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
NR_DL_FRAME_PARMS *frame_parms,
uint32_t frame,
uint16_t nb_symb_sch,
uint16_t nb_re_dmrs,
uint8_t nr_tti_rx,
uint8_t harq_pid,
uint8_t is_crnti)
......@@ -324,7 +325,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
uint16_t R = nfapi_ulsch_pdu_rel15->R;
uint8_t mcs = nfapi_ulsch_pdu_rel15->mcs;
uint8_t n_layers = nfapi_ulsch_pdu_rel15->n_layers;
uint8_t nb_re_dmrs = nfapi_ulsch_pdu_rel15->nb_re_dmrs;
uint8_t length_dmrs = nfapi_ulsch_pdu_rel15->length_dmrs;
// ------------------------------------------------------------------
......@@ -352,7 +352,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
G = nr_get_G(nb_rb, number_symbols, nb_re_dmrs, length_dmrs, Qm, n_layers);
LOG_D(PHY,"ULSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_symb_sch %d nb_rb %d\n",harq_pid,A,G, mcs, n_layers, nb_symb_sch,nb_rb);
LOG_D(PHY,"ULSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_symb_sch %d nb_rb %d, nb_re_dmrs %d, Qm %d, n_layers %d\n",harq_pid,A,G, mcs, n_layers, nb_symb_sch,nb_rb, nb_re_dmrs, Qm, n_layers);
if (harq_process->round == 0) {
......
......@@ -3,6 +3,7 @@
#include "nr_transport_proto.h"
#include "PHY/impl_defs_top.h"
#include "PHY/NR_TRANSPORT/nr_sch_dmrs.h"
#include "PHY/NR_REFSIG/dmrs_nr.h"
#include "PHY/NR_ESTIMATION/nr_ul_estimation.h"
#include "PHY/defs_nr_common.h"
......@@ -229,13 +230,19 @@ void nr_ulsch_extract_rbs_single(int **rxdataF,
unsigned char symbol,
unsigned short start_rb,
unsigned short nb_rb_pusch,
NR_DL_FRAME_PARMS *frame_parms)
NR_DL_FRAME_PARMS *frame_parms,
uint8_t dmrs_symbol,
uint16_t number_symbols,
uint8_t mapping_type,
dmrs_UplinkConfig_t *dmrs_UplinkConfig)
{
unsigned short start_re, re, nb_re_pusch;
unsigned char aarx, is_dmrs_symbol = 0;
unsigned char aarx;
uint32_t rxF_ext_index = 0;
uint32_t ul_ch0_ext_index = 0;
uint32_t ul_ch0_index = 0;
uint8_t is_dmrs_symbol_flag, k_prime;
uint16_t n=0;
int16_t *rxF,*rxF_ext;
int *ul_ch0,*ul_ch0_ext;
......@@ -246,25 +253,42 @@ void nr_ulsch_extract_rbs_single(int **rxdataF,
printf("--------------------ch_ext_index = %d-----------------------\n", symbol*NR_NB_SC_PER_RB * nb_rb_pusch);
#endif
is_dmrs_symbol = (symbol == 2) ? 1 : 0; //to be updated from config
start_re = (frame_parms->first_carrier_offset + (start_rb * NR_NB_SC_PER_RB))%frame_parms->ofdm_symbol_size;
nb_re_pusch = NR_NB_SC_PER_RB * nb_rb_pusch;
is_dmrs_symbol_flag = 0;
for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
rxF = (int16_t *)&rxdataF[aarx][symbol * frame_parms->ofdm_symbol_size];
rxF_ext = (int16_t *)&rxdataF_ext[aarx][symbol * nb_re_pusch]; // [hna] rxdataF_ext isn't contiguous in order to solve an alignment problem ib llr computation in case of mod_order = 4, 6
ul_ch0 = &ul_ch_estimates[aarx][(2*(frame_parms->ofdm_symbol_size))]; // DMRS REs are only in symbol 2 (to be updated from config)
ul_ch0 = &ul_ch_estimates[aarx][dmrs_symbol*frame_parms->ofdm_symbol_size]; // update channel estimates if new dmrs symbol are available
ul_ch0_ext = &ul_ch_estimates_ext[aarx][symbol*nb_re_pusch];
n = 0;
k_prime = 0;
for (re = 0; re < nb_re_pusch; re++) {
if ( (is_dmrs_symbol && ((re&1) != 0)) || (is_dmrs_symbol == 0) ) { // [hna] (re&1) != frame_parms->nushift) assuming only dmrs type 1 and mapping type A
// frame_parms->nushift should be initialized with 0
is_dmrs_symbol_flag = is_dmrs_symbol(symbol,
(start_re + re)%frame_parms->ofdm_symbol_size,
start_re,
k_prime,
n,
0,
number_symbols,
dmrs_UplinkConfig,
mapping_type,
frame_parms->ofdm_symbol_size);
#ifdef DEBUG_RB_EXT
printf("re = %d, is_dmrs_symbol_flag = %d, symbol = %d\n", re, is_dmrs_symbol_flag, symbol);
#endif
if ( is_dmrs_symbol_flag == 0 ) {
rxF_ext[rxF_ext_index] = (rxF[ ((start_re + re)*2) % (frame_parms->ofdm_symbol_size*2)]);
rxF_ext[rxF_ext_index + 1] = (rxF[(((start_re + re)*2) + 1) % (frame_parms->ofdm_symbol_size*2)]);
ul_ch0_ext[ul_ch0_ext_index] = ul_ch0[ul_ch0_index];
......@@ -272,13 +296,15 @@ void nr_ulsch_extract_rbs_single(int **rxdataF,
#ifdef DEBUG_RB_EXT
printf("rxF_ext[%d] = %d\n", rxF_ext_index, rxF_ext[rxF_ext_index]);
printf("rxF_ext[%d] = %d\n", rxF_ext_index+1, rxF_ext[rxF_ext_index+1]);
printf("ul_ch0_ext[%d] = %d\n", 2*ul_ch0_ext_index, ((int16_t *)ul_ch0_ext)[2*ul_ch0_ext_index]);
printf("ul_ch0_ext[%d] = %d\n", 2*ul_ch0_ext_index + 1, ((int16_t *)ul_ch0_ext)[2*ul_ch0_ext_index + 1]);
#endif
rxF_ext_index = rxF_ext_index + 2;
ul_ch0_ext_index++;
}
rxF_ext_index +=2;
} else {
k_prime++;
k_prime&=1;
n+=(k_prime)?0:1;
}
ul_ch0_index++;
}
}
......@@ -288,8 +314,9 @@ void nr_ulsch_scale_channel(int **ul_ch_estimates_ext,
NR_DL_FRAME_PARMS *frame_parms,
NR_gNB_ULSCH_t **ulsch_gNB,
uint8_t symbol,
uint8_t pilots,
unsigned short nb_rb)
uint8_t is_dmrs_symbol,
unsigned short nb_rb,
pusch_dmrs_type_t pusch_dmrs_type)
{
#if defined(__x86_64__)||defined(__i386__)
......@@ -302,7 +329,7 @@ void nr_ulsch_scale_channel(int **ul_ch_estimates_ext,
ch_amp = 1024*8; //((pilots) ? (ulsch_gNB[0]->sqrt_rho_b) : (ulsch_gNB[0]->sqrt_rho_a));
LOG_D(PHY,"Scaling PUSCH Chest in OFDM symbol %d by %d, pilots %d nb_rb %d NCP %d symbol %d\n", symbol, ch_amp, pilots, nb_rb, frame_parms->Ncp, symbol);
LOG_D(PHY,"Scaling PUSCH Chest in OFDM symbol %d by %d, pilots %d nb_rb %d NCP %d symbol %d\n", symbol, ch_amp, is_dmrs_symbol, nb_rb, frame_parms->Ncp, symbol);
// printf("Scaling PUSCH Chest in OFDM symbol %d by %d\n",symbol_mod,ch_amp);
ch_amp128 = _mm_set1_epi16(ch_amp); // Q3.13
......@@ -312,8 +339,11 @@ void nr_ulsch_scale_channel(int **ul_ch_estimates_ext,
ul_ch128 = (__m128i *)&ul_ch_estimates_ext[aarx][symbol*nb_rb*NR_NB_SC_PER_RB];
if (pilots==1){
nb_rb = nb_rb>>1;
if (is_dmrs_symbol==1){
if (pusch_dmrs_type == pusch_dmrs_type1)
nb_rb = nb_rb>>1;
else
nb_rb = (2*nb_rb)/3;
}
......@@ -325,7 +355,7 @@ void nr_ulsch_scale_channel(int **ul_ch_estimates_ext,
ul_ch128[1] = _mm_mulhi_epi16(ul_ch128[1], ch_amp128);
ul_ch128[1] = _mm_slli_epi16(ul_ch128[1], 3);
if (pilots) {
if (is_dmrs_symbol) {
ul_ch128+=2;
} else {
ul_ch128[2] = _mm_mulhi_epi16(ul_ch128[2], ch_amp128);
......@@ -364,7 +394,7 @@ void nr_ulsch_channel_level(int **ul_ch_estimates_ext,
ul_ch128=(__m128i *)&ul_ch_estimates_ext[(aatx<<1)+aarx][symbol*nb_rb*12];
for (rb = 0; rb < nb_rb; rb++) {
for (rb = 0; rb < len/12; rb++) {
avg128U = _mm_add_epi32(avg128U, _mm_srai_epi32(_mm_madd_epi16(ul_ch128[0], ul_ch128[0]), x));
avg128U = _mm_add_epi32(avg128U, _mm_srai_epi32(_mm_madd_epi16(ul_ch128[1], ul_ch128[1]), x));
avg128U = _mm_add_epi32(avg128U, _mm_srai_epi32(_mm_madd_epi16(ul_ch128[2], ul_ch128[2]), x));
......@@ -446,7 +476,7 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext,
int **rho,
NR_DL_FRAME_PARMS *frame_parms,
unsigned char symbol,
uint8_t pilots,
uint8_t is_dmrs_symbol,
unsigned char mod_order,
unsigned short nb_rb,
unsigned char output_shift)
......@@ -549,7 +579,7 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext,
ul_ch_mag128[1] = _mm_mulhi_epi16(ul_ch_mag128[1],QAM_amp128);
ul_ch_mag128[1] = _mm_slli_epi16(ul_ch_mag128[1],1);
if (pilots==0) {
if (is_dmrs_symbol==0) {
mmtmpD0 = _mm_madd_epi16(ul_ch128[2],ul_ch128[2]);
mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift);
mmtmpD1 = _mm_packs_epi32(mmtmpD0,mmtmpD0);
......@@ -568,7 +598,7 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext,
ul_ch_mag128b[1] = _mm_mulhi_epi16(ul_ch_mag128b[1],QAM_amp128b);
ul_ch_mag128b[1] = _mm_slli_epi16(ul_ch_mag128b[1],1);
if (pilots==0) {
if (is_dmrs_symbol==0) {
ul_ch_mag128b[2] = _mm_mulhi_epi16(ul_ch_mag128b[2],QAM_amp128b);
ul_ch_mag128b[2] = _mm_slli_epi16(ul_ch_mag128b[2],1);
}
......@@ -616,7 +646,7 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext,
// print_shorts("ch:",ul_ch128+1);
// print_shorts("pack:",rxdataF_comp128+1);
if (pilots==0) {
if (is_dmrs_symbol==0) {
// multiply by conjugated channel
mmtmpD0 = _mm_madd_epi16(ul_ch128[2],rxdataF128[2]);
// mmtmpD0 contains real part of 4 consecutive outputs (32-bit)
......@@ -738,7 +768,7 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext,
unsigned short rb;
unsigned char aatx,aarx,symbol_mod,pilots=0;
unsigned char aatx,aarx,symbol_mod,is_dmrs_symbol=0;
int16x4_t *ul_ch128,*ul_ch128_2,*rxdataF128;
int32x4_t mmtmpD0,mmtmpD1,mmtmpD0b,mmtmpD1b;
......@@ -756,7 +786,7 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext,
nb_rb=1+(5*nb_rb/6);
}
else {
pilots=1;
is_dmrs_symbol=1;
}
}
......@@ -793,7 +823,7 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext,
mmtmpD1 = vmull_s16(ul_ch128[3], ul_ch128[3]);
mmtmpD1 = vqshlq_s32(vqaddq_s32(mmtmpD1,vrev64q_s32(mmtmpD1)),output_shift128);
mmtmpD3 = vcombine_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1));
if (pilots==0) {
if (is_dmrs_symbol==0) {
mmtmpD0 = vmull_s16(ul_ch128[4], ul_ch128[4]);
mmtmpD0 = vqshlq_s32(vqaddq_s32(mmtmpD0,vrev64q_s32(mmtmpD0)),output_shift128);
mmtmpD1 = vmull_s16(ul_ch128[5], ul_ch128[5]);
......@@ -806,7 +836,7 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext,
ul_ch_mag128[0] = vqdmulhq_s16(mmtmpD2,QAM_amp128);
ul_ch_mag128[1] = vqdmulhq_s16(mmtmpD3,QAM_amp128);
if (pilots==0) {
if (is_dmrs_symbol==0) {
ul_ch_mag128b[2] = vqdmulhq_s16(mmtmpD4,QAM_amp128b);
ul_ch_mag128[2] = vqdmulhq_s16(mmtmpD4,QAM_amp128);
}
......@@ -843,7 +873,7 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext,
mmtmpD1 = vqshlq_s32(mmtmpD1,output_shift128);
rxdataF_comp128[1] = vzip_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1));
if (pilots==0) {
if (is_dmrs_symbol==0) {
mmtmpD0 = vmull_s16(ul_ch128[4], rxdataF128[4]);
mmtmpD1 = vmull_s16(ul_ch128[5], rxdataF128[5]);
mmtmpD0 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0),vget_high_s32(mmtmpD0)),
......@@ -971,114 +1001,139 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
unsigned char harq_pid)
{
uint8_t first_symbol_flag, aarx, aatx, pilots; // pilots, a flag to indicate DMRS REs in current symbol
uint8_t first_symbol_flag, aarx, aatx, dmrs_symbol_flag; // dmrs_symbol_flag, a flag to indicate DMRS REs in current symbol
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
nfapi_nr_ul_config_ulsch_pdu_rel15_t *rel15_ul = &gNB->ulsch[UE_id][0]->harq_processes[harq_pid]->ulsch_pdu.ulsch_pdu_rel15;
uint32_t nb_re_pusch, bwp_start_subcarrier;
uint8_t mapping_type;
int avgs;
int avg[4];
pilots = 0;
dmrs_symbol_flag = 0;
first_symbol_flag = 0;
if(symbol == rel15_ul->start_symbol){
gNB->pusch_vars[UE_id]->rxdataF_ext_offset = 0;
first_symbol_flag = 1;
}
mapping_type = gNB->pusch_config.pusch_TimeDomainResourceAllocation[0]->mappingType;
if (symbol == rel15_ul->start_symbol){ // [hna] here it is assumed that first carries 6 DMRS REs (dmrs-type 1)
nb_re_pusch = rel15_ul->number_rbs * 6;
pilots = 1;
} else {
nb_re_pusch = rel15_ul->number_rbs * NR_NB_SC_PER_RB;
pilots = 0;
}
if (mapping_type == typeB) {
if(symbol == rel15_ul->start_symbol){
gNB->pusch_vars[UE_id]->rxdataF_ext_offset = 0;
gNB->pusch_vars[UE_id]->dmrs_symbol = 0;
first_symbol_flag = 1;
}
bwp_start_subcarrier = (rel15_ul->start_rb*NR_NB_SC_PER_RB + frame_parms->first_carrier_offset) % frame_parms->ofdm_symbol_size;
bwp_start_subcarrier = (rel15_ul->start_rb*NR_NB_SC_PER_RB + frame_parms->first_carrier_offset) % frame_parms->ofdm_symbol_size;
dmrs_symbol_flag = is_dmrs_symbol(symbol,
0,
0,
0,
0,
0,
rel15_ul->number_symbols,
&gNB->dmrs_UplinkConfig,
mapping_type,
frame_parms->ofdm_symbol_size);
if (dmrs_symbol_flag == 1){
nb_re_pusch = rel15_ul->number_rbs * ((gNB->dmrs_UplinkConfig.pusch_dmrs_type==pusch_dmrs_type1)?6:8);
gNB->pusch_vars[UE_id]->dmrs_symbol = symbol;
} else {
nb_re_pusch = rel15_ul->number_rbs * NR_NB_SC_PER_RB;
}
//----------------------------------------------------------
//--------------------- Channel estimation ---------------------
//----------------------------------------------------------
if (pilots == 1)
nr_pusch_channel_estimation(gNB,
0,
nr_tti_rx,
0, // p
symbol,
bwp_start_subcarrier,
rel15_ul->number_rbs);
//----------------------------------------------------------
//--------------------- Channel estimation ---------------------
//----------------------------------------------------------
//----------------------------------------------------------
//--------------------- RBs extraction ---------------------
//----------------------------------------------------------
nr_ulsch_extract_rbs_single(gNB->common_vars.rxdataF,
gNB->pusch_vars[UE_id]->ul_ch_estimates,
gNB->pusch_vars[UE_id]->rxdataF_ext,
gNB->pusch_vars[UE_id]->ul_ch_estimates_ext,
gNB->pusch_vars[UE_id]->rxdataF_ext_offset,
// rb_alloc, [hna] Resource Allocation Type 1 is assumed only for the moment
symbol,
rel15_ul->start_rb,
rel15_ul->number_rbs,
frame_parms);
nr_ulsch_scale_channel(gNB->pusch_vars[UE_id]->ul_ch_estimates_ext,
frame_parms,
gNB->ulsch[UE_id],
symbol,
pilots,
rel15_ul->number_rbs);
if (dmrs_symbol_flag == 1)
nr_pusch_channel_estimation(gNB,
0,
nr_tti_rx,
0, // p
symbol,
bwp_start_subcarrier,
rel15_ul->number_rbs,
&gNB->dmrs_UplinkConfig);
if (first_symbol_flag==1) {
//----------------------------------------------------------
//--------------------- RBs extraction ---------------------
//----------------------------------------------------------
nr_ulsch_channel_level(gNB->pusch_vars[UE_id]->ul_ch_estimates_ext,
nr_ulsch_extract_rbs_single(gNB->common_vars.rxdataF,
gNB->pusch_vars[UE_id]->ul_ch_estimates,
gNB->pusch_vars[UE_id]->rxdataF_ext,
gNB->pusch_vars[UE_id]->ul_ch_estimates_ext,
gNB->pusch_vars[UE_id]->rxdataF_ext_offset,
// rb_alloc, [hna] Resource Allocation Type 1 is assumed only for the moment
symbol,
rel15_ul->start_rb,
rel15_ul->number_rbs,
frame_parms,
gNB->pusch_vars[UE_id]->dmrs_symbol,
rel15_ul->number_symbols,
mapping_type,
&gNB->dmrs_UplinkConfig);
nr_ulsch_scale_channel(gNB->pusch_vars[UE_id]->ul_ch_estimates_ext,
frame_parms,
avg,
gNB->ulsch[UE_id],
symbol,
nb_re_pusch,
rel15_ul->number_rbs);
avgs = 0;
dmrs_symbol_flag,
rel15_ul->number_rbs,
gNB->dmrs_UplinkConfig.pusch_dmrs_type);
for (aatx=0;aatx<frame_parms->nb_antennas_tx;aatx++)
for (aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++)
avgs = cmax(avgs,avg[(aatx<<1)+aarx]);
if (first_symbol_flag==1) {
gNB->pusch_vars[UE_id]->log2_maxh = (log2_approx(avgs)/2)+1;
nr_ulsch_channel_level(gNB->pusch_vars[UE_id]->ul_ch_estimates_ext,
frame_parms,
avg,
symbol,
nb_re_pusch,
rel15_ul->number_rbs);
avgs = 0;
}
for (aatx=0;aatx<frame_parms->nb_antennas_tx;aatx++)
for (aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++)
avgs = cmax(avgs,avg[(aatx<<1)+aarx]);
nr_ulsch_channel_compensation(gNB->pusch_vars[UE_id]->rxdataF_ext,
gNB->pusch_vars[UE_id]->ul_ch_estimates_ext,
gNB->pusch_vars[UE_id]->ul_ch_mag0,
gNB->pusch_vars[UE_id]->ul_ch_magb0,
gNB->pusch_vars[UE_id]->rxdataF_comp,
(frame_parms->nb_antennas_tx>1) ? gNB->pusch_vars[UE_id]->rho : NULL,
frame_parms,
symbol,
pilots,
rel15_ul->Qm,
rel15_ul->number_rbs,
gNB->pusch_vars[UE_id]->log2_maxh);
gNB->pusch_vars[UE_id]->log2_maxh = (log2_approx(avgs)/2)+1;
#ifdef NR_SC_FDMA
nr_idft(&((uint32_t*)gNB->pusch_vars[UE_id]->rxdataF_ext[0])[symbol * rel15_ul->number_rbs * NR_NB_SC_PER_RB], nb_re_pusch);
#endif
}
//----------------------------------------------------------
//-------------------- LLRs computation --------------------
//----------------------------------------------------------
nr_ulsch_compute_llr(&gNB->pusch_vars[UE_id]->rxdataF_comp[0][symbol * rel15_ul->number_rbs * NR_NB_SC_PER_RB],
gNB->pusch_vars[UE_id]->ul_ch_mag0,
gNB->pusch_vars[UE_id]->ul_ch_magb0,
&gNB->pusch_vars[UE_id]->llr[gNB->pusch_vars[UE_id]->rxdataF_ext_offset * rel15_ul->Qm],
rel15_ul->number_rbs,
nb_re_pusch,
symbol,
rel15_ul->Qm);
gNB->pusch_vars[UE_id]->rxdataF_ext_offset = gNB->pusch_vars[UE_id]->rxdataF_ext_offset + nb_re_pusch;
nr_ulsch_channel_compensation(gNB->pusch_vars[UE_id]->rxdataF_ext,
gNB->pusch_vars[UE_id]->ul_ch_estimates_ext,
gNB->pusch_vars[UE_id]->ul_ch_mag0,
gNB->pusch_vars[UE_id]->ul_ch_magb0,
gNB->pusch_vars[UE_id]->rxdataF_comp,
(frame_parms->nb_antennas_tx>1) ? gNB->pusch_vars[UE_id]->rho : NULL,
frame_parms,
symbol,
dmrs_symbol_flag,
rel15_ul->Qm,
rel15_ul->number_rbs,
gNB->pusch_vars[UE_id]->log2_maxh);
#ifdef NR_SC_FDMA
nr_idft(&((uint32_t*)gNB->pusch_vars[UE_id]->rxdataF_ext[0])[symbol * rel15_ul->number_rbs * NR_NB_SC_PER_RB], nb_re_pusch);
#endif
//----------------------------------------------------------
//-------------------- LLRs computation --------------------
//----------------------------------------------------------
nr_ulsch_compute_llr(&gNB->pusch_vars[UE_id]->rxdataF_comp[0][symbol * rel15_ul->number_rbs * NR_NB_SC_PER_RB],
gNB->pusch_vars[UE_id]->ul_ch_mag0,
gNB->pusch_vars[UE_id]->ul_ch_magb0,
&gNB->pusch_vars[UE_id]->llr[gNB->pusch_vars[UE_id]->rxdataF_ext_offset * rel15_ul->Qm],
rel15_ul->number_rbs,
nb_re_pusch,
symbol,
rel15_ul->Qm);
gNB->pusch_vars[UE_id]->rxdataF_ext_offset = gNB->pusch_vars[UE_id]->rxdataF_ext_offset + nb_re_pusch;
} else {
LOG_E(PHY, "PUSCH mapping type A is not supported \n");
}
}
......@@ -173,3 +173,15 @@ short filt8_dcl1_h[8]= {
short filt8_dcr1_h[8]= {
0,0,4096,8192,12288,16384,0,0};
short filt8_ml2[8] = {
13107,9830,6554,3277,0,0,0,0};
short filt8_mr2[8] = {
3277,6554,9830,13107,0,0,0,0};
short filt8_rr1[8] = {
8192,12288,16384,20480,0,0,0,0};
short filt8_rr2[8] = {
-4096,-8192,-12288,-16384,0,0,0,0};
......@@ -124,4 +124,13 @@ extern short filt8_dcr1[8];
extern short filt8_dcl1_h[8];
extern short filt8_dcr1_h[8];
#endif
extern short filt8_ml2[8];
extern short filt8_mr2[8];
extern short filt8_rr1[8];
extern short filt8_rr2[8];
#endif
\ No newline at end of file
......@@ -201,7 +201,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;
uint16_t Kr,r;
uint32_t r_offset;
uint8_t BG;
uint32_t E,Kb;
uint8_t Ilbrm;
......@@ -233,7 +234,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
Ilbrm = 0;
Tbslbrm = 950984; //max tbs
nb_re_dmrs = ulsch->nb_re_dmrs;
length_dmrs = 1;
length_dmrs = ulsch->length_dmrs;
Coderate = 0.0;
///////////
......@@ -248,7 +249,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN);
LOG_D(PHY,"ulsch coding nb_rb %d nb_symb_sch %d nb_re_dmrs %d, length_dmrs %d\n", nb_rb,nb_symb_sch, nb_re_dmrs,length_dmrs);
LOG_D(PHY,"ulsch coding nb_rb %d nb_symb_sch %d nb_re_dmrs %d, length_dmrs %d, harq_process->Nl = %d\n", nb_rb,nb_symb_sch, nb_re_dmrs,length_dmrs, harq_process->Nl);
G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs,mod_order,harq_process->Nl);
......
......@@ -91,15 +91,15 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
int gNB_id) {
uint32_t available_bits;
uint8_t mod_order, cwd_index, num_of_codewords;
uint8_t mod_order, cwd_index, num_of_codewords, l;
uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5];
uint32_t ***pusch_dmrs;
int16_t **tx_layers;
int32_t **txdataF;
uint16_t start_sc, start_rb;
int8_t Wf[2], Wt[2], l0, l_prime[2], delta;
uint16_t n_dmrs,code_rate;
uint8_t dmrs_type, length_dmrs;
int8_t Wf[2], Wt[2], l_prime[2], delta;
uint16_t n_dmrs, code_rate, number_dmrs_symbols;
uint8_t dmrs_type;
uint8_t mapping_type;
int ap, start_symbol, Nid_cell, i;
int sample_offsetF, N_RE_prime, N_PRB_oh;
......@@ -111,20 +111,36 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
NR_UE_PUSCH *pusch_ue = UE->pusch_vars[thread_id][gNB_id];
num_of_codewords = 1; // tmp assumption
length_dmrs = 1;
n_rnti = 0x1234;
Nid_cell = 0;
N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig
number_dmrs_symbols = 0;
mapping_type = UE->pusch_config.pusch_TimeDomainResourceAllocation[0]->mappingType;
for (cwd_index = 0;cwd_index < num_of_codewords; cwd_index++) {
ulsch_ue = UE->ulsch[thread_id][gNB_id][cwd_index];
harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid];
ulsch_ue->length_dmrs = length_dmrs;
start_symbol = harq_process_ul_ue->start_symbol;
for (i = start_symbol; i < start_symbol + harq_process_ul_ue->number_of_symbols; i++)
number_dmrs_symbols += is_dmrs_symbol(i,
0,
0,
0,
0,
0,
harq_process_ul_ue->number_of_symbols,
&UE->dmrs_UplinkConfig,
mapping_type,
frame_parms->ofdm_symbol_size);
ulsch_ue->length_dmrs = UE->dmrs_UplinkConfig.pusch_maxLength;
ulsch_ue->rnti = n_rnti;
ulsch_ue->Nid_cell = Nid_cell;
ulsch_ue->nb_re_dmrs = UE->dmrs_UplinkConfig.pusch_maxLength*(UE->dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1?6:4);
ulsch_ue->nb_re_dmrs = ((UE->dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4)*number_dmrs_symbols;
N_RE_prime = NR_NB_SC_PER_RB*harq_process_ul_ue->number_of_symbols - ulsch_ue->nb_re_dmrs - N_PRB_oh;
......@@ -205,19 +221,12 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
}
start_symbol = 14 - harq_process_ul_ue->number_of_symbols;
/////////////////////////DMRS Modulation/////////////////////////
///////////
pusch_dmrs = UE->nr_gold_pusch_dmrs[slot];
n_dmrs = (harq_process_ul_ue->nb_rb*ulsch_ue->nb_re_dmrs);
int16_t mod_dmrs[n_dmrs<<1];
dmrs_type = UE->dmrs_UplinkConfig.pusch_dmrs_type;
mapping_type = UE->pusch_config.pusch_TimeDomainResourceAllocation[0]->mappingType;
l0 = get_l0_ul(mapping_type, 2);
nr_modulation(pusch_dmrs[l0][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
///////////
////////////////////////////////////////////////////////////////////////
......@@ -239,7 +248,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
///////////
l_prime[0] = 0; // single symbol ap 0
uint8_t dmrs_symbol = l0+l_prime[0], l; // Assuming dmrs-AdditionalPosition = 0
#ifdef NR_SC_FDMA
uint32_t nb_re_pusch, nb_re_dmrs_per_rb;
......@@ -247,8 +255,19 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
for (l = start_symbol; l < start_symbol + harq_process_ul_ue->number_of_symbols; l++) {
if(l == dmrs_symbol)
nb_re_dmrs_per_rb = ulsch_ue->nb_re_dmrs; // [hna] ulsch_ue->nb_re_dmrs = 6 in this configuration
is_dmrs = is_dmrs_symbol(l,
0,
0,
0,
0,
0,
harq_process_ul_ue->number_of_symbols,
&UE->dmrs_UplinkConfig,
mapping_type,
frame_parms->ofdm_symbol_size);
if (is_dmrs == 1)
nb_re_dmrs_per_rb = ulsch_ue->nb_re_dmrs;
else
nb_re_dmrs_per_rb = 0;
......@@ -287,17 +306,35 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
uint8_t k_prime=0;
uint8_t is_dmrs;
uint16_t m=0, n=0, dmrs_idx=0, k=0;
for (l=start_symbol; l<start_symbol+harq_process_ul_ue->number_of_symbols; l++) {
k = start_sc;
n = 0;
dmrs_idx = 0;
for (i=0; i<harq_process_ul_ue->nb_rb*NR_NB_SC_PER_RB; i++) {
sample_offsetF = l*frame_parms->ofdm_symbol_size + k;
if ((l == dmrs_symbol) && (k == ((start_sc+get_dmrs_freq_idx_ul(n, k_prime, delta, dmrs_type))%(frame_parms->ofdm_symbol_size)))) {
is_dmrs = 0;
is_dmrs = is_dmrs_symbol(l,
k,
start_sc,
k_prime,
n,
delta,
harq_process_ul_ue->number_of_symbols,
&UE->dmrs_UplinkConfig,
mapping_type,
frame_parms->ofdm_symbol_size);
if (is_dmrs == 1) {
nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[dmrs_idx<<1]) >> 15;
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15;
......
......@@ -119,6 +119,32 @@ void multadd_real_vector_complex_scalar(int16_t *x,
}
void multadd_real_four_symbols_vector_complex_scalar(int16_t *x,
int16_t *alpha,
int16_t *y)
{
// do 8 multiplications at a time
simd_q15_t alpha_r_128,alpha_i_128,yr,yi,*x_128=(simd_q15_t*)x;
simd_q15_t y_128;
y_128 = _mm_loadu_si128((simd_q15_t*)y);
alpha_r_128 = set1_int16(alpha[0]);
alpha_i_128 = set1_int16(alpha[1]);
yr = mulhi_s1_int16(alpha_r_128,x_128[0]);
yi = mulhi_s1_int16(alpha_i_128,x_128[0]);
y_128 = _mm_adds_epi16(y_128,_mm_unpacklo_epi16(yr,yi));
y_128 = _mm_adds_epi16(y_128,_mm_unpackhi_epi16(yr,yi));
_mm_storeu_si128((simd_q15_t*)y, y_128);
_mm_empty();
_m_empty();
}
/*
int rotate_cpx_vector(int16_t *x,
int16_t *alpha,
......
......@@ -71,6 +71,10 @@ void multadd_real_vector_complex_scalar(int16_t *x,
int16_t *y,
uint32_t N);
void multadd_real_four_symbols_vector_complex_scalar(int16_t *x,
int16_t *alpha,
int16_t *y);
/*!\fn void multadd_complex_vector_real_scalar(int16_t *x,int16_t alpha,int16_t *y,uint8_t zero_flag,uint32_t N)
This function performs componentwise multiplication and accumulation of a real scalar and a complex vector.
@param x Vector input (Q1.15) in the format |Re0 Im0|Re1 Im 1| ...
......
......@@ -414,6 +414,8 @@ typedef struct {
/// \brief llr values.
/// - first index: ? [0..1179743] (hard coded)
int16_t *llr;
// DMRS symbol index, to be updated every DMRS symbol within a slot.
uint8_t dmrs_symbol;
} NR_gNB_PUSCH;
......@@ -707,6 +709,8 @@ typedef struct PHY_VARS_gNB_s {
// PUSCH Varaibles
PUSCH_CONFIG_DEDICATED pusch_config_dedicated[NUMBER_OF_UE_MAX];
PUSCH_Config_t pusch_config;
// PUCCH variables
PUCCH_CONFIG_DEDICATED pucch_config_dedicated[NUMBER_OF_UE_MAX];
......@@ -722,6 +726,11 @@ typedef struct PHY_VARS_gNB_s {
// SRS Variables
SOUNDINGRS_UL_CONFIG_DEDICATED soundingrs_ul_config_dedicated[NUMBER_OF_UE_MAX];
dmrs_UplinkConfig_t dmrs_UplinkConfig;
dmrs_DownlinkConfig_t dmrs_DownlinkConfig;
uint8_t ncs_cell[20][7];
// Scheduling Request Config
......
......@@ -119,7 +119,7 @@ SystemInformationBlockType1_nr_t;
#define NR_TDD_SET_ALL_SYMBOLS (0x3FFF)
#define NR_DOWNLINK_SLOT (0x01)
#define NR_UPLINK_SLOT (0x02)
#define NR_UPLINK_SLOT (0x03)
#define FRAME_DURATION_MICRO_SEC (10000) /* frame duration in microsecond */
......@@ -537,6 +537,7 @@ typedef enum {
typedef enum {
pusch_dmrs_pos0 = 0,
pusch_dmrs_pos1 = 1,
pusch_dmrs_pos2 = 2,
pusch_dmrs_pos3 = 3,
} pusch_dmrs_AdditionalPosition_t;
typedef enum {
......
......@@ -22,6 +22,7 @@
#include "PHY/phy_extern.h"
#include "PHY/defs_gNB.h"
#include "sched_nr.h"
#include "PHY/NR_REFSIG/dmrs_nr.h"
#include "PHY/NR_TRANSPORT/nr_transport.h"
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
......@@ -224,16 +225,39 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int UE_id
nfapi_nr_ul_config_ulsch_pdu_rel15_t *nfapi_ulsch_pdu_rel15 = &rel15_ul->ulsch_pdu_rel15;
uint8_t ret;
uint8_t l, number_dmrs_symbols = 0;
uint8_t mapping_type;
uint32_t G;
int Nid_cell = 0; // [hna] shouldn't be a local variable (should be signaled)
uint16_t start_symbol, number_symbols, nb_re_dmrs;
mapping_type = gNB->pusch_config.pusch_TimeDomainResourceAllocation[0]->mappingType;
start_symbol = nfapi_ulsch_pdu_rel15->start_symbol;
number_symbols = nfapi_ulsch_pdu_rel15->number_symbols;
for (l = start_symbol; l < start_symbol + number_symbols; l++)
number_dmrs_symbols += is_dmrs_symbol(l,
0,
0,
0,
0,
0,
number_symbols,
&gNB->dmrs_UplinkConfig,
mapping_type,
frame_parms->ofdm_symbol_size);
nb_re_dmrs = ((gNB->dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4)*number_dmrs_symbols;
G = nr_get_G(nfapi_ulsch_pdu_rel15->number_rbs,
nfapi_ulsch_pdu_rel15->number_symbols,
nfapi_ulsch_pdu_rel15->nb_re_dmrs,
number_symbols,
nb_re_dmrs,
nfapi_ulsch_pdu_rel15->length_dmrs,
nfapi_ulsch_pdu_rel15->Qm,
nfapi_ulsch_pdu_rel15->n_layers);
//----------------------------------------------------------
//------------------- ULSCH unscrambling -------------------
//----------------------------------------------------------
......@@ -253,7 +277,8 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int UE_id
gNB->pusch_vars[UE_id]->llr,
frame_parms,
frame_rx,
nfapi_ulsch_pdu_rel15->number_symbols,
number_symbols,
nb_re_dmrs,
slot_rx,
harq_pid,
0);
......@@ -369,7 +394,7 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE\n",frame_rx,slot_rx);
nfapi_nr_pusch_pdu_t *pusch_pdu = &UL_tti_req->pdus_list[0].pusch_pdu;
nr_fill_ulsch(gNB,frame_rx,slot_rx,pusch_pdu);
nr_fill_ulsch(gNB,frame_rx,slot_rx,pusch_pdu);
uint8_t UE_id = find_nr_ulsch(pusch_pdu->rnti,gNB,SEARCH_EXIST);
uint8_t harq_pid = pusch_pdu->pusch_data.harq_process_id;
......
......@@ -382,7 +382,8 @@ int main(int argc, char **argv)
uint8_t UE_id = 0;
NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id][0];
nfapi_nr_ul_config_ulsch_pdu_rel15_t *rel15_ul = &ulsch_gNB->harq_processes[harq_pid]->ulsch_pdu.ulsch_pdu_rel15;
NR_UL_gNB_HARQ_t *harq_process_gNB = ulsch_gNB->harq_processes[harq_pid];
nfapi_nr_ul_config_ulsch_pdu_rel15_t *rel15_ul = &harq_process_gNB->ulsch_pdu.ulsch_pdu_rel15;
NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[0][0][0];
......@@ -400,7 +401,6 @@ int main(int argc, char **argv)
rel15_ul->mcs = Imcs;
rel15_ul->rv = rvidx;
rel15_ul->n_layers = Nl;
rel15_ul->nb_re_dmrs = nb_re_dmrs;
rel15_ul->length_dmrs = length_dmrs;
rel15_ul->R = code_rate;
///////////////////////////////////////////////////
......@@ -525,7 +525,7 @@ int main(int argc, char **argv)
#endif
ret = nr_ulsch_decoding(gNB, UE_id, channel_output_fixed, frame_parms,
frame, nb_symb_sch, subframe, harq_pid, is_crnti);
frame, nb_symb_sch, nb_re_dmrs, subframe, harq_pid, is_crnti);
if (ret > ulsch_gNB->max_ldpc_iterations)
n_errors++;
......
......@@ -151,7 +151,7 @@ int main(int argc, char **argv)
int loglvl = OAILOG_WARNING;
uint64_t SSB_positions=0x01;
uint16_t nb_symb_sch = 12;
int start_symbol = NR_SYMBOLS_PER_SLOT - nb_symb_sch;
int start_symbol = 0;
uint16_t nb_rb = 50;
uint8_t Imcs = 9;
uint8_t precod_nbr_layers = 1;
......@@ -441,17 +441,6 @@ int main(int argc, char **argv)
}
unsigned char harq_pid = 0;
unsigned int TBS;
unsigned int available_bits;
uint8_t nb_re_dmrs = UE->dmrs_UplinkConfig.pusch_maxLength*(UE->dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1?6:4);
uint8_t length_dmrs = 1;
unsigned char mod_order;
uint16_t code_rate;
mod_order = nr_get_Qm_ul(Imcs, 0);
code_rate = nr_get_code_rate_ul(Imcs, 0);
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, 1);
TBS = nr_compute_tbs(mod_order, code_rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, precod_nbr_layers);
NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id][0];
//nfapi_nr_ul_config_ulsch_pdu *rel15_ul = &ulsch_gNB->harq_processes[harq_pid]->ulsch_pdu;
......@@ -459,7 +448,7 @@ int main(int argc, char **argv)
nfapi_nr_pusch_pdu_t *pusch_pdu = &UL_tti_req->pdus_list[0].pusch_pdu;
NR_UE_ULSCH_t **ulsch_ue = UE->ulsch[0][0];
unsigned char *estimated_output_bit;
unsigned char *test_input_bit;
uint32_t errors_decoding = 0;
......@@ -471,7 +460,33 @@ int main(int argc, char **argv)
nr_scheduled_response_t scheduled_response;
fapi_nr_ul_config_request_t ul_config;
unsigned int TBS;
uint16_t number_dmrs_symbols = 0;
unsigned int available_bits;
uint8_t nb_re_dmrs;
uint8_t length_dmrs = UE->dmrs_UplinkConfig.pusch_maxLength;
unsigned char mod_order;
uint16_t code_rate;
for (i = start_symbol; i < nb_symb_sch; i++)
number_dmrs_symbols += is_dmrs_symbol(i,
0,
0,
0,
0,
0,
nb_symb_sch,
&UE->dmrs_UplinkConfig,
UE->pusch_config.pusch_TimeDomainResourceAllocation[0]->mappingType,
frame_parms->ofdm_symbol_size);
mod_order = nr_get_Qm_ul(Imcs, 0);
nb_re_dmrs = ((UE->dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1) ? 6 : 4) * number_dmrs_symbols;
code_rate = nr_get_code_rate_ul(Imcs, 0);
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, 1);
TBS = nr_compute_tbs(mod_order, code_rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, precod_nbr_layers);
printf("\n");
for (SNR = snr0; SNR < snr1; SNR += snr_step) {
......@@ -493,7 +508,6 @@ int main(int argc, char **argv)
rel15_ul->ulsch_pdu_rel15.number_rbs = nb_rb;
rel15_ul->ulsch_pdu_rel15.start_symbol = start_symbol;
rel15_ul->ulsch_pdu_rel15.number_symbols = nb_symb_sch;
rel15_ul->ulsch_pdu_rel15.nb_re_dmrs = nb_re_dmrs;
rel15_ul->ulsch_pdu_rel15.length_dmrs = length_dmrs;
rel15_ul->ulsch_pdu_rel15.Qm = mod_order;
rel15_ul->ulsch_pdu_rel15.mcs = Imcs;
......@@ -515,8 +529,8 @@ int main(int argc, char **argv)
pusch_pdu->rnti = n_rnti;
pusch_pdu->mcs_index = Imcs;
pusch_pdu->mcs_table = 0;
pusch_pdu->target_code_rate = nr_get_code_rate_ul(pusch_pdu->mcs_index,pusch_pdu->mcs_table);
pusch_pdu->qam_mod_order = nr_get_Qm_ul(pusch_pdu->mcs_index,pusch_pdu->mcs_table) ;
pusch_pdu->target_code_rate = code_rate;
pusch_pdu->qam_mod_order = mod_order;
pusch_pdu->transform_precoding = 0;
pusch_pdu->data_scrambling_id = 0;
pusch_pdu->nrOfLayers = 1;
......@@ -535,13 +549,7 @@ int main(int argc, char **argv)
pusch_pdu->pusch_data.rv_index = 0;
pusch_pdu->pusch_data.harq_process_id = 0;
pusch_pdu->pusch_data.new_data_indicator = 0;
pusch_pdu->pusch_data.tb_size = nr_compute_tbs(pusch_pdu->mcs_index,
pusch_pdu->target_code_rate,
pusch_pdu->rb_size,
pusch_pdu->nr_of_symbols,
nb_re_dmrs*length_dmrs,
0,
pusch_pdu->nrOfLayers = 1);
pusch_pdu->pusch_data.tb_size = TBS;
pusch_pdu->pusch_data.num_cb = 0;
......@@ -669,7 +677,7 @@ int main(int argc, char **argv)
break;
} // frame loop
if(is_frame_in_error == 0 || number_of_frames==1)
if(is_frame_in_error == 0)
break;
} // SNR loop
......
......@@ -375,11 +375,11 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
// Phytest scheduling
if (slot_rxP==2){
if (slot_rxP==NR_UPLINK_SLOT){
nr_schedule_uss_ulsch_phytest(&RC.nrmac[module_idP]->UL_tti_req[0], frame_rxP, slot_rxP);
}
if (slot_txP==1){
if (slot_txP==NR_DOWNLINK_SLOT){
nr_schedule_uss_dlsch_phytest(module_idP, frame_txP, slot_txP,NULL);
}
......
......@@ -526,7 +526,7 @@ void nr_schedule_uss_ulsch_phytest(nfapi_nr_ul_tti_request_t *UL_tti_req,
//pusch_pdu->tx_direct_current_location;//The uplink Tx Direct Current location for the carrier. Only values in the value range of this field between 0 and 3299, which indicate the subcarrier index within the carrier corresponding 1o the numerology of the corresponding uplink BWP and value 3300, which indicates "Outside the carrier" and value 3301, which indicates "Undetermined position within the carrier" are used. [TS38.331, UplinkTxDirectCurrentBWP IE]
pusch_pdu->uplink_frequency_shift_7p5khz = 0;
//Resource Allocation in time domain
pusch_pdu->start_symbol_index = 2;
pusch_pdu->start_symbol_index = 0;
pusch_pdu->nr_of_symbols = 12;
//Optional Data only included if indicated in pduBitmap
pusch_pdu->pusch_data.rv_index = 0;
......
diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index 227e8d8..6cd7151 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -661,7 +661,8 @@ function main() {
if [ "$SIMUS_PHY" = "1" ] ; then
echo_info "Compiling physical unitary tests simulators"
# TODO: fix: dlsim_tm4 pucchsim prachsim pdcchsim pbchsim mbmssim
- simlist="dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim"
+ #simlist="dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim"
+ simlist="nr_ulsim nr_dlsim"
for f in $simlist ; do
compilations \
phy_simulators $f \
diff --git a/executables/nr-ru.c b/executables/nr-ru.c
index b96fc9e..4ab9fce 100644
--- a/executables/nr-ru.c
+++ b/executables/nr-ru.c
@@ -2330,7 +2330,7 @@ void RCconfig_RU(void)
RC.ru[j]->nb_tx = *(RUParamList.paramarray[j][RU_NB_TX_IDX].uptr);
RC.ru[j]->nb_rx = *(RUParamList.paramarray[j][RU_NB_RX_IDX].uptr);
RC.ru[j]->att_tx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr);
- RC.ru[j]->att_rx = *(RUParamList.paramarray[j][RU_ATT_RX_IDX].uptr);
+ RC.ru[j]->att_rx = 4;//*(RUParamList.paramarray[j][RU_ATT_RX_IDX].uptr);
}// j=0..num_rus
} else {
RC.nb_RU = 0;
diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c
index fff1245..66d6e09 100644
--- a/openair1/PHY/INIT/nr_init.c
+++ b/openair1/PHY/INIT/nr_init.c
@@ -403,12 +403,47 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,
gNB->mac_enabled = 1;
fp->dl_CarrierFreq = 3500000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value);
fp->ul_CarrierFreq = 3500000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000);
- fp->threequarter_fs= 0;
+ fp->threequarter_fs= 1;
nr_init_frame_parms(gNB_config, fp);
gNB->configured = 1;
LOG_I(PHY,"gNB configured\n");
}

+void nr_phy_config_request_sim_ulsim(PHY_VARS_gNB *gNB,
+ int N_RB_DL,
+ int N_RB_UL,
+ int mu,
+ int Nid_cell,
+ uint64_t position_in_burst,
+ uint8_t threequarter_fs)
+{
+ NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
+ nfapi_nr_config_request_t *gNB_config = &gNB->gNB_config;
+ //overwrite for new NR parameters
+ gNB_config->nfapi_config.rf_bands.rf_band[0] = 78;
+ gNB_config->nfapi_config.nrarfcn.value = 620000;
+ gNB_config->subframe_config.numerology_index_mu.value = mu;
+ gNB_config->subframe_config.duplex_mode.value = TDD;
+ gNB_config->rf_config.dl_carrier_bandwidth.value = N_RB_DL;
+ gNB_config->rf_config.ul_carrier_bandwidth.value = N_RB_UL;
+ gNB_config->sch_config.half_frame_index.value = 0;
+ gNB_config->sch_config.ssb_subcarrier_offset.value = 0;
+ gNB_config->sch_config.n_ssb_crb.value = (N_RB_DL-20);
+ gNB_config->sch_config.ssb_subcarrier_offset.value = 0;
+ gNB_config->sch_config.physical_cell_id.value = Nid_cell;
+ gNB_config->sch_config.ssb_scg_position_in_burst.value = position_in_burst;
+ gNB_config->subframe_config.dl_cyclic_prefix_type.value = (fp->Ncp == NORMAL) ? NFAPI_CP_NORMAL : NFAPI_CP_EXTENDED;
+
+ gNB->mac_enabled = 1;
+ fp->dl_CarrierFreq = 3500000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value);
+ fp->ul_CarrierFreq = 3500000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000);
+ fp->threequarter_fs= threequarter_fs;
+ nr_init_frame_parms(gNB_config, fp);
+ nr_dump_frame_parms(fp);
+ gNB->configured = 1;
+ LOG_I(PHY,"gNB configured\n");
+}
+

void nr_phy_config_request(NR_PHY_Config_t *phy_config)
{
diff --git a/openair1/PHY/INIT/phy_init.h b/openair1/PHY/INIT/phy_init.h
index 7e0500b..4209413 100644
--- a/openair1/PHY/INIT/phy_init.h
+++ b/openair1/PHY/INIT/phy_init.h
@@ -387,6 +387,7 @@ void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms);
int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char abstraction_flag);
void nr_phy_config_request(NR_PHY_Config_t *gNB);
void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,int N_RB_DL,int N_RB_UL,int mu,int Nid_cell,uint64_t position_in_burst);
+void nr_phy_config_request_sim_ulsim(PHY_VARS_gNB *gNB,int N_RB_DL,int N_RB_UL,int mu,int Nid_cell,uint64_t position_in_burst, uint8_t threequarter_fs);
void phy_free_nr_gNB(PHY_VARS_gNB *gNB);
int l1_north_init_gNB(void);
void init_nr_transport(PHY_VARS_gNB *gNB);
diff --git a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c
index 0656091..9e5fcb1 100644
--- a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c
+++ b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c
@@ -140,7 +140,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
ul_ch,
8);
pil+=2;
- re_offset = (re_offset+2)&(gNB->frame_parms.ofdm_symbol_size-1);
+ re_offset = (re_offset+2)%gNB->frame_parms.ofdm_symbol_size;//(re_offset+2)&(gNB->frame_parms.ofdm_symbol_size-1);
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
//for (int i= 0; i<8; i++)
//printf("ul_ch addr %p %d\n", ul_ch+i, *(ul_ch+i));
@@ -156,7 +156,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
ul_ch,
8);
pil+=2;
- re_offset = (re_offset+2)&(gNB->frame_parms.ofdm_symbol_size-1);
+ re_offset = (re_offset+2)%gNB->frame_parms.ofdm_symbol_size;//(re_offset+2)&(gNB->frame_parms.ofdm_symbol_size-1);
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
//printf("ul_ch addr %p\n",ul_ch);

@@ -175,7 +175,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
//printf("ul_ch addr %p %d\n", ul_ch+i, *(ul_ch+i));

pil+=2;
- re_offset = (re_offset+2)&(gNB->frame_parms.ofdm_symbol_size-1);
+ re_offset = (re_offset+2)%gNB->frame_parms.ofdm_symbol_size;//(re_offset+2)&(gNB->frame_parms.ofdm_symbol_size-1);
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ul_ch+=8;

@@ -193,7 +193,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
8);

pil+=2;
- re_offset = (re_offset+2)&(gNB->frame_parms.ofdm_symbol_size-1);
+ re_offset = (re_offset+2)%gNB->frame_parms.ofdm_symbol_size;//(re_offset+2)&(gNB->frame_parms.ofdm_symbol_size-1);
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];

ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
@@ -206,7 +206,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
ul_ch,
8);
pil+=2;
- re_offset = (re_offset+2)&(gNB->frame_parms.ofdm_symbol_size-1);
+ re_offset = (re_offset+2)%gNB->frame_parms.ofdm_symbol_size;//(re_offset+2)&(gNB->frame_parms.ofdm_symbol_size-1);
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ul_ch+=8;

@@ -227,7 +227,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
//printf("ul_ch addr %p %d\n", ul_ch+i, *(ul_ch+i));

pil+=2;
- re_offset = (re_offset+2)&(gNB->frame_parms.ofdm_symbol_size-1);
+ re_offset = (re_offset+2)%gNB->frame_parms.ofdm_symbol_size;//(re_offset+2)&(gNB->frame_parms.ofdm_symbol_size-1);
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];

ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
@@ -242,7 +242,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
8);

pil+=2;
- re_offset = (re_offset+2)&(gNB->frame_parms.ofdm_symbol_size-1);
+ re_offset = (re_offset+2)%gNB->frame_parms.ofdm_symbol_size;//(re_offset+2)&(gNB->frame_parms.ofdm_symbol_size-1);
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ul_ch+=8;

diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c
index 2bc623a..e78842d 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c
@@ -54,5 +54,8 @@ void nr_ulsch_unscrambling(int16_t* llr,
}
if (((s>>(i&0x1f))&1)==1)
llr[i] = -llr[i];
+
+ //if (i<10)
+ //printf("llr[%d] = %d\n", i, llr[i]);
}
}
diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
index 19ca123..68a54b3 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
@@ -346,7 +346,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,

G = nr_get_G(nb_rb, number_symbols, nb_re_dmrs, length_dmrs, Qm, n_layers);

- LOG_D(PHY,"ULSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_symb_sch %d nb_rb %d\n",harq_pid,A,G, mcs, n_layers, nb_symb_sch,nb_rb);
+ LOG_I(PHY,"ULSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_symb_sch %d nb_rb %d\n",harq_pid,A,G, mcs, n_layers, nb_symb_sch,nb_rb);

if (harq_process->round == 0) {

diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
index e1b3c5c..0369e73 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
@@ -365,9 +365,9 @@ void nr_ulsch_channel_level(int **ul_ch_estimates_ext,
ul_ch128=(__m128i *)&ul_ch_estimates_ext[(aatx<<1)+aarx][symbol*nb_rb*12];

for (rb = 0; rb < nb_rb; rb++) {
- avg128U = _mm_add_epi32(avg128U, _mm_srai_epi32(_mm_madd_epi16(ul_ch128[0], ul_ch128[0]), x));
- avg128U = _mm_add_epi32(avg128U, _mm_srai_epi32(_mm_madd_epi16(ul_ch128[1], ul_ch128[1]), x));
- avg128U = _mm_add_epi32(avg128U, _mm_srai_epi32(_mm_madd_epi16(ul_ch128[2], ul_ch128[2]), x));
+ avg128U = _mm_add_epi32(avg128U, _mm_srai_epi16(_mm_madd_epi16(ul_ch128[0], ul_ch128[0]), x));
+ avg128U = _mm_add_epi32(avg128U, _mm_srai_epi16(_mm_madd_epi16(ul_ch128[1], ul_ch128[1]), x));
+ avg128U = _mm_add_epi32(avg128U, _mm_srai_epi16(_mm_madd_epi16(ul_ch128[2], ul_ch128[2]), x));
ul_ch128+=3;
}

@@ -977,6 +977,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
uint32_t nb_re_pusch, bwp_start_subcarrier;
int avgs;
int avg[4];
+ char filename[40];

pilots = 0;
first_symbol_flag = 0;
@@ -1062,6 +1063,16 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
rel15_ul->number_rbs,
gNB->pusch_vars[UE_id]->log2_maxh);

+ if (symbol == 3){
+ printf("log2_maxh = %d\n", gNB->pusch_vars[UE_id]->log2_maxh);
+ sprintf(filename,"rxdataF_gnb_ext.m");
+ LOG_M(filename,"rxdataF_gnb_v",&gNB->pusch_vars[UE_id]->rxdataF_ext[0][symbol*NR_NB_SC_PER_RB*rel15_ul->number_rbs],NR_NB_SC_PER_RB*rel15_ul->number_rbs, 1, 1);
+ sprintf(filename,"rxdataF_comp_gnb.m");
+ LOG_M(filename,"rxdataF_comp_gnb_v",&gNB->pusch_vars[UE_id]->rxdataF_comp[0][symbol*NR_NB_SC_PER_RB*rel15_ul->number_rbs],NR_NB_SC_PER_RB*rel15_ul->number_rbs, 1, 1);
+ sprintf(filename,"ul_ch_est_ext_gnb.m");
+ LOG_M(filename,"ul_ch_est_ext_gnb_v",&gNB->pusch_vars[UE_id]->ul_ch_estimates_ext[0][symbol*NR_NB_SC_PER_RB*rel15_ul->number_rbs], NR_NB_SC_PER_RB*rel15_ul->number_rbs, 1, 1);
+ }
+
#ifdef NR_SC_FDMA
nr_idft(&((uint32_t*)gNB->pusch_vars[UE_id]->rxdataF_ext[0])[symbol * rel15_ul->number_rbs * NR_NB_SC_PER_RB], nb_re_pusch);
#endif
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
index 79b5c8d..c96a9a6 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
@@ -155,6 +155,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
uint16_t n_tx=1, n_rx=1;
int32_t median[16];
uint32_t len;
+ char filename[40];

switch (type) {
case SI_PDSCH:
@@ -592,6 +593,17 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,

}

+ if (symbol == 3){
+ printf("log2_maxh = %d\n", pdsch_vars[eNB_id]->log2_maxh);
+ sprintf(filename,"rxdataF_ue_ext.m");
+ LOG_M(filename,"rxdataF_ue_ext_v",&pdsch_vars[eNB_id]->rxdataF_ext[0][symbol*NR_NB_SC_PER_RB*nb_rb],NR_NB_SC_PER_RB*nb_rb, 1, 1);
+ sprintf(filename,"rxdataF_comp_ue.m");
+ LOG_M(filename,"rxdataF_comp_ue_v",&pdsch_vars[eNB_id]->rxdataF_comp0[0][symbol*NR_NB_SC_PER_RB*nb_rb],NR_NB_SC_PER_RB*nb_rb, 1, 1);
+ sprintf(filename,"dl_ch_est_ext_ue.m");
+ LOG_M(filename,"dl_ch_est_ext_ue",&pdsch_vars[eNB_id]->dl_ch_estimates_ext[0][symbol*NR_NB_SC_PER_RB*nb_rb], NR_NB_SC_PER_RB*nb_rb, 1, 1);
+ }
+
+
#if UE_TIMING_TRACE
stop_meas(&ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot]);
#if DISABLE_LOG_X
@@ -636,6 +648,15 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
dl_ch_mag_ptr = pdsch_vars[eNB_id_i]->dl_ch_mag0;
//i_mod should have been passed as a parameter
}
+
+
+ if (symbol == 3){
+ printf("log2_maxh = %d\n", pdsch_vars[eNB_id]->log2_maxh);
+ sprintf(filename,"rxdataF_comp_ue.m");
+ LOG_M(filename,"rxdataF_comp_ue_v",&pdsch_vars[eNB_id]->rxdataF_comp0[0][symbol*NR_NB_SC_PER_RB*nb_rb],NR_NB_SC_PER_RB*nb_rb, 1, 1);
+ sprintf(filename,"dl_ch_est_ext_ue.m");
+ LOG_M(filename,"dl_ch_est_ext_ue",&pdsch_vars[eNB_id]->dl_ch_estimates_ext[0][symbol*NR_NB_SC_PER_RB*nb_rb], NR_NB_SC_PER_RB*nb_rb, 1, 1);
+ }

#if UE_TIMING_TRACE
stop_meas(&ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot]);
diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c
index 3ac808f..9ab539a 100644
--- a/openair1/SCHED_NR/nr_ru_procedures.c
+++ b/openair1/SCHED_NR/nr_ru_procedures.c
@@ -395,6 +395,7 @@ void nr_fep_full(RU_t *ru, int slot) {
RU_proc_t *proc = &ru->proc;
int l, aa;
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
+ char filename[40];

// if ((fp->frame_type == TDD) && 
// (subframe_select(fp,proc->tti_rx) != SF_UL)) return;
@@ -405,6 +406,9 @@ void nr_fep_full(RU_t *ru, int slot) {
// remove_7_5_kHz(ru,proc->tti_rx<<1);
// remove_7_5_kHz(ru,1+(proc->tti_rx<<1));

+ //sprintf(filename,"rxdata_gnb.m");
+ //LOG_M(filename,"rxdata_gnb_v",&ru->common.rxdata[0][proc->tti_rx*fp->samples_per_slot], 2*fp->samples_per_slot, 1, 0);
+
for (l = 0; l < fp->symbols_per_slot; l++) {
for (aa = 0; aa < fp->nb_antennas_rx; aa++) {
nr_slot_fep_ul(fp,
diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
index ccf5343..bbd0c65 100644
--- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
+++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
@@ -4143,6 +4143,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
uint8_t ssb_periodicity = 10;// ue->ssb_periodicity; // initialized to 5ms in nr_init_ue for scenarios where UE is not configured (otherwise acquired by cell configuration from gNB or LTE)
uint8_t dci_cnt = 0;
fapi_nr_pbch_config_t *pbch_config = &ue->nrUE_config.pbch_config;
+
+ char filename[40];

LOG_D(PHY," ****** start RX-Chain for Frame.Slot %d.%d ****** \n", frame_rx%1024, nr_tti_rx);

@@ -4200,6 +4202,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
}

dci_cnt = nr_ue_pdcch_procedures(eNB_id, ue, proc);
+ dci_cnt = 1;

if (dci_cnt > 0) {

@@ -4215,17 +4218,32 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
16384);
}
} else {
- LOG_D(PHY,"[UE %d] Frame %d, nr_tti_rx %d: No DCIs found\n",ue->Mod_id,frame_rx,nr_tti_rx);
+ LOG_I(PHY,"[UE %d] Frame %d, nr_tti_rx %d: No DCIs found\n",ue->Mod_id,frame_rx,nr_tti_rx);
}
#endif //NR_PDCCH_SCHED


if (dci_cnt > 0){
- LOG_D(PHY," ------ --> PDSCH ChannelComp/LLR Frame.slot %d.%d ------ \n", frame_rx%1024, nr_tti_rx);
+
+ ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id][0]->active = 1;
+ dlsch0_harq->nb_rb = 50;
+ dlsch0_harq->start_rb = 0;
+ dlsch0_harq->nb_symbols = 12;//dlsch_config_pdu->number_symbols;
+ dlsch0_harq->start_symbol = 2;//dlsch_config_pdu->start_symbol;
+ dlsch0_harq->mcs = 9;
+ dlsch0_harq->DCINdi = 1;
+ dlsch0_harq->rvidx = 0;
+ dlsch0_harq->Nl=1;
+ dlsch0_harq->status = ACTIVE;
+
+ LOG_I(PHY," ------ --> PDSCH ChannelComp/LLR Frame.slot %d.%d ------ \n", frame_rx%1024, nr_tti_rx);
//to update from pdsch config
nr_gold_pdsch(ue,nb_symb_pdcch,0, 1);

nb_symb_sch = dlsch0_harq->nb_symbols;
+
+ sprintf(filename,"rxdata_ue_test.m");
+ LOG_M(filename,"rxdata_ue_test_v",&ue->common_vars.rxdata[0][nr_tti_rx*ue->frame_parms.samples_per_slot],ue->frame_parms.samples_per_slot, 1, 1);

for (uint16_t m=nb_symb_pdcch;m<=(nb_symb_sch+nb_symb_pdcch-1) ; m++){
nr_slot_fep(ue,
@@ -4237,7 +4255,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,

}
//set active for testing, to be removed
- ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id][0]->active = 1;
+ 
}
else
ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id][0]->active = 0;
diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c
index a471062..cd64e53 100644
--- a/openair1/SIMULATION/NR_PHY/dlsim.c
+++ b/openair1/SIMULATION/NR_PHY/dlsim.c
@@ -173,7 +173,7 @@ int main(int argc, char **argv)
//unsigned char frame_type = 0;
unsigned char pbch_phase = 0;

- int frame=0,slot=1;
+ int frame=0,slot=2;
int frame_length_complex_samples;
int frame_length_complex_samples_no_prefix;
int slot_length_complex_samples_no_prefix;
@@ -188,7 +188,7 @@ int main(int argc, char **argv)
int run_initial_sync=0;
int do_pdcch_flag=1;

- int loglvl=OAILOG_WARNING;
+ int loglvl=OAILOG_INFO;

float target_error_rate = 0.01;

@@ -398,6 +398,7 @@ int main(int argc, char **argv)
logInit();
set_glog(loglvl);
T_stdout = 1;
+ FILE *in_file;

if (snr1set==0)
snr1 = snr0+10;
@@ -695,8 +696,13 @@ int main(int argc, char **argv)

nr_ue_phy_config_request(&UE_mac->phy_config);

+ int16_t *rxdata_ue;
+ rxdata_ue = &((short*) UE->common_vars.rxdata[0])[2*slot*frame_parms->samples_per_slot];
+
for (SNR = snr0; SNR < snr1; SNR += .2) {

+ in_file = fopen("rxdata_gnb.m", "r");
+
n_errors = 0;
//n_errors2 = 0;
//n_alamouti = 0;
@@ -710,14 +716,22 @@ int main(int argc, char **argv)
sigma2_dB = 10 * log10((double)txlev) - SNR;
sigma2 = pow(10, sigma2_dB/10);
// printf("sigma2 %f (%f dB)\n",sigma2,sigma2_dB);
-
+/*
for (i=0; i<frame_length_complex_samples; i++) {
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
((short*) UE->common_vars.rxdata[aa])[2*i] = (short) ((r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
((short*) UE->common_vars.rxdata[aa])[2*i+1] = (short) ((r_im[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
}
}
-
+*/
+ for (i = 0; i < 2*frame_parms->samples_per_slot; i++){
+ fscanf(in_file, "%d", &rxdata_ue[i]);
+ }
+/*
+ char filename[40];
+ sprintf(filename,"rxdata_ue_test.m");
+ LOG_M(filename,"rxdata_ue_test_v",&UE->common_vars.rxdata[0][slot*frame_parms->samples_per_slot],frame_parms->samples_per_slot, 1, 1);
+*/
if (n_trials == 1) {

LOG_M("rxsig0.m","rxs0", UE->common_vars.rxdata[0], frame_length_complex_samples, 1, 1);
diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c
index 00ba0bb..3e31fa0 100644
--- a/openair1/SIMULATION/NR_PHY/ulsim.c
+++ b/openair1/SIMULATION/NR_PHY/ulsim.c
@@ -99,7 +99,7 @@ int main(int argc, char **argv)
double sigma, sigma_dB;
double snr_step = 0.1;
uint8_t snr1set = 0;
- int slot = 0;
+ int slot = 1;
FILE *output_fd = NULL;
//uint8_t write_output_file = 0;
int trial, n_trials = 1, n_errors = 0, n_false_positive = 0, delay = 0;
@@ -116,10 +116,10 @@ int main(int argc, char **argv)
int number_of_frames = 1;
int frame_length_complex_samples;
NR_DL_FRAME_PARMS *frame_parms;
- int loglvl = OAILOG_WARNING;
+ int loglvl = OAILOG_INFO;
uint64_t SSB_positions=0x01;
- uint16_t nb_symb_sch = 12;
- int start_symbol = NR_SYMBOLS_PER_SLOT - nb_symb_sch;
+ uint16_t nb_symb_sch = 9;
+ int start_symbol = 2;
uint16_t nb_rb = 50;
uint8_t Imcs = 9;
uint8_t precod_nbr_layers = 1;
@@ -130,6 +130,7 @@ int main(int argc, char **argv)
int32_t txlev;
int start_rb = 0;
int UE_id =0; // [hna] only works for UE_id = 0 because NUMBER_OF_NR_UE_MAX is set to 1 (phy_init_nr_gNB causes segmentation fault)
+ uint8_t threequarter_fs = 0;

cpuf = get_cpu_freq_GHz();

@@ -144,7 +145,7 @@ int main(int argc, char **argv)
//logInit();
randominit(0);

- while ((c = getopt(argc, argv, "d:f:g:h:i:j:l:m:n:p:r:s:y:z:F:M:N:P:R:S:")) != -1) {
+ while ((c = getopt(argc, argv, "d:f:g:h:i:j:l:m:n:pr:s:y:z:F:M:N:P:R:S:E")) != -1) {
switch (c) {

/*case 'd':
@@ -303,6 +304,10 @@ int main(int argc, char **argv)
printf("Setting SNR1 to %f\n", snr1);
break;

+ case 'E':
+ threequarter_fs = 1;
+ 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]);
@@ -330,6 +335,7 @@ int main(int argc, char **argv)
printf("-O oversampling factor (1,2,4,8,16)\n");
printf("-R N_RB_DL\n");
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
+ printf("-E enable threequarter sampling\n");
exit(-1);
break;
}
@@ -338,6 +344,7 @@ int main(int argc, char **argv)
logInit();
set_glog(loglvl);
T_stdout = 1;
+ FILE *in_file;

if (snr1set == 0)
snr1 = snr0 + 10;
@@ -367,7 +374,7 @@ int main(int argc, char **argv)

crcTableInit();

- nr_phy_config_request_sim(gNB, N_RB_DL, N_RB_UL, mu, Nid_cell, SSB_positions);
+ nr_phy_config_request_sim_ulsim(gNB, N_RB_DL, N_RB_UL, mu, Nid_cell, SSB_positions, threequarter_fs);

phy_init_nr_gNB(gNB, 0, 0);
//init_eNB_afterRU();
@@ -511,20 +518,42 @@ int main(int argc, char **argv)
sigma_dB = 10*log10(txlev_float)-SNR;
sigma = pow(10,sigma_dB/10);

+ int16_t *rxdata_gnb;
+ rxdata_gnb = &((short*) gNB->common_vars.rxdata[0])[2*slot*frame_parms->samples_per_slot];
+
for (trial = 0; trial < n_trials; trial++) {

errors_scrambling = 0;
errors_decoding = 0;

+ in_file = fopen("rxdata_ue.m", "r");
+
+ if (in_file == NULL)
+ {
+ printf("Can't open file for reading.\n");
+ return -1;
+ }
+
//----------------------------------------------------------
//------------------------ add noise -----------------------
//----------------------------------------------------------
+ /*
for (i=0; i<frame_length_complex_samples; i++) {
for (ap=0; ap<frame_parms->nb_antennas_rx; ap++) {
- ((short*) gNB->common_vars.rxdata[ap])[(2*i) + (delay*2)] = (((int16_t *)UE->common_vars.txdata[ap])[(i<<1)]) + (int16_t)(sqrt(sigma/2)*gaussdouble(0.0,1.0)*(double)AMP); // convert to fixed point
- ((short*) gNB->common_vars.rxdata[ap])[2*i+1 + (delay*2)] = (((int16_t *)UE->common_vars.txdata[ap])[(i<<1)+1]) + (int16_t)(sqrt(sigma/2)*gaussdouble(0.0,1.0)*(double)AMP);
+ ((short*) gNB->common_vars.rxdata[ap])[(2*i) + (delay*2)] = 0.5*((((int16_t *)UE->common_vars.txdata[ap])[(i<<1)]) + (int16_t)(sqrt(sigma/2)*gaussdouble(0.0,1.0)*(double)AMP)); // convert to fixed point
+ ((short*) gNB->common_vars.rxdata[ap])[2*i+1 + (delay*2)] = 0.5*((((int16_t *)UE->common_vars.txdata[ap])[(i<<1)+1]) + (int16_t)(sqrt(sigma/2)*gaussdouble(0.0,1.0)*(double)AMP));
}
}
+ */
+
+ for (i = 0; i < 2*frame_parms->samples_per_slot; i++){
+ fscanf(in_file, "%d", &rxdata_gnb[i]);
+ }
+
+ char filename[40];
+ sprintf(filename,"rxdata_ue_ulsim.m");
+ LOG_M(filename,"rxdata_ue_v",&gNB->common_vars.rxdata[0][slot*frame_parms->samples_per_slot], frame_parms->samples_per_slot, 1, 1);
+ 
////////////////////////////////////////////////////////////

//----------------------------------------------------------
@@ -628,5 +657,8 @@ int main(int argc, char **argv)
if (input_fd)
fclose(input_fd);

+ if (in_file)
+ fclose(in_file);
+
return (n_errors);
}
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf
index a11bf9d..86dc080 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf
@@ -255,7 +255,6 @@ RUs = (
max_rxgain = 114;
eNB_instances = [0];
sdr_addrs = "type=x300";
-
}
); 

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