Commit 98a41e83 authored by Guy De Souza's avatar Guy De Souza

PBCH DMRS updated mapping

parent 56785bde
...@@ -19,13 +19,13 @@ ...@@ -19,13 +19,13 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
/*! \file PHY/LTE_TRANSPORT/pbch.c /*! \file PHY/NR_TRANSPORT/nr_pbch.c
* \brief Top-level routines for generating and decoding the PBCH/BCH physical/transport channel V8.6 2009-03 * \brief Top-level routines for generating and decoding the PBCH/BCH physical/transport channel V15.1 03/2018
* \author R. Knopp, F. Kaltenberger * \author G. De Souza
* \date 2011 * \date 2018
* \version 0.1 * \version 0.1
* \company Eurecom * \company Eurecom
* \email: knopp@eurecom.fr,florian.kaltenberger.fr * \email: desouza@eurecom.fr
* \note * \note
* \warning * \warning
*/ */
...@@ -45,6 +45,7 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs, ...@@ -45,6 +45,7 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
int32_t **txdataF, int32_t **txdataF,
int16_t amp, int16_t amp,
uint8_t ssb_start_symbol, uint8_t ssb_start_symbol,
uint8_t nu,
nfapi_config_request_t* config, nfapi_config_request_t* config,
NR_DL_FRAME_PARMS *frame_parms) NR_DL_FRAME_PARMS *frame_parms)
{ {
...@@ -55,10 +56,10 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs, ...@@ -55,10 +56,10 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
/// BPSK modulation /// BPSK modulation
for (m=0; m<NR_PBCH_DMRS_LENGTH; m++) { for (m=0; m<NR_PBCH_DMRS_LENGTH; m++) {
mod_dmrs[2*m] = nr_mod_table[2*(1 + (*(gold_pbch_dmrs + m/32))&(1<<(m&0xf)) )]; mod_dmrs[2*m] = nr_mod_table[2*(1 + ((gold_pbch_dmrs[m>>5])&(1<<(m&0x1f))) )];
mod_dmrs[2*m + 1] = nr_mod_table[2*(1 + (*(gold_pbch_dmrs + m/32))&(1<<(m&0xf)) ) + 1]; mod_dmrs[2*m + 1] = nr_mod_table[2*(1 + ((gold_pbch_dmrs[m>>5])&(1<<(m&0x1f))) ) + 1];
#ifdef DEBUG_PBCH #ifdef DEBUG_PBCH
printf("m %d mod_dmrs %d %d", m, mod_dmrs[2*m], mod_dmrs[2*m + 1]); printf("m %d mod_dmrs %d %d\n", m, mod_dmrs[2*m], mod_dmrs[2*m + 1]);
#endif #endif
} }
...@@ -68,22 +69,60 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs, ...@@ -68,22 +69,60 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
for (aa = 0; aa < config->rf_config.tx_antenna_ports.value; aa++) for (aa = 0; aa < config->rf_config.tx_antenna_ports.value; aa++)
{ {
// PBCH DMRS are mapped // PBCH DMRS are mapped within the SSB block on every fourth subcarrier starting from nu of symbols 1, 2, 3
k = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier + 56; //and ///symbol 1 [0+nu:4:236+nu] -- 60 mod symbols
k = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier + nu;
l = ssb_start_symbol + 1; l = ssb_start_symbol + 1;
for (m = 0; m < NR_PBCH_DMRS_LENGTH; m++) { for (m = 0; m < 60; m++) {
#ifdef DEBUG_PBCH
LOG_I(PHY,"Mapping modulated symbol %d at k %d of OFDM symbol %d\n", m, k, l);
#endif
((int16_t*)txdataF[aa])[2*(l*frame_parms->ofdm_symbol_size + k)] = (a * mod_dmrs[2*m]) >> 15; ((int16_t*)txdataF[aa])[2*(l*frame_parms->ofdm_symbol_size + k)] = (a * mod_dmrs[2*m]) >> 15;
((int16_t*)txdataF[aa])[2*(l*frame_parms->ofdm_symbol_size + k) + 1] = (a * mod_dmrs[2*m + 1]) >> 15; ((int16_t*)txdataF[aa])[2*(l*frame_parms->ofdm_symbol_size + k) + 1] = (a * mod_dmrs[2*m + 1]) >> 15;
k+=4;
if (k >= frame_parms->ofdm_symbol_size)
k-=frame_parms->ofdm_symbol_size;
}
///symbol 2 [0+u:4:44+nu ; 192+nu:4:236+nu] -- 24 mod symbols
k = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier + nu;
l++;
for (m = 60; m < 84; m++) {
#ifdef DEBUG_PBCH #ifdef DEBUG_PBCH
int idx = 2*(l*frame_parms->ofdm_symbol_size + k); LOG_I(PHY,"Mapping modulated symbol %d at k %d of OFDM symbol %d\n", m, k, l);
printf("aa %d m %d txdataF %d %d %d", aa, m, txdataF[aa][idx], txdataF[aa][idx+1]);
#endif #endif
k++; ((int16_t*)txdataF[aa])[2*(l*frame_parms->ofdm_symbol_size + k)] = (a * mod_dmrs[2*m]) >> 15;
((int16_t*)txdataF[aa])[2*(l*frame_parms->ofdm_symbol_size + k) + 1] = (a * mod_dmrs[2*m + 1]) >> 15;
k+=(m==71)?148:4; // Jump from 44+nu to 192+nu
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;
} }
///symbol 3 [0+nu:4:236+nu] -- 60 mod symbols
k = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier + nu;
l++;
for (m = 84; m < NR_PBCH_DMRS_LENGTH; m++) {
#ifdef DEBUG_PBCH
LOG_I(PHY,"Mapping modulated symbol %d at k %d of OFDM symbol %d\n", m, k, l);
#endif
((int16_t*)txdataF[aa])[2*(l*frame_parms->ofdm_symbol_size + k)] = (a * mod_dmrs[2*m]) >> 15;
((int16_t*)txdataF[aa])[2*(l*frame_parms->ofdm_symbol_size + k) + 1] = (a * mod_dmrs[2*m + 1]) >> 15;
k+=4;
if (k >= frame_parms->ofdm_symbol_size)
k-=frame_parms->ofdm_symbol_size;
}
} }
#ifdef DEBUG_PBCH
write_output("pbch_dmrsF.m", "pbch_dmrsF", txdataF[0][2*(ssb_start_symbol+1)*frame_parms->ofdm_symbol_size], 3*frame_parms->ofdm_symbol_size, 1, 1);
#endif
return (0); return (0);
} }
...@@ -120,11 +120,14 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int subframe) { ...@@ -120,11 +120,14 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int subframe) {
int **txdataF = gNB->common_vars.txdataF; int **txdataF = gNB->common_vars.txdataF;
uint8_t *pbch_pdu=&gNB->pbch_pdu[0]; uint8_t *pbch_pdu=&gNB->pbch_pdu[0];
int ss_subframe = (cfg->sch_config.half_frame_index.value)? 5 : 0; int ss_subframe = (cfg->sch_config.half_frame_index.value)? 5 : 0;
uint8_t Lmax, nu, ssb_index=0, n_hf=0;
LOG_D(PHY,"common_signal_procedures: frame %d, subframe %d\n",frame,subframe); LOG_D(PHY,"common_signal_procedures: frame %d, subframe %d\n",frame,subframe);
int ssb_start_symbol = nr_get_ssb_start_symbol(cfg, fp); int ssb_start_symbol = nr_get_ssb_start_symbol(cfg, fp);
nr_set_ssb_first_subcarrier(cfg, fp); nr_set_ssb_first_subcarrier(cfg, fp);
Lmax = (fp->dl_CarrierFreq < 3e9)? 4:8;
nu = (Lmax < 8)? ssb_index&3 : ssb_index&7;
if (subframe == ss_subframe) if (subframe == ss_subframe)
...@@ -133,7 +136,7 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int subframe) { ...@@ -133,7 +136,7 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int subframe) {
LOG_I(PHY,"SS TX: frame %d, subframe %d, start_symbol %d\n",frame,subframe, ssb_start_symbol); LOG_I(PHY,"SS TX: frame %d, subframe %d, start_symbol %d\n",frame,subframe, ssb_start_symbol);
nr_generate_pss(gNB->d_pss, txdataF, AMP, ssb_start_symbol, cfg, fp); nr_generate_pss(gNB->d_pss, txdataF, AMP, ssb_start_symbol, cfg, fp);
nr_generate_sss(gNB->d_sss, txdataF, AMP_OVER_2, ssb_start_symbol, cfg, fp); nr_generate_sss(gNB->d_sss, txdataF, AMP_OVER_2, ssb_start_symbol, cfg, fp);
nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[0][0],txdataF, AMP_OVER_2, ssb_start_symbol, cfg, fp); nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index],txdataF, AMP_OVER_2, ssb_start_symbol, nu, cfg, fp);
} }
} }
......
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