Commit 3a072ba3 authored by Guy De Souza's avatar Guy De Souza

Number of mod symbols addition in fapi

parent 065b24e5
......@@ -508,7 +508,7 @@ typedef struct{
typedef struct {
nfapi_tl_t tl;
uint8_t rnti;
uint16_t rnti;
uint8_t rnti_type;
uint8_t dci_format;
uint8_t config_type;
......@@ -550,6 +550,7 @@ typedef struct {
uint16_t length;
uint8_t pdu_index;
uint16_t rnti;
uint16_t nb_mod_symbols;
uint8_t time_allocation_type;
uint8_t freq_allocation_type;
uint8_t start_prb;
......
......@@ -197,10 +197,11 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch,
uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5];
int16_t **mod_symbs = (int16_t**)dlsch.mod_symbs;
int16_t **tx_layers = (int16_t**)dlsch.txdataF;
uint16_t n_symbs;
int8_t Wf[2], Wt[2], l0, l_prime, delta;
int8_t Wf[2], Wt[2], l0, l_prime[2], delta;
uint16_t TBS = rel15->transport_block_size;
uint16_t nb_symbols = rel15->nb_mod_symbols;
uint8_t Qm = rel15->modulation_order;
uint16_t encoded_length = nb_symbols*Qm;
/// CRC, coding, interleaving and rate matching
nr_dlsch_encoding(harq->pdu, subframe, &dlsch, &frame_parms);
......@@ -212,7 +213,7 @@ for (int i=0; i<MAX_NR_DLSCH_PAYLOAD_BYTES>>4; i++) {
printf("\n");
}
printf("\nEncoded payload:\n");
for (int i=0; i<TBS>>4; i++) {
for (int i=0; i<encoded_length>>4; i++) {
for (int j=0; j<16; j++)
printf("0x%02x\t", harq->f[(i<<4)+j]);
printf("\n");
......@@ -226,14 +227,14 @@ for (int i=0; i<TBS>>4; i++) {
pdcch_params.scrambling_id : config.sch_config.physical_cell_id.value;
for (int q=0; q<rel15->nb_codewords; q++)
nr_pdsch_codeword_scrambling(harq->f,
TBS,
encoded_length,
q,
Nid,
n_RNTI,
scrambled_output[q]);
#ifdef DEBUG_DLSCH
printf("PDSCH scrambling:\n");
for (int i=0; i<TBS>>7; i++) {
for (int i=0; i<encoded_length>>7; i++) {
for (int j=0; j<8; j++)
printf("0x%08x\t", scrambled_output[0][(i<<3)+j]);
printf("\n");
......@@ -241,15 +242,14 @@ for (int i=0; i<TBS>>7; i++) {
#endif
/// Modulation
n_symbs = TBS/Qm;
for (int q=0; q<rel15->nb_codewords; q++)
nr_pdsch_codeword_modulation(scrambled_output[q],
Qm,
TBS,
encoded_length,
mod_symbs[q]);
#ifdef DEBUG_DLSCH
printf("PDSCH Modulation: Qm %d(%d)\n", Qm, n_symbs);
for (int i=0; i<n_symbs>>3; i++) {
for (int i=0; i<nb_symbols>>3; i++) {
for (int j=0; j<8; j++) {
printf("%d %d\t", mod_symbs[0][((i<<3)+j)<<1], mod_symbs[0][(((i<<3)+j)<<1)+1]);
}
......@@ -261,12 +261,12 @@ for (int i=0; i<n_symbs>>3; i++) {
/// Layer mapping
nr_pdsch_layer_mapping(mod_symbs,
rel15->nb_layers,
n_symbs,
nb_symbols,
tx_layers);
#ifdef DEBUG_DLSCH
printf("Layer mapping (%d layers):\n", rel15->nb_layers);
for (int l=0; l<rel15->nb_layers; l++)
for (int i=0; i<n_symbs>>3; i++) {
for (int i=0; i<(nb_symbs/rel15->nb_layers)>>3; i++) {
for (int j=0; j<8; j++) {
printf("%d %d\t", tx_layers[l][((i<<3)+j)<<1], tx_layers[l][(((i<<3)+j)<<1)+1]);
}
......@@ -308,6 +308,7 @@ for (int i=0; i<n_dmrs>>3; i++) {
get_Wt(Wt, ap, dmrs_type);
get_Wf(Wf, ap, dmrs_type);
delta = get_delta(ap, dmrs_type);
l_prime[0] = 0; // single symbol ap 0
#ifdef DEBUG_DLSCH_MAPPING
printf("DMRS params for ap %d: Wt %d %d \t Wf %d %d\n", ap, Wt[0], Wt[1], Wf[0], Wf[1]);
#endif
......@@ -319,9 +320,9 @@ printf("DMRS params for ap %d: Wt %d %d \t Wf %d %d\n", ap, Wt[0], Wt[1], Wf[0],
if (k >= frame_parms.ofdm_symbol_size)
k -= frame_parms.ofdm_symbol_size;
if ((l==l0) && (k == ((dmrs_type)? (6*n+k_prime+delta):((n<<2)+(k_prime<<1)+delta)))) {
((int16_t*)txdataF[ap])[(l*frame_parms.ofdm_symbol_size + k)<<1] = (Wt[k_prime]*Wf[k_prime]*amp/2*mod_dmrs[dmrs_idx<<1]) >> 15;
((int16_t*)txdataF[ap])[((l*frame_parms.ofdm_symbol_size + k)<<1) + 1] = (Wt[k_prime]*Wf[k_prime]*amp/2*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15;
if ((l==(l0+l_prime[0])) && (k == ((dmrs_type)? (6*n+k_prime+delta):((n<<2)+(k_prime<<1)+delta)))) {
((int16_t*)txdataF[ap])[(l*frame_parms.ofdm_symbol_size + k)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*amp/2*mod_dmrs[dmrs_idx<<1]) >> 15;
((int16_t*)txdataF[ap])[((l*frame_parms.ofdm_symbol_size + k)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*amp/2*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15;
#ifdef DEBUG_DLSCH_MAPPING
printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t txdataF: %d %d\n",
dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[(l*frame_parms.ofdm_symbol_size + k)<<1], ((int16_t*)txdataF[ap])[((l*frame_parms.ofdm_symbol_size + k)<<1) + 1]);
......
......@@ -107,6 +107,8 @@ void nr_get_tbs(nfapi_nr_dl_config_dlsch_pdu *dlsch_pdu,
nfapi_nr_dl_config_dci_dl_pdu dci_pdu,
nfapi_nr_config_request_t config) {
LOG_I(MAC, "TBS calculation\n");
nfapi_nr_dl_config_pdcch_parameters_rel15_t params_rel15 = dci_pdu.pdcch_params_rel15;
nfapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_rel15 = &dlsch_pdu->dlsch_pdu_rel15;
uint8_t rnti_type = params_rel15.rnti_type;
......@@ -125,7 +127,7 @@ void nr_get_tbs(nfapi_nr_dl_config_dlsch_pdu *dlsch_pdu,
uint8_t table_idx, Qm, n, scale;
table_idx = get_table_idx(mcs_table, dci_format, rnti_type, ss_type);
scale = 10 + (((table_idx==2)&&((Imcs==20)||(Imcs==26)))?1:0);
scale = ((table_idx==2)&&((Imcs==20)||(Imcs==26)))?11:10;
N_RE = min(156, N_RE_prime)*dlsch_rel15->n_prb;
R = nr_get_code_rate(Imcs, table_idx);
......@@ -165,6 +167,7 @@ void nr_get_tbs(nfapi_nr_dl_config_dlsch_pdu *dlsch_pdu,
dlsch_rel15->modulation_order = Qm;
dlsch_rel15->transport_block_size = TBS;
dlsch_rel15->nb_re_dmrs = N_PRB_DMRS;
dlsch_rel15->nb_mod_symbols = N_RE_prime*dlsch_rel15->n_prb*dlsch_rel15->nb_codewords;
}
......
......@@ -76,8 +76,8 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
dlsch_pdu_rel15->start_prb = 0;
dlsch_pdu_rel15->n_prb = 106;
dlsch_pdu_rel15->start_symbol = 8;
dlsch_pdu_rel15->nb_symbols = 6;
dlsch_pdu_rel15->start_symbol = 2;
dlsch_pdu_rel15->nb_symbols = 8;
dlsch_pdu_rel15->rnti = rnti;
dlsch_pdu_rel15->nb_layers =1;
dlsch_pdu_rel15->nb_codewords = 1;
......
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