Commit 95c9cd7b authored by Melissa Elkadi's avatar Melissa Elkadi

Merge remote-tracking branch 'origin/episys-add-sl-freq-wt-bandwidth' into episys-add-sl-freq

parents 5b977ca7 4cf96402
......@@ -237,7 +237,7 @@ void rx_func(void *param)
slot_rx,
0,
gNB->frame_parms.Ncp == EXTENDED ? 12 : 14,
NR_LINK_TYPE_UL);
link_type_ul);
}
}
phy_procedures_gNB_uespec_RX(gNB, frame_rx, slot_rx);
......
......@@ -570,6 +570,7 @@ typedef struct
uint32_t uplink_frequency;//Absolute frequency of UL point A in KHz [38.104, sec5.2 and 38.211 sec 4.4.4.2] Value: 450000 -> 52600000
uint16_t ul_k0[5];//𝑘0 𝜇 for each of the numerologies [38.211, sec 5.3.1] Value: : 0 ->23699
uint16_t ul_grid_size[5];//Grid size 𝑁𝑔𝑟𝑖𝑑 𝑠𝑖𝑧𝑒,𝜇 for each of the numerologies [38.211, sec 4.4.2]. Value: 0->275 0 = this numerology not used
uint16_t sl_grid_size[5];
uint16_t num_rx_ant;//
uint8_t frequency_shift_7p5khz;//Indicates presence of 7.5KHz frequency shift. Value: 0 = false 1 = true
......
......@@ -43,6 +43,14 @@ static const int nr_ssb_table[48][3] = {
void set_Lmax(NR_DL_FRAME_PARMS *fp) {
if (get_softmodem_params()->sl_mode == 2) {
int sl_NumSSB_WithinPeriod = 1; //TODO: Needs to be updated from RRC parameters
int sl_TimeOffsetSSB = 1; //TODO: Needs to be updated from RRC parameters
int sl_TimeInterval = 1; //TODO: Needs to be updated from RRC parameters
if ((sl_NumSSB_WithinPeriod == 4) && ((sl_TimeOffsetSSB % fp->slots_per_frame) + 3 * sl_TimeInterval < NR_NUMBER_OF_SUBFRAMES_PER_FRAME))
fp->Lmax = 2;
else if ((sl_NumSSB_WithinPeriod == 2) && ((sl_TimeOffsetSSB % fp->slots_per_frame) + sl_TimeInterval < NR_NUMBER_OF_SUBFRAMES_PER_FRAME))
fp->Lmax = 4;
else
fp->Lmax = 1;
return;
}
......@@ -155,6 +163,7 @@ void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, int N_RB_DL)
while(fp->ofdm_symbol_size < N_RB_DL * 12)
fp->ofdm_symbol_size <<= 1;
//TODO: The following 'if' setting needs to be removed later;
if (get_softmodem_params()->sl_mode == 2)
fp->first_carrier_offset = 0;
else
......@@ -292,7 +301,8 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
LOG_D(PHY,"dl_CarrierFreq %lu\n",fp->dl_CarrierFreq);
if (get_softmodem_params()->sl_mode == 2) {
fp->sl_CarrierFreq = ((dl_bw_khz >> 1) + config->carrier_config.sl_frequency) * 1000;
uint64_t sl_bw_khz = (12*config->carrier_config.sl_grid_size[config->ssb_config.scs_common])*(15<<config->ssb_config.scs_common);
fp->sl_CarrierFreq = ((sl_bw_khz >> 1) + config->carrier_config.sl_frequency) * 1000;
}
uint64_t ul_bw_khz = (12*config->carrier_config.ul_grid_size[config->ssb_config.scs_common])*(15<<config->ssb_config.scs_common);
......@@ -301,6 +311,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
fp->numerology_index = config->ssb_config.scs_common;
fp->N_RB_UL = config->carrier_config.ul_grid_size[fp->numerology_index];
fp->N_RB_DL = config->carrier_config.dl_grid_size[fp->numerology_index];
fp->N_RB_SL = config->carrier_config.sl_grid_size[fp->numerology_index];
fp->frame_type = get_frame_type(fp->nr_band, fp->numerology_index);
int32_t uplink_frequency_offset = get_delta_duplex(fp->nr_band, fp->numerology_index);
......@@ -319,8 +330,8 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
AssertFatal(fp->numerology_index == NR_MU_2,"Invalid cyclic prefix %d for numerology index %d\n", Ncp, fp->numerology_index);
fp->Ncp = Ncp;
set_scs_parameters(fp, fp->numerology_index, fp->N_RB_DL);
int N_RB = (get_softmodem_params()->sl_mode == 2) ? fp->N_RB_SL : fp->N_RB_DL;
set_scs_parameters(fp, fp->numerology_index, N_RB);
fp->slots_per_frame = 10* fp->slots_per_subframe;
fp->symbols_per_slot = ((Ncp == NORMAL)? 14 : 12); // to redefine for different slot formats
......@@ -344,6 +355,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
}
fp->ssb_start_subcarrier = (12 * config->ssb_table.ssb_offset_point_a + sco);
//TODO: The following setting needs to be removed later;
if (get_softmodem_params()->sl_mode == 2) {
fp->ssb_start_subcarrier = 0;
}
......
......@@ -21,6 +21,7 @@
#include "nr_modulation.h"
#include "PHY/NR_REFSIG/nr_mod_table.h"
#include "executables/softmodem-common.h"
//Table 6.3.1.5-1 Precoding Matrix W 1 layer 2 antenna ports 'n' = -1 and 'o' = -j
const char nr_W_1l_2p[6][2][1] = {
......@@ -600,18 +601,20 @@ void init_symbol_rotation(NR_DL_FRAME_PARMS *fp) {
uint64_t dl_CarrierFreq = fp->dl_CarrierFreq;
uint64_t ul_CarrierFreq = fp->ul_CarrierFreq;
uint64_t sl_CarrierFreq = fp->sl_CarrierFreq;
double f[3] = {(double)dl_CarrierFreq, (double)ul_CarrierFreq, (double)sl_CarrierFreq};
double f[2] = {(double)dl_CarrierFreq, (double)ul_CarrierFreq};
const int nsymb = fp->symbols_per_slot * fp->slots_per_frame/10;
const double Tc=(1/480e3/4096);
const double Nu=2048*64*(1/(float)(1<<fp->numerology_index));
const double Ncp0=16*64 + (144*64*(1/(float)(1<<fp->numerology_index)));
const double Ncp1=(144*64*(1/(float)(1<<fp->numerology_index)));
const uint8_t num_freq = sizeof(f)/sizeof(f[0]);
const uint8_t sl_freq = !get_softmodem_params()->sl_mode ? 0 : 1;
for (uint8_t ll = 0; ll < sizeof(f)/sizeof(f[0]); ll++){
for (uint8_t ll = 0; ll < num_freq + sl_freq; ll++){
double f0 = f[ll];
LOG_D(PHY, "Doing symbol rotation calculation for gNB TX/RX, f0 %f Hz, Nsymb %d\n", f0, nsymb);
double f0 = (ll < num_freq) ? f[ll] : (double)sl_CarrierFreq;
LOG_I(PHY, "Doing symbol rotation calculation for gNB TX/RX, f0 %f Hz, Nsymb %d\n", f0, nsymb);
c16_t *symbol_rotation = fp->symbol_rotation[ll];
double tl = 0.0;
......
......@@ -33,6 +33,7 @@ This section deals with basic functions for OFDM Modulation.
#include "PHY/defs_eNB.h"
#include "PHY/defs_gNB.h"
#include "PHY/impl_defs_top.h"
#include "PHY/impl_defs_nr.h"
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "modulation_common.h"
......@@ -343,6 +344,7 @@ void apply_nr_rotation(NR_DL_FRAME_PARMS *fp,
int symb_offset = (slot%fp->slots_per_subframe)*fp->symbols_per_slot;
c16_t *symbol_rotation = fp->symbol_rotation[link_type] + symb_offset;
int N_RB = (link_type == link_type_sl) ? fp->N_RB_SL : fp->N_RB_DL;
for (int sidx = first_symbol; sidx < first_symbol + nsymb; sidx++) {
c16_t *this_rotation = symbol_rotation + sidx;
......@@ -355,20 +357,20 @@ void apply_nr_rotation(NR_DL_FRAME_PARMS *fp,
this_rotation->r,
this_rotation->i);
if (fp->N_RB_DL & 1) {
if (N_RB & 1) {
rotate_cpx_vector(this_symbol, this_rotation, this_symbol,
(fp->N_RB_DL + 1) * 6, 15);
(N_RB + 1) * 6, 15);
rotate_cpx_vector(this_symbol + fp->first_carrier_offset - 6,
this_rotation,
this_symbol + fp->first_carrier_offset - 6,
(fp->N_RB_DL + 1) * 6, 15);
(N_RB + 1) * 6, 15);
} else {
rotate_cpx_vector(this_symbol, this_rotation, this_symbol,
fp->N_RB_DL * 6, 15);
N_RB * 6, 15);
rotate_cpx_vector(this_symbol + fp->first_carrier_offset,
this_rotation,
this_symbol + fp->first_carrier_offset,
fp->N_RB_DL * 6, 15);
N_RB * 6, 15);
}
}
}
......
......@@ -301,7 +301,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
is * fp->samples_per_frame + ue->ssb_offset,
false,
rxdataF,
NR_LINK_TYPE_DL);
link_type_dl);
#ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"Calling sss detection (normal CP)\n");
......@@ -536,7 +536,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
is*fp->samples_per_frame+phy_pdcch_config->sfn*fp->samples_per_frame+ue->rx_offset,
true,
rxdataF,
NR_LINK_TYPE_DL);
link_type_dl);
nr_pdcch_channel_estimation(ue,
proc,
......@@ -563,7 +563,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
is*fp->samples_per_frame+phy_pdcch_config->sfn*fp->samples_per_frame+ue->rx_offset,
true,
rxdataF,
NR_LINK_TYPE_DL);
link_type_dl);
}
uint8_t nb_re_dmrs;
......
......@@ -617,7 +617,7 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE,
for(ap = 0; ap < n_antenna_ports; ap++) {
for (int s=0;s<NR_NUMBER_OF_SYMBOLS_PER_SLOT;s++){
c16_t *this_symbol = &txdataF[ap][frame_parms->ofdm_symbol_size * s];
c16_t rot=frame_parms->symbol_rotation[NR_LINK_TYPE_UL][s + symb_offset];
c16_t rot=frame_parms->symbol_rotation[link_type_ul][s + symb_offset];
LOG_D(PHY,"rotating txdataF symbol %d (%d) => (%d.%d)\n",
s,
s + symb_offset,
......
......@@ -147,6 +147,8 @@ struct NR_DL_FRAME_PARMS {
int N_RB_DL;
/// Number of resource blocks (RB) in UL
int N_RB_UL;
/// Number of resource blocks (RB) in SL
int N_RB_SL;
/// total Number of Resource Block Groups: this is ceil(N_PRB/P)
uint8_t N_RBG;
/// Total Number of Resource Block Groups SubSets: this is P
......
......@@ -99,12 +99,14 @@ SystemInformationBlockType1_nr_t;
#define NR_UPLINK_SLOT (0x02)
#define NR_MIXED_SLOT (0x03)
#define NR_LINK_TYPE_DL (0x00)
#define NR_LINK_TYPE_UL (0x01)
#define NR_LINK_TYPE_SL (0x02)
#define FRAME_DURATION_MICRO_SEC (10000) /* frame duration in microsecond */
enum nr_Link {
link_type_dl,
link_type_ul,
link_type_sl,
};
typedef enum {
ms0p5 = 500, /* duration is given in microsecond */
ms0p625 = 625,
......
......@@ -222,7 +222,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
//apply the OFDM symbol rotation here
for (aa=0; aa<cfg->carrier_config.num_tx_ant.value; aa++) {
apply_nr_rotation(fp, &gNB->common_vars.txdataF[aa][txdataF_offset], slot, 0, fp->Ncp == EXTENDED ? 12 : 14, NR_LINK_TYPE_DL);
apply_nr_rotation(fp, &gNB->common_vars.txdataF[aa][txdataF_offset], slot, 0, fp->Ncp == EXTENDED ? 12 : 14, link_type_dl);
T(T_GNB_PHY_DL_OUTPUT_SIGNAL, T_INT(0),
T_INT(frame), T_INT(slot),
......
......@@ -38,7 +38,7 @@
#include "PHY/MODULATION/modulation_eNB.h"
#include "PHY/MODULATION/modulation_UE.h"
#include "PHY/MODULATION/nr_modulation.h"
#include "PHY/INIT/nr_phy_init.h"
#include "PHY/INIT/phy_init.h"
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
#include "PHY/NR_UE_ESTIMATION/nr_estimation.h"
......@@ -47,10 +47,10 @@
#include "openair1/SIMULATION/TOOLS/sim.h"
#include "openair1/SIMULATION/RF/rf.h"
#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
#include "openair1/PHY/MODULATION/nr_modulation.h"
#include <executables/softmodem-common.h>
#include <executables/nr-uesoftmodem.h>
#include "nfapi/oai_integration/vendor_ext.h"
//#define DEBUG_NR_PBCHSIM
PHY_VARS_gNB *gNB;
......@@ -60,24 +60,13 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
double cpuf;
//uint8_t nfapi_mode = 0;
const int NB_UE_INST = 1;
uint16_t NB_UE_INST = 1;
// needed for some functions
openair0_config_t openair0_cfg[MAX_CARDS];
uint8_t const nr_rv_round_map[4] = {0, 2, 3, 1};
void inc_ref_sched_response(int _)
{
LOG_E(PHY, "fatal\n");
exit(1);
}
void deref_sched_response(int _)
{
LOG_E(PHY, "fatal\n");
exit(1);
}
uint64_t get_softmodem_optmask(void) {return 0;}
static softmodem_params_t softmodem_params;
softmodem_params_t *get_softmodem_params(void) {
......@@ -91,47 +80,31 @@ nrUE_params_t *get_nrUE_params(void) {
}
void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {}
NR_IF_Module_t *NR_IF_Module_init(int Mod_id) { return (NULL); }
nfapi_mode_t nfapi_getmode(void) { return NFAPI_MODE_UNKNOWN; }
void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind,
fapi_nr_dci_indication_t *dci_ind,
fapi_nr_rx_indication_t *rx_ind,
UE_nr_rxtx_proc_t *proc,
PHY_VARS_NR_UE *ue,
void *phy_data) {}
void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
uint8_t pdu_type,
int nr_ue_pdcch_procedures(uint8_t gNB_id,
PHY_VARS_NR_UE *ue,
NR_UE_DLSCH_t *dlsch0,
NR_UE_DLSCH_t *dlsch1,
uint16_t n_pdus,
UE_nr_rxtx_proc_t *proc,
void *typeSpecific,
uint8_t *b) {}
int nr_ue_pdcch_procedures(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
int32_t pdcch_est_size,
int32_t pdcch_dl_ch_estimates[][pdcch_est_size],
nr_phy_data_t *phy_data,
int n_ss,
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]) {
NR_UE_PDCCH_CONFIG *phy_pdcch_config,
int n_ss) {
return 0;
}
int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
NR_UE_DLSCH_t dlsch[2],
int16_t *llr[2],
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]) {
int eNB_id, PDSCH_t pdsch,
NR_UE_DLSCH_t *dlsch0, NR_UE_DLSCH_t *dlsch1) {
return 0;
}
bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
NR_UE_DLSCH_t dlsch[2],
int16_t *llr[2]) {
int gNB_id,
PDSCH_t pdsch,
NR_UE_DLSCH_t *dlsch0,
NR_UE_DLSCH_t *dlsch1,
int *dlsch_errors) {
return false;
}
......@@ -166,14 +139,14 @@ void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB,
gNB_config->tdd_table.tdd_period.value = 0;
//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 = 3600000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value);
fp->ul_CarrierFreq = 3600000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000);
if (mu>2) fp->nr_band = 257;
else fp->nr_band = 78;
fp->threequarter_fs= 0;
int bw_index = get_supported_band_index(mu, fp->nr_band, N_RB_DL);
gNB_config->carrier_config.dl_bandwidth.value = get_supported_bw_mhz(fp->nr_band > 256 ? FR2 : FR1, bw_index);
gNB_config->carrier_config.dl_bandwidth.value = config_bandwidth(mu, N_RB_DL, fp->nr_band);
fp->ofdm_offset_divisor = UINT_MAX;
nr_init_frame_parms(gNB_config, fp);
......@@ -191,7 +164,7 @@ int main(int argc, char **argv)
double sigma2, sigma2_dB=10,SNR,snr0=-2.0,snr1=2.0;
double cfo=0;
uint8_t snr1set=0;
c16_t **txdata;
int **txdata;
double **s_re,**s_im,**r_re,**r_im;
//double iqim = 0.0;
double ip =0.0;
......@@ -501,9 +474,7 @@ int main(int argc, char **argv)
frame_parms->freq_range = mu<2 ? nr_FR1 : nr_FR2;
nr_phy_config_request_sim_pbchsim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell,SSB_positions);
gNB->gNB_config.tdd_table.tdd_period.value = 6;
set_tdd_config_nr(&gNB->gNB_config, mu, 7, 6, 2, 4);
phy_init_nr_gNB(gNB);
phy_init_nr_gNB(gNB,0,1);
frame_parms->ssb_start_subcarrier = 12 * gNB->gNB_config.ssb_table.ssb_offset_point_a.value + ssb_subcarrier_offset;
uint8_t n_hf = 0;
......@@ -564,15 +535,11 @@ int main(int argc, char **argv)
n_rx,
channel_model,
fs,
0,
bw,
300e-9,
0.0,
CORR_LEVEL_LOW,
0,
0,
0,
0);
0, 0);
if (gNB2UE==NULL) {
printf("Problem generating channel model. Exiting.\n");
......@@ -586,7 +553,7 @@ int main(int argc, char **argv)
s_im = malloc(2*sizeof(double*));
r_re = malloc(2*sizeof(double*));
r_im = malloc(2*sizeof(double*));
txdata = calloc(2, sizeof(c16_t*));
txdata = calloc(2,sizeof(int*));
for (i=0; i<2; i++) {
......@@ -596,7 +563,7 @@ int main(int argc, char **argv)
r_re[i] = malloc16_clear(frame_length_complex_samples*sizeof(double));
r_im[i] = malloc16_clear(frame_length_complex_samples*sizeof(double));
printf("Allocating %d samples for txdata\n",frame_length_complex_samples);
txdata[i] = malloc16_clear(frame_length_complex_samples * sizeof(c16_t));
txdata[i] = malloc16_clear(frame_length_complex_samples*sizeof(int));
}
if (pbch_file_fd!=NULL) {
......@@ -624,8 +591,6 @@ int main(int argc, char **argv)
processingData_L1tx_t msgDataTx;
// generate signal
const uint32_t rxdataF_sz = UE->frame_parms.samples_per_slot_wCP;
__attribute__ ((aligned(32))) c16_t rxdataF[UE->frame_parms.nb_antennas_rx][rxdataF_sz];
if (input_fd==NULL) {
for (i=0; i<frame_parms->Lmax; i++) {
......@@ -649,39 +614,39 @@ int main(int argc, char **argv)
for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) {
if (cyclic_prefix_type == 1) {
apply_nr_rotation(frame_parms,
gNB->common_vars.txdataF[aa],
(int16_t*)gNB->common_vars.txdataF[aa],
slot,
0,
12,
NR_LINK_TYPE_DL);
type_dl);
PHY_ofdm_mod((int *)gNB->common_vars.txdataF[aa],
(int *)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
PHY_ofdm_mod(gNB->common_vars.txdataF[aa],
&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
frame_parms->ofdm_symbol_size,
12,
frame_parms->nb_prefix_samples,
CYCLIC_PREFIX);
} else {
apply_nr_rotation(frame_parms,
gNB->common_vars.txdataF[aa],
(int16_t*)gNB->common_vars.txdataF[aa],
slot,
0,
14,
NR_LINK_TYPE_DL);
type_dl);
/*nr_normal_prefix_mod(gNB->common_vars.txdataF[aa],
&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
14,
frame_parms);*/
PHY_ofdm_mod((int *)gNB->common_vars.txdataF[aa],
PHY_ofdm_mod(gNB->common_vars.txdataF[aa],
(int*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
frame_parms->ofdm_symbol_size,
1,
frame_parms->nb_prefix_samples0,
CYCLIC_PREFIX);
PHY_ofdm_mod((int *)&gNB->common_vars.txdataF[aa][frame_parms->ofdm_symbol_size],
PHY_ofdm_mod(&gNB->common_vars.txdataF[aa][frame_parms->ofdm_symbol_size],
(int*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)+frame_parms->nb_prefix_samples0+frame_parms->ofdm_symbol_size],
frame_parms->ofdm_symbol_size,
13,
......@@ -728,8 +693,8 @@ int main(int argc, char **argv)
for (i=0; i<frame_length_complex_samples; i++) {
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
r_re[aa][i] = (double)txdata[aa][i].r;
r_im[aa][i] = (double)txdata[aa][i].i;
r_re[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)]);
r_im[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)+1]);
}
}
......@@ -763,8 +728,8 @@ int main(int argc, char **argv)
for (i=0; i<frame_length_complex_samples; i++) {
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
UE->common_vars.rxdata[aa][i].r = (short)(r_re[aa][i] + sqrt(sigma2 / 2) * gaussdouble(0.0, 1.0));
UE->common_vars.rxdata[aa][i].i = (short)(r_im[aa][i] + sqrt(sigma2 / 2) * gaussdouble(0.0, 1.0));
((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)));
}
}
......@@ -781,41 +746,40 @@ int main(int argc, char **argv)
}
else {
UE_nr_rxtx_proc_t proc={0};
nr_phy_data_t phy_data={0};
NR_UE_PDCCH_CONFIG phy_pdcch_config={0};
UE->rx_offset=0;
uint8_t ssb_index = 0;
const int estimateSz = frame_parms->symbols_per_slot * frame_parms->ofdm_symbol_size;
__attribute__((aligned(32))) struct complex16 dl_ch_estimates[frame_parms->nb_antennas_rx][estimateSz];
__attribute__((aligned(32))) struct complex16 dl_ch_estimates_time[frame_parms->nb_antennas_rx][frame_parms->ofdm_symbol_size];
while (!((SSB_positions >> ssb_index) & 0x01))
ssb_index++; // to select the first transmitted ssb
UE->symbol_offset = nr_get_ssb_start_symbol(frame_parms, ssb_index);
const int estimateSz=7*2*sizeof(int)*frame_parms->ofdm_symbol_size;
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates[frame_parms->nb_antennas_rx][estimateSz];
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates_time[frame_parms->nb_antennas_rx][estimateSz];
while (!((SSB_positions >> ssb_index) & 0x01)) ssb_index++; // to select the first transmitted ssb
UE->symbol_offset = nr_get_ssb_start_symbol(frame_parms,ssb_index);
int ssb_slot = (UE->symbol_offset/14)+(n_hf*(frame_parms->slots_per_frame>>1));
proc.nr_slot_rx = ssb_slot;
proc.gNB_id = 0;
for (int i=UE->symbol_offset+1; i<UE->symbol_offset+4; i++) {
nr_slot_fep(UE,
&proc,
i%frame_parms->symbols_per_slot,
rxdataF);
ssb_slot);
nr_pbch_channel_estimation(UE,estimateSz, dl_ch_estimates, dl_ch_estimates_time, &proc,
i%frame_parms->symbols_per_slot,i-(UE->symbol_offset+1),ssb_index%8,n_hf,rxdataF);
0,ssb_slot,i%frame_parms->symbols_per_slot,i-(UE->symbol_offset+1),ssb_index%8,n_hf);
}
fapiPbch_t result;
ret = nr_rx_pbch(UE,
&proc,
estimateSz,
dl_ch_estimates,
UE->pbch_vars[0],
frame_parms,
0,
ssb_index%8,
SISO,
&phy_data,
&result,
rxdataF);
&phy_pdcch_config,
&result);
if (ret==0) {
//UE->rx_ind.rx_indication_body->mib_pdu.ssb_index; //not yet detected automatically
......@@ -828,6 +792,7 @@ int main(int argc, char **argv)
for (i=0;i<3;i++){
payload_ret += (result.decoded_output[i] == ((msgDataTx.ssb[ssb_index].ssb_pdu.ssb_pdu_rel15.bchPayload>>(8*i)) & 0xff));
}
//printf("xtra byte gNB: 0x%02x UE: 0x%02x\n",gNB_xtra_byte, UE->pbch_vars[0]->xtra_byte);
//printf("ret %d\n", payload_ret);
if (payload_ret!=4)
n_errors_payload++;
......@@ -850,11 +815,6 @@ int main(int argc, char **argv)
free_channel_desc_scm(gNB2UE);
int nb_slots_to_set = TDD_CONFIG_NB_FRAMES * (1 << mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME;
for (int i = 0; i < nb_slots_to_set; ++i)
free(gNB->gNB_config.tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list);
free(gNB->gNB_config.tdd_table.max_tdd_periodicity_list);
phy_free_nr_gNB(gNB);
free(RC.gNB[0]);
free(RC.gNB);
......
......@@ -1277,7 +1277,7 @@ int main(int argc, char **argv)
slot,
0,
gNB->frame_parms.Ncp == EXTENDED ? 12 : 14,
NR_LINK_TYPE_UL);
link_type_ul);
}
ul_proc_error = phy_procedures_gNB_uespec_RX(gNB, frame, slot);
......
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