Commit 1c3058e2 authored by francescomani's avatar francescomani

use of apply_rotation functions also at UE

parent 35b3a6d4
......@@ -14,7 +14,7 @@ rx_func_implem[rx_func]
handle_nr_slot_ind
--> rnti_to_remove-mgmt
--> L1_nr_prach_procedures
--> apply_nr_rotation_ul
--> apply_nr_rotation_RX
end
subgraph phy_procedures_gNB_uespec_RX
fill_ul_rb_mask
......@@ -58,7 +58,7 @@ subgraph tx_func
subgraph phy_procedures_gNB_TX
dcitop[nr_generate dci top]
--> nr_generate_csi_rs
--> apply_nr_rotation
--> apply_nr_rotation_TX
-- send_msg --> end_tx_func((L1_tx_out))
end
subgraph tx_reorder_thread
......
......@@ -33,7 +33,7 @@ rx_func_implem[rx_func]
handle_nr_slot_ind
--> rnti_to_remove-mgmt
--> L1_nr_prach_procedures
--> apply_nr_rotation_ul
--> apply_nr_rotation_RX
end
subgraph phy_procedures_gNB_uespec_RX
fill_ul_rb_mask
......@@ -67,7 +67,7 @@ subgraph tx
phy_procedures_gNB_TX
--> dcitop[nr_generate dci top]
--> nr_generate_csi_rs
--> apply_nr_rotation
--> apply_nr_rotation_TX
-- send_msg --> end_tx_func((L1_tx_out))
end
subgraph tx_reorder_thread
......
......@@ -231,13 +231,16 @@ void rx_func(void *param)
//WA: comment rotation in tx/rx
if((gNB->num_RU == 1) && (gNB->RU_list[0]->if_south != REMOTE_IF4p5)) {
//apply the rx signal rotation here
int soffset = (slot_rx & 3) * gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size;
for (int aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) {
apply_nr_rotation_ul(&gNB->frame_parms,
apply_nr_rotation_RX(&gNB->frame_parms,
gNB->common_vars.rxdataF[aa],
gNB->frame_parms.symbol_rotation[1],
slot_rx,
gNB->frame_parms.N_RB_UL,
soffset,
0,
gNB->frame_parms.Ncp == EXTENDED ? 12 : 14,
link_type_ul);
gNB->frame_parms.Ncp == EXTENDED ? 12 : 14);
}
}
phy_procedures_gNB_uespec_RX(gNB, frame_rx, slot_rx);
......
......@@ -108,23 +108,26 @@ int nr_beam_precoding(c16_t **txdataF,
int offset
);
void apply_nr_rotation(NR_DL_FRAME_PARMS *fp,
c16_t* txdata,
void apply_nr_rotation_TX(NR_DL_FRAME_PARMS *fp,
c16_t *txdataF,
c16_t *symbol_rotation,
int slot,
int nb_rb,
int first_symbol,
int nsymb,
int link_type);
int nsymb);
void init_symbol_rotation(NR_DL_FRAME_PARMS *fp);
void init_timeshift_rotation(NR_DL_FRAME_PARMS *fp);
void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms,
void apply_nr_rotation_RX(NR_DL_FRAME_PARMS *frame_parms,
c16_t *rxdataF,
c16_t *rot,
int slot,
int nb_rb,
int soffset,
int first_symbol,
int nsymb,
int link_type);
int nsymb);
/*! \brief Perform NR precoding. TS 38.211 V15.4.0 subclause 6.3.1.5
@param[in] datatx_F_precoding, Pointer to n_layers*re data array
......
......@@ -334,17 +334,17 @@ void do_OFDM_mod(c16_t **txdataF, c16_t **txdata, uint32_t frame,uint16_t next_s
}
void apply_nr_rotation(NR_DL_FRAME_PARMS *fp,
void apply_nr_rotation_TX(NR_DL_FRAME_PARMS *fp,
c16_t *txdataF,
c16_t *symbol_rotation,
int slot,
int nb_rb,
int first_symbol,
int nsymb,
int link_type)
int nsymb)
{
int symb_offset = (slot%fp->slots_per_subframe)*fp->symbols_per_slot;
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;
symbol_rotation += symb_offset;
for (int sidx = first_symbol; sidx < first_symbol + nsymb; sidx++) {
c16_t *this_rotation = symbol_rotation + sidx;
......@@ -357,20 +357,20 @@ void apply_nr_rotation(NR_DL_FRAME_PARMS *fp,
this_rotation->r,
this_rotation->i);
if (N_RB & 1) {
if (nb_rb & 1) {
rotate_cpx_vector(this_symbol, this_rotation, this_symbol,
(N_RB + 1) * 6, 15);
(nb_rb + 1) * 6, 15);
rotate_cpx_vector(this_symbol + fp->first_carrier_offset - 6,
this_rotation,
this_symbol + fp->first_carrier_offset - 6,
(N_RB + 1) * 6, 15);
(nb_rb + 1) * 6, 15);
} else {
rotate_cpx_vector(this_symbol, this_rotation, this_symbol,
N_RB * 6, 15);
nb_rb * 6, 15);
rotate_cpx_vector(this_symbol + fp->first_carrier_offset,
this_rotation,
this_symbol + fp->first_carrier_offset,
N_RB * 6, 15);
nb_rb * 6, 15);
}
}
}
......
......@@ -96,46 +96,14 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
stop_meas(&ue->rx_dft_stats);
int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot;
c16_t rot2 = frame_parms->symbol_rotation[0][symbol+symb_offset];
rot2.i=-rot2.i;
#ifdef DEBUG_FEP
// if (ue->frame <100)
printf("slot_fep: slot %d, symbol %d rx_offset %u, rotation symbol %d %d.%d\n", Ns,symbol, rx_offset,
symbol+symb_offset,rot2.r,rot2.i);
#endif
c16_t *shift_rot = frame_parms->timeshift_symbol_rotation;
c16_t *this_symbol = &rxdataF[aa][frame_parms->ofdm_symbol_size*symbol];
if (frame_parms->N_RB_DL & 1) {
rotate_cpx_vector(this_symbol, &rot2, this_symbol,
(frame_parms->N_RB_DL + 1) * 6, 15);
rotate_cpx_vector(this_symbol + frame_parms->first_carrier_offset - 6,
&rot2,
this_symbol + frame_parms->first_carrier_offset - 6,
(frame_parms->N_RB_DL + 1) * 6, 15);
multadd_cpx_vector((int16_t *)this_symbol, (int16_t *)shift_rot, (int16_t *)this_symbol,
1, (frame_parms->N_RB_DL + 1) * 6, 15);
multadd_cpx_vector((int16_t *)(this_symbol + frame_parms->first_carrier_offset - 6),
(int16_t *)(shift_rot + frame_parms->first_carrier_offset - 6),
(int16_t *)(this_symbol + frame_parms->first_carrier_offset - 6),
1, (frame_parms->N_RB_DL + 1) * 6, 15);
} else {
rotate_cpx_vector(this_symbol, &rot2, this_symbol,
frame_parms->N_RB_DL * 6, 15);
rotate_cpx_vector(this_symbol + frame_parms->first_carrier_offset,
&rot2,
this_symbol + frame_parms->first_carrier_offset,
frame_parms->N_RB_DL * 6, 15);
multadd_cpx_vector((int16_t *)this_symbol, (int16_t *)shift_rot, (int16_t *)this_symbol,
1, frame_parms->N_RB_DL * 6, 15);
multadd_cpx_vector((int16_t *)(this_symbol + frame_parms->first_carrier_offset),
(int16_t *)(shift_rot + frame_parms->first_carrier_offset),
(int16_t *)(this_symbol + frame_parms->first_carrier_offset),
1, frame_parms->N_RB_DL * 6, 15);
}
apply_nr_rotation_RX(frame_parms,
rxdataF[aa],
frame_parms->symbol_rotation[0],
Ns,
frame_parms->N_RB_DL,
0,
symbol,
1);
}
#ifdef DEBUG_FEP
......@@ -311,50 +279,51 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
return 0;
}
void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms,
void apply_nr_rotation_RX(NR_DL_FRAME_PARMS *frame_parms,
c16_t *rxdataF,
c16_t *rot,
int slot,
int nb_rb,
int soffset,
int first_symbol,
int nsymb,
int link_type)
int nsymb)
{
int symb_offset = (slot % frame_parms->slots_per_subframe) * frame_parms->symbols_per_slot;
int soffset = (slot & 3) * frame_parms->symbols_per_slot * frame_parms->ofdm_symbol_size;
for (int symbol = first_symbol; symbol < first_symbol + nsymb; symbol++) {
c16_t rot2 = frame_parms->symbol_rotation[link_type][symbol + symb_offset];
c16_t rot2 = rot[symbol + symb_offset];
rot2.i = -rot2.i;
LOG_D(PHY,"slot %d, symb_offset %d rotating by %d.%d\n", slot, symb_offset, rot2.r, rot2.i);
c16_t *shift_rot = frame_parms->timeshift_symbol_rotation;
c16_t *this_symbol = &rxdataF[soffset + (frame_parms->ofdm_symbol_size * symbol)];
if (frame_parms->N_RB_UL & 1) {
if (nb_rb & 1) {
rotate_cpx_vector(this_symbol, &rot2, this_symbol,
(frame_parms->N_RB_UL + 1) * 6, 15);
(nb_rb + 1) * 6, 15);
rotate_cpx_vector(this_symbol + frame_parms->first_carrier_offset - 6,
&rot2,
this_symbol + frame_parms->first_carrier_offset - 6,
(frame_parms->N_RB_UL + 1) * 6, 15);
(nb_rb + 1) * 6, 15);
multadd_cpx_vector((int16_t *)this_symbol, (int16_t *)shift_rot, (int16_t *)this_symbol,
1, (frame_parms->N_RB_UL+1) * 6, 15);
1, (nb_rb + 1) * 6, 15);
multadd_cpx_vector((int16_t *)(this_symbol + frame_parms->first_carrier_offset - 6),
(int16_t *)(shift_rot + frame_parms->first_carrier_offset - 6),
(int16_t *)(this_symbol + frame_parms->first_carrier_offset - 6),
1, (frame_parms->N_RB_UL+1) * 6, 15);
1, (nb_rb + 1) * 6, 15);
} else {
rotate_cpx_vector(this_symbol, &rot2, this_symbol,
frame_parms->N_RB_UL * 6, 15);
nb_rb * 6, 15);
rotate_cpx_vector(this_symbol + frame_parms->first_carrier_offset,
&rot2,
this_symbol + frame_parms->first_carrier_offset,
frame_parms->N_RB_UL * 6, 15);
nb_rb * 6, 15);
multadd_cpx_vector((int16_t *)this_symbol, (int16_t *)shift_rot, (int16_t *)this_symbol,
1, frame_parms->N_RB_UL * 6, 15);
1, nb_rb * 6, 15);
multadd_cpx_vector((int16_t *)(this_symbol + frame_parms->first_carrier_offset),
(int16_t *)(shift_rot + frame_parms->first_carrier_offset),
(int16_t *)(this_symbol + frame_parms->first_carrier_offset),
1, frame_parms->N_RB_UL * 6, 15);
1, nb_rb * 6, 15);
}
}
}
......@@ -592,16 +592,12 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE,
uint8_t slot,
NR_DL_FRAME_PARMS *frame_parms,
uint8_t n_antenna_ports) {
int tx_offset, ap;
c16_t **txdata;
c16_t **txdataF;
uint8_t n_antenna_ports)
{
/////////////////////////IFFT///////////////////////
///////////
tx_offset = frame_parms->get_samples_slot_timestamp(slot, frame_parms, 0);
int tx_offset = frame_parms->get_samples_slot_timestamp(slot, frame_parms, 0);
// clear the transmit data array for the current subframe
/*for (int aa=0; aa<UE->frame_parms.nb_antennas_tx; aa++) {
......@@ -610,38 +606,20 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE,
}*/
txdata = UE->common_vars.txdata;
txdataF = UE->common_vars.txdataF;
int symb_offset = (slot%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot;
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[link_type_ul][s + symb_offset];
LOG_D(PHY,"rotating txdataF symbol %d (%d) => (%d.%d)\n",
s,
s + symb_offset,
rot.r, rot.i);
if (frame_parms->N_RB_UL & 1) {
rotate_cpx_vector(this_symbol, &rot, this_symbol,
(frame_parms->N_RB_UL + 1) * 6, 15);
rotate_cpx_vector(this_symbol + frame_parms->first_carrier_offset - 6,
&rot,
this_symbol + frame_parms->first_carrier_offset - 6,
(frame_parms->N_RB_UL + 1) * 6, 15);
} else {
rotate_cpx_vector(this_symbol, &rot, this_symbol,
frame_parms->N_RB_UL * 6, 15);
rotate_cpx_vector(this_symbol + frame_parms->first_carrier_offset,
&rot,
this_symbol + frame_parms->first_carrier_offset,
frame_parms->N_RB_UL * 6, 15);
}
}
c16_t **txdata = UE->common_vars.txdata;
c16_t **txdataF = UE->common_vars.txdataF;
for(int ap = 0; ap < n_antenna_ports; ap++) {
apply_nr_rotation_TX(frame_parms,
txdataF[ap],
frame_parms->symbol_rotation[1],
slot,
frame_parms->N_RB_UL,
0,
NR_NUMBER_OF_SYMBOLS_PER_SLOT);
}
for (ap = 0; ap < n_antenna_ports; ap++) {
for (int ap = 0; ap < n_antenna_ports; ap++) {
if (frame_parms->Ncp == 1) { // extended cyclic prefix
PHY_ofdm_mod((int *)txdataF[ap],
(int *)&txdata[ap][tx_offset],
......
......@@ -222,7 +222,13 @@ 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, link_type_dl);
apply_nr_rotation_TX(fp,
&gNB->common_vars.txdataF[aa][txdataF_offset],
fp->symbol_rotation[0],
slot,
fp->N_RB_DL,
0,
fp->Ncp == EXTENDED ? 12 : 14);
T(T_GNB_PHY_DL_OUTPUT_SIGNAL, T_INT(0),
T_INT(frame), T_INT(slot),
......
......@@ -648,12 +648,13 @@ 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,
apply_nr_rotation_TX(frame_parms,
gNB->common_vars.txdataF[aa],
frame_parms->symbol_rotation[0],
slot,
frame_parms->N_RB_DL,
0,
12,
link_type_dl);
12);
PHY_ofdm_mod((int *)gNB->common_vars.txdataF[aa],
(int *)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
......@@ -662,12 +663,13 @@ int main(int argc, char **argv)
frame_parms->nb_prefix_samples,
CYCLIC_PREFIX);
} else {
apply_nr_rotation(frame_parms,
apply_nr_rotation_TX(frame_parms,
gNB->common_vars.txdataF[aa],
frame_parms->symbol_rotation[0],
slot,
frame_parms->N_RB_DL,
0,
14,
link_type_dl);
14);
/*nr_normal_prefix_mod(gNB->common_vars.txdataF[aa],
&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
......
......@@ -1259,11 +1259,14 @@ int main(int argc, char **argv)
slot,
0);
}
int offset = (slot & 3) * gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size;
for (int aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) {
apply_nr_rotation_ul(&gNB->frame_parms,
apply_nr_rotation_RX(&gNB->frame_parms,
gNB->common_vars.rxdataF[aa],
gNB->frame_parms.symbol_rotation[1],
slot,
gNB->frame_parms.N_RB_UL,
offset,
0,
gNB->frame_parms.Ncp == EXTENDED ? 12 : 14,
link_type_ul);
......
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