Commit 6de60def authored by Guy De Souza's avatar Guy De Souza

L2 interface changes

parent 4ff649ac
...@@ -1300,6 +1300,7 @@ set(PHY_SRC_UE ...@@ -1300,6 +1300,7 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_dlsch_tools.c ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_dlsch_tools.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_dlsch_coding.c ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_dlsch_coding.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_tbs_tools.c ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_tbs_tools.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_sch_dmrs.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold.c
${OPENAIR1_DIR}/PHY/TOOLS/file_output.c ${OPENAIR1_DIR}/PHY/TOOLS/file_output.c
${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c ${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c
......
...@@ -554,26 +554,24 @@ typedef struct { ...@@ -554,26 +554,24 @@ typedef struct {
uint8_t freq_allocation_type; uint8_t freq_allocation_type;
uint8_t start_prb; uint8_t start_prb;
uint8_t n_prb; uint8_t n_prb;
uint8_t S; uint8_t start_symbol;
uint8_t L; uint8_t nb_symbols;
uint8_t Imcs; uint8_t mcs_idx;
uint8_t nb_codewords; uint8_t nb_codewords;
uint8_t nb_layers; uint8_t nb_layers;
/*uint8_t R; uint16_t coding_rate;
uint8_t Qm; uint8_t modulation;
uint16_t TBS; uint8_t modulation_order;
uint8_t nb_layers;*/ uint16_t transport_block_size;
uint8_t nb_re_dmrs;
uint8_t time_alloc_list_flag; uint8_t time_alloc_list_flag;
uint8_t time_alloc_list; uint8_t time_alloc_list;
uint8_t rbg_list; uint8_t rbg_list;
uint8_t virtual_resource_block_assignment_flag; uint8_t virtual_resource_block_assignment_flag;
uint32_t resource_block_coding; uint32_t resource_block_coding;
uint8_t modulation;
uint8_t redundancy_version; uint8_t redundancy_version;
uint8_t transport_blocks; uint8_t transport_blocks;
//uint8_t transport_block_to_codeword_swap_flag;
uint8_t transmission_scheme; uint8_t transmission_scheme;
uint8_t number_of_layers;
uint8_t number_of_subbands; uint8_t number_of_subbands;
uint8_t codebook_index[NFAPI_MAX_NUM_SUBBANDS]; uint8_t codebook_index[NFAPI_MAX_NUM_SUBBANDS];
uint8_t ue_category_capacity; uint8_t ue_category_capacity;
......
...@@ -51,7 +51,8 @@ void nr_fill_dci_and_dlsch(PHY_VARS_gNB *gNB, ...@@ -51,7 +51,8 @@ void nr_fill_dci_and_dlsch(PHY_VARS_gNB *gNB,
int subframe, int subframe,
gNB_rxtx_proc_t *proc, gNB_rxtx_proc_t *proc,
NR_gNB_DCI_ALLOC_t *dci_alloc, NR_gNB_DCI_ALLOC_t *dci_alloc,
nfapi_nr_dl_config_request_pdu_t *pdu); nfapi_nr_dl_config_dci_dl_pdu *pdu,
nfapi_nr_dl_config_dlsch_pdu *dlsch_pdu);
void nr_fill_cce_list(NR_gNB_DCI_ALLOC_t* dci_alloc, uint16_t n_shift, uint8_t m); void nr_fill_cce_list(NR_gNB_DCI_ALLOC_t* dci_alloc, uint16_t n_shift, uint8_t m);
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
*/ */
#include "nr_dci.h" #include "nr_dci.h"
#include "nr_dlsch.h"
void nr_fill_cce_list(NR_gNB_DCI_ALLOC_t* dci_alloc, uint16_t n_shift, uint8_t m) { void nr_fill_cce_list(NR_gNB_DCI_ALLOC_t* dci_alloc, uint16_t n_shift, uint8_t m) {
...@@ -110,14 +111,15 @@ void nr_fill_dci_and_dlsch(PHY_VARS_gNB *gNB, ...@@ -110,14 +111,15 @@ void nr_fill_dci_and_dlsch(PHY_VARS_gNB *gNB,
int subframe, int subframe,
gNB_rxtx_proc_t *proc, gNB_rxtx_proc_t *proc,
NR_gNB_DCI_ALLOC_t *dci_alloc, NR_gNB_DCI_ALLOC_t *dci_alloc,
nfapi_nr_dl_config_request_pdu_t *pdu) nfapi_nr_dl_config_dci_dl_pdu *pdcch_pdu,
nfapi_nr_dl_config_dlsch_pdu *dlsch_pdu)
{ {
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
uint8_t n_shift; uint8_t n_shift;
uint32_t *dci_pdu = dci_alloc->dci_pdu; uint32_t *dci_pdu = dci_alloc->dci_pdu;
memset((void*)dci_pdu,0,4*sizeof(uint32_t)); memset((void*)dci_pdu,0,4*sizeof(uint32_t));
nfapi_nr_dl_config_dci_dl_pdu_rel15_t *pdu_rel15 = &pdu->dci_dl_pdu.dci_dl_pdu_rel15; nfapi_nr_dl_config_dci_dl_pdu_rel15_t *pdu_rel15 = &pdcch_pdu->dci_dl_pdu_rel15;
nfapi_nr_dl_config_pdcch_parameters_rel15_t *params_rel15 = &pdu->dci_dl_pdu.pdcch_params_rel15; nfapi_nr_dl_config_pdcch_parameters_rel15_t *params_rel15 = &pdcch_pdu->pdcch_params_rel15;
nfapi_nr_config_request_t *cfg = &gNB->gNB_config; nfapi_nr_config_request_t *cfg = &gNB->gNB_config;
NR_gNB_DLSCH_t *dlsch = &gNB->dlsch; NR_gNB_DLSCH_t *dlsch = &gNB->dlsch;
NR_DL_gNB_HARQ_t **harq = dlsch->harq_processes; NR_DL_gNB_HARQ_t **harq = dlsch->harq_processes;
...@@ -532,4 +534,11 @@ void nr_fill_dci_and_dlsch(PHY_VARS_gNB *gNB, ...@@ -532,4 +534,11 @@ void nr_fill_dci_and_dlsch(PHY_VARS_gNB *gNB,
nr_fill_cce_list(dci_alloc, n_shift, cand_idx); nr_fill_cce_list(dci_alloc, n_shift, cand_idx);
LOG_I(PHY, "DCI type %d payload (size %d) generated on candidate %d\n", dci_alloc->pdcch_params.dci_format, dci_alloc->size, cand_idx); LOG_I(PHY, "DCI type %d payload (size %d) generated on candidate %d\n", dci_alloc->pdcch_params.dci_format, dci_alloc->size, cand_idx);
/// DLSCH struct
memcpy((void*)&dlsch->harq_processes[dci_alloc->harq_pid]->dlsch_pdu, (void*)dlsch_pdu, sizeof(nfapi_nr_dl_config_dlsch_pdu));
nfapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_rel15 = &dlsch_pdu->dlsch_pdu_rel15;
nr_get_tbs(dlsch, *pdcch_pdu, *cfg, dci_alloc->harq_pid);
dlsch_rel15->nb_layers =1;
dlsch_rel15->nb_codewords = 1;
} }
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "nr_dlsch.h" #include "nr_dlsch.h"
#include "nr_dci.h" #include "nr_dci.h"
#include "nr_sch_dmrs.h"
#define DEBUG_DLSCH #define DEBUG_DLSCH
...@@ -207,7 +208,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch, ...@@ -207,7 +208,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch,
pdcch_params.scrambling_id : config.sch_config.physical_cell_id.value; pdcch_params.scrambling_id : config.sch_config.physical_cell_id.value;
for (int q=0; q<rel15->nb_codewords; q++) for (int q=0; q<rel15->nb_codewords; q++)
nr_pdsch_codeword_scrambling(harq->f, nr_pdsch_codeword_scrambling(harq->f,
harq->TBS, rel15->transport_block_size,
q, q,
Nid, Nid,
n_RNTI, n_RNTI,
...@@ -216,8 +217,8 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch, ...@@ -216,8 +217,8 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch,
/// Modulation /// Modulation
for (int q=0; q<rel15->nb_codewords; q++) for (int q=0; q<rel15->nb_codewords; q++)
nr_pdsch_codeword_modulation(scrambled_output[q], nr_pdsch_codeword_modulation(scrambled_output[q],
harq->Qm, rel15->modulation_order,
harq->TBS, rel15->transport_block_size,
mod_symbs[q]); mod_symbs[q]);
/// Layer mapping /// Layer mapping
...@@ -231,14 +232,14 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch, ...@@ -231,14 +232,14 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch,
//to be moved to init phase potentially, for now tx_layers 1-8 are mapped on antenna ports 1000-1007 //to be moved to init phase potentially, for now tx_layers 1-8 are mapped on antenna ports 1000-1007
/// DMRS QPSK modulation /// DMRS QPSK modulation
uint16_t n_dmrs = rel15->n_prb<<1; uint16_t n_dmrs = rel15->n_prb*rel15->nb_re_dmrs;
int16_t mod_dmrs[n_dmrs<<1]; int16_t mod_dmrs[n_dmrs<<1];
uint8_t dmrs_type = config.pdsch_config.dmrs_type.value; uint8_t dmrs_type = config.pdsch_config.dmrs_type.value;
nr_modulation(pdsch_dmrs, n_dmrs, MOD_QPSK, mod_dmrs); nr_modulation(pdsch_dmrs, n_dmrs, MOD_QPSK, mod_dmrs);
/// Resource mapping /// Resource mapping
AssertFatal(harq->Nl<=config.rf_config.tx_antenna_ports.value, "Not enough Tx antennas (%d) for %d layers\n",\ AssertFatal(rel15->nb_layers<=config.rf_config.tx_antenna_ports.value, "Not enough Tx antennas (%d) for %d layers\n",\
config.rf_config.tx_antenna_ports.value, harq->Nl); config.rf_config.tx_antenna_ports.value, rel15->nb_layers);
// Non interleaved VRB to PRB mapping // Non interleaved VRB to PRB mapping
uint8_t start_sc = frame_parms.first_carrier_offset + rel15->start_prb*NR_NB_SC_PER_RB +\ uint8_t start_sc = frame_parms.first_carrier_offset + rel15->start_prb*NR_NB_SC_PER_RB +\
...@@ -255,7 +256,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch, ...@@ -255,7 +256,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch,
uint8_t k_prime=0, n=0, dmrs_idx=0; uint8_t k_prime=0, n=0, dmrs_idx=0;
uint16_t m = 0; uint16_t m = 0;
for (int l=rel15->S; l<rel15->L; l++) for (int l=rel15->start_symbol; l<rel15->nb_symbols; l++)
for (int k=start_sc; k<rel15->n_prb*NR_NB_SC_PER_RB; k++) { for (int k=start_sc; k<rel15->n_prb*NR_NB_SC_PER_RB; k++) {
if (k >= frame_parms.ofdm_symbol_size) if (k >= frame_parms.ofdm_symbol_size)
k -= frame_parms.ofdm_symbol_size; k -= frame_parms.ofdm_symbol_size;
......
...@@ -85,9 +85,8 @@ uint32_t nr_get_G(uint16_t nb_rb, uint16_t nb_symb_sch,uint8_t nb_re_dmrs,uint16 ...@@ -85,9 +85,8 @@ uint32_t nr_get_G(uint16_t nb_rb, uint16_t nb_symb_sch,uint8_t nb_re_dmrs,uint16
int nr_dlsch_encoding(PHY_VARS_gNB *gNB, int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
unsigned char *a, unsigned char *a,
uint16_t nb_symb_sch,
NR_gNB_DLSCH_t *dlsch, NR_gNB_DLSCH_t *dlsch,
int frame, uint16_t frame,
uint8_t subframe, uint8_t subframe,
time_stats_t *rm_stats, time_stats_t *rm_stats,
time_stats_t *te_stats, time_stats_t *te_stats,
......
...@@ -245,9 +245,8 @@ void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch) ...@@ -245,9 +245,8 @@ void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch)
int nr_dlsch_encoding(PHY_VARS_gNB *gNB, int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
unsigned char *a, unsigned char *a,
uint16_t nb_symb_sch,
NR_gNB_DLSCH_t *dlsch, NR_gNB_DLSCH_t *dlsch,
int frame, uint16_t frame,
uint8_t subframe, uint8_t subframe,
time_stats_t *rm_stats, time_stats_t *rm_stats,
time_stats_t *te_stats, time_stats_t *te_stats,
...@@ -258,39 +257,33 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -258,39 +257,33 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
unsigned int crc=1; unsigned int crc=1;
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
unsigned char harq_pid = dlsch->harq_ids[subframe]; uint8_t harq_pid = dlsch->harq_ids[subframe];
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb; nfapi_nr_dl_config_dlsch_pdu_rel15_t rel15 = dlsch->harq_processes[harq_pid]->dlsch_pdu.dlsch_pdu_rel15;
unsigned int A, Z; uint16_t nb_rb = rel15.n_prb;
unsigned *pz = &Z; uint8_t nb_symb_sch = rel15.nb_symbols;
unsigned char mod_order; uint16_t A, Z;
unsigned int Kr=0,r,r_offset=0;//Kr_bytes uint16_t *pz = &Z;
//unsigned short m=dlsch->harq_processes[harq_pid]->mcs; uint8_t mod_order = rel15.modulation_order;
//uint8_t beamforming_mode=0; uint16_t Kr=0,r,r_offset=0;//Kr_bytes
uint8_t *d_tmp[MAX_NUM_DLSCH_SEGMENTS]; uint8_t *d_tmp[MAX_NUM_DLSCH_SEGMENTS];
//double rate = 0.33; //double rate = 0.33;
uint8_t kb,BG=1; uint8_t kb,BG=1;
uint32_t E; uint32_t E;
uint8_t Ilbrm = 0; uint8_t Ilbrm = 0;
uint32_t Tbslbrm = 950984; //max tbs uint32_t Tbslbrm = 950984; //max tbs
//uint16_t nb_symb_sch =12; uint8_t nb_re_dmrs = rel15.nb_re_dmrs;
uint8_t nb_re_dmrs = 6;
uint16_t length_dmrs = 1; uint16_t length_dmrs = 1;
uint8_t *channel_input[MAX_NUM_DLSCH_SEGMENTS]; //unsigned char uint8_t *channel_input[MAX_NUM_DLSCH_SEGMENTS]; //unsigned char
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN);
dlsch->harq_processes[harq_pid]->TBS= nr_compute_tbs(dlsch->harq_processes[harq_pid]->mcs, A = rel15.transport_block_size;
nb_rb,nb_symb_sch,nb_re_dmrs,length_dmrs,
dlsch->harq_processes[harq_pid]->Nl);
A = dlsch->harq_processes[harq_pid]->TBS;
//printf("Encoder: A: %d frame.subframe %d.%d \n",A, frame,subframe); //printf("Encoder: A: %d frame.subframe %d.%d \n",A, frame,subframe);
mod_order = nr_get_Qm(dlsch->harq_processes[harq_pid]->mcs,1);
G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs,mod_order,dlsch->harq_processes[harq_pid]->Nl); G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs,mod_order,rel15.nb_layers);
printf("dlsch coding A %d G %d mod_order %d\n", A,G, mod_order); printf("dlsch coding A %d G %d mod_order %d\n", A,G, mod_order);
Tbslbrm = nr_compute_tbs(28,nb_rb,frame_parms->symbols_per_slot,0,0, dlsch->harq_processes[harq_pid]->Nl); Tbslbrm = nr_compute_tbs(28,nb_rb,frame_parms->symbols_per_slot,0,0, rel15.nb_layers);
// if (dlsch->harq_processes[harq_pid]->Ndi == 1) { // this is a new packet // if (dlsch->harq_processes[harq_pid]->Ndi == 1) { // this is a new packet
if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet
...@@ -400,9 +393,9 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -400,9 +393,9 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
dlsch->harq_processes[harq_pid]->d[r], dlsch->harq_processes[harq_pid]->d[r],
dlsch->harq_processes[harq_pid]->e+r_offset, dlsch->harq_processes[harq_pid]->e+r_offset,
dlsch->harq_processes[harq_pid]->C, dlsch->harq_processes[harq_pid]->C,
dlsch->harq_processes[harq_pid]->rvidx, rel15.redundancy_version,
mod_order, mod_order,
dlsch->harq_processes[harq_pid]->Nl, rel15.nb_layers,
r); r);
#ifdef DEBUG_DLSCH_CODING #ifdef DEBUG_DLSCH_CODING
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
/*Table 7.4.1.1.2-1 and 7.4.1.1.2-2 38211 Columns: ap - CDM group - Delta - Wf(0) - Wf(1) - Wt(0) - Wt(1)*/ /*Table 7.4.1.1.2-1 and 7.4.1.1.2-2 38211 Columns: ap - CDM group - Delta - Wf(0) - Wf(1) - Wt(0) - Wt(1)*/
int8_t pdsch_dmrs_1[8][7] = {{0,0,0,1,1,1,1}, int8_t pdsch_dmrs_1[8][7] = {{0,0,0,1,1,1,1},
{1,0,0,1,-1,1,1}, {1,0,0,1,-1,1,1},
{2,1,1,1,1,,1,1}, {2,1,1,1,1,1,1},
{3,1,1,1,-1,1,1}, {3,1,1,1,-1,1,1},
{4,0,0,1,1,1,-1}, {4,0,0,1,1,1,-1},
{5,0,0,1,-1,1,-1}, {5,0,0,1,-1,1,-1},
...@@ -56,22 +56,18 @@ int8_t pdsch_dmrs_2[12][7] = {{0,0,0,1,1,1,1}, ...@@ -56,22 +56,18 @@ int8_t pdsch_dmrs_2[12][7] = {{0,0,0,1,1,1,1},
{10,2,4,1,1,1,-1}, {10,2,4,1,1,1,-1},
{11,2,4,1,-1,1,-1}}; {11,2,4,1,-1,1,-1}};
static inline void *get_l_prime(uint8_t n_symbs) { void get_l_prime(uint8_t *l_prime, uint8_t n_symbs) {
uint8_t *l_prime; for (int i=0; i<n_symbs; i++)
for (int i=0; i<nsymbs; i++)
*(l_prime+i) = i; *(l_prime+i) = i;
return l_prime;
} }
static inline void *get_antenna_ports(uint8_t n_symbs, uint8_t config) { void get_antenna_ports(uint8_t *ap, uint8_t n_symbs, uint8_t config) {
uint8_t *ap;
if (config == NFAPI_NR_DMRS_TYPE1) if (config == NFAPI_NR_DMRS_TYPE1)
for (int i=0; i<(4+4*(n_symbs-1); i++) for (int i=0; i<(4+((n_symbs-1)<<2)); i++)
*(ap+i) = i; *(ap+i) = i;
else else
for (int i=0; i<(7+4*(n_symbs-1); i++) for (int i=0; i<(7+((n_symbs-1)<<2)); i++)
*(ap+i) = i; *(ap+i) = i;
return ap;
} }
void get_Wt(int8_t *Wt, uint8_t ap, uint8_t config) { void get_Wt(int8_t *Wt, uint8_t ap, uint8_t config) {
...@@ -79,7 +75,7 @@ void get_Wt(int8_t *Wt, uint8_t ap, uint8_t config) { ...@@ -79,7 +75,7 @@ void get_Wt(int8_t *Wt, uint8_t ap, uint8_t config) {
*(Wt+i)=(config==NFAPI_NR_DMRS_TYPE1)?(pdsch_dmrs_1[ap][3+i]):(pdsch_dmrs_2[ap][3+i]); *(Wt+i)=(config==NFAPI_NR_DMRS_TYPE1)?(pdsch_dmrs_1[ap][3+i]):(pdsch_dmrs_2[ap][3+i]);
} }
void *get_Wf(int8_t *Wf, uint8_t ap, uint8_t config) { void get_Wf(int8_t *Wf, uint8_t ap, uint8_t config) {
for (int i=0; i<2; i++) for (int i=0; i<2; i++)
*(Wf+i)=(config==NFAPI_NR_DMRS_TYPE1)?(pdsch_dmrs_1[ap][5+i]):(pdsch_dmrs_2[ap][5+i]); *(Wf+i)=(config==NFAPI_NR_DMRS_TYPE1)?(pdsch_dmrs_1[ap][5+i]):(pdsch_dmrs_2[ap][5+i]);
} }
......
...@@ -35,6 +35,10 @@ ...@@ -35,6 +35,10 @@
#define NR_PDSCH_DMRS_ANTENNA_PORT0 1000 #define NR_PDSCH_DMRS_ANTENNA_PORT0 1000
#define NR_PDSCH_DMRS_NB_ANTENNA_PORTS 12 #define NR_PDSCH_DMRS_NB_ANTENNA_PORTS 12
void get_l_prime(uint8_t *l_prime, uint8_t n_symbs);
void get_antenna_ports(uint8_t *ap, uint8_t n_symbs, uint8_t config);
void get_Wt(int8_t *Wt, uint8_t ap, uint8_t config); void get_Wt(int8_t *Wt, uint8_t ap, uint8_t config);
void get_Wf(int8_t *Wf, uint8_t ap, uint8_t config); void get_Wf(int8_t *Wf, uint8_t ap, uint8_t config);
......
...@@ -118,12 +118,12 @@ void nr_get_tbs(NR_gNB_DLSCH_t *dlsch, ...@@ -118,12 +118,12 @@ void nr_get_tbs(NR_gNB_DLSCH_t *dlsch,
(config.pdsch_config.x_overhead.value); (config.pdsch_config.x_overhead.value);
uint8_t N_PRB_DMRS = (config.pdsch_config.dmrs_type.value == NFAPI_NR_DMRS_TYPE1)?4:6; //This only works for antenna port 1000 uint8_t N_PRB_DMRS = (config.pdsch_config.dmrs_type.value == NFAPI_NR_DMRS_TYPE1)?4:6; //This only works for antenna port 1000
uint8_t mcs_table = config.pdsch_config.mcs_table.value; uint8_t mcs_table = config.pdsch_config.mcs_table.value;
uint8_t N_sh_symb = dlsch_rel15->L; uint8_t N_sh_symb = dlsch_rel15->nb_symbols;
uint8_t Imcs = dlsch_rel15->Imcs; uint8_t Imcs = dlsch_rel15->mcs_idx;
uint16_t N_prime_RE = NR_NB_SC_PER_RB*N_sh_symb - N_PRB_DMRS - N_PRB_oh; uint16_t N_prime_RE = NR_NB_SC_PER_RB*N_sh_symb - N_PRB_DMRS - N_PRB_oh;
LOG_I(MAC, "N_prime_RE %d for %d symbols %d DMRS per PRB and %d overhead\n", N_prime_RE, N_sh_symb, N_PRB_DMRS, N_PRB_oh); LOG_I(MAC, "N_prime_RE %d for %d symbols %d DMRS per PRB and %d overhead\n", N_prime_RE, N_sh_symb, N_PRB_DMRS, N_PRB_oh);
uint16_t N_RE, Ninfo, Ninfo_prime, C; uint16_t N_RE, Ninfo, Ninfo_prime, C, TBS;
uint8_t table_idx, R, Qm, n, scale; uint8_t table_idx, R, Qm, n, scale;
table_idx = get_table_idx(mcs_table, dci_format, rnti_type, ss_type); table_idx = get_table_idx(mcs_table, dci_format, rnti_type, ss_type);
...@@ -132,14 +132,14 @@ void nr_get_tbs(NR_gNB_DLSCH_t *dlsch, ...@@ -132,14 +132,14 @@ void nr_get_tbs(NR_gNB_DLSCH_t *dlsch,
N_RE = min(156, N_RE)*dlsch_rel15->n_prb; N_RE = min(156, N_RE)*dlsch_rel15->n_prb;
R = nr_get_code_rate(Imcs, table_idx); R = nr_get_code_rate(Imcs, table_idx);
Qm = nr_get_Qm(Imcs, table_idx); Qm = nr_get_Qm(Imcs, table_idx);
Ninfo = (N_RE*R*Qm*harq->Nl)>>scale; Ninfo = (N_RE*R*Qm*dlsch_rel15->nb_layers)>>scale;
if (Ninfo <= 3824) { if (Ninfo <= 3824) {
n = max(3, (log2(Ninfo)-6)); n = max(3, (log2(Ninfo)-6));
Ninfo_prime = max(24, (Ninfo>>n)<<n); Ninfo_prime = max(24, (Ninfo>>n)<<n);
for (int i=0; i<93; i++) for (int i=0; i<93; i++)
if (nr_tbs_table[i] >= Ninfo_prime) { if (nr_tbs_table[i] >= Ninfo_prime) {
harq->TBS = nr_tbs_table[i]; TBS = nr_tbs_table[i];
break; break;
} }
} }
...@@ -149,24 +149,29 @@ void nr_get_tbs(NR_gNB_DLSCH_t *dlsch, ...@@ -149,24 +149,29 @@ void nr_get_tbs(NR_gNB_DLSCH_t *dlsch,
if (R<256) { if (R<256) {
C = CEILIDIV((Ninfo_prime+24),3816); C = CEILIDIV((Ninfo_prime+24),3816);
harq->TBS = (C*CEILIDIV((Ninfo_prime+24),(C<<3)))<<3; TBS = (C*CEILIDIV((Ninfo_prime+24),(C<<3)))<<3;
} }
else { else {
if (Ninfo_prime>8424) { if (Ninfo_prime>8424) {
C = CEILIDIV((Ninfo_prime+24),8424); C = CEILIDIV((Ninfo_prime+24),8424);
harq->TBS = (C*CEILIDIV((Ninfo_prime+24),(C<<3)))<<3; TBS = (C*CEILIDIV((Ninfo_prime+24),(C<<3)))<<3;
} }
else else
harq->TBS = (CEILIDIV((Ninfo_prime+24),8) - 24)<<3; TBS = (CEILIDIV((Ninfo_prime+24),8) - 24)<<3;
} }
} }
LOG_I(MAC, "TBS %d : N_RE %d N_PRB_DMRS %d N_sh_symb %d N_PRB_oh %d Ninfo %d Ninfo_prime %d R %d Qm %d table %d scale %d\n", LOG_I(MAC, "TBS %d : N_RE %d N_PRB_DMRS %d N_sh_symb %d N_PRB_oh %d Ninfo %d Ninfo_prime %d R %d Qm %d table %d scale %d\n",
harq->TBS, N_RE, N_PRB_DMRS, N_sh_symb, N_PRB_oh, Ninfo, Ninfo_prime, R, Qm, table_idx, scale); TBS, N_RE, N_PRB_DMRS, N_sh_symb, N_PRB_oh, Ninfo, Ninfo_prime, R, Qm, table_idx, scale);
dlsch_rel15->coding_rate = R;
dlsch_rel15->modulation_order = Qm;
dlsch_rel15->transport_block_size = TBS;
dlsch_rel15->nb_re_dmrs = N_PRB_DMRS;
} }
uint32_t nr_get_G(uint16_t nb_rb, uint16_t nb_symb_sch,uint8_t nb_re_dmrs,uint16_t length_dmrs, uint8_t Qm, uint8_t Nl) { uint32_t nr_get_G(uint16_t nb_rb, uint16_t nb_symb_sch,uint8_t nb_re_dmrs,uint16_t length_dmrs, uint8_t Qm, uint8_t Nl) {
uint32_t G; uint32_t G;
G = ((12*nb_symb_sch)-(nb_re_dmrs*length_dmrs))*nb_rb*Qm*Nl; G = ((NR_NB_SC_PER_RB*nb_symb_sch)-(nb_re_dmrs*length_dmrs))*nb_rb*Qm*Nl;
return(G); return(G);
} }
...@@ -70,8 +70,6 @@ typedef struct { ...@@ -70,8 +70,6 @@ typedef struct {
typedef struct { typedef struct {
/// Nfapi DLSCH PDU /// Nfapi DLSCH PDU
nfapi_nr_dl_config_dlsch_pdu dlsch_pdu; nfapi_nr_dl_config_dlsch_pdu dlsch_pdu;
/// Transport block size
uint32_t TBS;
/// pointer to pdu from MAC interface (this is "a" in 36.212) /// pointer to pdu from MAC interface (this is "a" in 36.212)
uint8_t *pdu; uint8_t *pdu;
/// The payload + CRC size in bits, "B" from 36-212 /// The payload + CRC size in bits, "B" from 36-212
...@@ -86,34 +84,8 @@ typedef struct { ...@@ -86,34 +84,8 @@ typedef struct {
uint32_t subframe; uint32_t subframe;
/// Index of current HARQ round for this DLSCH /// Index of current HARQ round for this DLSCH
uint8_t round; uint8_t round;
/// Modulation order
uint8_t Qm;
/// MCS
uint8_t mcs;
/// Redundancy-version of the current sub-frame
uint8_t rvidx;
/// MIMO mode for this DLSCH /// MIMO mode for this DLSCH
MIMO_mode_t mimo_mode; MIMO_mode_t mimo_mode;
/// Current RB allocation
uint32_t rb_alloc[4];
/// distributed/localized flag
vrb_t vrb_type;
/// Current subband PMI allocation
uint16_t pmi_alloc;
/// Current subband RI allocation
uint32_t ri_alloc;
/// Current subband CQI1 allocation
uint32_t cqi_alloc1;
/// Current subband CQI2 allocation
uint32_t cqi_alloc2;
/// Current Number of RBs
uint16_t nb_rb;
/// Current NDI
uint8_t ndi;
/// downlink power offset field
uint8_t dl_power_off;
/// start symbold of pdsch
uint8_t pdsch_start;
/// Concatenated sequences /// Concatenated sequences
uint8_t e[MAX_NUM_NR_CHANNEL_BITS] __attribute__((aligned(32))); uint8_t e[MAX_NUM_NR_CHANNEL_BITS] __attribute__((aligned(32)));
/// LDPC-code outputs /// LDPC-code outputs
...@@ -126,15 +98,6 @@ typedef struct { ...@@ -126,15 +98,6 @@ typedef struct {
uint32_t K; uint32_t K;
/// Number of "Filler" bits /// Number of "Filler" bits
uint32_t F; uint32_t F;
/// Number of MIMO layers (streams)
uint8_t Nl;
/// Number of layers for this PDSCH transmission (TM8-10)
uint8_t Nlayers;
/// First layer for this PSCH transmission
uint8_t first_layer;
/// codeword this transport block is mapped to
uint8_t codeword;
/// Number of codewords
} NR_DL_gNB_HARQ_t; } NR_DL_gNB_HARQ_t;
......
...@@ -65,7 +65,7 @@ void handle_nfapi_nr_dci_dl_pdu(PHY_VARS_gNB *gNB, ...@@ -65,7 +65,7 @@ void handle_nfapi_nr_dci_dl_pdu(PHY_VARS_gNB *gNB,
LOG_D(PHY,"Frame %d, Subframe %d: DCI processing - populating pdcch_vars->dci_alloc[%d] proc:subframe_tx:%d idx:%d pdcch_vars->num_dci:%d\n",frame,subframe, pdcch_vars->num_dci, proc->subframe_tx, idx, pdcch_vars->num_dci); LOG_D(PHY,"Frame %d, Subframe %d: DCI processing - populating pdcch_vars->dci_alloc[%d] proc:subframe_tx:%d idx:%d pdcch_vars->num_dci:%d\n",frame,subframe, pdcch_vars->num_dci, proc->subframe_tx, idx, pdcch_vars->num_dci);
// copy dci configuration into gNB structure // copy dci configuration into gNB structure
nr_fill_dci_and_dlsch(gNB,frame,subframe,proc,&pdcch_vars->dci_alloc[pdcch_vars->num_dci],dl_config_pdu); nr_fill_dci_and_dlsch(gNB,frame,subframe,proc,&pdcch_vars->dci_alloc[pdcch_vars->num_dci],&dl_config_pdu->dci_dl_pdu, &dl_config_pdu->dlsch_pdu);
LOG_D(PHY,"Frame %d, Subframe %d: DCI processing - populated pdcch_vars->dci_alloc[%d] proc:subframe_tx:%d idx:%d pdcch_vars->num_dci:%d\n",proc->frame_tx,proc->subframe_tx, pdcch_vars->num_dci, proc->subframe_tx, idx, pdcch_vars->num_dci); LOG_D(PHY,"Frame %d, Subframe %d: DCI processing - populated pdcch_vars->dci_alloc[%d] proc:subframe_tx:%d idx:%d pdcch_vars->num_dci:%d\n",proc->frame_tx,proc->subframe_tx, pdcch_vars->num_dci, proc->subframe_tx, idx, pdcch_vars->num_dci);
} }
......
...@@ -49,6 +49,7 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, ...@@ -49,6 +49,7 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
nfapi_nr_dl_config_request_pdu_t *dl_config_pdu; nfapi_nr_dl_config_request_pdu_t *dl_config_pdu;
nfapi_tx_request_pdu_t *TX_req; nfapi_tx_request_pdu_t *TX_req;
uint16_t sfn_sf = frameP << 4 | subframeP; uint16_t sfn_sf = frameP << 4 | subframeP;
uint16_t rnti = 0x1234;
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
LOG_I(MAC, "Scheduling common search space DCI type 1 for CC_id %d\n",CC_id); LOG_I(MAC, "Scheduling common search space DCI type 1 for CC_id %d\n",CC_id);
...@@ -69,8 +70,9 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, ...@@ -69,8 +70,9 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
dlsch_pdu_rel15->start_prb = 0; dlsch_pdu_rel15->start_prb = 0;
dlsch_pdu_rel15->n_prb = 40; dlsch_pdu_rel15->n_prb = 40;
dlsch_pdu_rel15->S = 8; dlsch_pdu_rel15->start_symbol = 8;
dlsch_pdu_rel15->L = 6; dlsch_pdu_rel15->nb_symbols = 6;
dlsch_pdu_rel15->rnti = rnti;
nr_configure_css_dci_from_mib(&gNB->pdcch_type0_params, nr_configure_css_dci_from_mib(&gNB->pdcch_type0_params,
kHz30, kHz30, nr_FR1, 0, 0, kHz30, kHz30, nr_FR1, 0, 0,
...@@ -79,36 +81,31 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, ...@@ -79,36 +81,31 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
memcpy((void*)params_rel15, (void*)&gNB->pdcch_type0_params, sizeof(nfapi_nr_dl_config_pdcch_parameters_rel15_t)); memcpy((void*)params_rel15, (void*)&gNB->pdcch_type0_params, sizeof(nfapi_nr_dl_config_pdcch_parameters_rel15_t));
pdu_rel15->frequency_domain_assignment = get_RIV(dlsch_pdu_rel15->start_prb, dlsch_pdu_rel15->n_prb, cfg->rf_config.dl_carrier_bandwidth.value); pdu_rel15->frequency_domain_assignment = get_RIV(dlsch_pdu_rel15->start_prb, dlsch_pdu_rel15->n_prb, cfg->rf_config.dl_carrier_bandwidth.value);
pdu_rel15->time_domain_assignment = get_SLIV(dlsch_pdu_rel15->S, dlsch_pdu_rel15->L); pdu_rel15->time_domain_assignment = get_SLIV(dlsch_pdu_rel15->start_symbol, dlsch_pdu_rel15->nb_symbols);
pdu_rel15->vrb_to_prb_mapping = 1; pdu_rel15->vrb_to_prb_mapping = 1;
pdu_rel15->mcs = 12; pdu_rel15->mcs = 12;
pdu_rel15->tb_scaling = 1; pdu_rel15->tb_scaling = 1;
pdu_rel15->ra_preamble_index = 25; pdu_rel15->ra_preamble_index = 25;
pdu_rel15->format_indicator = 1; pdu_rel15->format_indicator = 1;
pdu_rel15->ul_sul_indicator = 1;
pdu_rel15->ss_pbch_index = 21;
pdu_rel15->prach_mask_index = 3;
pdu_rel15->ndi = 1; pdu_rel15->ndi = 1;
pdu_rel15->rv = 2; pdu_rel15->rv = 0;
pdu_rel15->harq_pid = 7; pdu_rel15->harq_pid = 0;
pdu_rel15->dai = 2; pdu_rel15->dai = 2;
pdu_rel15->tpc = 2; pdu_rel15->tpc = 2;
pdu_rel15->pucch_resource_indicator = 7; pdu_rel15->pucch_resource_indicator = 7;
pdu_rel15->pdsch_to_harq_feedback_timing_indicator = 7; pdu_rel15->pdsch_to_harq_feedback_timing_indicator = 7;
LOG_I(MAC, "[gNB scheduler phytest] DCI type 1 payload: freq_alloc %d, time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d ndi %d rv %d\n",
pdu_rel15->tb_scaling = 1;
LOG_I(MAC, "[gNB scheduler phytest] DCI type 1 payload: freq_alloc %d, time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d\n",
pdu_rel15->frequency_domain_assignment, pdu_rel15->frequency_domain_assignment,
pdu_rel15->time_domain_assignment, pdu_rel15->time_domain_assignment,
pdu_rel15->vrb_to_prb_mapping, pdu_rel15->vrb_to_prb_mapping,
pdu_rel15->mcs, pdu_rel15->mcs,
pdu_rel15->tb_scaling); pdu_rel15->tb_scaling,
pdu_rel15->ndi,
pdu_rel15->rv);
params_rel15->rnti = 0x03; params_rel15->rnti = rnti;
params_rel15->rnti_type = NFAPI_NR_RNTI_C; params_rel15->rnti_type = NFAPI_NR_RNTI_C;
params_rel15->dci_format = NFAPI_NR_DL_DCI_FORMAT_1_0; params_rel15->dci_format = NFAPI_NR_DL_DCI_FORMAT_1_0;
//params_rel15->aggregation_level = 1; //params_rel15->aggregation_level = 1;
...@@ -129,7 +126,8 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, ...@@ -129,7 +126,8 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
params_rel15->sfn_mod2, params_rel15->sfn_mod2,
params_rel15->first_slot); params_rel15->first_slot);
dl_req->number_dci++; dl_req->number_dci++;
dl_req->number_pdu++; dl_req->number_pdsch_rnti++;
dl_req->number_pdu+=2;
TX_req = &nr_mac->TX_req[CC_id].tx_request_body.tx_pdu_list[nr_mac->TX_req[CC_id].tx_request_body.number_of_pdus]; TX_req = &nr_mac->TX_req[CC_id].tx_request_body.tx_pdu_list[nr_mac->TX_req[CC_id].tx_request_body.number_of_pdus];
TX_req->pdu_length = 6; TX_req->pdu_length = 6;
......
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