Commit 15417570 authored by Ahmed Hussein's avatar Ahmed Hussein Committed by Thomas Schlichter

Restructuring ulsim and introducing more functionalities in RX at gNB

parent 749bb669
......@@ -694,7 +694,6 @@ typedef struct {
uint8_t Qm;
uint8_t ndi;
uint8_t rv;
uint8_t harq_process_nbr;
int8_t accumulated_delta_PUSCH;
int8_t absolute_delta_PUSCH;
uint8_t n_layers;
......
......@@ -452,10 +452,14 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
gNB->dlsch[i][j]->rnti=0;
LOG_D(PHY,"dlsch[%d][%d] => %p rnti:%d\n",i,j,gNB->dlsch[i][j], gNB->dlsch[i][j]->rnti);
}*/
}
}
for (i=0; i<NUMBER_OF_NR_UE_MAX; i++) {
///////////////////////// Initializing gNB ULSCH /////////////////////////
LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH, UE %d\n",i);
for (j=0; j<2; j++) {
// ULSCH for RA
if(i==0) {
gNB->ulsch[i][j] = new_gNB_ulsch(5, fp->N_RB_UL, 0);
......@@ -487,7 +491,7 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
LOG_D(PHY,"gNB %d.%d : RA %p\n",gNB->Mod_id,gNB->CC_id,gNB->dlsch_ra);
gNB->rx_total_gain_dB=130;
for(i=0; i<NUMBER_OF_UE_MAX; i++)
for(i=0; i<NUMBER_OF_NR_UE_MAX; i++)
gNB->mu_mimo_mode[i].dl_pow_off = 2;
gNB->check_for_total_transmissions = 0;
......
......@@ -24,6 +24,7 @@
#include <stdint.h>
#include "PHY/defs_nr_common.h"
#include "PHY/defs_gNB.h"
#define DMRS_MOD_ORDER 2
......@@ -51,4 +52,20 @@ void nr_layer_mapping(int16_t **mod_symbs,
uint16_t n_symbs,
int16_t **tx_layers);
/*!
\brief This function implements the OFDM front end processor on reception (FEP)
\param phy_vars_ue Pointer to PHY variables
\param symbol symbol within slot (0..12/14)
\param Ns Slot number (0..19)
\param sample_offset offset within rxdata (points to beginning of subframe)
\param no_prefix if 1 prefix is removed by HW
*/
int nr_slot_fep_ul(PHY_VARS_gNB *phy_vars_gNB,
unsigned char symbol,
unsigned char Ns,
int sample_offset,
int no_prefix);
#endif
\ No newline at end of file
......@@ -19,9 +19,10 @@
* contact@openairinterface.org
*/
#include "PHY/defs_UE.h"
#include "PHY/defs_nr_UE.h"
#include "PHY/defs_gNB.h"
#include "modulation_UE.h"
#include "nr_modulation.h"
#include "PHY/LTE_ESTIMATION/lte_estimation.h"
#include "PHY/NR_UE_ESTIMATION/nr_estimation.h"
......@@ -198,3 +199,72 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
return(0);
}
int nr_slot_fep_ul(PHY_VARS_gNB *gNB,
unsigned char symbol,
unsigned char Ns,
int sample_offset,
int no_prefix)
{
unsigned char aa;
uint32_t slot_offset;
uint32_t rxdata_offset;
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
unsigned int nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples);
unsigned int nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples0);
void (*dft)(int16_t *,int16_t *, int);
switch (frame_parms->ofdm_symbol_size) {
case 128:
dft = dft128;
break;
case 256:
dft = dft256;
break;
case 512:
dft = dft512;
break;
case 1024:
dft = dft1024;
break;
case 1536:
dft = dft1536;
break;
case 2048:
dft = dft2048;
break;
case 4096:
dft = dft4096;
break;
case 8192:
dft = dft8192;
break;
default:
dft = dft512;
break;
}
slot_offset = Ns * frame_parms->samples_per_slot;
for (aa = 0; aa < frame_parms->nb_antennas_rx; aa++) {
if(symbol == 0)
rxdata_offset = slot_offset + nb_prefix_samples0 - SOFFSET;
else
rxdata_offset = slot_offset + nb_prefix_samples0 + (symbol * (frame_parms->ofdm_symbol_size + nb_prefix_samples)) - SOFFSET;
dft((int16_t *)&gNB->common_vars.rxdata[0][rxdata_offset],
(int16_t *)&gNB->common_vars.rxdataF[0][symbol * frame_parms->ofdm_symbol_size], 1);
}
return(0);
}
......@@ -19,7 +19,7 @@
* contact@openairinterface.org
*/
/*! \file PHY/NR_TRANSPORT/nr_sch_dmrs.c
/*! \file PHY/NR_TRANSPORT/nr_sch_dmrs.h
* \brief
* \author
* \date
......
......@@ -32,7 +32,6 @@
#include "PHY/defs_nr_common.h"
/** \brief This function is the top-level entry point to PUSCH demodulation, after frequency-domain transformation and channel estimation. It performs
- RB extraction (signal and channel estimates)
- channel compensation (matched filtering)
......@@ -45,14 +44,13 @@
@param frame Frame number
@param nr_tti_rx TTI number
@param symbol Symbol on which to act (within-in nr_TTI_rx)
@param first_symbol_flag set to 1 on first ULSCH symbol
@param harq_pid HARQ process ID
*/
int nr_rx_ulsch(PHY_VARS_gNB *gNB,
void nr_rx_pusch(PHY_VARS_gNB *gNB,
uint8_t UE_id,
uint32_t frame,
uint8_t nr_tti_rx,
unsigned char symbol,
unsigned char first_symbol_flag,
unsigned char harq_pid);
......@@ -62,17 +60,17 @@ int nr_rx_ulsch(PHY_VARS_gNB *gNB,
@param rb_alloc RB allocation map (used for Resource Allocation Type 0 in NR)
@param symbol Symbol on which to act (within-in nr_TTI_rx)
@param start_rb The starting RB in the RB allocation (used for Resource Allocation Type 1 in NR)
@param nb_pusch_rb The number of RBs allocated (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
*/
unsigned short nr_ulsch_extract_rbs_single(int **rxdataF,
void nr_ulsch_extract_rbs_single(int **rxdataF,
int **rxdataF_ext,
uint32_t rxdataF_ext_offset,
// unsigned int *rb_alloc, [hna] Resource Allocation Type 1 is assumed only for the moment
unsigned char symbol,
unsigned short start_rb,
unsigned short nb_pusch_rb,
unsigned short nb_rb_pusch,
NR_DL_FRAME_PARMS *frame_parms);
......
......@@ -46,7 +46,6 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations,uint8_t N_RB_UL, uint8
@param nr_tti_rx, current received TTI
@param harq_pid, harq process id
@param is_crnti
@param llr8_flag If 1, indicate that the 8-bit decoder should be used
*/
uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
......@@ -57,8 +56,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
uint16_t nb_symb_sch,
uint8_t nr_tti_rx,
uint8_t harq_pid,
uint8_t is_crnti,
uint8_t llr8_flag);
uint8_t is_crnti);
/*! \brief Perform PUSCH unscrambling. TS 38.211 V15.4.0 subclause 6.3.1.1
......@@ -75,3 +73,9 @@ void nr_ulsch_unscrambling(int16_t* llr,
uint32_t Nid,
uint32_t n_RNTI);
void nr_ulsch_procedures(PHY_VARS_gNB *gNB,
gNB_L1_rxtx_proc_t *proc,
int UE_id,
uint8_t harq_pid);
......@@ -278,13 +278,13 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
uint16_t nb_symb_sch,
uint8_t nr_tti_rx,
uint8_t harq_pid,
uint8_t is_crnti,
uint8_t llr8_flag)
uint8_t is_crnti)
{
uint32_t A,E;
uint32_t G;
uint32_t ret,offset;
uint32_t nb_rb;
int32_t no_iteration_ldpc, length_dec;
uint32_t r,r_offset=0,Kr=8424,Kr_bytes,K_bytes_F,err_flag=0;
uint8_t crc_type;
......@@ -306,7 +306,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
uint8_t kc;
uint8_t Ilbrm = 0;
uint32_t Tbslbrm = 950984;
uint16_t nb_rb = 30; //to update
uint8_t nb_re_dmrs = 6;
uint16_t length_dmrs = 1;
double Coderate = 0.0;
......@@ -341,7 +340,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
A = harq_process->TBS;
ret = ulsch->max_ldpc_iterations;
harq_process->G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, nfapi_ulsch_pdu_rel15->Qm,nfapi_ulsch_pdu_rel15->n_layers);
// harq_process->G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, nfapi_ulsch_pdu_rel15->Qm,nfapi_ulsch_pdu_rel15->n_layers);
G = harq_process->G;
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, nfapi_ulsch_pdu_rel15->mcs, nfapi_ulsch_pdu_rel15->n_layers, nb_symb_sch,nb_rb);
......
// This should have nr_rx_pdsch, nr_ulsch_extract_rbs_single, and nr_ulsch_compute_llr
#include "PHY/defs_gNB.h"
#include "nr_transport_proto.h"
#include "PHY/impl_defs_top.h"
#include "PHY/NR_TRANSPORT/nr_sch_dmrs.h"
//==============================================================================================
// Extraction functions
//==============================================================================================
unsigned short nr_ulsch_extract_rbs_single(int **rxdataF,
void nr_ulsch_extract_rbs_single(int **rxdataF,
int **rxdataF_ext,
uint32_t rxdataF_ext_offset,
// unsigned int *rb_alloc, [hna] Resource Allocation Type 1 is assumed only for the moment
unsigned char symbol,
unsigned short start_rb,
unsigned short nb_rb_pdsch,
unsigned short nb_rb_pusch,
NR_DL_FRAME_PARMS *frame_parms)
{
unsigned short start_re,re;
unsigned char aarx, is_dmrs_symbol = 0;
uint32_t rxF_ext_index = 0, nb_re_pdsch = 0;
uint32_t rxF_ext_index = 0, nb_re_pusch = 0;
int16_t *rxF,*rxF_ext;
......@@ -26,14 +24,14 @@ unsigned short nr_ulsch_extract_rbs_single(int **rxdataF,
start_re = frame_parms->first_carrier_offset + (start_rb * NR_NB_SC_PER_RB);
nb_re_pdsch = NR_NB_SC_PER_RB * nb_rb_pdsch;
nb_re_pusch = NR_NB_SC_PER_RB * nb_rb_pusch;
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][rxdataF_ext_offset];
for (re = 0; re < nb_re_pdsch; re++) {
for (re = 0; re < nb_re_pusch; re++) {
if ( (is_dmrs_symbol && ((re&1) != frame_parms->nushift)) || (is_dmrs_symbol == 0) ) { // [hna] (re&1) != frame_parms->nushift) assuming only dmrs type 1 and mapping type A
......@@ -44,6 +42,56 @@ unsigned short nr_ulsch_extract_rbs_single(int **rxdataF,
}
}
}
}
void nr_rx_pusch(PHY_VARS_gNB *gNB,
uint8_t UE_id,
uint32_t frame,
uint8_t nr_tti_rx,
unsigned char symbol,
unsigned char harq_pid)
{
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
nfapi_nr_ul_config_ulsch_pdu_rel15_t *rel15_ul = &gNB->ulsch[UE_id+1][0]->harq_processes[harq_pid]->ulsch_pdu.ulsch_pdu_rel15;
uint32_t nb_re;
if(symbol == rel15_ul->start_symbol)
gNB->pusch_vars[UE_id]->rxdataF_ext_offset = 0;
if (symbol == 2) // [hna] here it is assumed that symbol 2 carries 6 DMRS REs (dmrs-type 1)
nb_re = rel15_ul->number_rbs * 6;
else
nb_re = rel15_ul->number_rbs * 12;
//----------------------------------------------------------
//--------------------- RBs extraction ---------------------
//----------------------------------------------------------
nr_ulsch_extract_rbs_single(gNB->common_vars.rxdataF,
gNB->pusch_vars[UE_id]->rxdataF_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,
nb_re,
frame_parms);
//----------------------------------------------------------
//-------------------- LLRs computation --------------------
//----------------------------------------------------------
nr_ulsch_compute_llr(&gNB->pusch_vars[UE_id]->rxdataF_ext[0][gNB->pusch_vars[UE_id]->rxdataF_ext_offset],
gNB->pusch_vars[UE_id]->ul_ch_mag,
gNB->pusch_vars[UE_id]->ul_ch_magb,
&gNB->pusch_vars[UE_id]->llr[gNB->pusch_vars[UE_id]->rxdataF_ext_offset * rel15_ul->Qm],
nb_re,
symbol,
rel15_ul->Qm);
gNB->pusch_vars[UE_id]->rxdataF_ext_offset = gNB->pusch_vars[UE_id]->rxdataF_ext_offset + nb_re;
return(nb_rb_pdsch/frame_parms->nb_antennas_rx);
}
\ No newline at end of file
......@@ -116,7 +116,7 @@ void nr_ulsch_16qam_llr(int32_t *rxdataF_comp,
nb_re >>= 2; // length in quad words (4 REs)
nb_re += (len_mod4 == 0 ? 0 : 1);
temp_channel = _mm_set1_epi16((int16_t)((QAM64_n1 * one_over_sqrt_2)>>15));
temp_channel = _mm_set1_epi16((int16_t)((QAM16_n1 * one_over_sqrt_2)>>15));
for (i=0; i<nb_re; i++) {
......@@ -218,9 +218,9 @@ void nr_ulsch_64qam_llr(int32_t *rxdataF_comp,
// #endif
// -------------------------------------------------------------------------
len_mod4 =nb_re&3;
nb_re=nb_re>>2; // length in quad words (4 REs)
nb_re+=((len_mod4==0)?0:1);
len_mod4 = nb_re&3;
nb_re = nb_re>>2; // length in quad words (4 REs)
nb_re += ((len_mod4 == 0) ? 0 : 1);
temp_channel[0] = _mm_set1_epi16((int16_t)((QAM64_n1 * one_over_sqrt_2)>>15));
......
......@@ -363,6 +363,8 @@ typedef struct {
/// - first index: rx antenna id [0..nb_antennas_rx[
/// - second index (definition from phy_init_lte_eNB()): ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **rxdataF_ext2;
/// \brief Offset for calculating the index of rxdataF_ext for the current symbol
uint32_t rxdataF_ext_offset;
/// \brief Hold the channel estimates in time domain based on DRS.
/// - first index: rx antenna id [0..nb_antennas_rx[
/// - second index: ? [0..4*ofdm_symbol_size[
......
......@@ -23,7 +23,9 @@
#include "PHY/defs_gNB.h"
#include "sched_nr.h"
#include "PHY/NR_TRANSPORT/nr_transport.h"
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
#include "PHY/NR_TRANSPORT/nr_ulsch.h"
#include "SCHED/sched_eNB.h"
#include "SCHED/sched_common_extern.h"
#include "nfapi_interface.h"
......@@ -31,7 +33,7 @@
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "PHY/INIT/phy_init.h"
#include "PHY/MODULATION/nr_modulation.h"
#include "T.h"
#include "assertions.h"
......@@ -200,3 +202,67 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+offset,0);
}
void nr_ulsch_procedures(PHY_VARS_gNB *gNB, gNB_L1_rxtx_proc_t *proc, int UE_id, uint8_t harq_pid) {
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
nfapi_nr_ul_config_ulsch_pdu *rel15_ul = &gNB->ulsch[UE_id+1][0]->harq_processes[harq_pid]->ulsch_pdu;
uint8_t ret;
int Nid_cell = 0; // shouldn't be a local variable
//----------------------------------------------------------
//------------------- ULSCH unscrambling -------------------
//----------------------------------------------------------
nr_ulsch_unscrambling(gNB->pusch_vars[UE_id]->llr, gNB->ulsch[UE_id+1][0]->harq_processes[harq_pid]->G, 0, Nid_cell, rel15_ul->rnti);
////////////////////////////////////////////////////////////
//----------------------------------------------------------
//--------------------- ULSCH decoding ---------------------
//----------------------------------------------------------
ret = nr_ulsch_decoding(gNB, UE_id, gNB->pusch_vars[UE_id]->llr, frame_parms, proc->frame_rx,
rel15_ul->ulsch_pdu_rel15.number_symbols, proc->slot_rx, harq_pid, 0);
// if (ret > ulsch_gNB->max_ldpc_iterations)
// n_errors++;
}
void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, gNB_L1_rxtx_proc_t *proc) {
uint8_t symbol;
for(symbol = 0; symbol < NR_SYMBOLS_PER_SLOT; symbol++) {
nr_slot_fep_ul(gNB, symbol, proc->slot_rx, 0, 0);
}
}
void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, gNB_L1_rxtx_proc_t *proc, uint8_t symbol_start, uint8_t symbol_end) {
uint8_t UE_id;
uint8_t symbol;
uint8_t harq_pid = 0; // [hna] Previously in LTE, the harq_pid was obtained from the subframe number (Synchronous HARQ)
// In NR, this should be signaled through uplink scheduling dci (i.e, DCI 0_0, 0_1) (Asynchronous HARQ)
for (UE_id = 0; UE_id < NUMBER_OF_NR_UE_MAX; UE_id++) {
for(symbol = symbol_start; symbol < symbol_end; symbol++) {
nr_rx_pusch(gNB, UE_id, proc->frame_rx, proc->slot_rx, symbol, harq_pid);
}
nr_ulsch_procedures(gNB, proc, UE_id, harq_pid);
}
}
......@@ -36,7 +36,9 @@
nr_slot_t nr_slot_select (nfapi_nr_config_request_t *cfg, unsigned char slot);
void nr_set_ssb_first_subcarrier(nfapi_nr_config_request_t *cfg, NR_DL_FRAME_PARMS *fp);
void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, int frame_tx,int slot_tx, int do_meas);
void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, int frame_tx, int slot_tx, int do_meas);
void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, gNB_L1_rxtx_proc_t *proc);
void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, gNB_L1_rxtx_proc_t *proc, uint8_t symbol_start, uint8_t symbol_end);
void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot);
void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx);
void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx);
......
......@@ -546,7 +546,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, llr8_flag);
frame, nb_symb_sch, subframe, harq_pid, is_crnti);
if (ret > ulsch_gNB->max_ldpc_iterations)
n_errors++;
......
This diff is collapsed.
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