Commit 3a8bf560 authored by Ahmed Hussein's avatar Ahmed Hussein Committed by Thomas Schlichter

channel estimation, compensation, etc ..

Added the following folder:
- ../openair1/PHY/NR_ESTIMATION/

Added the following file to CMakelists.txt:
- ../openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c

Added the following functions:
- nr_pusch_dmrs_rx
- nr_gold_pusch
- nr_ulsch_channel_level
- nr_ulsch_channel_compensation
- nr_ulsch_scale_channel is commented out (I think only used for downlink)

Changes from Khalid Ahmed Mahmoud Mohamed:
- nr_pusch_channel_estimation is used
- nr_ulsch_scale_channel is used
- nr_ulsch_channel_level is used
- nr_ulsch_channel_compensation is used
- multiple logging options for channel and signal magnitude
parent ad372542
......@@ -1333,6 +1333,8 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_ulsch_llr_computation.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold.c
${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/filt16a_32.c
${OPENAIR1_DIR}/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c
${OPENAIR1_DIR}/PHY/TOOLS/file_output.c
${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c
#${OPENAIR1_DIR}/PHY/TOOLS/lte_dfts.c
......@@ -1377,6 +1379,7 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/NR_REFSIG/ul_ref_seq_nr.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_dmrs_rx.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
${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c
${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c
......
......@@ -208,24 +208,32 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
for (int UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
//FIXME
pusch_vars[UE_id] = (NR_gNB_PUSCH *)malloc16_clear( sizeof(NR_gNB_PUSCH) );
pusch_vars[UE_id]->rxdataF_ext = (int32_t **)malloc16( 2*sizeof(int32_t *) );
pusch_vars[UE_id]->rxdataF_ext2 = (int32_t **)malloc16( 2*sizeof(int32_t *) );
pusch_vars[UE_id]->drs_ch_estimates = (int32_t **)malloc16( 2*sizeof(int32_t *) );
pusch_vars[UE_id]->drs_ch_estimates_time = (int32_t **)malloc16( 2*sizeof(int32_t *) );
pusch_vars[UE_id]->rxdataF_comp = (int32_t **)malloc16( 2*sizeof(int32_t *) );
pusch_vars[UE_id]->ul_ch_mag = (int32_t **)malloc16( 2*sizeof(int32_t *) );
pusch_vars[UE_id]->ul_ch_magb = (int32_t **)malloc16( 2*sizeof(int32_t *) );
for (i=0; i<2; i++) {
pusch_vars[UE_id]->rxdataF_ext = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
pusch_vars[UE_id]->rxdataF_ext2 = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
pusch_vars[UE_id]->ul_ch_estimates = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
pusch_vars[UE_id]->ul_ch_estimates_ext = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
pusch_vars[UE_id]->ul_ch_estimates_time = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
pusch_vars[UE_id]->rxdataF_comp = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
pusch_vars[UE_id]->ul_ch_mag0 = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
pusch_vars[UE_id]->ul_ch_magb0 = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
pusch_vars[UE_id]->ul_ch_mag = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
pusch_vars[UE_id]->ul_ch_magb = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
pusch_vars[UE_id]->rho = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t*) );
for (i=0; i<fp->nb_antennas_rx; i++) {
// RK 2 times because of output format of FFT!
// FIXME We should get rid of this
pusch_vars[UE_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12*fp->symbols_per_slot );
pusch_vars[UE_id]->rxdataF_ext2[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12*fp->symbols_per_slot );
pusch_vars[UE_id]->drs_ch_estimates[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12*fp->symbols_per_slot );
pusch_vars[UE_id]->drs_ch_estimates_time[i] = (int32_t *)malloc16_clear( 2*sizeof(int32_t)*fp->ofdm_symbol_size );
pusch_vars[UE_id]->ul_ch_estimates[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12*fp->symbols_per_slot );
pusch_vars[UE_id]->ul_ch_estimates_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12*fp->symbols_per_slot );
pusch_vars[UE_id]->ul_ch_estimates_time[i] = (int32_t *)malloc16_clear( 2*sizeof(int32_t)*fp->ofdm_symbol_size );
pusch_vars[UE_id]->rxdataF_comp[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12*fp->symbols_per_slot );
pusch_vars[UE_id]->ul_ch_mag0[i] = (int32_t *)malloc16_clear( fp->symbols_per_slot*sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12 );
pusch_vars[UE_id]->ul_ch_magb0[i] = (int32_t *)malloc16_clear( fp->symbols_per_slot*sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12 );
pusch_vars[UE_id]->ul_ch_mag[i] = (int32_t *)malloc16_clear( fp->symbols_per_slot*sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12 );
pusch_vars[UE_id]->ul_ch_magb[i] = (int32_t *)malloc16_clear( fp->symbols_per_slot*sizeof(int32_t)*cfg->rf_config.ul_carrier_bandwidth.value*12 );
pusch_vars[UE_id]->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(fp->N_RB_UL*12*7*2) );
}
pusch_vars[UE_id]->llr = (int16_t *)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) ); // [hna] 6144 is LTE and (8*((3*8*6144)+12)) is not clear
......
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef __NR_UL_ESTIMATION_DEFS__H__
#define __NR_UL_ESTIMATION_DEFS__H__
#include "PHY/defs_gNB.h"
/** @addtogroup _PHY_PARAMETER_ESTIMATION_BLOCKS_
* @{
*/
/*!
\brief This function performs channel estimation including frequency interpolation
\param gNB Pointer to gNB PHY variables
\param Ns slot number (0..19)
\param p
\param symbol symbol within slot
\param bwp_start_subcarrier, first allocated subcarrier
\param nb_rb_pusch, number of allocated RBs for this UE
*/
int32_t nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
uint8_t gNB_offset,
unsigned char Ns,
unsigned short p,
unsigned char symbol,
unsigned short bwp_start_subcarrier,
unsigned short nb_rb_pusch);
#endif
......@@ -36,6 +36,8 @@
#include "refsig_defs_ue.h"
#include "PHY/defs_nr_UE.h"
#include "nr_refsig.h"
#include "PHY/defs_gNB.h"
/*Table 7.4.1.1.2-1/2 from 38.211 */
int wf1[8][2] = {{1,1},{1,-1},{1,1},{1,-1},{1,1},{1,-1},{1,1},{1,1}};
......@@ -48,6 +50,59 @@ short nr_rx_mod_table[14] = {0,0,23170,-23170,-23170,23170,23170,-23170,23170,2
short nr_rx_nmod_table[14] = {0,0,-23170,23170,23170,-23170,-23170,23170,-23170,-23170,23170,23170,23170,-23170};
int nr_pusch_dmrs_rx(PHY_VARS_gNB *gNB,
unsigned int Ns,
unsigned int *nr_gold_pusch,
int32_t *output,
unsigned short p,
unsigned char lp,
unsigned short nb_pusch_rb)
{
int8_t w,config_type;
short *mod_table;
unsigned char idx=0;
typedef int array_of_w[2];
array_of_w *wf;
array_of_w *wt;
config_type = 0; //to be updated by higher layer
wf = (config_type==0) ? wf1 : wf2;
wt = (config_type==0) ? wt1 : wt2;
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 (gNB->frame_parms.Ncp == NORMAL) {
for (int i=0; i<nb_pusch_rb*((config_type==0) ? 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;
idx = ((((nr_gold_pusch[(i<<1)>>5])>>((i<<1)&0x1f))&1)<<1) ^ (((nr_gold_pusch[((i<<1)+1)>>5])>>(((i<<1)+1)&0x1f))&1);
((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("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]);
#endif
}
} else {
LOG_E(PHY,"extended cp not supported for PUSCH DMRS yet\n");
}
} else {
LOG_E(PHY,"Illegal p %d PUSCH DMRS port\n",p);
}
return(0);
}
int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue,
unsigned int Ns,
......
......@@ -101,3 +101,59 @@ void nr_init_pdsch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid)
}
}
}
void nr_gold_pusch(PHY_VARS_gNB* gNB, unsigned short lbar,unsigned short *n_idDMRS, unsigned short length_dmrs)
{
unsigned char ns,l;
unsigned int n,x1,x2,x2tmp0;
int nscid;
unsigned int nid;
/// to be updated from higher layer
//unsigned short lbar = 0;
for (nscid=0; nscid<2; nscid++) {
if (n_idDMRS)
nid = n_idDMRS[nscid];
else
nid = gNB->frame_parms.Nid_cell;
//printf("gold pdsch nid %d lbar %d\n",nid,lbar);
for (ns=0; ns<20; ns++) {
for (l=0; l<length_dmrs; l++) {
x2tmp0 = ((14*ns+(lbar+l)+1)*((nid<<1)+1))<<17;
x2 = (x2tmp0+(nid<<1)+nscid)%(1<<31); //cinit
//printf("ns %d gold pdsch x2 %d\n",ns,x2);
x1 = 1+ (1<<31);
x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31);
// skip first 50 double words (1600 bits)
for (n=1; n<50; n++) {
x1 = (x1>>1) ^ (x1>>4);
x1 = x1 ^ (x1<<31) ^ (x1<<28);
x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4);
x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28);
//printf("x1 : %x, x2 : %x\n",x1,x2);
}
for (n=0; n<52; n++) {
x1 = (x1>>1) ^ (x1>>4);
x1 = x1 ^ (x1<<31) ^ (x1<<28);
x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4);
x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28);
gNB->nr_gold_pusch[nscid][ns][l][n] = x1^x2;
// if ((ns==2)&&(l==0))
//printf("n=%d : c %x\n",n,x1^x2);
}
}
}
}
}
\ No newline at end of file
......@@ -39,4 +39,13 @@ void nr_init_pbch_dmrs(PHY_VARS_gNB* gNB);
void nr_init_pdcch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid);
void nr_init_pdsch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid);
void nr_gold_pusch(PHY_VARS_gNB* gNB, unsigned short lbar,unsigned short *n_idDMRS, unsigned short length_dmrs);
int nr_pusch_dmrs_rx(PHY_VARS_gNB *gNB,
unsigned int Ns,
unsigned int *nr_gold_pusch,
int32_t *output,
unsigned short p,
unsigned char lp,
unsigned short nb_pusch_rb);
#endif
......@@ -65,7 +65,9 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
*/
void nr_ulsch_extract_rbs_single(int **rxdataF,
int **ul_ch_estimates,
int **rxdataF_ext,
int **ul_ch_estimates_ext,
uint32_t rxdataF_ext_offset,
// unsigned int *rb_alloc, [hna] Resource Allocation Type 1 is assumed only for the moment
unsigned char symbol,
......@@ -73,6 +75,54 @@ void nr_ulsch_extract_rbs_single(int **rxdataF,
unsigned short nb_rb_pusch,
NR_DL_FRAME_PARMS *frame_parms);
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);
/** \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
@param ul_ch_estimates_ext Channel estimates in allocated RBs
@param frame_parms Pointer to frame descriptor
@param avg Pointer to average signal strength
@param pilots_flag Flag to indicate pilots in symbol
@param nb_rb Number of allocated RBs
*/
void nr_ulsch_channel_level(int **ul_ch_estimates_ext,
NR_DL_FRAME_PARMS *frame_parms,
int32_t *avg,
uint8_t symbol,
uint32_t len,
unsigned short nb_rb);
/** \brief This function performs channel compensation (matched filtering) on the received RBs for this allocation. In addition, it computes the squared-magnitude of the channel with weightings for 16QAM/64QAM detection as well as dual-stream detection (cross-correlation)
@param rxdataF_ext Frequency-domain received signal in RBs to be demodulated
@param ul_ch_estimates_ext Frequency-domain channel estimates in RBs to be demodulated
@param ul_ch_mag First Channel magnitudes (16QAM/64QAM)
@param ul_ch_magb Second weighted Channel magnitudes (64QAM)
@param rxdataF_comp Compensated received waveform
@param frame_parms Pointer to frame descriptor
@param symbol Symbol on which to operate
@param Qm Modulation order of allocation
@param nb_rb Number of RBs in allocation
@param output_shift Rescaling for compensated output (should be energy-normalizing)
*/
void nr_ulsch_channel_compensation(int **rxdataF_ext,
int **ul_ch_estimates_ext,
int **ul_ch_mag,
int **ul_ch_magb,
int **rxdataF_comp,
int **rho,
NR_DL_FRAME_PARMS *frame_parms,
unsigned char symbol,
uint8_t pilots,
unsigned char mod_order,
unsigned short nb_rb,
unsigned char output_shift);
/*!
\brief This function implements the idft transform precoding in PUSCH
\param z Pointer to input in frequnecy domain, and it is also the output in time domain
......@@ -102,6 +152,7 @@ void nr_ulsch_qpsk_llr(int32_t *rxdataF_comp,
void nr_ulsch_16qam_llr(int32_t *rxdataF_comp,
int32_t **ul_ch_mag,
int16_t *ulsch_llr,
uint32_t nb_rb,
uint32_t nb_re,
uint8_t symbol);
......@@ -118,6 +169,7 @@ void nr_ulsch_64qam_llr(int32_t *rxdataF_comp,
int32_t **ul_ch_mag,
int32_t **ul_ch_magb,
int16_t *ulsch_llr,
uint32_t nb_rb,
uint32_t nb_re,
uint8_t symbol);
......@@ -135,6 +187,7 @@ void nr_ulsch_compute_llr(int32_t *rxdataF_comp,
int32_t **ul_ch_mag,
int32_t **ul_ch_magb,
int16_t *ulsch_llr,
uint32_t nb_rb,
uint32_t nb_re,
uint8_t symbol,
uint8_t mod_order);
\ No newline at end of file
......@@ -30,7 +30,6 @@
* \warning
*/
#include "PHY/defs_nr_common.h"
#include "PHY/sse_intrin.h"
#include "PHY/impl_defs_top.h"
......@@ -71,23 +70,20 @@ void nr_ulsch_qpsk_llr(int32_t *rxdataF_comp,
void nr_ulsch_16qam_llr(int32_t *rxdataF_comp,
int32_t **ul_ch_mag,
int16_t *ulsch_llr,
uint32_t nb_rb,
uint32_t nb_re,
uint8_t symbol)
{
#if defined(__x86_64__) || defined(__i386__)
__m128i *rxF = (__m128i*)rxdataF_comp;
// __m128i *ch_mag; // [hna] This should be uncommented once channel estimation is implemented
__m128i *ch_mag;
__m128i llr128[2];
uint32_t *llr32;
// [hna] temp_channel and one_over_sqrt_2 are for temporary use until channel estimation is implemented
// else ul_ch_mag and ul_ch_magb should be used after channel estimation has benn implemented
__m128i temp_channel;
int16_t one_over_sqrt_2 = 23170;
#elif defined(__arm__)
int16x8_t *rxF = (int16x8_t*)&rxdataF_comp;
// int16x8_t *ch_mag; // [hna] This should be uncommented once channel estimation is implemented
int16x8_t *ch_mag;
int16x8_t xmm0;
int16_t *llr16;
#endif
......@@ -103,21 +99,16 @@ void nr_ulsch_16qam_llr(int32_t *rxdataF_comp,
llr16 = (int16_t*)ulsch_llr;
#endif
// [hna] This should be uncommented once channel estimation is implemented
// ------------------------------------------------------------
// #if defined(__x86_64__) || defined(__i386__)
// ch_mag = (__m128i*)&ul_ch_mag[0][(symbol*nb_rb*12)];
// #elif defined(__arm__)
// ch_mag = (int16x8_t*)&ul_ch_mag[0][(symbol*nb_rb*12)];
// #endif
// ------------------------------------------------------------
#if defined(__x86_64__) || defined(__i386__)
ch_mag = (__m128i*)&ul_ch_mag[0][(symbol*nb_rb*12)];
#elif defined(__arm__)
ch_mag = (int16x8_t*)&ul_ch_mag[0][(symbol*nb_rb*12)];
#endif
len_mod4 = nb_re&3;
nb_re >>= 2; // length in quad words (4 REs)
nb_re += (len_mod4 == 0 ? 0 : 1);
temp_channel = _mm_set1_epi16((QAM16_n1 * one_over_sqrt_2)>>(2*15-AMP_SHIFT));
for (i=0; i<nb_re; i++) {
#if defined(__x86_64__) || defined(__i386)
......@@ -125,7 +116,7 @@ void nr_ulsch_16qam_llr(int32_t *rxdataF_comp,
xmm0 = _mm_abs_epi16(rxF[i]); // registers of even index in xmm0-> |y_R|, registers of odd index in xmm0-> |y_I|
xmm0 = _mm_subs_epi16(temp_channel,xmm0); // registers of even index in xmm0-> |y_R|-|h|^2, registers of odd index in xmm0-> |y_I|-|h|^2
xmm0 = _mm_subs_epi16(ch_mag[i],xmm0); // registers of even index in xmm0-> |y_R|-|h|^2, registers of odd index in xmm0-> |y_I|-|h|^2
llr128[0] = _mm_unpacklo_epi32(rxF[i],xmm0); // llr128[0] contains the llrs of the 1st and 2nd REs
llr128[1] = _mm_unpackhi_epi32(rxF[i],xmm0); // llr128[1] contains the llrs of the 3rd and 4th REs
......@@ -186,52 +177,43 @@ void nr_ulsch_64qam_llr(int32_t *rxdataF_comp,
int32_t **ul_ch_mag,
int32_t **ul_ch_magb,
int16_t *ulsch_llr,
uint32_t nb_rb,
uint32_t nb_re,
uint8_t symbol)
{
#if defined(__x86_64__) || defined(__i386__)
__m128i *rxF = (__m128i*)rxdataF_comp;
// __m128i *ch_mag,*ch_magb; // [hna] This should be uncommented once channel estimation is implemented
// [hna] temp_channel and one_over_sqrt_2 are for temporary use until channel estimation is implemented
// else ul_ch_mag and ul_ch_magb should be used after channel estimation has been implemented
__m128i temp_channel[2];
int16_t one_over_sqrt_2 = 23170;
__m128i *ch_mag,*ch_magb;
#elif defined(__arm__)
int16x8_t *rxF = (int16x8_t*)&rxdataF_comp;
// int16x8_t *ch_mag,*ch_magb; // [hna] This should be uncommented once channel estimation is implemented
int16x8_t *ch_mag,*ch_magb; // [hna] This should be uncommented once channel estimation is implemented
int16x8_t xmm1,xmm2;
#endif
int i;
unsigned char len_mod4;
// [hna] This should be uncommented once channel estimation is implemented
// -------------------------------------------------------------------------
// #if defined(__x86_64__) || defined(__i386__)
// ch_mag = (__m128i*)&ul_ch_mag[0][(symbol*frame_parms->N_RB_UL*12)];
// ch_magb = (__m128i*)&ul_ch_magb[0][(symbol*frame_parms->N_RB_UL*12)];
// #elif defined(__arm__)
// ch_mag = (int16x8_t*)&ul_ch_mag[0][(symbol*frame_parms->N_RB_UL*12)];
// ch_magb = (int16x8_t*)&ul_ch_magb[0][(symbol*frame_parms->N_RB_UL*12)];
// #endif
// -------------------------------------------------------------------------
#if defined(__x86_64__) || defined(__i386__)
ch_mag = (__m128i*)&ul_ch_mag[0][(symbol*nb_rb*12)];
ch_magb = (__m128i*)&ul_ch_magb[0][(symbol*nb_rb*12)];
#elif defined(__arm__)
ch_mag = (int16x8_t*)&ul_ch_mag[0][(symbol*nb_rb*12)];
ch_magb = (int16x8_t*)&ul_ch_magb[0][(symbol*nb_rb*12)];
#endif
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((QAM64_n1 * one_over_sqrt_2)>>(2*15-AMP_SHIFT));
temp_channel[1] = _mm_set1_epi16((QAM64_n2 * one_over_sqrt_2)>>(2*15-AMP_SHIFT));
for (i=0; i<nb_re; i++) {
#if defined(__x86_64__) || defined(__i386__)
xmm1 = _mm_abs_epi16(rxF[i]);
xmm1 = _mm_subs_epi16(temp_channel[0],xmm1);
xmm1 = _mm_subs_epi16(ch_mag[i],xmm1);
xmm2 = _mm_abs_epi16(xmm1);
xmm2 = _mm_subs_epi16(temp_channel[1],xmm2);
xmm2 = _mm_subs_epi16(ch_magb[i],xmm2);
#elif defined(__arm__)
xmm1 = vabsq_s16(rxF[i]);
xmm1 = vsubq_s16(ch_mag[i],xmm1);
......@@ -331,6 +313,7 @@ void nr_ulsch_compute_llr(int32_t *rxdataF_comp,
int32_t **ul_ch_mag,
int32_t **ul_ch_magb,
int16_t *ulsch_llr,
uint32_t nb_rb,
uint32_t nb_re,
uint8_t symbol,
uint8_t mod_order)
......@@ -346,6 +329,7 @@ void nr_ulsch_compute_llr(int32_t *rxdataF_comp,
nr_ulsch_16qam_llr(rxdataF_comp,
ul_ch_mag,
ulsch_llr,
nb_rb,
nb_re,
symbol);
break;
......@@ -354,6 +338,7 @@ void nr_ulsch_compute_llr(int32_t *rxdataF_comp,
ul_ch_mag,
ul_ch_magb,
ulsch_llr,
nb_rb,
nb_re,
symbol);
break;
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "filt16a_32.h"
short filt16a_l0[16] = {
16384,12288,8192,4096,0,0,0,0,0,0,0,0,0,0,0,0};
short filt16a_r0[16] = {
0,0,0,0,0,4096,8192,12288,16384,20480,24576,28672,0,0,0,0};
short filt16a_m0[16] = {
0,4096,8192,12288,16384,12288,8192,4096,0,-4096,-8192,-12288,0,0,0,0};
short filt16a_l1[16] = {
20480,16384,12288,8192,4096,0,0,0,0,0,0,0,0,0,0,0};
short filt16a_r1[16] = {
0,0,0,0,0,0,4096,8192,12288,16384,20480,24576,0,0,0,0};
short filt16a_m1[16] = {
-4096,0,4096,8192,12288,16384,12288,8192,4096,0,-4096,-8192,0,0,0,0};
short filt16a_l2[16] = {
24576,20480,16384,12288,8192,4096,0,0,0,0,0,0,0,0,0,0};
short filt16a_r2[16] = {
0,0,0,0,0,0,0,4096,8192,12288,16384,20480,0,0,0,0};
short filt16a_m2[16] = {
-8192,-4096,0,4096,8192,12288,16384,12288,8192,4096,0,-4096,0,0,0,0};
short filt16a_l3[16] = {
28672,24576,20480,16384,12288,8192,4096,0,0,0,0,0,0,0,0,0};
short filt16a_r3[16] = {
0,0,0,0,0,0,0,0,4096,8192,12288,16384,0,0,0,0};
short filt16a_m3[16] = {
-12288,-8192,-4096,0,4096,8192,12288,16384,12288,8192,4096,0,0,0,0,0};
short filt16a_l0_dc[16] = {
16384,12288,8192,4096,0,0,0,0,0,0,0,0,0,0,0,0};
short filt16a_r0_dc[16] = {
0,0,0,0,0,3276,9830,13107,16384,19660,22937,26214,0,0,0,0};
short filt16a_m0_dc[16] = {
0,4096,8192,12288,16384,13107,6553,3276,0,-3277,-6554,-9831,0,0,0,0};
short filt16a_l1_dc[16] = {
16384,12288,8192,4096,0,-4096,0,0,0,0,0,0,0,0,0,0};
short filt16a_r1_dc[16] = {
0,0,0,0,0,0,6553,9830,13107,16384,19660,22937,0,0,0,0};
short filt16a_m1_dc[16] = {
-4096,0,4096,8192,12288,16384,9830,6553,3276,0,-3277,-6554,0,0,0,0};
short filt16a_l2_dc[16] = {
26214,22937,19660,16384,13107,9830,6553,0,0,0,0,0,0,0,0,0};
short filt16a_r2_dc[16] = {
0,0,0,0,0,0,0,4096,8192,12288,16384,20480,0,0,0,0};
short filt16a_m2_dc[16] = {
-6554,-3277,0,3276,6553,6553,16384,12288,8192,4096,0,-4096,0,0,0,0};
short filt16a_l3_dc[16] = {
26214,22937,19660,16384,13107,9830,3276,0,0,0,0,0,0,0,0,0};
short filt16a_r3_dc[16] = {
0,0,0,0,0,0,0,0,4096,8192,12288,16384,0,0,0,0};
short filt16a_m3_dc[16] = {
-9831,-6554,-3277,0,3276,6553,9830,16384,12288,8192,4096,0,0,0,0,0};
short filt16a_1[16] = {
16384,16384,16384,16384,16384,16384,16384,16384,16384,16384,16384,16384};
short filt16a_2l0[16] = {
16384,12288,8192,4096,-4096,0,0,0,0,0,0,0,0,0,0,0};
short filt16a_2r0[16] = {
0,4096,8192,12288,16384,20480,0,0,0,0,0,0,0,0,0,0};
short filt16a_2l1[16] = {
20480,16384,12288,8192,4096,0,0,0,0,0,0,0,0,0,0,0};
short filt16a_2r1[16] = {
-4096,0,4096,8192,12288,16384,0,0,0,0,0,0,0,0,0,0};
/*filter8*/
short filt8_l0[8] = {
16384,8192,0,0,0,0,0,0};
short filt8_mr0[8] = {
0,0,0,8192,16384,8192,0,-8192};
short filt8_r0[8] = {
0,8192,16384,24576,0,0,0,0};
short filt8_m0[8] = {
0,8192,16384,8192,0,0,0,0};
short filt8_mm0[8]= {
0,0,0,8192,16384,8192,0,0};
short filt8_l1[8] = {
24576,16384,0,0,0,0,0,0};
short filt8_ml1[8] = {
-8192,0,8192,16384,8192,0,0,0};
short filt8_r1[8] = {
0,0,8192,16384,0,0,0,0};
short filt8_m1[8] = {
0,0,8192,16384,8192,0,0,0};
short filt8_mm1[8]= {
0,0,0,0,8192,16384,8192,0};
\ No newline at end of file
short filt16a_l0[16] = {
16384,12288,8192,4096,0,0,0,0,0,0,0,0,0,0,0,0};
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
short filt16a_r0[16] = {
0,0,0,0,0,4096,8192,12288,16384,20480,24576,28672,0,0,0,0};
#ifndef __FILT16A_32__H__
#define __FILT16A_32__H__
short filt16a_m0[16] = {
0,4096,8192,12288,16384,12288,8192,4096,0,-4096,-8192,-12288,0,0,0,0};
extern short filt16a_l0[16];
short filt16a_l1[16] = {
20480,16384,12288,8192,4096,0,0,0,0,0,0,0,0,0,0,0};
extern short filt16a_r0[16];
short filt16a_r1[16] = {
0,0,0,0,0,0,4096,8192,12288,16384,20480,24576,0,0,0,0};
extern short filt16a_m0[16];
short filt16a_m1[16] = {
-4096,0,4096,8192,12288,16384,12288,8192,4096,0,-4096,-8192,0,0,0,0};
extern short filt16a_l1[16];
short filt16a_l2[16] = {
24576,20480,16384,12288,8192,4096,0,0,0,0,0,0,0,0,0,0};
extern short filt16a_r1[16];
short filt16a_r2[16] = {
0,0,0,0,0,0,0,4096,8192,12288,16384,20480,0,0,0,0};
extern short filt16a_m1[16];
short filt16a_m2[16] = {
-8192,-4096,0,4096,8192,12288,16384,12288,8192,4096,0,-4096,0,0,0,0};
extern short filt16a_l2[16];
short filt16a_l3[16] = {
28672,24576,20480,16384,12288,8192,4096,0,0,0,0,0,0,0,0,0};
extern short filt16a_r2[16];
short filt16a_r3[16] = {
0,0,0,0,0,0,0,0,4096,8192,12288,16384,0,0,0,0};
extern short filt16a_m2[16];
short filt16a_m3[16] = {
-12288,-8192,-4096,0,4096,8192,12288,16384,12288,8192,4096,0,0,0,0,0};
extern short filt16a_l3[16];
short filt16a_l0_dc[16] = {
16384,12288,8192,4096,0,0,0,0,0,0,0,0,0,0,0,0};
extern short filt16a_r3[16];
short filt16a_r0_dc[16] = {
0,0,0,0,0,3276,9830,13107,16384,19660,22937,26214,0,0,0,0};
extern short filt16a_m3[16];
short filt16a_m0_dc[16] = {
0,4096,8192,12288,16384,13107,6553,3276,0,-3277,-6554,-9831,0,0,0,0};
extern short filt16a_l0_dc[16];
short filt16a_l1_dc[16] = {
16384,12288,8192,4096,0,-4096,0,0,0,0,0,0,0,0,0,0};
extern short filt16a_r0_dc[16];
short filt16a_r1_dc[16] = {
0,0,0,0,0,0,6553,9830,13107,16384,19660,22937,0,0,0,0};
extern short filt16a_m0_dc[16];
short filt16a_m1_dc[16] = {
-4096,0,4096,8192,12288,16384,9830,6553,3276,0,-3277,-6554,0,0,0,0};
extern short filt16a_l1_dc[16];
short filt16a_l2_dc[16] = {
26214,22937,19660,16384,13107,9830,6553,0,0,0,0,0,0,0,0,0};
extern short filt16a_r1_dc[16];
short filt16a_r2_dc[16] = {
0,0,0,0,0,0,0,4096,8192,12288,16384,20480,0,0,0,0};
extern short filt16a_m1_dc[16];
short filt16a_m2_dc[16] = {
-6554,-3277,0,3276,6553,6553,16384,12288,8192,4096,0,-4096,0,0,0,0};
extern short filt16a_l2_dc[16];
short filt16a_l3_dc[16] = {
26214,22937,19660,16384,13107,9830,3276,0,0,0,0,0,0,0,0,0};
extern short filt16a_r2_dc[16];
short filt16a_r3_dc[16] = {
0,0,0,0,0,0,0,0,4096,8192,12288,16384,0,0,0,0};
extern short filt16a_m2_dc[16];
short filt16a_m3_dc[16] = {
-9831,-6554,-3277,0,3276,6553,9830,16384,12288,8192,4096,0,0,0,0,0};
extern short filt16a_l3_dc[16];
short filt16a_1[16] = {
16384,16384,16384,16384,16384,16384,16384,16384,16384,16384,16384,16384};
extern short filt16a_r3_dc[16];
short filt16a_2l0[16] = {
16384,12288,8192,4096,-4096,0,0,0,0,0,0,0,0,0,0,0};
extern short filt16a_m3_dc[16];
short filt16a_2r0[16] = {
0,4096,8192,12288,16384,20480,0,0,0,0,0,0,0,0,0,0};
extern short filt16a_1[16];
short filt16a_2l1[16] = {
20480,16384,12288,8192,4096,0,0,0,0,0,0,0,0,0,0,0};
extern short filt16a_2l0[16];
short filt16a_2r1[16] = {
-4096,0,4096,8192,12288,16384,0,0,0,0,0,0,0,0,0,0};
extern short filt16a_2r0[16];
extern short filt16a_2l1[16];
extern short filt16a_2r1[16];
/*filter8*/
short filt8_l0[8] = {
16384,8192,0,0,0,0,0,0};
extern short filt8_l0[8];
extern short filt8_mr0[8];
short filt8_mr0[8] = {
0,0,0,8192,16384,8192,0,-8192};
extern short filt8_r0[8];
short filt8_r0[8] = {
0,8192,16384,24576,0,0,0,0};
extern short filt8_m0[8];
short filt8_m0[8] = {
0,8192,16384,8192,0,0,0,0};
extern short filt8_mm0[8];
short filt8_mm0[8]= {
0,0,0,8192,16384,8192,0,0};
extern short filt8_l1[8];
short filt8_l1[8] = {
24576,16384,0,0,0,0,0,0};
extern short filt8_ml1[8];
short filt8_ml1[8] = {
-8192,0,8192,16384,8192,0,0,0};
extern short filt8_r1[8];
short filt8_r1[8] = {
0,0,8192,16384,0,0,0,0};
extern short filt8_m1[8];
short filt8_m1[8] = {
0,0,8192,16384,8192,0,0,0};
extern short filt8_mm1[8];
short filt8_mm1[8]= {
0,0,0,0,8192,16384,8192,0};
#endif
\ No newline at end of file
......@@ -43,6 +43,7 @@
#include "PHY/TOOLS/tools_defs.h"
//#define DEBUG_SCFDMA
//#define DEBUG_PUSCH_MAPPING
int generate_ue_ulsch_params(PHY_VARS_NR_UE *UE,
......@@ -343,6 +344,7 @@ uint8_t nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]);
#endif
dmrs_idx++;
k_prime++;
k_prime&=1;
......
......@@ -366,11 +366,15 @@ typedef struct {
/// \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[
int32_t **drs_ch_estimates_time;
int32_t **ul_ch_estimates_time;
/// \brief Hold the channel estimates in frequency domain based on DRS.
/// - first index: rx antenna id [0..nb_antennas_rx[
/// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **drs_ch_estimates;
int32_t **ul_ch_estimates;
/// \brief Uplink channel estimates extracted in PRBS.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **ul_ch_estimates_ext;
/// \brief Holds the compensated signal.
/// - first index: rx antenna id [0..nb_antennas_rx[
/// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
......@@ -383,6 +387,28 @@ typedef struct {
/// - first index: rx antenna id [0..nb_antennas_rx[
/// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **ul_ch_magb;
/// \brief Cross-correlation of two UE signals.
/// - first index: rx antenna [0..nb_antennas_rx[
/// - second index: symbol [0..]
int32_t **rho;
/// \f$\log_2(\max|H_i|^2)\f$
int16_t log2_maxh;
/// \brief Magnitude of Uplink Channel first layer (16QAM level/First 64QAM level).
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..168*N_RB_UL[
int32_t **ul_ch_mag0;
/// \brief Magnitude of Uplink Channel second layer (16QAM level/First 64QAM level).
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..168*N_RB_UL[
int32_t **ul_ch_mag1[8][8];
/// \brief Magnitude of Uplink Channel, first layer (2nd 64QAM level).
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..168*N_RB_UL[
int32_t **ul_ch_magb0;
/// \brief Magnitude of Uplink Channel second layer (2nd 64QAM level).
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..168*N_RB_UL[
int32_t **ul_ch_magb1[8][8];
/// measured RX power based on DRS
int ulsch_power[2];
/// \brief llr values.
......@@ -643,6 +669,9 @@ typedef struct PHY_VARS_gNB_s {
/// PDSCH DMRS sequence
uint32_t ****nr_gold_pdsch_dmrs;
/// PUSCH DMRS
uint32_t nr_gold_pusch[2][20][2][52];
/// Indicator set to 0 after first SR
uint8_t first_sr[NUMBER_OF_UE_MAX];
......
......@@ -208,6 +208,7 @@
/// First Amplitude for QAM16 (\f$ 2^{15} \times 2/\sqrt{10}\f$)
#define QAM16_n1 20724
/// Second Amplitude for QAM16 (\f$ 2^{15} \times 1/\sqrt{10}\f$)
#define QAM16_n2 10362
......
......@@ -497,6 +497,8 @@ int main(int argc, char **argv)
//---------------------- count errors ----------------------
//----------------------------------------------------------
printf("available_bits = %d\n",available_bits);
for (i = 0; i < available_bits; i++) {
if(((ulsch_ue[0]->g[i] == 0) && (gNB->pusch_vars[UE_id]->llr[i] <= 0)) ||
......@@ -511,6 +513,7 @@ int main(int argc, char **argv)
}
for (i = 0; i < TBS; i++) {
estimated_output_bit[i] = (ulsch_gNB->harq_processes[harq_pid]->b[i/8] & (1 << (i & 7))) >> (i & 7);
......
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