Commit 221973bf authored by Florian Kaltenberger's avatar Florian Kaltenberger

PRACH duration to be calculated based on PRACH format.

PRACH_PDU.prach_format now interpreted according to last version (March 2020) of 5G FAPI specs
fixing nr_prachsim
parent 5bb1893f
...@@ -1584,10 +1584,10 @@ void *ru_thread( void *param ) { ...@@ -1584,10 +1584,10 @@ void *ru_thread( void *param ) {
// Do PRACH RU processing // Do PRACH RU processing
int prach_id=find_nr_prach_ru(ru,proc->frame_rx,proc->tti_rx,SEARCH_EXIST); int prach_id=find_nr_prach_ru(ru,proc->frame_rx,proc->tti_rx,SEARCH_EXIST);
int prachStartSymbol; uint8_t prachStartSymbol,N_dur;
uint16_t format,RA_sfn_index;
uint8_t start_symbol,N_t_slot,N_dur,N_RA_slot,config_period;
if (prach_id>=0) { if (prach_id>=0) {
N_dur = get_nr_prach_duration(ru->prach_list[prach_id].fmt);
/*
get_nr_prach_info_from_index(ru->config.prach_config.prach_ConfigurationIndex.value, get_nr_prach_info_from_index(ru->config.prach_config.prach_ConfigurationIndex.value,
proc->frame_rx,proc->tti_rx, proc->frame_rx,proc->tti_rx,
ru->config.carrier_config.dl_frequency.value, ru->config.carrier_config.dl_frequency.value,
...@@ -1600,7 +1600,7 @@ void *ru_thread( void *param ) { ...@@ -1600,7 +1600,7 @@ void *ru_thread( void *param ) {
&RA_sfn_index, &RA_sfn_index,
&N_RA_slot, &N_RA_slot,
&config_period); &config_period);
*/
for (int prach_oc = 0; prach_oc<ru->prach_list[prach_id].num_prach_ocas; prach_oc++) { for (int prach_oc = 0; prach_oc<ru->prach_list[prach_id].num_prach_ocas; prach_oc++) {
prachStartSymbol = ru->prach_list[prach_id].prachStartSymbol+prach_oc*N_dur; prachStartSymbol = ru->prach_list[prach_id].prachStartSymbol+prach_oc*N_dur;
//comment FK: the standard 38.211 section 5.3.2 has one extra term +14*N_RA_slot. This is because there prachStartSymbol is given wrt to start of the 15kHz slot or 60kHz slot. Here we work slot based, so this function is anyway only called in slots where there is PRACH. Its up to the MAC to schedule another PRACH PDU in the case there are there N_RA_slot \in {0,1}. //comment FK: the standard 38.211 section 5.3.2 has one extra term +14*N_RA_slot. This is because there prachStartSymbol is given wrt to start of the 15kHz slot or 60kHz slot. Here we work slot based, so this function is anyway only called in slots where there is PRACH. Its up to the MAC to schedule another PRACH PDU in the case there are there N_RA_slot \in {0,1}.
......
...@@ -223,22 +223,24 @@ void rx_nr_prach_ru(RU_t *ru, ...@@ -223,22 +223,24 @@ void rx_nr_prach_ru(RU_t *ru,
ru->idx,frame,slot,prachfmt[prachFormat],msg1_frequencystart,prachStartSymbol); ru->idx,frame,slot,prachfmt[prachFormat],msg1_frequencystart,prachStartSymbol);
switch (prachFormat) { switch (prachFormat) {
case 0: //A1 case 4: //A1
Ncp = 288/(1<<mu); Ncp = 288/(1<<mu);
break; break;
case 1: //A2 case 5: //A2
Ncp = 576/(1<<mu); Ncp = 576/(1<<mu);
break; break;
case 2: //A3 case 6: //A3
Ncp = 864/(1<<mu); Ncp = 864/(1<<mu);
break; break;
case 3: //B1 case 7: //B1
Ncp = 216/(1<<mu); Ncp = 216/(1<<mu);
break; break;
/*
// B2 and B3 do not exist in FAPI
case 4: //B2 case 4: //B2
Ncp = 360/(1<<mu); Ncp = 360/(1<<mu);
break; break;
...@@ -246,16 +248,16 @@ void rx_nr_prach_ru(RU_t *ru, ...@@ -246,16 +248,16 @@ void rx_nr_prach_ru(RU_t *ru,
case 5: //B3 case 5: //B3
Ncp = 504/(1<<mu); Ncp = 504/(1<<mu);
break; break;
*/
case 6: //B4 case 8: //B4
Ncp = 936/(1<<mu); Ncp = 936/(1<<mu);
break; break;
case 7: //C0 case 9: //C0
Ncp = 1240/(1<<mu); Ncp = 1240/(1<<mu);
break; break;
case 8: //C2 case 10: //C2
Ncp = 2048/(1<<mu); Ncp = 2048/(1<<mu);
break; break;
...@@ -334,21 +336,21 @@ void rx_nr_prach_ru(RU_t *ru, ...@@ -334,21 +336,21 @@ void rx_nr_prach_ru(RU_t *ru,
else if (mu==1) { else if (mu==1) {
dftlen=2048; dftlen=2048;
dft(DFT_2048,prach2,rxsigF[aa],1); dft(DFT_2048,prach2,rxsigF[aa],1);
if (prachFormat != 7) { // !=C0 if (prachFormat != 9/*C0*/) {
dft(DFT_2048,prach2+4096,rxsigF[aa]+4096,1); dft(DFT_2048,prach2+4096,rxsigF[aa]+4096,1);
reps++; reps++;
} }
if (prachFormat == 1 || prachFormat == 2 || prachFormat == 4 || prachFormat == 5 || prachFormat == 6 || prachFormat == 8) { if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) {
dft(DFT_2048,prach2+4096*2,rxsigF[aa]+4096*2,1); dft(DFT_2048,prach2+4096*2,rxsigF[aa]+4096*2,1);
dft(DFT_2048,prach2+4096*3,rxsigF[aa]+4096*3,1); dft(DFT_2048,prach2+4096*3,rxsigF[aa]+4096*3,1);
reps+=2; reps+=2;
} }
if (prachFormat == 2 || prachFormat == 5 || prachFormat == 6) { if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) {
dft(DFT_2048,prach2+4096*4,rxsigF[aa]+4096*4,1); dft(DFT_2048,prach2+4096*4,rxsigF[aa]+4096*4,1);
dft(DFT_2048,prach2+4096*5,rxsigF[aa]+4096*5,1); dft(DFT_2048,prach2+4096*5,rxsigF[aa]+4096*5,1);
reps+=2; reps+=2;
} }
if (prachFormat == 6) { if (prachFormat == 8/*B4*/) {
for (int i=6;i<12;i++) dft(DFT_2048,prach2+(4096*i),rxsigF[aa]+(4096*i),1); for (int i=6;i<12;i++) dft(DFT_2048,prach2+(4096*i),rxsigF[aa]+(4096*i),1);
reps+=6; reps+=6;
} }
...@@ -389,22 +391,22 @@ void rx_nr_prach_ru(RU_t *ru, ...@@ -389,22 +391,22 @@ void rx_nr_prach_ru(RU_t *ru,
else if (mu==1) { else if (mu==1) {
dftlen=1536; dftlen=1536;
dft(DFT_1536,prach2,rxsigF[aa],1); dft(DFT_1536,prach2,rxsigF[aa],1);
if (prachFormat != 7) { if (prachFormat != 9/*C0*/) {
dft(DFT_1536,prach2+3072,rxsigF[aa]+3072,1); dft(DFT_1536,prach2+3072,rxsigF[aa]+3072,1);
reps++; reps++;
} }
if (prachFormat == 1 || prachFormat == 2 || prachFormat == 4 || prachFormat == 5 || prachFormat == 6 || prachFormat == 8) { if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) {
dft(DFT_1536,prach2+3072*2,rxsigF[aa]+3072*2,1); dft(DFT_1536,prach2+3072*2,rxsigF[aa]+3072*2,1);
dft(DFT_1536,prach2+3072*3,rxsigF[aa]+3072*3,1); dft(DFT_1536,prach2+3072*3,rxsigF[aa]+3072*3,1);
reps+=2; reps+=2;
} }
if (prachFormat == 2 || prachFormat == 5 || prachFormat == 6) { if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) {
dft(DFT_1536,prach2+3072*4,rxsigF[aa]+3072*4,1); dft(DFT_1536,prach2+3072*4,rxsigF[aa]+3072*4,1);
dft(DFT_1536,prach2+3072*5,rxsigF[aa]+3072*5,1); dft(DFT_1536,prach2+3072*5,rxsigF[aa]+3072*5,1);
reps+=2; reps+=2;
} }
if (prachFormat == 6) { if (prachFormat == 8/*B4*/) {
for (int i=6;i<12;i++) dft(DFT_1536,prach2+(3072*i),rxsigF[aa]+(3072*i),1); for (int i=6;i<12;i++) dft(DFT_1536,prach2+(3072*i),rxsigF[aa]+(3072*i),1);
reps+=6; reps+=6;
} }
...@@ -449,22 +451,22 @@ void rx_nr_prach_ru(RU_t *ru, ...@@ -449,22 +451,22 @@ void rx_nr_prach_ru(RU_t *ru,
else if (mu==1) { else if (mu==1) {
dftlen=4096; dftlen=4096;
dft(DFT_4096,prach2,rxsigF[aa],1); dft(DFT_4096,prach2,rxsigF[aa],1);
if (prachFormat != 7) { //!=C0 if (prachFormat != 9/*C0*/) {
dft(DFT_4096,prach2+8192,rxsigF[aa]+8192,1); dft(DFT_4096,prach2+8192,rxsigF[aa]+8192,1);
reps++; reps++;
} }
if (prachFormat == 1 || prachFormat == 2 || prachFormat == 4 || prachFormat == 5 || prachFormat == 6 || prachFormat == 8) { if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) {
dft(DFT_4096,prach2+8192*2,rxsigF[aa]+8192*2,1); dft(DFT_4096,prach2+8192*2,rxsigF[aa]+8192*2,1);
dft(DFT_4096,prach2+8192*3,rxsigF[aa]+8192*3,1); dft(DFT_4096,prach2+8192*3,rxsigF[aa]+8192*3,1);
reps+=2; reps+=2;
} }
if (prachFormat == 2 || prachFormat == 5 || prachFormat == 6) { if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) {
dft(DFT_4096,prach2+8192*4,rxsigF[aa]+8192*4,1); dft(DFT_4096,prach2+8192*4,rxsigF[aa]+8192*4,1);
dft(DFT_4096,prach2+8192*5,rxsigF[aa]+8192*5,1); dft(DFT_4096,prach2+8192*5,rxsigF[aa]+8192*5,1);
reps+=2; reps+=2;
} }
if (prachFormat == 6) { if (prachFormat == 8/*B4*/) {
for (int i=6;i<12;i++) dft(DFT_4096,prach2+(8192*i),rxsigF[aa]+(8192*i),1); for (int i=6;i<12;i++) dft(DFT_4096,prach2+(8192*i),rxsigF[aa]+(8192*i),1);
reps+=6; reps+=6;
} }
...@@ -501,22 +503,22 @@ void rx_nr_prach_ru(RU_t *ru, ...@@ -501,22 +503,22 @@ void rx_nr_prach_ru(RU_t *ru,
else if (mu==1) { else if (mu==1) {
dftlen=3072; dftlen=3072;
dft(DFT_3072,prach2,rxsigF[aa],1); dft(DFT_3072,prach2,rxsigF[aa],1);
if (prachFormat != 7) { //!=C0 if (prachFormat != 9/*C0*/) {
dft(DFT_3072,prach2+6144,rxsigF[aa]+6144,1); dft(DFT_3072,prach2+6144,rxsigF[aa]+6144,1);
reps++; reps++;
} }
if (prachFormat == 1 || prachFormat == 2 || prachFormat == 4 || prachFormat == 5 || prachFormat == 6 || prachFormat == 8) { if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) {
dft(DFT_3072,prach2+6144*2,rxsigF[aa]+6144*2,1); dft(DFT_3072,prach2+6144*2,rxsigF[aa]+6144*2,1);
dft(DFT_3072,prach2+6144*3,rxsigF[aa]+6144*3,1); dft(DFT_3072,prach2+6144*3,rxsigF[aa]+6144*3,1);
reps+=2; reps+=2;
} }
if (prachFormat == 2 || prachFormat == 5 || prachFormat == 6) { if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) {
dft(DFT_3072,prach2+6144*4,rxsigF[aa]+6144*4,1); dft(DFT_3072,prach2+6144*4,rxsigF[aa]+6144*4,1);
dft(DFT_3072,prach2+6144*5,rxsigF[aa]+6144*5,1); dft(DFT_3072,prach2+6144*5,rxsigF[aa]+6144*5,1);
reps+=2; reps+=2;
} }
if (prachFormat == 6) { if (prachFormat == 8/*B4*/) {
for (int i=6;i<12;i++) dft(DFT_3072,prach2+(6144*i),rxsigF[aa]+(6144*i),1); for (int i=6;i<12;i++) dft(DFT_3072,prach2+(6144*i),rxsigF[aa]+(6144*i),1);
reps+=6; reps+=6;
} }
...@@ -609,7 +611,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -609,7 +611,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
uint8_t prach_fmt = prach_pdu->prach_format; uint8_t prach_fmt = prach_pdu->prach_format;
uint16_t N_ZC = (prach_sequence_length==0)?839:139; uint16_t N_ZC = (prach_sequence_length==0)?839:139;
LOG_D(PHY,"L1 PRACH RX: rooSequenceIndex %d, numRootSeqeuences %d, NCS %d, N_ZC %d \n",rootSequenceIndex,numrootSequenceIndex,NCS,N_ZC); LOG_D(PHY,"L1 PRACH RX: rooSequenceIndex %d, numRootSeqeuences %d, NCS %d, N_ZC %d, format %d \n",rootSequenceIndex,numrootSequenceIndex,NCS,N_ZC,prach_fmt);
prach_ifft = gNB->prach_vars.prach_ifft; prach_ifft = gNB->prach_vars.prach_ifft;
prachF = gNB->prach_vars.prachF; prachF = gNB->prach_vars.prachF;
......
This diff is collapsed.
...@@ -75,10 +75,13 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { ...@@ -75,10 +75,13 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) {
if (prach_id>=0) { if (prach_id>=0) {
nfapi_nr_prach_pdu_t *prach_pdu = &gNB->prach_vars.list[prach_id].pdu; nfapi_nr_prach_pdu_t *prach_pdu = &gNB->prach_vars.list[prach_id].pdu;
int prachStartSymbol; uint8_t prachStartSymbol;
uint8_t N_dur = get_nr_prach_duration(prach_pdu->prach_format);
/*
uint16_t format,RA_sfn_index; uint16_t format,RA_sfn_index;
uint8_t start_symbol,N_t_slot,N_dur,N_RA_slot,config_period; uint8_t start_symbol,N_t_slot,N_dur,N_RA_slot,config_period;
get_nr_prach_info_from_index(gNB->gNB_config.prach_config.prach_ConfigurationIndex.value, get_nr_prach_info_from_index(gNB->gNB_config.prach_config.prach_ConfigurationIndex.value,
frame,slot, frame,slot,
gNB->gNB_config.carrier_config.dl_frequency.value, gNB->gNB_config.carrier_config.dl_frequency.value,
...@@ -91,6 +94,7 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { ...@@ -91,6 +94,7 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) {
&RA_sfn_index, &RA_sfn_index,
&N_RA_slot, &N_RA_slot,
&config_period); &config_period);
*/
for(int prach_oc = 0; prach_oc < prach_pdu->num_prach_ocas; prach_oc++) { for(int prach_oc = 0; prach_oc < prach_pdu->num_prach_ocas; prach_oc++) {
for (ru_aa=0,aa=0;ru_aa<ru->nb_rx;ru_aa++,aa++) { for (ru_aa=0,aa=0;ru_aa<ru->nb_rx;ru_aa++,aa++) {
......
...@@ -93,6 +93,10 @@ int main(int argc, char **argv){ ...@@ -93,6 +93,10 @@ int main(int argc, char **argv){
uint16_t Nid_cell = 0, preamble_tx = 0, preamble_delay, format, format0, format1; uint16_t Nid_cell = 0, preamble_tx = 0, preamble_delay, format, format0, format1;
uint32_t tx_lev = 10000, prach_errors = 0, samp_count; //,tx_lev_dB; uint32_t tx_lev = 10000, prach_errors = 0, samp_count; //,tx_lev_dB;
uint64_t SSB_positions = 0x01, absoluteFrequencyPointA = 640000; uint64_t SSB_positions = 0x01, absoluteFrequencyPointA = 640000;
uint16_t RA_sfn_index;
uint8_t N_RA_slot;
uint8_t config_period;
int prachOccasion = 0;
// int8_t interf1=-19,interf2=-19; // int8_t interf1=-19,interf2=-19;
// uint8_t abstraction_flag=0,calibration_flag=0; // uint8_t abstraction_flag=0,calibration_flag=0;
...@@ -407,15 +411,18 @@ int main(int argc, char **argv){ ...@@ -407,15 +411,18 @@ int main(int argc, char **argv){
gNB->proc.slot_rx = slot; gNB->proc.slot_rx = slot;
int ret = get_nr_prach_info_from_index(config_index, int ret = get_nr_prach_info_from_index(config_index,
(int)frame, (int)frame,
(int)slot_gNB, (int)slot_gNB,
absoluteFrequencyPointA, absoluteFrequencyPointA,
mu, mu,
frame_parms->frame_type, frame_parms->frame_type,
&format, &format,
&start_symbol, &start_symbol,
&N_t_slot, &N_t_slot,
&N_dur); &N_dur,
&RA_sfn_index,
&N_RA_slot,
&config_period);
if (ret == 0) {printf("No prach in %d.%d, mu %d, config_index %d\n",frame,slot,mu,config_index); exit(-1);} if (ret == 0) {printf("No prach in %d.%d, mu %d, config_index %d\n",frame,slot,mu,config_index); exit(-1);}
format0 = format&0xff; // first column of format from table format0 = format&0xff; // first column of format from table
...@@ -424,60 +431,54 @@ int main(int argc, char **argv){ ...@@ -424,60 +431,54 @@ int main(int argc, char **argv){
if (format1 != 0xff) { if (format1 != 0xff) {
switch(format0) { switch(format0) {
case 0xa1: case 0xa1:
prach_format = 9; prach_format = 11;
break; break;
case 0xa2: case 0xa2:
prach_format = 10; prach_format = 12;
break; break;
case 0xa3: case 0xa3:
prach_format = 11; prach_format = 13;
break; break;
default: default:
AssertFatal(1==0, "Only formats A1/B1 A2/B2 A3/B3 are valid for dual format"); AssertFatal(1==0, "Only formats A1/B1 A2/B2 A3/B3 are valid for dual format");
} }
} else { } else {
switch(format0) { switch(format0) { // single PRACH format
case 0xa1: case 0:
prach_format = 0; prach_format = 0;
break; break;
case 0xa2: case 1:
prach_format = 1; prach_format = 1;
break; break;
case 0xa3: case 2:
prach_format = 2; prach_format = 2;
break; break;
case 0xb1: case 3:
prach_format = 3; prach_format = 3;
break; break;
case 0xb2: case 0xa1:
prach_format = 4; prach_format = 4;
break; break;
case 0xb3: case 0xa2:
prach_format = 5; prach_format = 5;
break; break;
case 0xb4: case 0xa3:
prach_format = 6; prach_format = 6;
break; break;
case 0xc0: case 0xb1:
prach_format = 7; prach_format = 7;
break; break;
case 0xc2: case 0xb4:
prach_format = 8; prach_format = 8;
break; break;
case 0: case 0xc0:
// long formats are handled @ PHY prach_format = 9;
break; break;
case 1: case 0xc2:
// long formats are handled @ PHY prach_format = 10;
break; break;
case 2:
// long formats are handled @ PHY
break;
case 3:
// long formats are handled @ PHY
break;
default: default:
AssertFatal(1==0, "Invalid PRACH format"); AssertFatal(1 == 0, "Invalid PRACH format");
} }
} }
...@@ -699,11 +700,11 @@ int main(int argc, char **argv){ ...@@ -699,11 +700,11 @@ int main(int argc, char **argv){
} }
rx_nr_prach_ru(ru, prach_format, numRA, prachStartSymbol, frame, slot); rx_nr_prach_ru(ru, prach_format, numRA, prachStartSymbol, prachOccasion, frame, slot);
gNB->prach_vars.rxsigF = ru->prach_rxsigF; gNB->prach_vars.rxsigF = ru->prach_rxsigF[prachOccasion];
if (n_frames == 1) printf("ncs %d,num_seq %d\n",prach_pdu->num_cs, prach_config->num_prach_fd_occasions_list[fd_occasion].num_root_sequences.value); if (n_frames == 1) printf("ncs %d,num_seq %d\n",prach_pdu->num_cs, prach_config->num_prach_fd_occasions_list[fd_occasion].num_root_sequences.value);
rx_nr_prach(gNB, prach_pdu, frame, subframe, &preamble_rx, &preamble_energy, &preamble_delay); rx_nr_prach(gNB, prach_pdu, prachOccasion, frame, subframe, &preamble_rx, &preamble_energy, &preamble_delay);
// printf(" preamble_energy %d preamble_rx %d preamble_tx %d \n", preamble_energy, preamble_rx, preamble_tx); // printf(" preamble_energy %d preamble_rx %d preamble_tx %d \n", preamble_energy, preamble_rx, preamble_tx);
......
...@@ -48,8 +48,7 @@ uint16_t NCS_restricted_TypeB_delta_f_RA_5[14] = {36,57,60,63,65,68,71,77,81,8 ...@@ -48,8 +48,7 @@ uint16_t NCS_restricted_TypeB_delta_f_RA_5[14] = {36,57,60,63,65,68,71,77,81,8
// Table 6.3.3.1-7 (38.211) NCS for preamble formats with delta_f_RA = 15 * 2mu KHz where mu = {0,1,2,3} // Table 6.3.3.1-7 (38.211) NCS for preamble formats with delta_f_RA = 15 * 2mu KHz where mu = {0,1,2,3}
uint16_t NCS_unrestricted_delta_f_RA_15[16] = {0,2,4,6,8,10,12,13,15,17,19,23,27,34,46,69}; uint16_t NCS_unrestricted_delta_f_RA_15[16] = {0,2,4,6,8,10,12,13,15,17,19,23,27,34,46,69};
const char *prachfmt[]={"A1","A2","A3","B1","B2","B3","B4","C0","C2"}; const char *prachfmt[]={"0","1","2","3", "A1","A2","A3","B1","B4","C0","C2","A1/B1","A2/B2","A3/B3"};
const char *prachfmt03[]={"0","1","2","3"};
uint16_t get_NCS(uint8_t index, uint16_t format0, uint8_t restricted_set_config) { uint16_t get_NCS(uint8_t index, uint16_t format0, uint8_t restricted_set_config) {
...@@ -1120,6 +1119,61 @@ int get_nr_prach_occasion_info_from_index(uint8_t index, ...@@ -1120,6 +1119,61 @@ int get_nr_prach_occasion_info_from_index(uint8_t index,
} }
} }
uint8_t get_nr_prach_duration(uint8_t prach_format){
switch(prach_format){
case 0: // format 0
return 0;
case 1: // format 1
return 0;
case 2: // format 2
return 0;
case 3: // format 3
return 0;
case 4: // format A1
return 2;
case 5: // format A2
return 4;
case 6: // format A3
return 6;
case 7: // format B1
return 2;
case 8: // format B4
return 12;
case 9: // format C0
return 2;
case 10: // format C2
return 6;
case 11: // format A1/B1
return 2;
case 12: // format A2/B2
return 4;
case 13: // format A3/B3
return 6;
default :
AssertFatal(1==0,"Invalid Prach format\n");
break;
}
}
int get_nr_prach_info_from_index(uint8_t index, int get_nr_prach_info_from_index(uint8_t index,
int frame, int frame,
int slot, int slot,
......
...@@ -115,6 +115,8 @@ int get_nr_prach_occasion_info_from_index(uint8_t index, ...@@ -115,6 +115,8 @@ int get_nr_prach_occasion_info_from_index(uint8_t index,
uint16_t *N_RA_sfn, uint16_t *N_RA_sfn,
uint8_t *max_association_period); uint8_t *max_association_period);
uint8_t get_nr_prach_duration(uint8_t prach_format);
uint8_t compute_nr_root_seq(NR_RACH_ConfigCommon_t *rach_config, uint8_t compute_nr_root_seq(NR_RACH_ConfigCommon_t *rach_config,
uint8_t nb_preambles, uint8_t nb_preambles,
uint8_t unpaired); uint8_t unpaired);
......
...@@ -952,6 +952,9 @@ void nr_ue_msg2_scheduler(module_id_t mod_id, ...@@ -952,6 +952,9 @@ void nr_ue_msg2_scheduler(module_id_t mod_id,
void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) { void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) {
uint8_t config_index, mu, N_dur, N_t_slot, start_symbol; uint8_t config_index, mu, N_dur, N_t_slot, start_symbol;
uint16_t RA_sfn_index;
uint8_t N_RA_slot;
uint8_t config_period;
uint16_t format, format0, format1, ncs; uint16_t format, format0, format1, ncs;
int msg1_FDM, is_nr_prach_slot, fdm; int msg1_FDM, is_nr_prach_slot, fdm;
...@@ -986,7 +989,10 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s ...@@ -986,7 +989,10 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
&format, &format,
&start_symbol, &start_symbol,
&N_t_slot, &N_t_slot,
&N_dur); &N_dur,
&RA_sfn_index,
&N_RA_slot,
&config_period);
if (is_nr_prach_slot && mac->ra_state == RA_UE_IDLE) { if (is_nr_prach_slot && mac->ra_state == RA_UE_IDLE) {
...@@ -1033,57 +1039,51 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s ...@@ -1033,57 +1039,51 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
if (format1 != 0xff) { if (format1 != 0xff) {
switch(format0) { // dual PRACH format switch(format0) { // dual PRACH format
case 0xa1: case 0xa1:
prach_config_pdu->prach_format = 9; prach_config_pdu->prach_format = 11;
break; break;
case 0xa2: case 0xa2:
prach_config_pdu->prach_format = 10; prach_config_pdu->prach_format = 12;
break; break;
case 0xa3: case 0xa3:
prach_config_pdu->prach_format = 11; prach_config_pdu->prach_format = 13;
break; break;
default: default:
AssertFatal(1 == 0, "Only formats A1/B1 A2/B2 A3/B3 are valid for dual format"); AssertFatal(1 == 0, "Only formats A1/B1 A2/B2 A3/B3 are valid for dual format");
} }
} else { } else {
switch(format0) { // single PRACH format switch(format0) { // single PRACH format
case 0xa1: case 0:
prach_config_pdu->prach_format = 0; prach_config_pdu->prach_format = 0;
break; break;
case 0xa2: case 1:
prach_config_pdu->prach_format = 1; prach_config_pdu->prach_format = 1;
break; break;
case 0xa3: case 2:
prach_config_pdu->prach_format = 2; prach_config_pdu->prach_format = 2;
break; break;
case 0xb1: case 3:
prach_config_pdu->prach_format = 3; prach_config_pdu->prach_format = 3;
break; break;
case 0xb2: case 0xa1:
prach_config_pdu->prach_format = 4; prach_config_pdu->prach_format = 4;
break; break;
case 0xb3: case 0xa2:
prach_config_pdu->prach_format = 5; prach_config_pdu->prach_format = 5;
break; break;
case 0xb4: case 0xa3:
prach_config_pdu->prach_format = 6; prach_config_pdu->prach_format = 6;
break; break;
case 0xc0: case 0xb1:
prach_config_pdu->prach_format = 7; prach_config_pdu->prach_format = 7;
break; break;
case 0xc2: case 0xb4:
prach_config_pdu->prach_format = 8; prach_config_pdu->prach_format = 8;
break; break;
case 0: case 0xc0:
// long formats are handled @ PHY prach_config_pdu->prach_format = 9;
break;
case 1:
// long formats are handled @ PHY
break;
case 2:
// long formats are handled @ PHY
break; break;
case 3: case 0xc2:
// long formats are handled @ PHY prach_config_pdu->prach_format = 10;
break; break;
default: default:
AssertFatal(1 == 0, "Invalid PRACH format"); AssertFatal(1 == 0, "Invalid PRACH format");
......
...@@ -269,23 +269,24 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP ...@@ -269,23 +269,24 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP
prach_pdu->num_cs = get_NCS(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig, prach_pdu->num_cs = get_NCS(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig,
format0, format0,
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->restrictedSetConfig); scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->restrictedSetConfig);
LOG_I(MAC, "Frame %d, Slot %d: Prach Occasion id = %u fdm index = %u start symbol = %u slot index = %u subframe index = %u \n", frameP, slotP, LOG_I(MAC, "Frame %d, Slot %d: Prach Occasion id = %u fdm index = %u start symbol = %u slot index = %u subframe index = %u \n",
prach_occasion_id, prach_pdu->num_ra, frameP, slotP,
prach_pdu->prach_start_symbol, prach_occasion_id, prach_pdu->num_ra,
slot_index, RA_sfn_index); prach_pdu->prach_start_symbol,
slot_index, RA_sfn_index);
// SCF PRACH PDU format field does not consider A1/B1 etc. possibilities // SCF PRACH PDU format field does not consider A1/B1 etc. possibilities
// We added 9 = A1/B1 10 = A2/B2 11 A3/B3 // We added 9 = A1/B1 10 = A2/B2 11 A3/B3
if (format1!=0xff) { if (format1!=0xff) {
switch(format0) { switch(format0) {
case 0xa1: case 0xa1:
prach_pdu->prach_format = 9; prach_pdu->prach_format = 11;
break; break;
case 0xa2: case 0xa2:
prach_pdu->prach_format = 10; prach_pdu->prach_format = 12;
break; break;
case 0xa3: case 0xa3:
prach_pdu->prach_format = 11; prach_pdu->prach_format = 13;
break; break;
default: default:
AssertFatal(1==0,"Only formats A1/B1 A2/B2 A3/B3 are valid for dual format"); AssertFatal(1==0,"Only formats A1/B1 A2/B2 A3/B3 are valid for dual format");
...@@ -293,44 +294,38 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP ...@@ -293,44 +294,38 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP
} }
else{ else{
switch(format0) { switch(format0) {
case 0xa1: case 0:
prach_pdu->prach_format = 0; prach_pdu->prach_format = 0;
break; break;
case 0xa2: case 1:
prach_pdu->prach_format = 1; prach_pdu->prach_format = 1;
break; break;
case 0xa3: case 2:
prach_pdu->prach_format = 2; prach_pdu->prach_format = 2;
break; break;
case 0xb1: case 3:
prach_pdu->prach_format = 3; prach_pdu->prach_format = 3;
break; break;
case 0xb2: case 0xa1:
prach_pdu->prach_format = 4; prach_pdu->prach_format = 4;
break; break;
case 0xb3: case 0xa2:
prach_pdu->prach_format = 5; prach_pdu->prach_format = 5;
break; break;
case 0xb4: case 0xa3:
prach_pdu->prach_format = 6; prach_pdu->prach_format = 6;
break; break;
case 0xc0: case 0xb1:
prach_pdu->prach_format = 7; prach_pdu->prach_format = 7;
break; break;
case 0xc2: case 0xb4:
prach_pdu->prach_format = 8; prach_pdu->prach_format = 8;
break; break;
case 0: case 0xc0:
// long formats are handled @ PHY prach_pdu->prach_format = 9;
break;
case 1:
// long formats are handled @ PHY
break;
case 2:
// long formats are handled @ PHY
break; break;
case 3: case 0xc2:
// long formats are handled @ PHY prach_pdu->prach_format = 10;
break; break;
default: default:
AssertFatal(1==0,"Invalid PRACH format"); AssertFatal(1==0,"Invalid PRACH format");
......
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