Commit 4cf96402 authored by David Kim's avatar David Kim

Added Sidelink bandwidth and link types with enum.

parent a3135235
......@@ -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
......
......@@ -46,8 +46,10 @@ void set_Lmax(NR_DL_FRAME_PARMS *fp) {
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 == 2) && ((sl_TimeOffsetSSB % fp->slots_per_frame) + sl_TimeInterval < NR_NUMBER_OF_SUBFRAMES_PER_FRAME))
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;
......@@ -161,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
......@@ -298,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);
......@@ -307,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);
......@@ -325,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
......@@ -350,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),
......
This diff is collapsed.
......@@ -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