Commit ff440a30 authored by Khalid Ahmed's avatar Khalid Ahmed Committed by Thomas Schlichter
Browse files

SC-FDMA implemented and compiling. (NOT TESTED)!!

parent c38a4859
......@@ -1069,6 +1069,10 @@ void nr_pusch_codeword_scrambling(uint8_t *in,
uint32_t n_RNTI,
uint32_t* out);
void pusch_transform_precoding(NR_UE_ULSCH_t *ulsch,
NR_DL_FRAME_PARMS *frame_parms,
int harq_pid);
uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
......
......@@ -138,10 +138,6 @@ typedef struct {
uint32_t sumKr;
/// Number of "Filler" bits
uint32_t F;
/// Msc_initial, Initial number of subcarriers for ULSCH
uint16_t Msc_initial;
/// Nsymb_initial, Initial number of symbols for ULSCH
uint8_t Nsymb_initial;
/// n_DMRS for cyclic shift of DMRS
uint8_t n_DMRS;
/// n_DMRS2 for cyclic shift of DMRS
......@@ -165,6 +161,8 @@ typedef struct {
typedef struct {
/// Current Number of Symbols
uint8_t Nsymb_pusch;
/// Nsc_pusch, number of allocated subcarriers for ULSCH
uint16_t Nsc_pusch;
/// number of DMRS resource elements
uint8_t nb_re_dmrs;
/// DMRS length
......@@ -204,9 +202,9 @@ typedef struct {
/// Scrambled "b"-sequences (for definition see 36-211 V8.6 2009-03, p.14)
uint8_t b_tilde[MAX_NUM_NR_CHANNEL_BITS];
/// Modulated "d"-sequences (for definition see 36-211 V8.6 2009-03, p.14)
int32_t d_mod[MAX_NUM_NR_RE] __attribute__ ((aligned(16)));
/// Transform-coded "z"-sequences (for definition see 36-211 V8.6 2009-03, p.14-15)
int32_t z[MAX_NUM_NR_RE];
uint32_t d_mod[MAX_NUM_NR_RE] __attribute__ ((aligned(16)));
/// Transform-coded "y"-sequences (for definition see 38-211 V15.3.0 2018-09, subsection 6.3.1.4)
uint32_t y[MAX_NUM_NR_RE];
/*
/// "q" sequences for CQI/PMI (for definition see 36-212 V8.6 2009-03, p.27)
uint8_t q[MAX_CQI_PAYLOAD];
......
......@@ -30,9 +30,19 @@
* \warning
*/
#include <stdint.h>
#include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h"
#include "common/utils/assertions.h"
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
#include "PHY/defs_nr_common.h"
#include "PHY/TOOLS/tools_defs.h"
//#define DEBUG_SCFDMA
#ifdef DEBUG_SCFDMA
FILE *debug_scfdma;
#endif
......@@ -74,3 +84,100 @@ void nr_pusch_codeword_scrambling(uint8_t *in,
}
}
void pusch_transform_precoding(NR_UE_ULSCH_t *ulsch, NR_DL_FRAME_PARMS *frame_parms, int harq_pid){
NR_UL_UE_HARQ_t *harq_process;
int16_t x[8192] = {0}; // 8192 is the maximum number of fft bins
uint32_t *dmod;
int sc, pusch_symb, pusch_sc;
int symb, k, l, num_mod_symb;
harq_process = ulsch->harq_processes[harq_pid];
#ifdef DEBUG_SCFDMA
debug_scfdma = fopen("debug_scfdma.txt","w");
#endif
dmod = ulsch->d_mod;
pusch_symb = ulsch->Nsymb_pusch;
pusch_sc = ulsch->Nsc_pusch;
num_mod_symb = harq_process->num_of_mod_symbols;
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;
}
k = 0;
symb = 0;
for(l = 0; l < pusch_symb; l++){
for (sc = 0; sc < pusch_sc; sc++){
x[sc*2] = (symb<num_mod_symb)?(AMP*((int16_t *)dmod)[symb*2])>>15:0;
x[sc*2 + 1] = (symb<num_mod_symb)?(AMP*((int16_t *)dmod)[symb*2 + 1])>>15:0;
#ifdef DEBUG_SCFDMA
fprintf(debug_scfdma, "x[%d] = %d\n", symb*2, x[sc*2] );
fprintf(debug_scfdma, "x[%d] = %d\n", symb*2 + 1, x[sc*2 + 1] );
#endif
symb++;
}
dft(x, (int16_t *)&ulsch->y[l*pusch_sc], 1);
}
#ifdef DEBUG_SCFDMA
for (symb = 0; symb < num_mod_symb; symb++)
{
fprintf(debug_scfdma, "ulsch->y[%d] = %d\n", symb*2, ((int16_t *)ulsch->y)[symb*2] );
fprintf(debug_scfdma, "ulsch->y[%d] = %d\n", symb*2 + 1, ((int16_t *)ulsch->y)[symb*2 + 1] );
}
fclose(debug_scfdma);
#endif
}
......@@ -507,6 +507,8 @@ int main(int argc, char **argv) {
ulsch_ue[cwd]->nb_re_dmrs = nb_re_dmrs;
ulsch_ue[cwd]->length_dmrs = length_dmrs;
ulsch_ue[cwd]->rnti = n_rnti;
ulsch_ue[cwd]->Nsc_pusch = nb_rb*NR_NB_SC_PER_RB;
ulsch_ue[cwd]->Nsymb_pusch = nb_symb_sch;
///////////
////////////////////////////////////////////////////////////////////////////////////////////
......@@ -572,6 +574,8 @@ int main(int argc, char **argv) {
mod_order,
(int16_t *)ulsch_ue[cwd]->d_mod);
pusch_transform_precoding(ulsch_ue[cwd], frame_parms, harq_pid);
///////////
////////////////////////////////////////////////////////////////////////
......
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