Commit b6513faa authored by rmagueta's avatar rmagueta

Fix PRACH msg1-FrequencyStart/k1

parent e82915c4
...@@ -171,9 +171,6 @@ void rx_nr_prach_ru(RU_t *ru, ...@@ -171,9 +171,6 @@ void rx_nr_prach_ru(RU_t *ru,
int16_t *prach[ru->nb_rx]; int16_t *prach[ru->nb_rx];
int prach_sequence_length = ru->config.prach_config.prach_sequence_length.value; int prach_sequence_length = ru->config.prach_config.prach_sequence_length.value;
int msg1_frequencystart = ru->config.prach_config.num_prach_fd_occasions_list[numRA].k1.value;
int sample_offset_slot = (prachStartSymbol==0?0:fp->ofdm_symbol_size*prachStartSymbol+fp->nb_prefix_samples0+fp->nb_prefix_samples*(prachStartSymbol-1)); int sample_offset_slot = (prachStartSymbol==0?0:fp->ofdm_symbol_size*prachStartSymbol+fp->nb_prefix_samples0+fp->nb_prefix_samples*(prachStartSymbol-1));
//to be checked for mu=0; //to be checked for mu=0;
...@@ -195,8 +192,7 @@ void rx_nr_prach_ru(RU_t *ru, ...@@ -195,8 +192,7 @@ void rx_nr_prach_ru(RU_t *ru,
int16_t *prach2; int16_t *prach2;
if (prach_sequence_length == 0) { if (prach_sequence_length == 0) {
LOG_D(PHY,"PRACH (ru %d) in %d.%d, format %d, msg1_frequencyStart %d\n", LOG_D(PHY,"PRACH (ru %d) in %d.%d, format %d\n", ru->idx,frame,slot2,prachFormat);
ru->idx,frame,slot2,prachFormat,msg1_frequencystart);
AssertFatal(prachFormat<4,"Illegal prach format %d for length 839\n",prachFormat); AssertFatal(prachFormat<4,"Illegal prach format %d for length 839\n",prachFormat);
switch (prachFormat) { switch (prachFormat) {
case 0: case 0:
...@@ -218,8 +214,8 @@ void rx_nr_prach_ru(RU_t *ru, ...@@ -218,8 +214,8 @@ void rx_nr_prach_ru(RU_t *ru,
} }
} }
else { else {
LOG_D(PHY,"PRACH (ru %d) in %d.%d, format %s, msg1_frequencyStart %d,startSymbol %d\n", LOG_D(PHY,"PRACH (ru %d) in %d.%d, format %s,startSymbol %d\n",
ru->idx,frame,slot,prachfmt[prachFormat],msg1_frequencystart,prachStartSymbol); ru->idx,frame,slot,prachfmt[prachFormat],prachStartSymbol);
switch (prachFormat) { switch (prachFormat) {
case 4: //A1 case 4: //A1
...@@ -284,15 +280,15 @@ void rx_nr_prach_ru(RU_t *ru, ...@@ -284,15 +280,15 @@ void rx_nr_prach_ru(RU_t *ru,
K=1; K=1;
kbar=2; kbar=2;
} }
int n_ra_prb = msg1_frequencystart;
int k = (12*n_ra_prb) - 6*fp->N_RB_UL; int k1 = (int16_t)ru->config.prach_config.num_prach_fd_occasions_list[numRA].k1.value;
int N_ZC = (prach_sequence_length==0)?839:139; int N_ZC = (prach_sequence_length==0)?839:139;
if (k<0) k+=(fp->ofdm_symbol_size); if (k1<0) k1+=(fp->ofdm_symbol_size);
k*=K; k1*=K;
k+=kbar; k1+=kbar;
int reps=1; int reps=1;
...@@ -653,7 +649,7 @@ void rx_nr_prach_ru(RU_t *ru, ...@@ -653,7 +649,7 @@ void rx_nr_prach_ru(RU_t *ru,
int16_t rxsigF_tmp[N_ZC<<1]; int16_t rxsigF_tmp[N_ZC<<1];
// if (k+N_ZC > dftlen) { // PRACH signal is split around DC // if (k+N_ZC > dftlen) { // PRACH signal is split around DC
int16_t *rxsigF2=rxsigF[aa]; int16_t *rxsigF2=rxsigF[aa];
int k2=k<<1; int k2=k1<<1;
for (int j=0;j<N_ZC<<1;j++,k2++) { for (int j=0;j<N_ZC<<1;j++,k2++) {
if (k2==(dftlen<<1)) k2=0; if (k2==(dftlen<<1)) k2=0;
...@@ -685,7 +681,6 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -685,7 +681,6 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
uint16_t rootSequenceIndex; uint16_t rootSequenceIndex;
int numrootSequenceIndex; int numrootSequenceIndex;
uint8_t restricted_set; uint8_t restricted_set;
uint8_t n_ra_prb=0xFF;
int16_t *prachF=NULL; int16_t *prachF=NULL;
int nb_rx; int nb_rx;
...@@ -720,7 +715,6 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -720,7 +715,6 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
numrootSequenceIndex = cfg->num_prach_fd_occasions_list[prach_pdu->num_ra].num_root_sequences.value; numrootSequenceIndex = cfg->num_prach_fd_occasions_list[prach_pdu->num_ra].num_root_sequences.value;
NCS = prach_pdu->num_cs;//cfg->num_prach_fd_occasions_list[0].prach_zero_corr_conf.value; NCS = prach_pdu->num_cs;//cfg->num_prach_fd_occasions_list[0].prach_zero_corr_conf.value;
int prach_sequence_length = cfg->prach_sequence_length.value; int prach_sequence_length = cfg->prach_sequence_length.value;
int msg1_frequencystart = cfg->num_prach_fd_occasions_list[prach_pdu->num_ra].k1.value;
// int num_unused_root_sequences = cfg->num_prach_fd_occasions_list[0].num_unused_root_sequences.value; // int num_unused_root_sequences = cfg->num_prach_fd_occasions_list[0].num_unused_root_sequences.value;
// cfg->num_prach_fd_occasions_list[0].unused_root_sequences_list // cfg->num_prach_fd_occasions_list[0].unused_root_sequences_list
...@@ -734,7 +728,8 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -734,7 +728,8 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
prach_ifft = gNB->prach_vars.prach_ifft; prach_ifft = gNB->prach_vars.prach_ifft;
prachF = gNB->prach_vars.prachF; prachF = gNB->prach_vars.prachF;
if (LOG_DEBUGFLAG(PRACH)){ if (LOG_DEBUGFLAG(PRACH)){
if ((frame&1023) < 20) LOG_D(PHY,"PRACH (gNB) : running rx_prach for subframe %d, msg1_frequencystart %d, rootSequenceIndex %d\n", subframe,msg1_frequencystart,rootSequenceIndex); if ((frame&1023) < 20) LOG_D(PHY,"PRACH (gNB) : running rx_prach for subframe %d, rootSequenceIndex %d\n",
subframe, rootSequenceIndex);
} }
start_meas(&gNB->rx_prach); start_meas(&gNB->rx_prach);
...@@ -936,14 +931,13 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -936,14 +931,13 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
if (LOG_DUMPFLAG(PRACH)) { if (LOG_DUMPFLAG(PRACH)) {
//int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840)); //int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
// if (en>60) { // if (en>60) {
int k = (12*n_ra_prb) - 6*fp->N_RB_UL; int k1 = (int16_t)cfg->num_prach_fd_occasions_list[prach_pdu->num_ra].k1.value;
if (k<0) k+=fp->ofdm_symbol_size;
k*=12; if (k1<0) k1+=fp->ofdm_symbol_size;
k+=13;
k*=2;
k1*=12;
k1+=13;
k1*=2;
LOG_M("rxsigF.m","prach_rxF",&rxsigF[0][0],12288,1,1); LOG_M("rxsigF.m","prach_rxF",&rxsigF[0][0],12288,1,1);
LOG_M("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1); LOG_M("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
......
...@@ -71,7 +71,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ ...@@ -71,7 +71,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
int16_t Ncp = 0, amp, *prach, *prach2, *prachF, *Xu; int16_t Ncp = 0, amp, *prach, *prach2, *prachF, *Xu;
int32_t Xu_re, Xu_im; int32_t Xu_re, Xu_im;
int prach_start, prach_sequence_length, i, prach_len, dftlen, mu, kbar, K, n_ra_prb, k, prachStartSymbol, sample_offset_slot; int prach_start, prach_sequence_length, i, prach_len, dftlen, mu, kbar, K, k1, prachStartSymbol, sample_offset_slot;
//int restricted_Type; //int restricted_Type;
prach = prach_tmp; prach = prach_tmp;
...@@ -83,7 +83,6 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ ...@@ -83,7 +83,6 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
mu = nrUE_config->prach_config.prach_sub_c_spacing; mu = nrUE_config->prach_config.prach_sub_c_spacing;
restricted_set = prach_pdu->restricted_set; restricted_set = prach_pdu->restricted_set;
rootSequenceIndex = prach_pdu->root_seq_id; rootSequenceIndex = prach_pdu->root_seq_id;
n_ra_prb = prach_pdu->freq_msg1;
NCS = prach_pdu->num_cs; NCS = prach_pdu->num_cs;
prach_fmt_id = prach_pdu->prach_format; prach_fmt_id = prach_pdu->prach_format;
preamble_index = prach_resources->ra_PreambleIndex; preamble_index = prach_resources->ra_PreambleIndex;
...@@ -93,7 +92,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ ...@@ -93,7 +92,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
first_nonzero_root_idx = 0; first_nonzero_root_idx = 0;
kbar = 1; kbar = 1;
K = 24; K = 24;
k = 12*n_ra_prb - 6*fp->N_RB_UL; k1 = (int16_t)prach_pdu->freq_msg1;
prachStartSymbol = prach_pdu->prach_start_symbol; prachStartSymbol = prach_pdu->prach_start_symbol;
//restricted_Type = 0; //restricted_Type = 0;
...@@ -185,7 +184,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ ...@@ -185,7 +184,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
// now generate PRACH signal // now generate PRACH signal
#ifdef NR_PRACH_DEBUG #ifdef NR_PRACH_DEBUG
if (NCS>0) if (NCS>0)
LOG_I(PHY, "PRACH [UE %d] generate PRACH in slot %d for RootSeqIndex %d, Preamble Index %d, PRACH Format %s, NCS %d (N_ZC %d): Preamble_offset %d, Preamble_shift %d msg1 frequency start %d\n", LOG_I(PHY, "PRACH [UE %d] generate PRACH in slot %d for RootSeqIndex %d, Preamble Index %d, PRACH Format %s, NCS %d (N_ZC %d): Preamble_offset %d, Preamble_shift %dn",
Mod_id, Mod_id,
slot, slot,
rootSequenceIndex, rootSequenceIndex,
...@@ -194,8 +193,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ ...@@ -194,8 +193,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
NCS, NCS,
N_ZC, N_ZC,
preamble_offset, preamble_offset,
preamble_shift, preamble_shift);
n_ra_prb);
#endif #endif
// nsymb = (frame_parms->Ncp==0) ? 14:12; // nsymb = (frame_parms->Ncp==0) ? 14:12;
...@@ -209,17 +207,16 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ ...@@ -209,17 +207,16 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
kbar = 2; kbar = 2;
} }
if (k<0) if (k1<0)
k += fp->ofdm_symbol_size; k1 += fp->ofdm_symbol_size;
k *= K; k1 *= K;
k += kbar; k1 += kbar;
k *= 2; k1 *= 2;
LOG_I(PHY, "PRACH [UE %d] in slot %d, placing PRACH in position %d, msg1 frequency start %d, preamble_offset %d, first_nonzero_root_idx %d\n", Mod_id, LOG_I(PHY, "PRACH [UE %d] in slot %d, placing PRACH in position %d, preamble_offset %d, first_nonzero_root_idx %d\n", Mod_id,
slot, slot,
k, k1,
n_ra_prb,
preamble_offset, preamble_offset,
first_nonzero_root_idx); first_nonzero_root_idx);
...@@ -344,10 +341,10 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ ...@@ -344,10 +341,10 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
Xu_re = (((int32_t)Xu[offset<<1]*amp)>>15); Xu_re = (((int32_t)Xu[offset<<1]*amp)>>15);
Xu_im = (((int32_t)Xu[1+(offset<<1)]*amp)>>15); Xu_im = (((int32_t)Xu[1+(offset<<1)]*amp)>>15);
prachF[k++]= ((Xu_re*nr_ru[offset2<<1]) - (Xu_im*nr_ru[1+(offset2<<1)]))>>15; prachF[k1++]= ((Xu_re*nr_ru[offset2<<1]) - (Xu_im*nr_ru[1+(offset2<<1)]))>>15;
prachF[k++]= ((Xu_im*nr_ru[offset2<<1]) + (Xu_re*nr_ru[1+(offset2<<1)]))>>15; prachF[k1++]= ((Xu_im*nr_ru[offset2<<1]) + (Xu_re*nr_ru[1+(offset2<<1)]))>>15;
if (k==dftlen) k=0; if (k1==dftlen) k1=0;
} }
#if defined (PRACH_WRITE_OUTPUT_DEBUG) #if defined (PRACH_WRITE_OUTPUT_DEBUG)
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
*/ */
//#include "mac_defs.h" //#include "mac_defs.h"
#include <NR_MAC_gNB/mac_proto.h>
#include "NR_MAC_UE/mac_proto.h" #include "NR_MAC_UE/mac_proto.h"
#include "NR_MAC-CellGroupConfig.h" #include "NR_MAC-CellGroupConfig.h"
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h" #include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
...@@ -309,8 +310,11 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, ...@@ -309,8 +310,11 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139; cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139;
else else
cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839; cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839;
cfg->prach_config.num_prach_fd_occasions_list[i].k1 =
cfg->prach_config.num_prach_fd_occasions_list[i].k1 = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart; (NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) +
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart +
(get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i))*12 -
6*scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig; cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig;
cfg->prach_config.num_prach_fd_occasions_list[i].num_root_sequences = compute_nr_root_seq(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup, nb_preambles, mac->frame_type, frequency_range); cfg->prach_config.num_prach_fd_occasions_list[i].num_root_sequences = compute_nr_root_seq(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup, nb_preambles, mac->frame_type, frequency_range);
//cfg->prach_config.num_prach_fd_occasions_list[i].num_unused_root_sequences = ??? //cfg->prach_config.num_prach_fd_occasions_list[i].num_unused_root_sequences = ???
......
...@@ -208,8 +208,11 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm ...@@ -208,8 +208,11 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm
cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839; cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839;
cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.tl.tag = NFAPI_NR_CONFIG_PRACH_ROOT_SEQUENCE_INDEX_TAG; cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.tl.tag = NFAPI_NR_CONFIG_PRACH_ROOT_SEQUENCE_INDEX_TAG;
cfg->num_tlv++; cfg->num_tlv++;
cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB( cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); cfg->prach_config.num_prach_fd_occasions_list[i].k1.value =
//k1= msg1_FrequencyStart + 12 (no. of FDM)(RB for PRACH occasion); (NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) +
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart +
(get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i))*12 -
6*scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
cfg->prach_config.num_prach_fd_occasions_list[i].k1.tl.tag = NFAPI_NR_CONFIG_K1_TAG; cfg->prach_config.num_prach_fd_occasions_list[i].k1.tl.tag = NFAPI_NR_CONFIG_K1_TAG;
cfg->num_tlv++; cfg->num_tlv++;
cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig; cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig;
......
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