Commit 4bf5166a authored by Raymond Knopp's avatar Raymond Knopp

integration of PSSCH with PUSCH TX

parent d4e30b97
...@@ -769,3 +769,35 @@ uint32_t get_ssb_offset_to_pointA(uint32_t absoluteFrequencySSB, ...@@ -769,3 +769,35 @@ uint32_t get_ssb_offset_to_pointA(uint32_t absoluteFrequencySSB,
AssertFatal(sco % scs_scaling == 0, "ssb offset %d can create frequency offset\n", sco); AssertFatal(sco % scs_scaling == 0, "ssb offset %d can create frequency offset\n", sco);
return ssb_offset_point_a; return ssb_offset_point_a;
} }
#define MAX_EL_213_9_3_2 19
const float tab38_213_9_3_2[MAX_EL_213_9_3_2] = {1.125,1.250,1.375,1.625,1.750,2.000,2.250,2.500,2.875,3.125,3.500,4.000,5.000,6.250,8.000,10.000,12.625,15.875,20.000};
int get_NREsci2(const int sci2_alpha,
const int sci2_payload_len,
const int sci2_beta_offset,
const int pssch_numsym,
const int pscch_numsym,
const int pscch_numrbs,
const int l_subch,
const int subchannel_size,
const int mcs,
const int mcs_tb_ind) {
float Osci2 = (float)sci2_payload_len;
AssertFatal(sci2_beta_offset < MAX_EL_213_9_3_2, "illegal sci2_beta_offset %d\n",sci2_beta_offset);
float beta_offset_sci2 = tab38_213_9_3_2[sci2_beta_offset];
uint32_t R10240 = nr_get_code_rate_ul(mcs,mcs_tb_ind);
uint32_t tmp = (uint32_t)ceil((Osci2 + 24)*beta_offset_sci2/(R10240/5120));
float tmp2 = 12.0*pssch_numsym;
int N_REsci1 = 12*pscch_numrbs*pscch_numsym;
tmp2 *= l_subch*subchannel_size;
tmp2 -= N_REsci1;
tmp2 *= ((float)sci2_alpha/100.0);
return min(tmp,(int)ceil(tmp2));
}
...@@ -115,6 +115,8 @@ uint32_t get_ssb_offset_to_pointA(uint32_t absoluteFrequencySSB, ...@@ -115,6 +115,8 @@ uint32_t get_ssb_offset_to_pointA(uint32_t absoluteFrequencySSB,
int ssbSubcarrierSpacing, int ssbSubcarrierSpacing,
int frequency_range); int frequency_range);
int get_ssb_subcarrier_offset(uint32_t absoluteFrequencySSB, uint32_t absoluteFrequencyPointA); int get_ssb_subcarrier_offset(uint32_t absoluteFrequencySSB, uint32_t absoluteFrequencyPointA);
#define CEILIDIV(a,b) ((a+b-1)/b) #define CEILIDIV(a,b) ((a+b-1)/b)
#define ROUNDIDIV(a,b) (((a<<1)+b)/(b<<1)) #define ROUNDIDIV(a,b) (((a<<1)+b)/(b<<1))
......
...@@ -641,7 +641,7 @@ void processSlotTX(void *arg) { ...@@ -641,7 +641,7 @@ void processSlotTX(void *arg) {
sl_indication.phy_data = &phy_data; sl_indication.phy_data = &phy_data;
sl_indication.slot_type = SIDELINK_SLOT_TYPE_TX; sl_indication.slot_type = SIDELINK_SLOT_TYPE_TX;
LOG_D(NR_PHY,"Sending SL indication RX %d.%d TX %d.%d\n",proc->frame_rx,proc->nr_slot_rx,proc->frame_tx,proc->nr_slot_tx); LOG_I(NR_PHY,"Sending SL indication RX %d.%d TX %d.%d\n",proc->frame_rx,proc->nr_slot_rx,proc->frame_tx,proc->nr_slot_tx);
UE->if_inst->sl_indication(&sl_indication); UE->if_inst->sl_indication(&sl_indication);
stop_meas(&UE->ue_ul_indication_stats); stop_meas(&UE->ue_ul_indication_stats);
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#define NR_POLAR_DCI_MESSAGE_TYPE 1 //int8_t #define NR_POLAR_DCI_MESSAGE_TYPE 1 //int8_t
#define NR_POLAR_SCI_MESSAGE_TYPE (NR_POLAR_PSBCH_MESSAGE_TYPE + 1) //int8_t #define NR_POLAR_SCI_MESSAGE_TYPE (NR_POLAR_PSBCH_MESSAGE_TYPE + 1) //int8_t
#define NR_POLAR_SCI2_MESSAGE_TYPE (NR_POLAR_SCI_MESSAGE_TYPE + 1) //int8_t
#define NR_POLAR_DCI_CRC_PARITY_BITS 24 #define NR_POLAR_DCI_CRC_PARITY_BITS 24
#define NR_POLAR_DCI_CRC_ERROR_CORRECTION_BITS 3 #define NR_POLAR_DCI_CRC_ERROR_CORRECTION_BITS 3
......
...@@ -607,6 +607,7 @@ void init_polar_deinterleaver_table(t_nrPolar_params *polarParams) { ...@@ -607,6 +607,7 @@ void init_polar_deinterleaver_table(t_nrPolar_params *polarParams) {
uint32_t polar_decoder_int16(int16_t *input, uint32_t polar_decoder_int16(int16_t *input,
uint64_t *out, uint64_t *out,
uint16_t *nid,
uint8_t ones_flag, uint8_t ones_flag,
int8_t messageType, int8_t messageType,
uint16_t messageLength, uint16_t messageLength,
...@@ -615,7 +616,7 @@ uint32_t polar_decoder_int16(int16_t *input, ...@@ -615,7 +616,7 @@ uint32_t polar_decoder_int16(int16_t *input,
t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, true); t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, true);
#ifdef POLAR_CODING_DEBUG #ifdef POLAR_CODING_DEBUG
printf("\nRX\n"); printf("\nRX N %d (messageType %d messageLength %d aggregation_level %d)\n",polarParams->N,messageType,messageLength,aggregation_level);
printf("rm:"); printf("rm:");
for (int i = 0; i < polarParams->N; i++) { for (int i = 0; i < polarParams->N; i++) {
if (i % 4 == 0) { if (i % 4 == 0) {
...@@ -794,5 +795,6 @@ uint32_t polar_decoder_int16(int16_t *input, ...@@ -794,5 +795,6 @@ uint32_t polar_decoder_int16(int16_t *input,
#endif #endif
out[0]=Ar; out[0]=Ar;
if (nid) *nid=crc&65535;
polarReturn crc^rxcrc; polarReturn crc^rxcrc;
} }
...@@ -153,6 +153,7 @@ void polar_encoder_dci(uint32_t *in, ...@@ -153,6 +153,7 @@ void polar_encoder_dci(uint32_t *in,
void polar_encoder_fast(uint64_t *A, void polar_encoder_fast(uint64_t *A,
void *out, void *out,
uint32_t *crc,
int32_t crcmask, int32_t crcmask,
uint8_t ones_flag, uint8_t ones_flag,
int8_t messageType, int8_t messageType,
...@@ -168,6 +169,7 @@ int8_t polar_decoder(double *input, ...@@ -168,6 +169,7 @@ int8_t polar_decoder(double *input,
uint32_t polar_decoder_int16(int16_t *input, uint32_t polar_decoder_int16(int16_t *input,
uint64_t *out, uint64_t *out,
uint16_t *nid,
uint8_t ones_flag, uint8_t ones_flag,
int8_t messageType, int8_t messageType,
uint16_t messageLength, uint16_t messageLength,
......
...@@ -492,6 +492,7 @@ void build_polar_tables(t_nrPolar_params *polarParams) { ...@@ -492,6 +492,7 @@ void build_polar_tables(t_nrPolar_params *polarParams) {
void polar_encoder_fast(uint64_t *A, void polar_encoder_fast(uint64_t *A,
void *out, void *out,
uint32_t *crc,
int32_t crcmask, int32_t crcmask,
uint8_t ones_flag, uint8_t ones_flag,
int8_t messageType, int8_t messageType,
...@@ -604,7 +605,7 @@ void polar_encoder_fast(uint64_t *A, ...@@ -604,7 +605,7 @@ void polar_encoder_fast(uint64_t *A,
else if (polarParams->crcParityBits == 11) else if (polarParams->crcParityBits == 11)
tcrc = (uint64_t)((crcmask^(crc11(A128_flip,bitlen)>>21)))&0x7ff; tcrc = (uint64_t)((crcmask^(crc11(A128_flip,bitlen)>>21)))&0x7ff;
} }
if (crc) *crc = (uint32_t)tcrc;
// this is number of quadwords in the bit string // this is number of quadwords in the bit string
int quadwlen = (polarParams->K+63)/64; int quadwlen = (polarParams->K+63)/64;
...@@ -717,6 +718,7 @@ void polar_encoder_fast(uint64_t *A, ...@@ -717,6 +718,7 @@ void polar_encoder_fast(uint64_t *A,
#ifdef POLAR_CODING_DEBUG #ifdef POLAR_CODING_DEBUG
uint64_t *out64 = (uint64_t *)out; uint64_t *out64 = (uint64_t *)out;
printf("N %d, encoderLength %d\n",polarParams->N,polarParams->encoderLength);
printf("rm:"); printf("rm:");
for (int n = 0; n < polarParams->encoderLength; n++) { for (int n = 0; n < polarParams->encoderLength; n++) {
if (n % 4 == 0) { if (n % 4 == 0) {
......
...@@ -99,7 +99,7 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui ...@@ -99,7 +99,7 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui
//Parse the list. If the node is already created, return without initialization. //Parse the list. If the node is already created, return without initialization.
while (currentPtr != NULL) { while (currentPtr != NULL) {
//printf("currentPtr->idx %d, (%d,%d)\n",currentPtr->idx,currentPtr->payloadBits,currentPtr->encoderLength); //printf("currentPtr->idx %d, (%d,%d)\n",currentPtr->idx,currentPtr->payloadBits,currentPtr->encoderLength);
//LOG_D(PHY,"Looking for index %d\n",(messageType * messageLength * aggregation_prime)); LOG_D(NR_PHY,"Looking for index %d\n",(messageType * messageLength * aggregation_level));
if (currentPtr->busy == false && currentPtr->idx == PolarKey ) { if (currentPtr->busy == false && currentPtr->idx == PolarKey ) {
currentPtr->busy=true; currentPtr->busy=true;
pthread_mutex_unlock(&PolarListMutex); pthread_mutex_unlock(&PolarListMutex);
...@@ -208,7 +208,7 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui ...@@ -208,7 +208,7 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui
newPolarInitNode->crcCorrectionBits = SL_NR_POLAR_PSBCH_CRC_ERROR_CORRECTION_BITS; newPolarInitNode->crcCorrectionBits = SL_NR_POLAR_PSBCH_CRC_ERROR_CORRECTION_BITS;
newPolarInitNode->crc_generator_matrix = crc24c_generator_matrix(newPolarInitNode->payloadBits);//G_P newPolarInitNode->crc_generator_matrix = crc24c_generator_matrix(newPolarInitNode->payloadBits);//G_P
LOG_D(PHY,"SIDELINK: Initializing polar parameters for PSBCH (K %d, E %d)\n",newPolarInitNode->payloadBits,newPolarInitNode->encoderLength); LOG_D(PHY,"SIDELINK: Initializing polar parameters for PSBCH (K %d, E %d)\n",newPolarInitNode->payloadBits,newPolarInitNode->encoderLength);
} else if (messageType == NR_POLAR_DCI_MESSAGE_TYPE || messageType == NR_POLAR_SCI_MESSAGE_TYPE) { } else if (messageType == NR_POLAR_DCI_MESSAGE_TYPE || messageType == NR_POLAR_SCI_MESSAGE_TYPE || messageType == NR_POLAR_SCI2_MESSAGE_TYPE) {
newPolarInitNode->n_max = NR_POLAR_DCI_N_MAX; newPolarInitNode->n_max = NR_POLAR_DCI_N_MAX;
newPolarInitNode->i_il = NR_POLAR_DCI_I_IL; newPolarInitNode->i_il = NR_POLAR_DCI_I_IL;
newPolarInitNode->i_seg = NR_POLAR_DCI_I_SEG; newPolarInitNode->i_seg = NR_POLAR_DCI_I_SEG;
...@@ -217,7 +217,12 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui ...@@ -217,7 +217,12 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui
newPolarInitNode->i_bil = NR_POLAR_DCI_I_BIL; newPolarInitNode->i_bil = NR_POLAR_DCI_I_BIL;
newPolarInitNode->crcParityBits = NR_POLAR_DCI_CRC_PARITY_BITS; newPolarInitNode->crcParityBits = NR_POLAR_DCI_CRC_PARITY_BITS;
newPolarInitNode->payloadBits = messageLength; newPolarInitNode->payloadBits = messageLength;
newPolarInitNode->encoderLength = messageType == NR_POLAR_DCI_MESSAGE_TYPE ? aggregation_level * 108 : aggregation_level * 18; // for SCI aggregartion_level helds the number of PRBs, so multiply by 9*2 bits per PRB (9 REs with PSCCH payload) if (messageType == NR_POLAR_DCI_MESSAGE_TYPE)
newPolarInitNode->encoderLength = aggregation_level * 108;
else if (messageType == NR_POLAR_SCI_MESSAGE_TYPE)
newPolarInitNode->encoderLength = aggregation_level * 18; // for SCI1A aggregartion_level helds the number of PRBs, so multiply by 9*2 bits per PRB (9 REs with PSCCH payload)
else if (messageType == NR_POLAR_SCI2_MESSAGE_TYPE)
newPolarInitNode->encoderLength = aggregation_level * 2; // for SCI2 aggregartion_level helds the number of REs so multiple by 2, QPSK )
newPolarInitNode->crcCorrectionBits = NR_POLAR_DCI_CRC_ERROR_CORRECTION_BITS; newPolarInitNode->crcCorrectionBits = NR_POLAR_DCI_CRC_ERROR_CORRECTION_BITS;
newPolarInitNode->crc_generator_matrix = crc24c_generator_matrix(newPolarInitNode->payloadBits + newPolarInitNode->crcParityBits); // G_P newPolarInitNode->crc_generator_matrix = crc24c_generator_matrix(newPolarInitNode->payloadBits + newPolarInitNode->crcParityBits); // G_P
//printf("Initializing polar parameters for DCI (K %d, E %d, L %d)\n",newPolarInitNode->payloadBits,newPolarInitNode->encoderLength,aggregation_level); //printf("Initializing polar parameters for DCI (K %d, E %d, L %d)\n",newPolarInitNode->payloadBits,newPolarInitNode->encoderLength,aggregation_level);
......
...@@ -955,6 +955,25 @@ void sl_ue_phy_init(PHY_VARS_NR_UE *UE) { ...@@ -955,6 +955,25 @@ void sl_ue_phy_init(PHY_VARS_NR_UE *UE) {
} }
nr_init_pdcch_dmrs(sl_fp,UE->nr_gold_pscch_dmrs, UE->SL_UE_PHY_PARAMS.sl_config.sl_DMRS_ScrambleId); nr_init_pdcch_dmrs(sl_fp,UE->nr_gold_pscch_dmrs, UE->SL_UE_PHY_PARAMS.sl_config.sl_DMRS_ScrambleId);
// PSCCH DMRS RX
UE->nr_gold_pscch = malloc16(sl_fp->slots_per_frame * sizeof(uint32_t **));
uint32_t ***pscch_dmrs_rx = UE->nr_gold_pscch;
AssertFatal(pscch_dmrs_rx!=NULL, "NR init: pscch_dmrs malloc failed\n");
for (int slot=0; slot<sl_fp->slots_per_frame; slot++) {
pscch_dmrs_rx[slot] = malloc16(sl_fp->symbols_per_slot * sizeof(uint32_t *));
AssertFatal(pscch_dmrs_rx[slot]!=NULL, "NR init: pscch_dmrs for slot %d - malloc failed\n", slot);
for (int symb=0; symb<sl_fp->symbols_per_slot; symb++) {
pscch_dmrs_rx[slot][symb] = malloc16(pscch_dmrs_init_length * sizeof(uint32_t));
AssertFatal(pscch_dmrs[slot][symb]!=NULL, "NR init: pscch_dmrs for slot %d symbol %d - malloc failed\n", slot, symb);
}
}
nr_gold_pdcch(sl_fp, pscch_dmrs_rx,UE->SL_UE_PHY_PARAMS.sl_config.sl_DMRS_ScrambleId);
// SSS
for (int slss_id = 0; slss_id < SL_NR_NUM_SLSS_IDs; slss_id++) { for (int slss_id = 0; slss_id < SL_NR_NUM_SLSS_IDs; slss_id++) {
sl_generate_psbch_dmrs_qpsk_sequences(UE, UE->SL_UE_PHY_PARAMS.init_params.psbch_dmrs_modsym[slss_id], slss_id); sl_generate_psbch_dmrs_qpsk_sequences(UE, UE->SL_UE_PHY_PARAMS.init_params.psbch_dmrs_modsym[slss_id], slss_id);
sl_generate_sss(&UE->SL_UE_PHY_PARAMS.init_params, slss_id, scaling_value); sl_generate_sss(&UE->SL_UE_PHY_PARAMS.init_params, slss_id, scaling_value);
...@@ -963,4 +982,6 @@ void sl_ue_phy_init(PHY_VARS_NR_UE *UE) { ...@@ -963,4 +982,6 @@ void sl_ue_phy_init(PHY_VARS_NR_UE *UE) {
// Generate PSS time domain samples used for correlation during SLSS reception. // Generate PSS time domain samples used for correlation during SLSS reception.
sl_generate_pss_ifft_samples(&UE->SL_UE_PHY_PARAMS, &UE->SL_UE_PHY_PARAMS.init_params); sl_generate_pss_ifft_samples(&UE->SL_UE_PHY_PARAMS, &UE->SL_UE_PHY_PARAMS.init_params);
} }
...@@ -613,7 +613,7 @@ void init_symbol_rotation(NR_DL_FRAME_PARMS *fp) { ...@@ -613,7 +613,7 @@ void init_symbol_rotation(NR_DL_FRAME_PARMS *fp) {
double f0 = f[ll]; double f0 = f[ll];
if (f0 == 0) continue; if (f0 == 0) continue;
LOG_D(PHY, "Doing symbol rotation calculation for gNB TX/RX, f0 %f Hz, Nsymb %d\n", f0, nsymb); LOG_I(NR_PHY, "Doing symbol rotation calculation for gNB TX/RX, f0 %f Hz, Nsymb %d\n", f0, nsymb);
c16_t *symbol_rotation = fp->symbol_rotation[ll]; c16_t *symbol_rotation = fp->symbol_rotation[ll];
double tl = 0.0; double tl = 0.0;
...@@ -631,12 +631,12 @@ void init_symbol_rotation(NR_DL_FRAME_PARMS *fp) { ...@@ -631,12 +631,12 @@ void init_symbol_rotation(NR_DL_FRAME_PARMS *fp) {
} }
poff = 2 * M_PI * (tl + (Ncp * Tc)) * f0; poff = 2 * M_PI * (tl + (Ncp * Tc)) * f0;
exp_re = cos(poff); exp_re = 1.0;//cos(poff);
exp_im = sin(-poff); exp_im = 0.0;//sin(-poff);
symbol_rotation[l].r = (int16_t)floor(exp_re * 32767); symbol_rotation[l].r = (int16_t)floor(exp_re * 32767);
symbol_rotation[l].i = (int16_t)floor(exp_im * 32767); symbol_rotation[l].i = (int16_t)floor(exp_im * 32767);
LOG_D(PHY, "Symbol rotation %d/%d => tl %f (%d,%d) (%f)\n", LOG_I(PHY, "Symbol rotation %d/%d => tl %f (%d,%d) (%f)\n",
l, l,
nsymb, nsymb,
tl, tl,
......
...@@ -45,7 +45,6 @@ void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRA ...@@ -45,7 +45,6 @@ void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRA
{ {
PHY_ofdm_mod((int *)txdataF, // input PHY_ofdm_mod((int *)txdataF, // input
(int *)txdata, // output (int *)txdata, // output
frame_parms->ofdm_symbol_size, frame_parms->ofdm_symbol_size,
...@@ -67,6 +66,7 @@ void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRA ...@@ -67,6 +66,7 @@ void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRA
void nr_normal_prefix_mod(c16_t *txdataF, c16_t *txdata, uint8_t nsymb, const NR_DL_FRAME_PARMS *frame_parms, uint32_t slot) void nr_normal_prefix_mod(c16_t *txdataF, c16_t *txdata, uint8_t nsymb, const NR_DL_FRAME_PARMS *frame_parms, uint32_t slot)
{ {
// This function works only slot wise. For more generic symbol generation refer nr_feptx0() // This function works only slot wise. For more generic symbol generation refer nr_feptx0()
LOG_I(NR_PHY,"normal_prefix_mod: prefix0 %d, prefix %d, nsymb %d\n",frame_parms->nb_prefix_samples0,frame_parms->nb_prefix_samples,nsymb);
if (frame_parms->numerology_index != 0) { // case where numerology != 0 if (frame_parms->numerology_index != 0) { // case where numerology != 0
if (!(slot%(frame_parms->slots_per_subframe/2))) { if (!(slot%(frame_parms->slots_per_subframe/2))) {
PHY_ofdm_mod((int *)txdataF, PHY_ofdm_mod((int *)txdataF,
......
...@@ -162,11 +162,12 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -162,11 +162,12 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
rx_offset += frame_parms->ofdm_symbol_size * symbol; rx_offset += frame_parms->ofdm_symbol_size * symbol;
// use OFDM symbol from within 1/8th of the CP to avoid ISI // use OFDM symbol from within 1/8th of the CP to avoid ISI
rx_offset -= (nb_prefix_samples / frame_parms->ofdm_offset_divisor); // rx_offset -= (nb_prefix_samples / frame_parms->ofdm_offset_divisor);
rx_offset += 1;
//#ifdef DEBUG_FEP //#ifdef DEBUG_FEP
// if (ue->frame <100) // if (ue->frame <100)
LOG_D(PHY,"slot_fep: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, rx_offset %u energy %d\n", LOG_I(PHY,"slot_fep: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, rx_offset %u energy %d\n",
Ns, symbol, nb_prefix_samples, nb_prefix_samples0, rx_offset, dB_fixed(signal_energy((int32_t *)&common_vars->rxdata[0][rx_offset],frame_parms->ofdm_symbol_size))); Ns, symbol, nb_prefix_samples, nb_prefix_samples0, rx_offset, dB_fixed(signal_energy((int32_t *)&common_vars->rxdata[0][rx_offset],frame_parms->ofdm_symbol_size)));
//#endif //#endif
...@@ -191,6 +192,9 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -191,6 +192,9 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
stop_meas(&ue->rx_dft_stats); stop_meas(&ue->rx_dft_stats);
/*
LOG_I(NR_PHY,"%d.%d Applying rotation for symbol %d, linktype %d\n",
proc->frame_rx,proc->nr_slot_rx,symbol,linktype);
apply_nr_rotation_RX(frame_parms, apply_nr_rotation_RX(frame_parms,
rxdataF[aa], rxdataF[aa],
frame_parms->symbol_rotation[linktype], frame_parms->symbol_rotation[linktype],
...@@ -198,7 +202,10 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -198,7 +202,10 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
frame_parms->N_RB_DL, frame_parms->N_RB_DL,
0, 0,
symbol, symbol,
1); linktype);
*/
for (int i=1413;i<1422;i+=4)
printf("i : %d,%d\n", rxdataF[aa][i + (frame_parms->ofdm_symbol_size*symbol)].r,rxdataF[aa][i+(frame_parms->ofdm_symbol_size*symbol)].i);
} }
#ifdef DEBUG_FEP #ifdef DEBUG_FEP
...@@ -392,7 +399,6 @@ void apply_nr_rotation_RX(NR_DL_FRAME_PARMS *frame_parms, ...@@ -392,7 +399,6 @@ void apply_nr_rotation_RX(NR_DL_FRAME_PARMS *frame_parms,
c16_t rot2 = rot[symbol + symb_offset]; c16_t rot2 = rot[symbol + symb_offset];
rot2.i = -rot2.i; rot2.i = -rot2.i;
LOG_D(PHY,"slot %d, symb_offset %d rotating by %d.%d\n", slot, symb_offset, rot2.r, rot2.i);
c16_t *shift_rot = frame_parms->timeshift_symbol_rotation; c16_t *shift_rot = frame_parms->timeshift_symbol_rotation;
c16_t *this_symbol = &rxdataF[soffset + (frame_parms->ofdm_symbol_size * symbol)]; c16_t *this_symbol = &rxdataF[soffset + (frame_parms->ofdm_symbol_size * symbol)];
......
...@@ -51,21 +51,20 @@ void nr_gold_pbch(PHY_VARS_NR_UE* ue) ...@@ -51,21 +51,20 @@ void nr_gold_pbch(PHY_VARS_NR_UE* ue)
} }
void nr_gold_pdcch(PHY_VARS_NR_UE* ue, void nr_gold_pdcch(NR_DL_FRAME_PARMS *fp, uint32_t ***nr_gold,uint16_t nid)
unsigned short nid)
{ {
unsigned int n = 0, x1 = 0, x2 = 0, x2tmp0 = 0; unsigned int n = 0, x1 = 0, x2 = 0, x2tmp0 = 0;
uint8_t reset; uint8_t reset;
int pdcch_dmrs_init_length = (((ue->frame_parms.N_RB_DL << 1) * 3) >> 5) + 1; int pdcch_dmrs_init_length = (((fp->N_RB_DL << 1) * 3) >> 5) + 1;
for (int ns = 0; ns < ue->frame_parms.slots_per_frame; ns++) { for (int ns = 0; ns < fp->slots_per_frame; ns++) {
for (int l = 0; l < ue->frame_parms.symbols_per_slot; l++) { for (int l = 0; l < fp->symbols_per_slot; l++) {
reset = 1; reset = 1;
x2tmp0 = ((ue->frame_parms.symbols_per_slot * ns + l + 1) * ((nid << 1) + 1)); x2tmp0 = ((fp->symbols_per_slot * ns + l + 1) * ((nid << 1) + 1));
x2tmp0 <<= 17; x2tmp0 <<= 17;
x2 = (x2tmp0 + (nid << 1)) % (1U << 31); //cinit x2 = (x2tmp0 + (nid << 1)) % (1U << 31); //cinit
for (n=0; n<pdcch_dmrs_init_length; n++) { for (n=0; n<pdcch_dmrs_init_length; n++) {
ue->nr_gold_pdcch[0][ns][l][n] = lte_gold_generic(&x1, &x2, reset); nr_gold[ns][l][n] = lte_gold_generic(&x1, &x2, reset);
reset = 0; reset = 0;
} }
} }
...@@ -118,6 +117,24 @@ void nr_init_pusch_dmrs(PHY_VARS_NR_UE* ue, ...@@ -118,6 +117,24 @@ void nr_init_pusch_dmrs(PHY_VARS_NR_UE* ue,
} }
} }
void nr_init_pssch_dmrs_oneshot(NR_DL_FRAME_PARMS *fp,
uint16_t N_id,
uint32_t *pssch_dmrs,
int slot,
int symb)
{
uint32_t x1 = 0, x2 = 0, n = 0;
int pusch_dmrs_init_length = ((fp->N_RB_UL * 12) >> 5) + 1;
int reset = 1;
x2 = ((1U << 17) * (fp->symbols_per_slot*slot + symb + 1) * ((N_id << 1) + 1) + (N_id << 1) );
LOG_D(PHY,"DMRS slot %d, symb %d x2 %x\n", slot, symb, x2);
for (n=0; n<pusch_dmrs_init_length; n++) {
pssch_dmrs[n] = lte_gold_generic(&x1, &x2, reset);
reset = 0;
}
}
void init_nr_gold_prs(PHY_VARS_NR_UE* ue) void init_nr_gold_prs(PHY_VARS_NR_UE* ue)
{ {
unsigned int x1 = 0, x2 = 0; unsigned int x1 = 0, x2 = 0;
......
...@@ -57,8 +57,8 @@ int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue, ...@@ -57,8 +57,8 @@ int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue,
void nr_gold_pbch(PHY_VARS_NR_UE* ue); void nr_gold_pbch(PHY_VARS_NR_UE* ue);
void nr_gold_pdcch(PHY_VARS_NR_UE* ue, void nr_gold_pdcch(NR_DL_FRAME_PARMS *fp,
unsigned short n_idDMRS); uint32_t ***nr_gold, uint16_t nid);
void nr_gold_pdsch(PHY_VARS_NR_UE* ue, void nr_gold_pdsch(PHY_VARS_NR_UE* ue,
int nscid, int nscid,
......
...@@ -66,12 +66,12 @@ void nr_pdcch_scrambling(uint32_t *in, ...@@ -66,12 +66,12 @@ void nr_pdcch_scrambling(uint32_t *in,
} }
} }
void nr_generate_dci(PHY_VARS_gNB *gNB, PHY_VARS_NR_UE *ue, uint32_t nr_generate_dci(PHY_VARS_gNB *gNB, PHY_VARS_NR_UE *ue,
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15, nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
int32_t *txdataF, int32_t *txdataF,
int16_t amp, int16_t amp,
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
int slot) { int slot) {
uint16_t cset_start_sc; uint16_t cset_start_sc;
uint8_t cset_start_symb, cset_nsymb; uint8_t cset_start_symb, cset_nsymb;
...@@ -94,6 +94,8 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, PHY_VARS_NR_UE *ue, ...@@ -94,6 +94,8 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, PHY_VARS_NR_UE *ue,
int16_t mod_dmrs[pdcch_pdu_rel15->StartSymbolIndex+pdcch_pdu_rel15->DurationSymbols][(((n_rb+rb_offset+pdcch_pdu_rel15->BWPStart)*6+15)>>4)<<4] __attribute__((aligned(16))); // 3 for the max coreset duration int16_t mod_dmrs[pdcch_pdu_rel15->StartSymbolIndex+pdcch_pdu_rel15->DurationSymbols][(((n_rb+rb_offset+pdcch_pdu_rel15->BWPStart)*6+15)>>4)<<4] __attribute__((aligned(16))); // 3 for the max coreset duration
uint32_t tcrc[pdcch_pdu_rel15->numDlDci];
for (int d=0;d<pdcch_pdu_rel15->numDlDci;d++) { for (int d=0;d<pdcch_pdu_rel15->numDlDci;d++) {
/*The coreset is initialised /*The coreset is initialised
* in frequency: the first subcarrier is obtained by adding the first CRB overlapping the SSB and the rb_offset for coreset 0 * in frequency: the first subcarrier is obtained by adding the first CRB overlapping the SSB and the rb_offset for coreset 0
...@@ -116,7 +118,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, PHY_VARS_NR_UE *ue, ...@@ -116,7 +118,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, PHY_VARS_NR_UE *ue,
LOG_D(PHY, "pdcch: Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb); LOG_D(PHY, "pdcch: Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb);
// DMRS length is per OFDM symbol // DMRS length is per OFDM symbol
uint32_t dmrs_length = (n_rb+pdcch_pdu_rel15->BWPStart)*6; //2(QPSK)*3(per RB)*6(REG per CCE) uint32_t dmrs_length = (n_rb+pdcch_pdu_rel15->BWPStart)*6; //2(QPSK)*3(per RB)*6(REG per CCE)
uint32_t encoded_length = gNB ? dci_pdu->AggregationLevel*108:dci_pdu->AggregationLevel*18*cset_nsymb; //2(QPSK)*9(per RB)*6(REG per CCE) uint32_t encoded_length = gNB ? dci_pdu->AggregationLevel*108:dci_pdu->AggregationLevel*18; //2(QPSK)*9(per RB)*6(REG per CCE)
if (dci_pdu->RNTI != 0xFFFF) if (dci_pdu->RNTI != 0xFFFF)
LOG_D(PHY, "DL_DCI : rb_offset %d, nb_rb %d, DMRS length per symbol %d\t DCI encoded length %d (precoder_granularity %d, reg_mapping %d), Scrambling_Id %d, ScramblingRNTI %x, PayloadSizeBits %d\n", LOG_D(PHY, "DL_DCI : rb_offset %d, nb_rb %d, DMRS length per symbol %d\t DCI encoded length %d (precoder_granularity %d, reg_mapping %d), Scrambling_Id %d, ScramblingRNTI %x, PayloadSizeBits %d\n",
rb_offset, n_rb,dmrs_length, encoded_length,pdcch_pdu_rel15->precoderGranularity,pdcch_pdu_rel15->CceRegMappingType, rb_offset, n_rb,dmrs_length, encoded_length,pdcch_pdu_rel15->precoderGranularity,pdcch_pdu_rel15->CceRegMappingType,
...@@ -144,8 +146,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, PHY_VARS_NR_UE *ue, ...@@ -144,8 +146,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, PHY_VARS_NR_UE *ue,
uint16_t n_RNTI = dci_pdu->RNTI; uint16_t n_RNTI = dci_pdu->RNTI;
uint16_t Nid = dci_pdu->ScramblingId; uint16_t Nid = dci_pdu->ScramblingId;
uint16_t scrambling_RNTI = dci_pdu->ScramblingRNTI; uint16_t scrambling_RNTI = dci_pdu->ScramblingRNTI;
polar_encoder_fast((uint64_t*)dci_pdu->Payload, (void*)encoder_output, &tcrc[d],n_RNTI, 1,
polar_encoder_fast((uint64_t*)dci_pdu->Payload, (void*)encoder_output, n_RNTI, 1,
gNB ? NR_POLAR_DCI_MESSAGE_TYPE : NR_POLAR_SCI_MESSAGE_TYPE, gNB ? NR_POLAR_DCI_MESSAGE_TYPE : NR_POLAR_SCI_MESSAGE_TYPE,
dci_pdu->PayloadSizeBits, dci_pdu->AggregationLevel); dci_pdu->PayloadSizeBits, dci_pdu->AggregationLevel);
#ifdef DEBUG_CHANNEL_CODING #ifdef DEBUG_CHANNEL_CODING
...@@ -184,7 +185,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, PHY_VARS_NR_UE *ue, ...@@ -184,7 +185,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, PHY_VARS_NR_UE *ue,
if (cset_start_sc >= frame_parms->ofdm_symbol_size) if (cset_start_sc >= frame_parms->ofdm_symbol_size)
cset_start_sc -= frame_parms->ofdm_symbol_size; cset_start_sc -= frame_parms->ofdm_symbol_size;
int num_regs = gNB ? dci_pdu->AggregationLevel * NR_NB_REG_PER_CCE / pdcch_pdu_rel15->DurationSymbols : dci_pdu->AggregationLevel; int num_regs = gNB ? dci_pdu->AggregationLevel * NR_NB_REG_PER_CCE / pdcch_pdu_rel15->DurationSymbols : dci_pdu->AggregationLevel/pdcch_pdu_rel15->DurationSymbols;
/*Mapping the encoded DCI along with the DMRS */ /*Mapping the encoded DCI along with the DMRS */
for(int symbol_idx = 0; symbol_idx < pdcch_pdu_rel15->DurationSymbols; symbol_idx++) { for(int symbol_idx = 0; symbol_idx < pdcch_pdu_rel15->DurationSymbols; symbol_idx++) {
...@@ -200,10 +201,10 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, PHY_VARS_NR_UE *ue, ...@@ -200,10 +201,10 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, PHY_VARS_NR_UE *ue,
l = cset_start_symb + symbol_idx; l = cset_start_symb + symbol_idx;
// dmrs index depends on reference point for k according to 38.211 7.4.1.3.2 // dmrs index depends on reference point for k according to 38.211 7.4.1.3.2
if (gNB && pdcch_pdu_rel15->CoreSetType == NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG) if (pdcch_pdu_rel15->CoreSetType == NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG)
dmrs_idx = (reg_list[d][reg_count] + pdcch_pdu_rel15->BWPStart) * 3; dmrs_idx = (gNB ? reg_list[d][reg_count] + pdcch_pdu_rel15->BWPStart : reg_count) * 3;
else else
dmrs_idx = gNB ? ((reg_list[d][reg_count] + rb_offset) * 3) : (pdcch_pdu_rel15->dci_pdu[d].CceIndex + rb_offset) * 3; dmrs_idx = gNB ? ((reg_list[d][reg_count] + rb_offset) * 3) : (pdcch_pdu_rel15->dci_pdu[d].CceIndex + rb_offset + reg_count) * 3;
k_prime = 0; k_prime = 0;
...@@ -253,6 +254,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, PHY_VARS_NR_UE *ue, ...@@ -253,6 +254,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, PHY_VARS_NR_UE *ue,
dci_pdu->PayloadSizeBits, dci_pdu->PayloadSizeBits,
*(unsigned long long *)dci_pdu->Payload); *(unsigned long long *)dci_pdu->Payload);
} // for (int d=0;d<pdcch_pdu_rel15->numDlDci;d++) } // for (int d=0;d<pdcch_pdu_rel15->numDlDci;d++)
return(tcrc[0]); // this is for SCI, it should be passed in another way after so we can get more than 1
} }
void nr_generate_dci_top(processingData_L1tx_t *msgTx, void nr_generate_dci_top(processingData_L1tx_t *msgTx,
......
...@@ -302,7 +302,7 @@ int nr_generate_pbch(nfapi_nr_dl_tti_ssb_pdu *ssb_pdu, ...@@ -302,7 +302,7 @@ int nr_generate_pbch(nfapi_nr_dl_tti_ssb_pdu *ssb_pdu,
a_reversed |= (((uint64_t)pbch->pbch_a_prime>>i)&1)<<(31-i); a_reversed |= (((uint64_t)pbch->pbch_a_prime>>i)&1)<<(31-i);
/// CRC, coding and rate matching /// CRC, coding and rate matching
polar_encoder_fast (&a_reversed, (void*)pbch->pbch_e, 0, 0, polar_encoder_fast (&a_reversed, (void*)pbch->pbch_e, NULL,0, 0,
NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL); NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL);
#ifdef DEBUG_PBCH_ENCODING #ifdef DEBUG_PBCH_ENCODING
......
...@@ -40,6 +40,16 @@ uint32_t nr_get_G(uint16_t nb_rb, uint16_t nb_symb_sch,uint8_t nb_re_dmrs,uint16 ...@@ -40,6 +40,16 @@ uint32_t nr_get_G(uint16_t nb_rb, uint16_t nb_symb_sch,uint8_t nb_re_dmrs,uint16
return(G); return(G);
} }
nr_get_G_SL(uint16_t nb_rb, uint16_t nb_symb_sch,uint8_t nb_re_dmrs,uint16_t length_dmrs,uint8_t sci1_dmrs_overlap,uint8_t sci1_symb,uint16_t sci1_rb,uint16_t sci2_re,uint8_t Qm,uint8_t Nl) {
uint32_t G_SL;
G_SL = ((NR_NB_SC_PER_RB*nb_symb_sch)-(nb_re_dmrs*length_dmrs))*nb_rb*Qm*Nl;
if (sci1_dmrs_overlap > 0) G_SL += (nb_re_dmrs*sci1_rb*Qm*Nl); // return the dmrs that are not transmitted due to SCI1
G_SL -= (sci1_symb*sci1_rb*NR_NB_SC_PER_RB*Qm*Nl); // REs taken by SCI1
G_SL -= (sci2_re*Qm*Nl); // REs taken by SCI2
return(G_SL);
}
uint32_t nr_get_E(uint32_t G, uint8_t C, uint8_t Qm, uint8_t Nl, uint8_t r) { uint32_t nr_get_E(uint32_t G, uint8_t C, uint8_t Qm, uint8_t Nl, uint8_t r) {
uint32_t E; uint32_t E;
uint8_t Cprime = C; //assume CBGTI not present uint8_t Cprime = C; //assume CBGTI not present
......
...@@ -1691,7 +1691,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, ...@@ -1691,7 +1691,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
} // symb } // symb
// run polar decoder on llrs // run polar decoder on llrs
decoderState = polar_decoder_int16((int16_t *)llrs, decodedPayload, 0, NR_POLAR_UCI_PUCCH_MESSAGE_TYPE, nb_bit, pucch_pdu->prb_size); decoderState = polar_decoder_int16((int16_t *)llrs, decodedPayload, NULL, 0, NR_POLAR_UCI_PUCCH_MESSAGE_TYPE, nb_bit, pucch_pdu->prb_size);
LOG_D(PHY,"UCI decoderState %d, payload[0] %llu\n",decoderState,(unsigned long long)decodedPayload[0]); LOG_D(PHY,"UCI decoderState %d, payload[0] %llu\n",decoderState,(unsigned long long)decodedPayload[0]);
if (decoderState>0) decoderState=1; if (decoderState>0) decoderState=1;
......
...@@ -1061,12 +1061,16 @@ void nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -1061,12 +1061,16 @@ void nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
int nb_rb_coreset=0; int nb_rb_coreset=0;
int coreset_start_rb=0; int coreset_start_rb=0;
get_coreset_rballoc(coreset->frequency_domain_resource,&nb_rb_coreset,&coreset_start_rb); if (pscch_flag == 0) get_coreset_rballoc(coreset->frequency_domain_resource,&nb_rb_coreset,&coreset_start_rb);
else {
coreset_start_rb = coreset->frequency_domain_resource[0];
nb_rb_coreset = coreset->frequency_domain_resource[1];
}
if(nb_rb_coreset==0) return; if(nb_rb_coreset==0) return;
#ifdef DEBUG_PDCCH #ifdef DEBUG_PDCCH
printf("pdcch_channel_estimation: first_carrier_offset %d, BWPStart %d, coreset_start_rb %d, coreset_nb_rb %d\n", printf("pdcch_channel_estimation: first_carrier_offset %d, BWPStart %d, coreset_start_rb %d, coreset_nb_rb %d, symbold %d\n",
first_carrier_offset, BWPStart, coreset_start_rb, nb_rb_coreset); first_carrier_offset, BWPStart, coreset_start_rb, nb_rb_coreset,symbol);
#endif #endif
unsigned short coreset_start_subcarrier = first_carrier_offset+(BWPStart + coreset_start_rb)*12; unsigned short coreset_start_subcarrier = first_carrier_offset+(BWPStart + coreset_start_rb)*12;
...@@ -1084,17 +1088,20 @@ void nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -1084,17 +1088,20 @@ void nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
unsigned short scrambling_id = coreset->pdcch_dmrs_scrambling_id; unsigned short scrambling_id = coreset->pdcch_dmrs_scrambling_id;
// checking if re-initialization of scrambling IDs is needed (should be done here but scrambling ID for PDCCH is not taken from RRC) // checking if re-initialization of scrambling IDs is needed (should be done here but scrambling ID for PDCCH is not taken from RRC)
if (scrambling_id != ue->scramblingID_pdcch){ if (pscch_flag == 0 && scrambling_id != ue->scramblingID_pdcch){
ue->scramblingID_pdcch = scrambling_id; ue->scramblingID_pdcch = scrambling_id;
nr_gold_pdcch(ue,ue->scramblingID_pdcch); nr_gold_pdcch(&ue->frame_parms,ue->nr_gold_pdcch[gNB_id],ue->scramblingID_pdcch);
} }
int dmrs_ref = 0; int dmrs_ref = 0;
if (coreset->CoreSetType == NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG) if (coreset->CoreSetType == NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG)
dmrs_ref = BWPStart; dmrs_ref = BWPStart;
// generate pilot // generate pilot
int pilot[(nb_rb_coreset + dmrs_ref) * 3] __attribute__((aligned(16))); int pilot[(nb_rb_coreset + dmrs_ref) * 3] __attribute__((aligned(16)));
nr_pdcch_dmrs_rx(ue,Ns,ue->nr_gold_pdcch[gNB_id][Ns][symbol], &pilot[0],2000,(nb_rb_coreset+dmrs_ref)); if (pscch_flag ==0)
nr_pdcch_dmrs_rx(ue,Ns,ue->nr_gold_pdcch[gNB_id][Ns][symbol], &pilot[0],2000,(nb_rb_coreset+dmrs_ref));
else
nr_pdcch_dmrs_rx(ue,Ns,ue->nr_gold_pscch[Ns][symbol], &pilot[0],2000,(nb_rb_coreset+dmrs_ref));
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) { for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
......
...@@ -203,7 +203,7 @@ static void nr_pdcch_demapping_deinterleaving(int pscch_flag, ...@@ -203,7 +203,7 @@ static void nr_pdcch_demapping_deinterleaving(int pscch_flag,
} }
} // pscch_flag == 0 } // pscch_flag == 0
else { //this will need to be changed a bit when we scan for multiple SCI else { //this will need to be changed a bit when we scan for multiple SCI
memcpy(e_rx,llr,coreset_nbr_rb*coreset_time_dur*data_sc*sizeof(uint32_t)); memcpy(e_rx,llr+(data_sc*coreset_nbr_rb),coreset_nbr_rb*coreset_time_dur*data_sc*sizeof(uint32_t));
} }
} }
} }
...@@ -410,10 +410,11 @@ void nr_pdcch_extract_rbs_single(uint32_t rxdataF_sz, ...@@ -410,10 +410,11 @@ void nr_pdcch_extract_rbs_single(uint32_t rxdataF_sz,
c_rb_by6 = c_rb/6; c_rb_by6 = c_rb/6;
// skip zeros in frequency domain bitmap // skip zeros in frequency domain bitmap
while ((coreset_freq_dom[c_rb_by6>>3] & (1<<(7-(c_rb_by6&7)))) == 0) { if (coreset_freq_dom)
c_rb+=6; while ((coreset_freq_dom[c_rb_by6>>3] & (1<<(7-(c_rb_by6&7)))) == 0) {
c_rb_by6 = c_rb/6; c_rb+=6;
} c_rb_by6 = c_rb/6;
}
rxF=NULL; rxF=NULL;
...@@ -703,10 +704,10 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, ...@@ -703,10 +704,10 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
memset(llr, 0, sizeof(llr)); memset(llr, 0, sizeof(llr));
LOG_D(PHY,"pdcch coreset: freq %x, n_rb %d, rb_offset %d\n", LOG_I(NR_PHY,"pdcch coreset: freq %x, n_rb %d, rb_offset %d\n",
rel15->coreset.frequency_domain_resource[0],n_rb,rb_offset); rel15->coreset.frequency_domain_resource[0],n_rb,rb_offset);
for (int s=rel15->coreset.StartSymbolIndex; s<(rel15->coreset.StartSymbolIndex+rel15->coreset.duration); s++) { for (int s=rel15->coreset.StartSymbolIndex; s<(rel15->coreset.StartSymbolIndex+rel15->coreset.duration); s++) {
LOG_D(PHY,"in nr_pdcch_extract_rbs_single(rxdataF -> rxdataF_ext || dl_ch_estimates -> dl_ch_estimates_ext)\n"); LOG_D(NR_PHY,"in nr_pdcch_extract_rbs_single(rxdataF -> rxdataF_ext || dl_ch_estimates -> dl_ch_estimates_ext)\n");
nr_pdcch_extract_rbs_single(ue->frame_parms.samples_per_slot_wCP, nr_pdcch_extract_rbs_single(ue->frame_parms.samples_per_slot_wCP,
rxdataF, rxdataF,
...@@ -717,10 +718,12 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, ...@@ -717,10 +718,12 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
pdcch_dl_ch_estimates_ext, pdcch_dl_ch_estimates_ext,
s, s,
frame_parms, frame_parms,
rel15->coreset.frequency_domain_resource, pscch_flag ==0 ? rel15->coreset.frequency_domain_resource : NULL,
n_rb, n_rb,
rel15->BWPStart); rel15->BWPStart);
if (pscch_flag == 1)
LOG_I(NR_PHY,"PSCCH: %d.%d rx level0_%d %d ch_level0_%d %d\n",proc->frame_rx,proc->nr_slot_rx, s, dB_fixed(signal_energy_nodc(&rxdataF_ext[0][s*n_rb*NBR_RE_PER_RB_WITH_DMRS],n_rb*NBR_RE_PER_RB_WITH_DMRS)),s,dB_fixed(signal_energy_nodc(&pdcch_dl_ch_estimates_ext[0][s*n_rb*NBR_RE_PER_RB_WITH_DMRS],n_rb*NBR_RE_PER_RB_WITH_DMRS)));
LOG_D(PHY,"we enter nr_pdcch_channel_level(avgP=%d) => compute channel level based on ofdm symbol 0, pdcch_vars[eNB_id]->dl_ch_estimates_ext\n",*avgP); LOG_D(PHY,"we enter nr_pdcch_channel_level(avgP=%d) => compute channel level based on ofdm symbol 0, pdcch_vars[eNB_id]->dl_ch_estimates_ext\n",*avgP);
LOG_D(PHY,"in nr_pdcch_channel_level(dl_ch_estimates_ext -> dl_ch_estimates_ext)\n"); LOG_D(PHY,"in nr_pdcch_channel_level(dl_ch_estimates_ext -> dl_ch_estimates_ext)\n");
// compute channel level based on ofdm symbol 0 // compute channel level based on ofdm symbol 0
...@@ -779,9 +782,6 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, ...@@ -779,9 +782,6 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
// T_INT(n_pdcch_symbols), // T_INT(n_pdcch_symbols),
// T_BUFFER(pdcch_vars[eNB_id]->rxdataF_comp, frame_parms->N_RB_DL*12*n_pdcch_symbols* 4)); // T_BUFFER(pdcch_vars[eNB_id]->rxdataF_comp, frame_parms->N_RB_DL*12*n_pdcch_symbols* 4));
#endif
#ifdef DEBUG_DCI_DECODING
printf("demapping: slot %u, mi %d\n",slot,get_mi(frame_parms,slot));
#endif #endif
} }
...@@ -851,7 +851,7 @@ static uint16_t nr_dci_false_detection(uint64_t *dci, ...@@ -851,7 +851,7 @@ static uint16_t nr_dci_false_detection(uint64_t *dci,
) { ) {
uint32_t encoder_output[NR_MAX_DCI_SIZE_DWORD]; uint32_t encoder_output[NR_MAX_DCI_SIZE_DWORD];
polar_encoder_fast(dci, (void*)encoder_output, rnti, 1, polar_encoder_fast(dci, (void*)encoder_output, NULL,rnti, 1,
messageType, messageLength, aggregation_level); messageType, messageLength, aggregation_level);
uint8_t *enout_p = (uint8_t*)encoder_output; uint8_t *enout_p = (uint8_t*)encoder_output;
uint16_t x = 0; uint16_t x = 0;
...@@ -873,7 +873,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, ...@@ -873,7 +873,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,
int pscch_flag, int pscch_flag,
int16_t *pdcch_e_rx, int16_t *pdcch_e_rx,
fapi_nr_dci_indication_t *dci_ind, void *ind,
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15) { fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15) {
//int gNB_id = 0; //int gNB_id = 0;
...@@ -881,6 +881,11 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, ...@@ -881,6 +881,11 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
rnti_t n_rnti; rnti_t n_rnti;
int e_rx_cand_idx = 0; int e_rx_cand_idx = 0;
fapi_nr_dci_indication_t *dci_ind=NULL;
sl_nr_sci_indication_t *sci_ind=NULL;
if (pscch_flag == 0) dci_ind = (fapi_nr_dci_indication_t*)ind;
else sci_ind = (sl_nr_sci_indication_t *)ind;
for (int j=0;j<rel15->number_of_candidates;j++) { for (int j=0;j<rel15->number_of_candidates;j++) {
int CCEind = rel15->CCE[j]; int CCEind = rel15->CCE[j];
int L = rel15->L[j]; int L = rel15->L[j];
...@@ -891,11 +896,13 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, ...@@ -891,11 +896,13 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
// skip this candidate if we've already found one with the // skip this candidate if we've already found one with the
// same rnti and format at a different aggregation level // same rnti and format at a different aggregation level
int dci_found=0; int dci_found=0;
for (int ind=0;ind < dci_ind->number_of_dcis ; ind++) { if (dci_ind) {
if (rel15->rnti== dci_ind->dci_list[ind].rnti && for (int ind=0;ind < dci_ind->number_of_dcis ; ind++) {
rel15->dci_format_options[k]==dci_ind->dci_list[ind].dci_format) { if (rel15->rnti== dci_ind->dci_list[ind].rnti &&
dci_found=1; rel15->dci_format_options[k]==dci_ind->dci_list[ind].dci_format) {
break; dci_found=1;
break;
}
} }
} }
if (dci_found == 1) if (dci_found == 1)
...@@ -910,44 +917,63 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, ...@@ -910,44 +917,63 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
nr_pdcch_unscrambling(&pdcch_e_rx[e_rx_cand_idx], rel15->coreset.scrambling_rnti, pscch_flag==0 ? L*108 : L*18, rel15->coreset.pdcch_dmrs_scrambling_id, tmp_e); nr_pdcch_unscrambling(&pdcch_e_rx[e_rx_cand_idx], rel15->coreset.scrambling_rnti, pscch_flag==0 ? L*108 : L*18, rel15->coreset.pdcch_dmrs_scrambling_id, tmp_e);
#ifdef DEBUG_DCI_DECODING #ifdef DEBUG_DCI_DECODING
uint32_t *z = (uint32_t *) &e_rx[e_rx_cand_idx]; uint32_t *z = (uint32_t *) &pdcch_e_rx[e_rx_cand_idx];
for (int index_z = 0; index_z < L*6; index_z++){ for (int index_z = 0; index_z < (pscch_flag == 0 ? L*6 : L); index_z++){
for (int i=0; i<9; i++) { for (int i=0; i<9; i++) {
LOG_I(PHY,"z[%d]=(%d,%d) \n", (9*index_z + i), *(int16_t *) &z[9*index_z + i],*(1 + (int16_t *) &z[9*index_z + i])); LOG_I(PHY,"z[%d]=(%d,%d) \n", (9*index_z + i), *(int16_t *) &z[9*index_z + i],*(1 + (int16_t *) &z[9*index_z + i]));
} }
} }
#endif #endif
uint16_t Nid;
uint16_t crc = polar_decoder_int16(tmp_e, uint16_t crc = polar_decoder_int16(tmp_e,
dci_estimation, dci_estimation,
&Nid,
1, 1,
pscch_flag == 0 ? NR_POLAR_DCI_MESSAGE_TYPE : NR_POLAR_SCI_MESSAGE_TYPE, dci_length, L); pscch_flag == 0 ? NR_POLAR_DCI_MESSAGE_TYPE : NR_POLAR_SCI_MESSAGE_TYPE, dci_length, L);
n_rnti = rel15->rnti; n_rnti = rel15->rnti;
LOG_D(PHY, "(%i.%i) dci indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d,payload %llx )\n", LOG_D(PHY, "(%i.%i) %s indication (rnti %x,format %s,n_CCE %d,payloadSize %d,payload %llx )\n",
proc->frame_rx, proc->nr_slot_rx,n_rnti,nr_dci_format_string[rel15->dci_format_options[k]],CCEind,dci_length, *(unsigned long long*)dci_estimation); proc->frame_rx, proc->nr_slot_rx,pscch_flag==0?"dci":"sci",n_rnti,pscch_flag==0?nr_dci_format_string[rel15->dci_format_options[k]]:"1A",CCEind,dci_length, *(unsigned long long*)dci_estimation);
if (crc == n_rnti) { if (crc == n_rnti) {
LOG_D(PHY, "(%i.%i) Received dci indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d,payload %llx)\n", LOG_I(PHY, "(%i.%i) Received %s indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d,payload %llx)\n",
proc->frame_rx, proc->nr_slot_rx,n_rnti,nr_dci_format_string[rel15->dci_format_options[k]],CCEind,dci_length,*(unsigned long long*)dci_estimation); proc->frame_rx, proc->nr_slot_rx,pscch_flag==0?"dci":"sci",n_rnti,pscch_flag==0?nr_dci_format_string[rel15->dci_format_options[k]]:"1A",CCEind,dci_length,*(unsigned long long*)dci_estimation);
uint16_t mb = nr_dci_false_detection(dci_estimation,tmp_e,pscch_flag==0?L*108:L*18,n_rnti, NR_POLAR_DCI_MESSAGE_TYPE, dci_length, L); uint16_t mb = nr_dci_false_detection(dci_estimation,tmp_e,pscch_flag==0?L*108:L*18,n_rnti, pscch_flag==0?NR_POLAR_DCI_MESSAGE_TYPE:NR_POLAR_SCI_MESSAGE_TYPE, dci_length, L);
ue->dci_thres = (ue->dci_thres + mb) / 2; ue->dci_thres = (ue->dci_thres + mb) / 2;
if (mb > (ue->dci_thres+30)) { if (mb > (ue->dci_thres+30)) {
LOG_W(PHY,"DCI false positive. Dropping DCI index %d. Mismatched bits: %d/%d. Current DCI threshold: %d\n",j,mb,pscch_flag==0?L*108:L*18,ue->dci_thres); LOG_W(PHY,"DCI false positive. Dropping DCI index %d. Mismatched bits: %d/%d. Current DCI threshold: %d\n",j,mb,pscch_flag==0?L*108:L*18,ue->dci_thres);
continue; continue;
} else { } else {
dci_ind->SFN = proc->frame_rx; if (pscch_flag == 0) {
dci_ind->slot = proc->nr_slot_rx; dci_ind->SFN = proc->frame_rx;
dci_ind->dci_list[dci_ind->number_of_dcis].rnti = n_rnti; dci_ind->slot = proc->nr_slot_rx;
dci_ind->dci_list[dci_ind->number_of_dcis].n_CCE = CCEind; dci_ind->dci_list[dci_ind->number_of_dcis].rnti = n_rnti;
dci_ind->dci_list[dci_ind->number_of_dcis].N_CCE = L; dci_ind->dci_list[dci_ind->number_of_dcis].n_CCE = CCEind;
dci_ind->dci_list[dci_ind->number_of_dcis].dci_format = rel15->dci_format_options[k]; dci_ind->dci_list[dci_ind->number_of_dcis].N_CCE = L;
dci_ind->dci_list[dci_ind->number_of_dcis].ss_type = rel15->dci_type_options[k]; dci_ind->dci_list[dci_ind->number_of_dcis].dci_format = rel15->dci_format_options[k];
dci_ind->dci_list[dci_ind->number_of_dcis].coreset_type = rel15->coreset.CoreSetType; dci_ind->dci_list[dci_ind->number_of_dcis].ss_type = rel15->dci_type_options[k];
int n_rb, rb_offset; dci_ind->dci_list[dci_ind->number_of_dcis].coreset_type = rel15->coreset.CoreSetType;
get_coreset_rballoc(rel15->coreset.frequency_domain_resource, &n_rb, &rb_offset); int n_rb, rb_offset;
dci_ind->dci_list[dci_ind->number_of_dcis].cset_start = rel15->BWPStart + rb_offset; get_coreset_rballoc(rel15->coreset.frequency_domain_resource, &n_rb, &rb_offset);
dci_ind->dci_list[dci_ind->number_of_dcis].payloadSize = dci_length; dci_ind->dci_list[dci_ind->number_of_dcis].cset_start = rel15->BWPStart + rb_offset;
memcpy((void*)dci_ind->dci_list[dci_ind->number_of_dcis].payloadBits,(void*)dci_estimation,8); dci_ind->dci_list[dci_ind->number_of_dcis].payloadSize = dci_length;
dci_ind->number_of_dcis++; memcpy((void*)dci_ind->dci_list[dci_ind->number_of_dcis].payloadBits,(void*)dci_estimation,8);
dci_ind->number_of_dcis++;
}
else {
sci_ind->sfn = proc->frame_rx;
sci_ind->slot = proc->nr_slot_rx;
sci_ind->sensing_result = 0;
sci_ind->pssch_rsrp = 0; // need to get this from the inner receiver
sci_ind->sci_pdu[sci_ind->number_of_SCIs].sci_format_type = SL_SCI_FORMAT_1A_ON_PSCCH;
sci_ind->sci_pdu[sci_ind->number_of_SCIs].subch_index = 0;
sci_ind->sci_pdu[sci_ind->number_of_SCIs].pscch_rsrp = 0; // need to get from inner rx
sci_ind->sci_pdu[sci_ind->number_of_SCIs].sci_payloadlen = dci_length;
sci_ind->sci_pdu[sci_ind->number_of_SCIs].Nid = Nid;
memcpy(sci_ind->sci_pdu[sci_ind->number_of_SCIs].sci_payloadBits,&dci_estimation,8);
sci_ind->number_of_SCIs++;
}
break; // If DCI is found, no need to check for remaining DCI lengths break; // If DCI is found, no need to check for remaining DCI lengths
} }
} else { } else {
...@@ -956,7 +982,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, ...@@ -956,7 +982,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
} }
e_rx_cand_idx += 9*L*6*2; //e_rx index for next candidate (L CCEs, 6 REGs per CCE and 9 REs per REG and 2 uint16_t per RE) e_rx_cand_idx += 9*L*6*2; //e_rx index for next candidate (L CCEs, 6 REGs per CCE and 9 REs per REG and 2 uint16_t per RE)
} }
return(dci_ind->number_of_dcis); return(dci_ind ? dci_ind->number_of_dcis : sci_ind->number_of_SCIs);
} }
...@@ -330,7 +330,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, ...@@ -330,7 +330,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
// compute the scramblingID_pdcch and the gold pdcch // compute the scramblingID_pdcch and the gold pdcch
ue->scramblingID_pdcch = fp->Nid_cell; ue->scramblingID_pdcch = fp->Nid_cell;
nr_gold_pdcch(ue,fp->Nid_cell); nr_gold_pdcch(&ue->frame_parms,ue->nr_gold_pdcch[0],fp->Nid_cell);
// compute the scrambling IDs for PDSCH DMRS // compute the scrambling IDs for PDSCH DMRS
for (int i=0; i<NR_NB_NSCID; i++) { for (int i=0; i<NR_NB_NSCID; i++) {
......
...@@ -505,7 +505,7 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue, ...@@ -505,7 +505,7 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue,
0, 0, pbch_a_prime, &pbch_a_interleaved); 0, 0, pbch_a_prime, &pbch_a_interleaved);
//polar decoding de-rate matching //polar decoding de-rate matching
uint64_t tmp=0; uint64_t tmp=0;
decoderState = polar_decoder_int16(pbch_e_rx,(uint64_t *)&tmp,0, decoderState = polar_decoder_int16(pbch_e_rx,(uint64_t *)&tmp,NULL,0,
NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL); NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL);
pbch_a_prime = tmp; pbch_a_prime = tmp;
......
...@@ -228,7 +228,7 @@ int nr_rx_psbch(PHY_VARS_NR_UE *ue, ...@@ -228,7 +228,7 @@ int nr_rx_psbch(PHY_VARS_NR_UE *ue,
0, 0, 0, NULL); 0, 0, 0, NULL);
//polar decoding de-rate matching //polar decoding de-rate matching
uint64_t tmp=0; uint64_t tmp=0;
decoderState = polar_decoder_int16(psbch_e_rx,(uint64_t *)&tmp,0, decoderState = polar_decoder_int16(psbch_e_rx,(uint64_t *)&tmp,NULL,0,
SL_NR_POLAR_PSBCH_MESSAGE_TYPE, SL_NR_POLAR_PSBCH_PAYLOAD_BITS, SL_NR_POLAR_PSBCH_AGGREGATION_LEVEL); SL_NR_POLAR_PSBCH_MESSAGE_TYPE, SL_NR_POLAR_PSBCH_PAYLOAD_BITS, SL_NR_POLAR_PSBCH_AGGREGATION_LEVEL);
...@@ -265,4 +265,4 @@ int nr_rx_psbch(PHY_VARS_NR_UE *ue, ...@@ -265,4 +265,4 @@ int nr_rx_psbch(PHY_VARS_NR_UE *ue,
LOG_D(PHY, "PSBCH RX SL-MIB:%x, decoded DFN:slot %d:%d, %x\n",psbch_payload, DFN, slot_offset, *(uint32_t *)decoded_output); LOG_D(PHY, "PSBCH RX SL-MIB:%x, decoded DFN:slot %d:%d, %x\n",psbch_payload, DFN, slot_offset, *(uint32_t *)decoded_output);
return 0; return 0;
} }
\ No newline at end of file
...@@ -172,7 +172,7 @@ void sl_generate_and_map_psbch(struct complex16 *txF, uint32_t *payload, uint16_ ...@@ -172,7 +172,7 @@ void sl_generate_and_map_psbch(struct complex16 *txF, uint32_t *payload, uint16_
#endif #endif
/// CRC, coding and rate matching /// CRC, coding and rate matching
polar_encoder_fast(&psbch_a_reversed, (void*)encoder_output, 0, 0, polar_encoder_fast(&psbch_a_reversed, (void*)encoder_output, NULL, 0, 0,
SL_NR_POLAR_PSBCH_MESSAGE_TYPE, SL_NR_POLAR_PSBCH_MESSAGE_TYPE,
SL_NR_POLAR_PSBCH_PAYLOAD_BITS, SL_NR_POLAR_PSBCH_PAYLOAD_BITS,
SL_NR_POLAR_PSBCH_AGGREGATION_LEVEL); SL_NR_POLAR_PSBCH_AGGREGATION_LEVEL);
......
...@@ -43,19 +43,19 @@ ...@@ -43,19 +43,19 @@
#include "T.h" #include "T.h"
void nr_generate_dci(void *gNB, PHY_VARS_NR_UE *ue, uint32_t nr_generate_dci(void *gNB, PHY_VARS_NR_UE *ue,
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15, nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
int32_t *txdataF, int32_t *txdataF,
int16_t amp, int16_t amp,
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
int slot); int slot);
void nr_generate_sci1(const PHY_VARS_NR_UE *ue, uint32_t nr_generate_sci1(const PHY_VARS_NR_UE *ue,
c16_t *txdataF, c16_t *txdataF,
const NR_DL_FRAME_PARMS *frame_parms, const NR_DL_FRAME_PARMS *frame_parms,
const int16_t amp, const int16_t amp,
const int nr_slot_tx, const int nr_slot_tx,
const sl_nr_tx_config_pscch_pssch_pdu_t *pscch_pssch_pdu) const sl_nr_tx_config_pscch_pssch_pdu_t *pscch_pssch_pdu)
{ {
nfapi_nr_dl_tti_pdcch_pdu_rel15_t pdcch_pdu_rel15={0}; nfapi_nr_dl_tti_pdcch_pdu_rel15_t pdcch_pdu_rel15={0};
...@@ -68,8 +68,8 @@ void nr_generate_sci1(const PHY_VARS_NR_UE *ue, ...@@ -68,8 +68,8 @@ void nr_generate_sci1(const PHY_VARS_NR_UE *ue,
pdcch_pdu_rel15.dci_pdu[0].ScramblingId = pscch_pssch_pdu->pscch_dmrs_scrambling_id; pdcch_pdu_rel15.dci_pdu[0].ScramblingId = pscch_pssch_pdu->pscch_dmrs_scrambling_id;
pdcch_pdu_rel15.dci_pdu[0].PayloadSizeBits = pscch_pssch_pdu->pscch_sci_payload_len; pdcch_pdu_rel15.dci_pdu[0].PayloadSizeBits = pscch_pssch_pdu->pscch_sci_payload_len;
// for SCI we put the number of PRBs in the FAPI AggregationLevel field // for SCI we put the number of PRBs in the FAPI AggregationLevel field
pdcch_pdu_rel15.dci_pdu[0].AggregationLevel = pscch_pssch_pdu->pscch_numrbs; pdcch_pdu_rel15.dci_pdu[0].AggregationLevel = pscch_pssch_pdu->pscch_numrbs*pscch_pssch_pdu->pscch_numsym;
pdcch_pdu_rel15.dci_pdu[0].ScramblingRNTI = 1010; pdcch_pdu_rel15.dci_pdu[0].ScramblingRNTI = 1010;
*(uint64_t*)pdcch_pdu_rel15.dci_pdu[0].Payload = *(uint64_t *)pscch_pssch_pdu->pscch_sci_payload; *(uint64_t*)pdcch_pdu_rel15.dci_pdu[0].Payload = *(uint64_t *)pscch_pssch_pdu->pscch_sci_payload;
nr_generate_dci(NULL,(PHY_VARS_NR_UE *)ue,&pdcch_pdu_rel15,(int32_t *)txdataF,amp,(NR_DL_FRAME_PARMS*)frame_parms,nr_slot_tx); return(nr_generate_dci(NULL,(PHY_VARS_NR_UE *)ue,&pdcch_pdu_rel15,(int32_t *)txdataF,amp,(NR_DL_FRAME_PARMS*)frame_parms,nr_slot_tx));
} }
...@@ -211,6 +211,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -211,6 +211,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
NR_UE_ULSCH_t *ulsch, NR_UE_ULSCH_t *ulsch,
sl_nr_tx_config_pscch_pssch_pdu_t *pscch_pssch_pdu,
NR_DL_FRAME_PARMS* frame_parms, NR_DL_FRAME_PARMS* frame_parms,
uint8_t harq_pid, uint8_t harq_pid,
unsigned int G); unsigned int G);
...@@ -252,7 +253,7 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE, ...@@ -252,7 +253,7 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE,
const uint8_t slot, const uint8_t slot,
const NR_DL_FRAME_PARMS *frame_parms, const NR_DL_FRAME_PARMS *frame_parms,
const uint8_t n_antenna_ports, const uint8_t n_antenna_ports,
c16_t **txdataF); c16_t **txdataF, uint32_t linktype);
int8_t clean_UE_ulsch(PHY_VARS_NR_UE *UE, uint8_t gNB_id); int8_t clean_UE_ulsch(PHY_VARS_NR_UE *UE, uint8_t gNB_id);
...@@ -369,7 +370,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, ...@@ -369,7 +370,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,
int pscch_flag, int pscch_flag,
int16_t *pdcch_e_rx, int16_t *pdcch_e_rx,
fapi_nr_dci_indication_t *dci_ind, void *ind,
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15); fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15);
...@@ -428,12 +429,12 @@ void nr_tx_psbch(PHY_VARS_NR_UE *UE, uint32_t frame_tx, uint32_t slot_tx, ...@@ -428,12 +429,12 @@ void nr_tx_psbch(PHY_VARS_NR_UE *UE, uint32_t frame_tx, uint32_t slot_tx,
int sl_nr_slss_search(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc, int num_frames); int sl_nr_slss_search(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc, int num_frames);
void nr_generate_sci1(const PHY_VARS_NR_UE *ue, uint32_t nr_generate_sci1(const PHY_VARS_NR_UE *ue,
c16_t *txdataF, c16_t *txdataF,
const NR_DL_FRAME_PARMS *frame_parms, const NR_DL_FRAME_PARMS *frame_parms,
const int16_t amp, const int16_t amp,
const int nr_slot_tx, const int nr_slot_tx,
const sl_nr_tx_config_pscch_pssch_pdu_t *pscch_pssch_pdu); const sl_nr_tx_config_pscch_pssch_pdu_t *pscch_pssch_pdu);
/**@}*/ /**@}*/
#endif #endif
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
NR_UE_ULSCH_t *ulsch, NR_UE_ULSCH_t *ulsch,
sl_nr_tx_config_pscch_pssch_pdu_t *pscch_pssch_pdu,
NR_DL_FRAME_PARMS* frame_parms, NR_DL_FRAME_PARMS* frame_parms,
uint8_t harq_pid, uint8_t harq_pid,
unsigned int G) { unsigned int G) {
...@@ -54,28 +55,33 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, ...@@ -54,28 +55,33 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
unsigned int crc = 1; unsigned int crc = 1;
NR_UL_UE_HARQ_t *harq_process = &ue->ul_harq_processes[harq_pid]; NR_UL_UE_HARQ_t *harq_process = &ue->ul_harq_processes[harq_pid];
uint16_t nb_rb = ulsch->pusch_pdu.rb_size; uint16_t nb_rb = pscch_pssch_pdu == NULL ? ulsch->pusch_pdu.rb_size : pscch_pssch_pdu->l_subch * pscch_pssch_pdu->subchannel_size;
uint32_t A = ulsch->pusch_pdu.pusch_data.tb_size<<3; uint32_t A = (pscch_pssch_pdu == NULL ? ulsch->pusch_pdu.pusch_data.tb_size : pscch_pssch_pdu->tb_size)<<3;
uint32_t *pz = &harq_process->Z; uint32_t *pz = &harq_process->Z;
uint8_t mod_order = ulsch->pusch_pdu.qam_mod_order; uint8_t mod_order = pscch_pssch_pdu == NULL ? ulsch->pusch_pdu.qam_mod_order : pscch_pssch_pdu->mod_order;
int ndi = pscch_pssch_pdu==NULL ? ulsch->pusch_pdu.pusch_data.new_data_indicator:pscch_pssch_pdu->ndi;
int num_layers = pscch_pssch_pdu == NULL ? ulsch->pusch_pdu.nrOfLayers:pscch_pssch_pdu->num_layers;
int rv_index = pscch_pssch_pdu == NULL ? ulsch->pusch_pdu.pusch_data.rv_index:pscch_pssch_pdu->rv_index;
int tbslbrm = pscch_pssch_pdu==NULL?ulsch->pusch_pdu.tbslbrm:pscch_pssch_pdu->tbslbrm;
uint16_t Kr=0; uint16_t Kr=0;
uint32_t r_offset=0; uint32_t r_offset=0;
uint32_t F=0; uint32_t F=0;
// target_code_rate is in 0.1 units // target_code_rate is in 0.1 units
float Coderate = (float) ulsch->pusch_pdu.target_code_rate / 10240.0f; float Coderate = (float) (pscch_pssch_pdu == NULL ? ulsch->pusch_pdu.target_code_rate : pscch_pssch_pdu->target_coderate) / 10240.0f;
/////////// ///////////
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_UE_ULSCH_ENCODING, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_UE_ULSCH_ENCODING, VCD_FUNCTION_IN);
LOG_D(NR_PHY, "ulsch coding nb_rb %d, Nl = %d\n", nb_rb, ulsch->pusch_pdu.nrOfLayers); LOG_D(NR_PHY, "ulsch coding nb_rb %d, Nl = %d\n", nb_rb, num_layers);
LOG_D(NR_PHY, "ulsch coding A %d G %d mod_order %d Coderate %f\n", A, G, mod_order, Coderate); LOG_D(NR_PHY, "ulsch coding A %d G %d mod_order %d Coderate %f\n", A, G, mod_order, Coderate);
LOG_D(NR_PHY, "harq_pid %d harq_process->ndi %d, pusch_data.new_data_indicator %d\n", LOG_D(NR_PHY, "harq_pid %d harq_process->ndi %d, pusch_data.new_data_indicator %d\n",
harq_pid,harq_process->ndi,ulsch->pusch_pdu.pusch_data.new_data_indicator); harq_pid,harq_process->ndi,ndi);
if (harq_process->first_tx == 1 || if (harq_process->first_tx == 1 ||
harq_process->ndi != ulsch->pusch_pdu.pusch_data.new_data_indicator) { // this is a new packet harq_process->ndi != ndi) { // this is a new packet
#ifdef DEBUG_ULSCH_CODING #ifdef DEBUG_ULSCH_CODING
printf("encoding thinks this is a new packet \n"); printf("encoding thinks this is a new packet \n");
#endif #endif
...@@ -90,7 +96,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, ...@@ -90,7 +96,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
printf("\n"); printf("\n");
*/ */
int max_payload_bytes = MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER*ulsch->pusch_pdu.nrOfLayers*1056; int max_payload_bytes = MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER*num_layers*1056;
if (A > 3824) { if (A > 3824) {
// Add 24-bit crc (polynomial A) to payload // Add 24-bit crc (polynomial A) to payload
...@@ -145,7 +151,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, ...@@ -145,7 +151,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
&harq_process->F, &harq_process->F,
harq_process->BG); harq_process->BG);
if (harq_process->C>MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*ulsch->pusch_pdu.nrOfLayers) { if (harq_process->C>MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*num_layers) {
LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d\n",harq_process->C,harq_process->B); LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d\n",harq_process->C,harq_process->B);
return(-1); return(-1);
} }
...@@ -217,8 +223,8 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, ...@@ -217,8 +223,8 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
/////////// ///////////
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
LOG_D(PHY,"setting ndi to %d from pusch_data\n", ulsch->pusch_pdu.pusch_data.new_data_indicator); LOG_D(PHY,"setting ndi to %d from pusch_data\n", ndi);
harq_process->ndi = ulsch->pusch_pdu.pusch_data.new_data_indicator; harq_process->ndi = ndi;
} }
F = harq_process->F; F = harq_process->F;
Kr = harq_process->K; Kr = harq_process->K;
...@@ -238,17 +244,17 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, ...@@ -238,17 +244,17 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
G, G,
Kr*3, Kr*3,
mod_order,nb_rb, mod_order,nb_rb,
ulsch->pusch_pdu.pusch_data.rv_index); rv_index);
//start_meas(rm_stats); //start_meas(rm_stats);
///////////////////////// d---->| Rate matching bit selection |---->e ///////////////////////// ///////////////////////// d---->| Rate matching bit selection |---->e /////////////////////////
/////////// ///////////
uint32_t E = nr_get_E(G, harq_process->C, mod_order, ulsch->pusch_pdu.nrOfLayers, r); uint32_t E = nr_get_E(G, harq_process->C, mod_order, num_layers, r);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RATE_MATCHING_LDPC, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RATE_MATCHING_LDPC, VCD_FUNCTION_IN);
start_meas(&ue->ulsch_rate_matching_stats); start_meas(&ue->ulsch_rate_matching_stats);
if (nr_rate_matching_ldpc(ulsch->pusch_pdu.tbslbrm, if (nr_rate_matching_ldpc(tbslbrm,
harq_process->BG, harq_process->BG,
*pz, *pz,
harq_process->d[r], harq_process->d[r],
......
...@@ -93,6 +93,55 @@ void nr_pusch_codeword_scrambling_uci(uint8_t *in, ...@@ -93,6 +93,55 @@ void nr_pusch_codeword_scrambling_uci(uint8_t *in,
} }
} }
void nr_pusch_codeword_scrambling_sci(uint32_t *in,
uint32_t size,
uint32_t Nid,
uint32_t* out)
{
uint8_t reset, b_idx;
uint32_t x1 = 0, x2 = 0, s = 0, temp_out = 0;
reset = 1;
x2 = (Nid<<15) + 1010;
for (int i=0; i<size; i++) {
b_idx = i&0x1f;
if (b_idx==0) {
s = lte_gold_generic(&x1, &x2, reset);
reset = 0;
if (i)
out++;
}
*out ^= (((in[i])&1) ^ ((s>>b_idx)&1))<<b_idx;
//printf("i %d b_idx %d in %d s 0x%08x out 0x%08x\n", i, b_idx, in[i], s, *out);
}
}
void nr_pusch_codeword_scrambling_sci_2layer(uint32_t *in,
uint32_t size,
uint32_t Nid,
uint32_t* out)
{
uint8_t reset, b_idx;
uint32_t x1 = 0, x2 = 0, s = 0, temp_out = 0;
reset = 1;
x2 = (Nid<<15) + 1010;
for (int i=0; i<size; i+=4) {
b_idx = i&0x1f;
if (b_idx==0) {
s = lte_gold_generic(&x1, &x2, reset);
reset = 0;
if (i)
out++;
}
*out ^= (((in[i])&1) ^ ((s>>b_idx)&1))<<b_idx;
*out ^= (((in[i+1])&1) ^ ((s>>(b_idx+1))&1))<<(b_idx+1);
*out ^= (((in[i])&1) ^ ((s>>b_idx)&1))<<(b_idx+2);
*out ^= (((in[i+1])&1) ^ ((s>>(b_idx+1))&1))<<(b_idx+3);
//printf("i %d b_idx %d in %d s 0x%08x out 0x%08x\n", i, b_idx, in[i], s, *out);
}
}
void nr_pusch_codeword_scrambling(uint8_t *in, void nr_pusch_codeword_scrambling(uint8_t *in,
uint32_t size, uint32_t size,
uint32_t Nid, uint32_t Nid,
...@@ -106,6 +155,8 @@ void nr_pusch_codeword_scrambling(uint8_t *in, ...@@ -106,6 +155,8 @@ void nr_pusch_codeword_scrambling(uint8_t *in,
nr_codeword_scrambling(in, size, 0, Nid, n_RNTI, out); nr_codeword_scrambling(in, size, 0, Nid, n_RNTI, out);
} }
int dmrs_pscch_mask[2] = {7,15} ;
void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
const unsigned char harq_pid, const unsigned char harq_pid,
const uint32_t frame, const uint32_t frame,
...@@ -122,26 +173,26 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -122,26 +173,26 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
int i; int i;
int sample_offsetF, N_RE_prime; int sample_offsetF, N_RE_prime;
NR_DL_FRAME_PARMS *frame_parms = &UE->frame_parms;
int N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig int N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig
uint16_t number_dmrs_symbols = 0; uint16_t number_dmrs_symbols = 0;
NR_UE_ULSCH_t *ulsch_ue = &phy_data->ulsch; NR_UE_ULSCH_t *ulsch_ue = &phy_data->ulsch;
sl_nr_tx_config_pscch_pssch_pdu_t *pscch_pssch_pdu = &phy_data->nr_sl_pssch_pscch_pdu;
NR_UL_UE_HARQ_t *harq_process_ul_ue = &UE->ul_harq_processes[harq_pid]; NR_UL_UE_HARQ_t *harq_process_ul_ue = &UE->ul_harq_processes[harq_pid];
const nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &ulsch_ue->pusch_pdu; const nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &ulsch_ue->pusch_pdu;
int start_symbol = pusch_pdu->start_symbol_index; NR_DL_FRAME_PARMS *frame_parms = pscch_pssch_pdu == NULL ? &UE->frame_parms : &UE->SL_UE_PHY_PARAMS.sl_frame_params;
uint16_t ul_dmrs_symb_pos = pusch_pdu->ul_dmrs_symb_pos; int start_symbol = pscch_pssch_pdu == NULL ? pusch_pdu->start_symbol_index : (1+pscch_pssch_pdu->pssch_startsym);
uint8_t number_of_symbols = pusch_pdu->nr_of_symbols; uint16_t ul_dmrs_symb_pos = pscch_pssch_pdu == NULL ? pusch_pdu->ul_dmrs_symb_pos : pscch_pssch_pdu->dmrs_symbol_position;
uint8_t dmrs_type = pusch_pdu->dmrs_config_type; uint8_t number_of_symbols = pscch_pssch_pdu == NULL ? pusch_pdu->nr_of_symbols : pscch_pssch_pdu->pssch_numsym;
uint16_t start_rb = pusch_pdu->rb_start; uint8_t dmrs_type = pscch_pssch_pdu == NULL ? pusch_pdu->dmrs_config_type : pusch_dmrs_type1;
uint16_t nb_rb = pusch_pdu->rb_size; uint16_t start_rb = pscch_pssch_pdu == NULL ? pusch_pdu->rb_start : pscch_pssch_pdu->startrb;
uint8_t Nl = pusch_pdu->nrOfLayers; uint16_t nb_rb = pscch_pssch_pdu == NULL ? pusch_pdu->rb_size : pscch_pssch_pdu->l_subch * pscch_pssch_pdu->subchannel_size;
uint8_t mod_order = pusch_pdu->qam_mod_order; uint8_t Nl = pscch_pssch_pdu == NULL ? pusch_pdu->nrOfLayers : pscch_pssch_pdu->num_layers;
uint16_t rnti = pusch_pdu->rnti; uint8_t mod_order = pscch_pssch_pdu == NULL ? pusch_pdu->qam_mod_order : pscch_pssch_pdu->mod_order;
uint8_t cdm_grps_no_data = pusch_pdu->num_dmrs_cdm_grps_no_data; uint16_t rnti = pscch_pssch_pdu == NULL ? pusch_pdu->rnti : 0;
uint16_t start_sc = frame_parms->first_carrier_offset + (start_rb+pusch_pdu->bwp_start)*NR_NB_SC_PER_RB; uint8_t cdm_grps_no_data = pscch_pssch_pdu == NULL ? pusch_pdu->num_dmrs_cdm_grps_no_data : 1;
uint16_t start_sc = frame_parms->first_carrier_offset + (start_rb+(pscch_pssch_pdu == NULL ? pusch_pdu->bwp_start:0))*NR_NB_SC_PER_RB;
if (start_sc >= frame_parms->ofdm_symbol_size) if (start_sc >= frame_parms->ofdm_symbol_size)
start_sc -= frame_parms->ofdm_symbol_size; start_sc -= frame_parms->ofdm_symbol_size;
...@@ -156,7 +207,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -156,7 +207,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
nb_dmrs_re_per_rb = ((dmrs_type == pusch_dmrs_type1) ? 6:4)*cdm_grps_no_data; nb_dmrs_re_per_rb = ((dmrs_type == pusch_dmrs_type1) ? 6:4)*cdm_grps_no_data;
LOG_D(PHY,"ulsch TX %x : start_rb %d nb_rb %d mod_order %d Nl %d Tpmi %d bwp_start %d start_sc %d start_symbol %d num_symbols %d cdmgrpsnodata %d num_dmrs %d dmrs_re_per_rb %d\n", LOG_D(PHY,"ulsch TX %x : start_rb %d nb_rb %d mod_order %d Nl %d Tpmi %d bwp_start %d start_sc %d start_symbol %d num_symbols %d cdmgrpsnodata %d num_dmrs %d dmrs_re_per_rb %d\n",
rnti,start_rb,nb_rb,mod_order,Nl,pusch_pdu->Tpmi,pusch_pdu->bwp_start,start_sc,start_symbol,number_of_symbols,cdm_grps_no_data,number_dmrs_symbols,nb_dmrs_re_per_rb); rnti,start_rb,nb_rb,mod_order,Nl,pscch_pssch_pdu==NULL?pusch_pdu->Tpmi:0,pscch_pssch_pdu==NULL?pusch_pdu->bwp_start:0,start_sc,start_symbol,number_of_symbols,cdm_grps_no_data,number_dmrs_symbols,nb_dmrs_re_per_rb);
// TbD num_of_mod_symbols is set but never used // TbD num_of_mod_symbols is set but never used
N_RE_prime = NR_NB_SC_PER_RB*number_of_symbols - nb_dmrs_re_per_rb*number_dmrs_symbols - N_PRB_oh; N_RE_prime = NR_NB_SC_PER_RB*number_of_symbols - nb_dmrs_re_per_rb*number_dmrs_symbols - N_PRB_oh;
harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb; harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb;
...@@ -164,18 +215,39 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -164,18 +215,39 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
/////////////////////////ULSCH coding///////////////////////// /////////////////////////ULSCH coding/////////////////////////
/////////// ///////////
unsigned int G = nr_get_G(nb_rb, number_of_symbols, int sci2_re = pscch_pssch_pdu ? get_NREsci2(pscch_pssch_pdu->sci2_alpha_times_100,
nb_dmrs_re_per_rb, number_dmrs_symbols, mod_order, Nl); pscch_pssch_pdu->sci2_payload_len,
pscch_pssch_pdu->sci2_beta_offset,
pscch_pssch_pdu->pssch_numsym,
pscch_pssch_pdu->pscch_numsym,
pscch_pssch_pdu->pscch_numrbs,
pscch_pssch_pdu->l_subch,
pscch_pssch_pdu->subchannel_size,
pscch_pssch_pdu->mcs,
pscch_pssch_pdu->mcs_table): 0 ;
int sci1_dmrs_overlap = pscch_pssch_pdu ? pscch_pssch_pdu->dmrs_symbol_position & dmrs_pscch_mask[pscch_pssch_pdu->pscch_numsym] : 0;
unsigned int G = (pscch_pssch_pdu==NULL) ? nr_get_G(nb_rb, number_of_symbols,
nb_dmrs_re_per_rb, number_dmrs_symbols, mod_order, Nl):
nr_get_G_SL(nb_rb, number_of_symbols,6,number_dmrs_symbols,sci1_dmrs_overlap,pscch_pssch_pdu->pscch_numsym,pscch_pssch_pdu->pscch_numrbs,sci2_re,mod_order,Nl);
uint32_t Gsci2 = sci2_re*2*Nl;
trace_NRpdu(DIRECTION_UPLINK, trace_NRpdu(DIRECTION_UPLINK,
harq_process_ul_ue->a, harq_process_ul_ue->a,
pusch_pdu->pusch_data.tb_size, pscch_pssch_pdu==NULL?pusch_pdu->pusch_data.tb_size:pscch_pssch_pdu->tb_size,
WS_C_RNTI, rnti, frame, slot, 0, 0); WS_C_RNTI, rnti, frame, slot, 0, 0);
if (nr_ulsch_encoding(UE, ulsch_ue, frame_parms, harq_pid, G) == -1) if (nr_ulsch_encoding(UE, ulsch_ue, pscch_pssch_pdu,frame_parms, harq_pid, G) == -1)
return; return;
uint32_t sci2_encoded_output[sci2_re];
if (pscch_pssch_pdu) {
// do SCI2 encoding
polar_encoder_fast((uint64_t*)pscch_pssch_pdu->sci2_payload, (void*)sci2_encoded_output, NULL,0, 1,
NR_POLAR_SCI2_MESSAGE_TYPE,
pscch_pssch_pdu->sci2_payload_len, sci2_re);
}
/////////// ///////////
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
...@@ -185,15 +257,28 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -185,15 +257,28 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
uint32_t available_bits = G; uint32_t available_bits = G;
uint32_t scrambled_output[(available_bits>>5)+1]; uint32_t scrambled_output[(available_bits>>5)+1];
uint32_t scrambled_output_sci[(Gsci2>>5)+1];
memset(scrambled_output, 0, ((available_bits>>5)+1)*sizeof(uint32_t)); memset(scrambled_output, 0, ((available_bits>>5)+1)*sizeof(uint32_t));
memset(scrambled_output_sci, 0, ((available_bits>>5)+1)*sizeof(uint32_t));
nr_pusch_codeword_scrambling(harq_process_ul_ue->f, nr_pusch_codeword_scrambling(harq_process_ul_ue->f,
available_bits, G,
ulsch_ue->Nid_cell, pscch_pssch_pdu==NULL ? ulsch_ue->Nid_cell : phy_data->pscch_Nid,
rnti, pscch_pssch_pdu==NULL ? rnti : 1010,
false, false,
scrambled_output); scrambled_output);
if (pscch_pssch_pdu && Nl==1)
nr_pusch_codeword_scrambling_sci(sci2_encoded_output,
Gsci2,
phy_data->pscch_Nid,
scrambled_output_sci);
else if (pscch_pssch_pdu)
nr_pusch_codeword_scrambling_sci_2layer(sci2_encoded_output,
Gsci2,
phy_data->pscch_Nid,
scrambled_output_sci);
///////////// /////////////
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
...@@ -203,11 +288,25 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -203,11 +288,25 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
int max_num_re = Nl*number_of_symbols*nb_rb*NR_NB_SC_PER_RB; int max_num_re = Nl*number_of_symbols*nb_rb*NR_NB_SC_PER_RB;
int32_t d_mod[max_num_re] __attribute__ ((aligned(16))); int32_t d_mod[max_num_re] __attribute__ ((aligned(16)));
nr_modulation(scrambled_output, // assume one codeword for the moment if (Gsci2 > 0) {
available_bits, nr_modulation(scrambled_output_sci, // assume one codeword for the moment
mod_order, Gsci2,
(int16_t *)d_mod); 2,
(int16_t *)d_mod);
int32_t d_mod2[max_num_re] __attribute__ ((aligned(16)));
nr_modulation(scrambled_output, // assume one codeword for the moment
available_bits,
mod_order,
(int16_t *)d_mod2);
LOG_I(NR_PHY,"SCI bits %d (sci2_re %d), PSSCH bits %d (PSCCH RE %d), max_re %d\n",Gsci2,sci2_re,available_bits,available_bits/mod_order,max_num_re);
memcpy(d_mod+sci2_re,d_mod2,available_bits*sizeof(int)/mod_order);
}
else
nr_modulation(scrambled_output, // assume one codeword for the moment
available_bits,
mod_order,
(int16_t *)d_mod);
/////////// ///////////
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
...@@ -215,10 +314,10 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -215,10 +314,10 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
/////////////////////////DMRS Modulation///////////////////////// /////////////////////////DMRS Modulation/////////////////////////
/////////// ///////////
if(pusch_pdu->ul_dmrs_scrambling_id != UE->scramblingID_ulsch[pusch_pdu->scid]) { if(!pscch_pssch_pdu && pusch_pdu->ul_dmrs_scrambling_id != UE->scramblingID_ulsch[pusch_pdu->scid]) {
UE->scramblingID_ulsch[pusch_pdu->scid] = pusch_pdu->ul_dmrs_scrambling_id; UE->scramblingID_ulsch[pusch_pdu->scid] = pusch_pdu->ul_dmrs_scrambling_id;
nr_init_pusch_dmrs(UE, pusch_pdu->scid, pusch_pdu->ul_dmrs_scrambling_id); nr_init_pusch_dmrs(UE, pusch_pdu->scid, pusch_pdu->ul_dmrs_scrambling_id);
} }
uint32_t ***pusch_dmrs = UE->nr_gold_pusch_dmrs[slot]; uint32_t ***pusch_dmrs = UE->nr_gold_pusch_dmrs[slot];
uint16_t n_dmrs = (pusch_pdu->bwp_start + start_rb + nb_rb)*((dmrs_type == pusch_dmrs_type1) ? 6:4); uint16_t n_dmrs = (pusch_pdu->bwp_start + start_rb + nb_rb)*((dmrs_type == pusch_dmrs_type1) ? 6:4);
...@@ -235,7 +334,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -235,7 +334,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
uint8_t L_ptrs, K_ptrs = 0; uint8_t L_ptrs, K_ptrs = 0;
uint16_t beta_ptrs = 1; // temp value until power control is implemented uint16_t beta_ptrs = 1; // temp value until power control is implemented
if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { if (!pscch_pssch_pdu && (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS)) {
K_ptrs = pusch_pdu->pusch_ptrs.ptrs_freq_density; K_ptrs = pusch_pdu->pusch_ptrs.ptrs_freq_density;
L_ptrs = 1<<pusch_pdu->pusch_ptrs.ptrs_time_density; L_ptrs = 1<<pusch_pdu->pusch_ptrs.ptrs_time_density;
...@@ -263,7 +362,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -263,7 +362,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
nr_ue_layer_mapping((int16_t *)d_mod, nr_ue_layer_mapping((int16_t *)d_mod,
Nl, Nl,
available_bits/mod_order, (available_bits/mod_order)+sci2_re,
tx_layers); tx_layers);
/////////// ///////////
...@@ -373,6 +472,10 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -373,6 +472,10 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
uint8_t is_dmrs_sym = 0; uint8_t is_dmrs_sym = 0;
uint8_t is_ptrs_sym = 0; uint8_t is_ptrs_sym = 0;
uint16_t dmrs_idx = 0, ptrs_idx = 0; uint16_t dmrs_idx = 0, ptrs_idx = 0;
int is_pscch_sym = 0;
if (pscch_pssch_pdu && l<(start_symbol + pscch_pssch_pdu->pscch_numsym)) {
is_pscch_sym = 1;
}
if ((ul_dmrs_symb_pos >> l) & 0x01) { if ((ul_dmrs_symb_pos >> l) & 0x01) {
is_dmrs_sym = 1; is_dmrs_sym = 1;
...@@ -387,7 +490,13 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -387,7 +490,13 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
// TODO: performance improvement, we can skip the modulation of DMRS symbols outside the bandwidth part // TODO: performance improvement, we can skip the modulation of DMRS symbols outside the bandwidth part
// Perform this on gold sequence, not required when SC FDMA operation is done, // Perform this on gold sequence, not required when SC FDMA operation is done,
LOG_D(PHY,"DMRS in symbol %d\n",l); LOG_D(PHY,"DMRS in symbol %d\n",l);
nr_modulation(pusch_dmrs[l][pusch_pdu->scid], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated if (pscch_pssch_pdu == NULL)
nr_modulation(pusch_dmrs[l][pusch_pdu->scid], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
else {
uint32_t pssch_dmrs[((frame_parms->N_RB_UL * 12) >> 5) + 1];
nr_init_pssch_dmrs_oneshot(frame_parms,phy_data->pscch_Nid,pssch_dmrs,slot,l);
nr_modulation(pssch_dmrs, n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
}
} else { } else {
dmrs_idx = 0; dmrs_idx = 0;
} }
...@@ -404,6 +513,14 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -404,6 +513,14 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
for (i=0; i< nb_rb*NR_NB_SC_PER_RB; i++) { for (i=0; i< nb_rb*NR_NB_SC_PER_RB; i++) {
uint8_t is_dmrs = 0; uint8_t is_dmrs = 0;
uint8_t is_ptrs = 0; uint8_t is_ptrs = 0;
if (is_pscch_sym && i==(pscch_pssch_pdu->startrb)) {
i+=(pscch_pssch_pdu->pscch_numrbs*NR_NB_SC_PER_RB);
k+=(pscch_pssch_pdu->pscch_numrbs*NR_NB_SC_PER_RB);
if (is_dmrs_sym) {
dmrs_idx+=(6*pscch_pssch_pdu->pscch_numrbs);
n+=(3*pscch_pssch_pdu->pscch_numrbs);
}
}
sample_offsetF = l*frame_parms->ofdm_symbol_size + k; sample_offsetF = l*frame_parms->ofdm_symbol_size + k;
...@@ -591,15 +708,18 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE, ...@@ -591,15 +708,18 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE,
const uint8_t slot, const uint8_t slot,
const NR_DL_FRAME_PARMS *frame_parms, const NR_DL_FRAME_PARMS *frame_parms,
const uint8_t n_antenna_ports, const uint8_t n_antenna_ports,
c16_t **txdataF) c16_t **txdataF,
uint32_t linktype)
{ {
const int tx_offset = frame_parms->get_samples_slot_timestamp(slot, frame_parms, 0); const int tx_offset = frame_parms->get_samples_slot_timestamp(slot, frame_parms, 0);
c16_t **txdata = UE->common_vars.txData; c16_t **txdata = UE->common_vars.txData;
LOG_I(NR_PHY,"Applying TX rotation for slot %d linktype %d\n",slot,linktype);
for(int ap = 0; ap < n_antenna_ports; ap++) { for(int ap = 0; ap < n_antenna_ports; ap++) {
apply_nr_rotation_TX(frame_parms, apply_nr_rotation_TX(frame_parms,
txdataF[ap], txdataF[ap],
frame_parms->symbol_rotation[1], frame_parms->symbol_rotation[linktype],
slot, slot,
frame_parms->N_RB_UL, frame_parms->N_RB_UL,
0, 0,
......
...@@ -645,7 +645,7 @@ static void nr_uci_encoding(uint64_t payload, ...@@ -645,7 +645,7 @@ static void nr_uci_encoding(uint64_t payload,
AssertFatal(nrofPRB<=16,"Number of PRB >16\n"); AssertFatal(nrofPRB<=16,"Number of PRB >16\n");
} else if (A>=12) { } else if (A>=12) {
AssertFatal(A<65,"Polar encoding not supported yet for UCI with more than 64 bits\n"); AssertFatal(A<65,"Polar encoding not supported yet for UCI with more than 64 bits\n");
polar_encoder_fast(&payload, b, 0,0, polar_encoder_fast(&payload, b, NULL,0,0,
NR_POLAR_UCI_PUCCH_MESSAGE_TYPE, NR_POLAR_UCI_PUCCH_MESSAGE_TYPE,
A, A,
nrofPRB); nrofPRB);
......
...@@ -657,7 +657,10 @@ typedef struct { ...@@ -657,7 +657,10 @@ typedef struct {
sl_nr_ue_phy_params_t SL_UE_PHY_PARAMS; sl_nr_ue_phy_params_t SL_UE_PHY_PARAMS;
bool phy_config_request_sent; bool phy_config_request_sent;
int pscch_dmrs_gold_init; int pscch_dmrs_gold_init;
/// PDCCH DMRS for TX
uint32_t ***nr_gold_pscch_dmrs; uint32_t ***nr_gold_pscch_dmrs;
/// PSCCH DMRS for RX
uint32_t ***nr_gold_pscch;
} PHY_VARS_NR_UE; } PHY_VARS_NR_UE;
typedef struct { typedef struct {
...@@ -684,6 +687,7 @@ typedef struct nr_phy_data_tx_s { ...@@ -684,6 +687,7 @@ typedef struct nr_phy_data_tx_s {
sl_nr_tx_config_type_enum_t sl_tx_action; sl_nr_tx_config_type_enum_t sl_tx_action;
sl_nr_tx_config_psbch_pdu_t psbch_vars; sl_nr_tx_config_psbch_pdu_t psbch_vars;
sl_nr_tx_config_pscch_pssch_pdu_t nr_sl_pssch_pscch_pdu; sl_nr_tx_config_pscch_pssch_pdu_t nr_sl_pssch_pscch_pdu;
uint32_t pscch_Nid;
sl_nr_tx_config_psfch_pdu_t nr_sl_psfch_pdu; sl_nr_tx_config_psfch_pdu_t nr_sl_psfch_pdu;
} nr_phy_data_tx_t; } nr_phy_data_tx_t;
......
...@@ -707,12 +707,12 @@ int8_t sl_handle_scheduled_response(nr_scheduled_response_t *scheduled_response) ...@@ -707,12 +707,12 @@ int8_t sl_handle_scheduled_response(nr_scheduled_response_t *scheduled_response)
case SL_NR_CONFIG_TYPE_RX_PSCCH: case SL_NR_CONFIG_TYPE_RX_PSCCH:
phy_data->sl_rx_action = SL_NR_CONFIG_TYPE_RX_PSCCH; phy_data->sl_rx_action = SL_NR_CONFIG_TYPE_RX_PSCCH;
phy_data->nr_sl_pscch_pdu = sl_rx_config->sl_rx_config_list[0].rx_pscch_config_pdu; phy_data->nr_sl_pscch_pdu = sl_rx_config->sl_rx_config_list[0].rx_pscch_config_pdu;
LOG_D(PHY, "Recvd CONFIG_TYPE_RX_PSCCH\n"); LOG_D(NR_PHY, "Recvd CONFIG_TYPE_RX_PSCCH\n");
break; break;
case SL_NR_CONFIG_TYPE_RX_PSSCH_SCI: case SL_NR_CONFIG_TYPE_RX_PSSCH_SCI:
phy_data->sl_rx_action = SL_NR_CONFIG_TYPE_RX_PSSCH_SCI; phy_data->sl_rx_action = SL_NR_CONFIG_TYPE_RX_PSSCH_SCI;
phy_data->nr_sl_pssch_sci_pdu = sl_rx_config->sl_rx_config_list[0].rx_sci2_config_pdu; phy_data->nr_sl_pssch_sci_pdu = sl_rx_config->sl_rx_config_list[0].rx_sci2_config_pdu;
LOG_D(PHY, "Recvd CONFIG_TYPE_RX_PSCCH\n"); LOG_I(NR_PHY, "Recvd CONFIG_TYPE_RX_PSSCH\n");
break; break;
default: default:
AssertFatal(0,"Incorrect sl_rx config req pdutype \n"); AssertFatal(0,"Incorrect sl_rx config req pdutype \n");
......
...@@ -291,7 +291,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, n ...@@ -291,7 +291,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, n
pucch_procedures_ue_nr(ue, proc, phy_data, (c16_t **)&txdataF); pucch_procedures_ue_nr(ue, proc, phy_data, (c16_t **)&txdataF);
LOG_D(PHY, "Sending Uplink data \n"); LOG_D(PHY, "Sending Uplink data \n");
nr_ue_pusch_common_procedures(ue, proc->nr_slot_tx, &ue->frame_parms, ue->frame_parms.nb_antennas_tx, (c16_t **)txdataF); nr_ue_pusch_common_procedures(ue, proc->nr_slot_tx, &ue->frame_parms, ue->frame_parms.nb_antennas_tx, (c16_t **)txdataF,link_type_ul);
nr_ue_prach_procedures(ue, proc); nr_ue_prach_procedures(ue, proc);
...@@ -433,7 +433,10 @@ int nr_ue_pdcch_procedures(PHY_VARS_NR_UE *ue, ...@@ -433,7 +433,10 @@ int nr_ue_pdcch_procedures(PHY_VARS_NR_UE *ue,
int nr_slot_rx = proc->nr_slot_rx; int nr_slot_rx = proc->nr_slot_rx;
unsigned int dci_cnt=0; unsigned int dci_cnt=0;
fapi_nr_dci_indication_t dci_ind = {0}; fapi_nr_dci_indication_t dci_ind = {0};
sl_nr_sci_indication_t sci_ind = {0};
nr_downlink_indication_t dl_indication; nr_downlink_indication_t dl_indication;
nr_sidelink_indication_t sl_indication;
NR_UE_PDCCH_CONFIG *phy_pdcch_config = &phy_data->phy_pdcch_config; NR_UE_PDCCH_CONFIG *phy_pdcch_config = &phy_data->phy_pdcch_config;
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &phy_pdcch_config->pdcch_config[n_ss]; fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &phy_pdcch_config->pdcch_config[n_ss];
...@@ -456,7 +459,7 @@ int nr_ue_pdcch_procedures(PHY_VARS_NR_UE *ue, ...@@ -456,7 +459,7 @@ int nr_ue_pdcch_procedures(PHY_VARS_NR_UE *ue,
n_ss); n_ss);
#endif #endif
dci_cnt = nr_dci_decoding_procedure(ue, proc, pscch_flag, pdcch_e_rx, &dci_ind, rel15); dci_cnt = nr_dci_decoding_procedure(ue, proc, pscch_flag, pdcch_e_rx, pscch_flag==0 ? (void*)&dci_ind : (void*)&sci_ind, rel15);
#ifdef NR_PDCCH_SCHED_DEBUG #ifdef NR_PDCCH_SCHED_DEBUG
LOG_I(PHY,"<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> Ending function nr_dci_decoding_procedure() -> dci_cnt=%u\n",dci_cnt); LOG_I(PHY,"<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> Ending function nr_dci_decoding_procedure() -> dci_cnt=%u\n",dci_cnt);
...@@ -465,21 +468,35 @@ int nr_ue_pdcch_procedures(PHY_VARS_NR_UE *ue, ...@@ -465,21 +468,35 @@ int nr_ue_pdcch_procedures(PHY_VARS_NR_UE *ue,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DCI_DECODING, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DCI_DECODING, VCD_FUNCTION_OUT);
for (int i=0; i<dci_cnt; i++) { for (int i=0; i<dci_cnt; i++) {
LOG_D(PHY,"[UE %d] AbsSubFrame %d.%d: DCI %i of %d total DCIs found --> rnti %x : format %d\n", if (pscch_flag==0)
ue->Mod_id,frame_rx%1024,nr_slot_rx, LOG_D(PHY,"[UE %d] AbsSubFrame %d.%d: DCI %i of %d total DCIs found --> rnti %x : format %d\n",
i + 1, ue->Mod_id,frame_rx%1024,nr_slot_rx,
dci_cnt, i + 1,
dci_ind.dci_list[i].rnti, dci_cnt,
dci_ind.dci_list[i].dci_format); dci_ind.dci_list[i].rnti,
dci_ind.dci_list[i].dci_format);
else
LOG_D(PHY,"[UE %d] AbsSubFrame %d.%d: SCI 1A %i of %d total SCIs found \n",
ue->Mod_id,frame_rx%1024,nr_slot_rx,
i + 1,
dci_cnt);
} }
dci_ind.number_of_dcis = dci_cnt; if (pscch_flag == 0) {
dci_ind.number_of_dcis = dci_cnt;
// fill dl_indication message
nr_fill_dl_indication(&dl_indication, &dci_ind, NULL, proc, ue, phy_data);
// send to mac
ue->if_inst->dl_indication(&dl_indication);
// fill dl_indication message
nr_fill_dl_indication(&dl_indication, &dci_ind, NULL, proc, ue, phy_data);
// send to mac
ue->if_inst->dl_indication(&dl_indication);
}
else {
sci_ind.number_of_SCIs = dci_cnt;
// fill sl_indication message
nr_fill_sl_indication(&sl_indication, NULL, &sci_ind, proc, ue, phy_data);
// send to mac
ue->if_inst->sl_indication(&sl_indication);
}
stop_meas(&ue->dlsch_rx_pdcch_stats); stop_meas(&ue->dlsch_rx_pdcch_stats);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PDCCH_PROCEDURES, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PDCCH_PROCEDURES, VCD_FUNCTION_OUT);
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "PHY/MODULATION/modulation_UE.h" #include "PHY/MODULATION/modulation_UE.h"
#include "PHY/NR_UE_ESTIMATION/nr_estimation.h" #include "PHY/NR_UE_ESTIMATION/nr_estimation.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
#include "executables/nr-uesoftmodem.h"
void nr_fill_sl_indication(nr_sidelink_indication_t *sl_ind, void nr_fill_sl_indication(nr_sidelink_indication_t *sl_ind,
sl_nr_rx_indication_t *rx_ind, sl_nr_rx_indication_t *rx_ind,
...@@ -200,7 +201,7 @@ void psbch_pscch_processing(PHY_VARS_NR_UE *ue, ...@@ -200,7 +201,7 @@ void psbch_pscch_processing(PHY_VARS_NR_UE *ue,
proc, proc,
sym, sym,
rxdataF, rxdataF,
link_type_ul); link_type_sl);
start_meas(&sl_phy_params->channel_estimation_stats); start_meas(&sl_phy_params->channel_estimation_stats);
nr_pbch_channel_estimation(ue, nr_pbch_channel_estimation(ue,
...@@ -260,7 +261,7 @@ void psbch_pscch_processing(PHY_VARS_NR_UE *ue, ...@@ -260,7 +261,7 @@ void psbch_pscch_processing(PHY_VARS_NR_UE *ue,
LOG_I(NR_PHY,"============================================\n"); LOG_I(NR_PHY,"============================================\n");
} }
} }
else if (phy_data->sl_rx_action == SL_NR_CONFIG_TYPE_RX_PSCCH){ else if (phy_data->sl_rx_action == SL_NR_CONFIG_TYPE_RX_PSCCH && !get_nrUE_params()->sync_ref){
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &phy_data->phy_pdcch_config.pdcch_config[0]; fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &phy_data->phy_pdcch_config.pdcch_config[0];
LOG_I(NR_PHY,"pscch_numsym = %d\n",phy_data->nr_sl_pscch_pdu.pscch_numsym); LOG_I(NR_PHY,"pscch_numsym = %d\n",phy_data->nr_sl_pscch_pdu.pscch_numsym);
...@@ -285,12 +286,13 @@ void psbch_pscch_processing(PHY_VARS_NR_UE *ue, ...@@ -285,12 +286,13 @@ void psbch_pscch_processing(PHY_VARS_NR_UE *ue,
rel15->coreset.RegBundleSize = 0; rel15->coreset.RegBundleSize = 0;
rel15->coreset.duration = phy_data->nr_sl_pscch_pdu.pscch_numsym; rel15->coreset.duration = phy_data->nr_sl_pscch_pdu.pscch_numsym;
rel15->coreset.pdcch_dmrs_scrambling_id = phy_data->nr_sl_pscch_pdu.pscch_dmrs_scrambling_id; rel15->coreset.pdcch_dmrs_scrambling_id = phy_data->nr_sl_pscch_pdu.pscch_dmrs_scrambling_id;
rel15->coreset.scrambling_rnti = 0; rel15->coreset.scrambling_rnti = 1010;
rel15->coreset.tci_present_in_dci = 0; rel15->coreset.tci_present_in_dci = 0;
rel15->number_of_candidates = phy_data->nr_sl_pscch_pdu.l_subch; rel15->number_of_candidates = phy_data->nr_sl_pscch_pdu.l_subch;
rel15->num_dci_options = 1; rel15->num_dci_options = 1;
rel15->dci_length_options[0] = phy_data->nr_sl_pscch_pdu.sci_1a_length; rel15->dci_length_options[0] = phy_data->nr_sl_pscch_pdu.sci_1a_length;
LOG_I(NR_PHY,"PSCCH_PDU SCI 1A length %d\n",rel15->dci_length_options[0]);
// L now provides the number of PRBs used by PSCCH instead of the number of CCEs // L now provides the number of PRBs used by PSCCH instead of the number of CCEs
rel15->L[0] = phy_data->nr_sl_pscch_pdu.pscch_numrbs * phy_data->nr_sl_pscch_pdu.pscch_numsym; rel15->L[0] = phy_data->nr_sl_pscch_pdu.pscch_numrbs * phy_data->nr_sl_pscch_pdu.pscch_numsym;
// This provides the offset of the candidate of PSCCH in RBs instead of CCEs // This provides the offset of the candidate of PSCCH in RBs instead of CCEs
...@@ -306,7 +308,7 @@ void psbch_pscch_processing(PHY_VARS_NR_UE *ue, ...@@ -306,7 +308,7 @@ void psbch_pscch_processing(PHY_VARS_NR_UE *ue,
proc, proc,
1+sym, 1+sym,
rxdataF, rxdataF,
link_type_ul); link_type_sl);
nr_pdcch_channel_estimation(ue, nr_pdcch_channel_estimation(ue,
proc, proc,
1, 1,
...@@ -319,10 +321,28 @@ void psbch_pscch_processing(PHY_VARS_NR_UE *ue, ...@@ -319,10 +321,28 @@ void psbch_pscch_processing(PHY_VARS_NR_UE *ue,
rxdataF); rxdataF);
} }
nr_ue_pdcch_procedures(ue, proc, 1, pscch_est_size, pscch_dl_ch_estimates, phy_data, 0, rxdataF); nr_ue_pdcch_procedures(ue, proc, 1, pscch_est_size, pscch_dl_ch_estimates, phy_data, 0, rxdataF);
LOG_I(NR_PHY,"returned from nr_ue_pdcch_procedures\n");
}
if (phy_data->sl_rx_action == SL_NR_CONFIG_TYPE_RX_PSSCH_SCI && !get_nrUE_params()->sync_ref){
LOG_I(NR_PHY,"sci2_len = %d\n",phy_data->nr_sl_pssch_sci_pdu.sci2_len);
LOG_I(NR_PHY,"sci2_beta_offset = %d\n",phy_data->nr_sl_pssch_sci_pdu.sci2_beta_offset);
LOG_I(NR_PHY,"sci2_alpha_times_100= %d\n",phy_data->nr_sl_pssch_sci_pdu.sci2_alpha_times_100);
LOG_I(NR_PHY,"pssch_targetCodeRate = %d\n",phy_data->nr_sl_pssch_sci_pdu.targetCodeRate);
LOG_I(NR_PHY,"pssch_num_layers = %d\n",phy_data->nr_sl_pssch_sci_pdu.num_layers);
LOG_I(NR_PHY,"dmrs_symbol_position = %d\n",phy_data->nr_sl_pssch_sci_pdu.dmrs_symbol_position);
LOG_I(NR_PHY,"Nid = %x\n",phy_data->nr_sl_pssch_sci_pdu.Nid);
LOG_I(NR_PHY,"startrb = %d\n",phy_data->nr_sl_pssch_sci_pdu.startrb);
LOG_I(NR_PHY,"pscch_numsym = %d\n",phy_data->nr_sl_pssch_sci_pdu.pscch_numsym);
LOG_I(NR_PHY,"pscch_numrbs = %d\n",phy_data->nr_sl_pssch_sci_pdu.pscch_numrbs);
LOG_I(NR_PHY,"num_subch= %d\n",phy_data->nr_sl_pssch_sci_pdu.num_subch);
LOG_I(NR_PHY,"subchannel_size = %d\n",phy_data->nr_sl_pssch_sci_pdu.subchannel_size);
LOG_I(NR_PHY,"l_subch = %d\n",phy_data->nr_sl_pssch_sci_pdu.l_subch);
LOG_I(NR_PHY,"pssch_numsym = %d\n",phy_data->nr_sl_pssch_sci_pdu.pssch_numsym);
LOG_I(NR_PHY,"sense_pssch = %d\n",phy_data->nr_sl_pssch_sci_pdu.sense_pssch);
} }
UEscopeCopy(ue, commonRxdataF, rxdataF, sizeof(int32_t), fp->nb_antennas_rx, rxdataF_sz, 0); UEscopeCopy(ue, commonRxdataF, rxdataF, sizeof(int32_t), fp->nb_antennas_rx, rxdataF_sz, 0);
} }
...@@ -372,19 +392,24 @@ int phy_procedures_nrUE_SL_TX(PHY_VARS_NR_UE *ue, ...@@ -372,19 +392,24 @@ int phy_procedures_nrUE_SL_TX(PHY_VARS_NR_UE *ue,
} }
else if (phy_data->sl_tx_action == SL_NR_CONFIG_TYPE_TX_PSCCH_PSSCH) { else if (phy_data->sl_tx_action == SL_NR_CONFIG_TYPE_TX_PSCCH_PSSCH) {
LOG_I(NR_PHY,"Generating PSCCH (%d.%d)\n",frame_tx,slot_tx); LOG_I(NR_PHY,"Generating PSCCH (%d.%d)\n",frame_tx,slot_tx);
phy_data->pscch_Nid = nr_generate_sci1(ue,txdataF[0],fp,AMP,slot_tx,&phy_data->nr_sl_pssch_pscch_pdu) &0xFFFF;
nr_generate_sci1(ue,txdataF[0],fp,AMP,slot_tx,&phy_data->nr_sl_pssch_pscch_pdu); nr_ue_ulsch_procedures(ue,0,frame_tx,slot_tx,0,phy_data,txdataF);
tx_action = 1;
} }
else if (phy_data->sl_tx_action == SL_NR_CONFIG_TYPE_TX_PSFCH) { else if (phy_data->sl_tx_action == SL_NR_CONFIG_TYPE_TX_PSFCH) {
LOG_I(NR_PHY,"Generating PSFCH ( )\n"); LOG_I(NR_PHY,"Generating PSFCH ( )\n");
} }
if (tx_action) { if (tx_action) {
LOG_D(PHY, "Sending Uplink data \n"); LOG_D(PHY, "Sending SL data \n");
nr_ue_pusch_common_procedures(ue, nr_ue_pusch_common_procedures(ue,
proc->nr_slot_tx, proc->nr_slot_tx,
fp, fp,
fp->nb_antennas_tx, fp->nb_antennas_tx,
txdataF); txdataF, link_type_sl);
} }
LOG_D(PHY,"****** end Sidelink TX-Chain for AbsSubframe %d.%d ******\n", LOG_D(PHY,"****** end Sidelink TX-Chain for AbsSubframe %d.%d ******\n",
......
...@@ -846,7 +846,7 @@ int main(int argc, char **argv) ...@@ -846,7 +846,7 @@ int main(int argc, char **argv)
// compute the scramblingID_pdcch and the gold pdcch // compute the scramblingID_pdcch and the gold pdcch
UE->scramblingID_pdcch = frame_parms->Nid_cell; UE->scramblingID_pdcch = frame_parms->Nid_cell;
nr_gold_pdcch(UE, frame_parms->Nid_cell); nr_gold_pdcch(&UE->frame_parms, UE->nr_gold_pdcch[0],frame_parms->Nid_cell);
// compute the scrambling IDs for PDSCH DMRS // compute the scrambling IDs for PDSCH DMRS
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
......
...@@ -470,6 +470,8 @@ int sl_nr_ue_slot_select(sl_nr_phy_config_request_t *cfg, ...@@ -470,6 +470,8 @@ int sl_nr_ue_slot_select(sl_nr_phy_config_request_t *cfg,
int nr_frame, int nr_slot, int nr_frame, int nr_slot,
uint8_t frame_duplex_type); uint8_t frame_duplex_type);
int nr_ue_process_sci1_indication_pdu(NR_UE_MAC_INST_t *mac,module_id_t mod_id,frame_t frame, int slot, sl_nr_sci_indication_pdu_t *sci,void *phy_data);
void nr_ue_sidelink_scheduler(nr_sidelink_indication_t *sl_ind); void nr_ue_sidelink_scheduler(nr_sidelink_indication_t *sl_ind);
void nr_mac_rrc_sl_mib_ind(const module_id_t module_id, void nr_mac_rrc_sl_mib_ind(const module_id_t module_id,
......
...@@ -3472,7 +3472,7 @@ void nr_ue_sidelink_scheduler(nr_sidelink_indication_t *sl_ind) { ...@@ -3472,7 +3472,7 @@ void nr_ue_sidelink_scheduler(nr_sidelink_indication_t *sl_ind) {
uint8_t mask = mac->sl_rx_res_pool->ext1->sl_TimeResource_r16->buf[slot_mod_period>>3]; uint8_t mask = mac->sl_rx_res_pool->ext1->sl_TimeResource_r16->buf[slot_mod_period>>3];
if (((1<<slot_mod_period) % mask) == 0) rx_allowed=false; if (((1<<slot_mod_period) % mask) == 0) rx_allowed=false;
} }
if (sl_ind->slot_type==SIDELINK_SLOT_TYPE_TX) rx_allowed=false; if (sl_ind->slot_type==SIDELINK_SLOT_TYPE_TX || sl_ind->phy_data==NULL) rx_allowed=false;
if (((get_nrUE_params()->sync_ref && sl_ind->slot_rx > 9) || if (((get_nrUE_params()->sync_ref && sl_ind->slot_rx > 9) ||
(!get_nrUE_params()->sync_ref && sl_ind->slot_rx < 10)) && rx_allowed) { (!get_nrUE_params()->sync_ref && sl_ind->slot_rx < 10)) && rx_allowed) {
LOG_I(NR_MAC,"Scheduling PSCCH RX processing slot %d, sync_ref %d\n",slot,get_nrUE_params()->sync_ref); LOG_I(NR_MAC,"Scheduling PSCCH RX processing slot %d, sync_ref %d\n",slot,get_nrUE_params()->sync_ref);
......
...@@ -134,10 +134,12 @@ uint32_t nr_sci_size(const NR_SL_ResourcePool_r16_t *sl_res_pool, ...@@ -134,10 +134,12 @@ uint32_t nr_sci_size(const NR_SL_ResourcePool_r16_t *sl_res_pool,
AssertFatal(sl_res_pool->sl_PSCCH_Config_r16->choice.setup!=NULL,"sl_res_pool->sl_PSCCH_Config_r16->choice.setup is null\n"); AssertFatal(sl_res_pool->sl_PSCCH_Config_r16->choice.setup!=NULL,"sl_res_pool->sl_PSCCH_Config_r16->choice.setup is null\n");
AssertFatal(sl_res_pool->sl_PSCCH_Config_r16->choice.setup->sl_NumReservedBits_r16!=NULL, "sl_res_pool->sl_PSCCH_Config_r16->choice.setup->sl_NumReservedBits_r16 is null\n"); AssertFatal(sl_res_pool->sl_PSCCH_Config_r16->choice.setup->sl_NumReservedBits_r16!=NULL, "sl_res_pool->sl_PSCCH_Config_r16->choice.setup->sl_NumReservedBits_r16 is null\n");
sci_pdu->reserved.nbits = *sl_res_pool->sl_PSCCH_Config_r16->choice.setup->sl_NumReservedBits_r16; sci_pdu->reserved.nbits = *sl_res_pool->sl_PSCCH_Config_r16->choice.setup->sl_NumReservedBits_r16;
size+=sci_pdu->reserved.nbits;
// conflict_information_receiver; // depending on sl-IndicationUE-B // conflict_information_receiver; // depending on sl-IndicationUE-B
// note: R17 field not included here // note: R17 field not included here
sci_pdu->conflict_information_receiver.nbits=0; sci_pdu->conflict_information_receiver.nbits=0;
size+=sci_pdu->conflict_information_receiver.nbits;
break; break;
case NR_SL_SCI_FORMAT_2A: case NR_SL_SCI_FORMAT_2A:
case NR_SL_SCI_FORMAT_2B: case NR_SL_SCI_FORMAT_2B:
...@@ -192,10 +194,7 @@ int get_nREDMRS(const NR_SL_ResourcePool_r16_t *sl_res_pool) { ...@@ -192,10 +194,7 @@ int get_nREDMRS(const NR_SL_ResourcePool_r16_t *sl_res_pool) {
return(nREDMRS/cnt); return(nREDMRS/cnt);
} }
#define MAX_EL_213_9_3_2 19 /*
const float tab38_213_9_3_2[MAX_EL_213_9_3_2] = {1.125,1.250,1.375,1.625,1.750,2.000,2.250,2.500,2.875,3.125,3.500,4.000,5.000,6.250,8.000,10.000,12.625,15.875,20.000};
const float alpha_tab[4] = {0.5,0.65,0.8,1.0};
int get_NREsci2(const NR_SL_ResourcePool_r16_t *sl_res_pool, int get_NREsci2(const NR_SL_ResourcePool_r16_t *sl_res_pool,
const sl_nr_tx_config_pscch_pssch_pdu_t *nr_sl_pssch_pscch_pdu, const sl_nr_tx_config_pscch_pssch_pdu_t *nr_sl_pssch_pscch_pdu,
const int mcs_tb_ind) { const int mcs_tb_ind) {
...@@ -217,7 +216,7 @@ int get_NREsci2(const NR_SL_ResourcePool_r16_t *sl_res_pool, ...@@ -217,7 +216,7 @@ int get_NREsci2(const NR_SL_ResourcePool_r16_t *sl_res_pool,
return min(tmp,(int)ceil(tmp2)); return min(tmp,(int)ceil(tmp2));
} }
*/
void fill_pssch_pscch_pdu(sl_nr_tx_config_pscch_pssch_pdu_t *nr_sl_pssch_pscch_pdu, void fill_pssch_pscch_pdu(sl_nr_tx_config_pscch_pssch_pdu_t *nr_sl_pssch_pscch_pdu,
const NR_SL_BWP_ConfigCommon_r16_t *sl_bwp, const NR_SL_BWP_ConfigCommon_r16_t *sl_bwp,
const NR_SL_ResourcePool_r16_t *sl_res_pool, const NR_SL_ResourcePool_r16_t *sl_res_pool,
...@@ -267,66 +266,74 @@ void fill_pssch_pscch_pdu(sl_nr_tx_config_pscch_pssch_pdu_t *nr_sl_pssch_pscch_p ...@@ -267,66 +266,74 @@ void fill_pssch_pscch_pdu(sl_nr_tx_config_pscch_pssch_pdu_t *nr_sl_pssch_pscch_p
nr_sl_pssch_pscch_pdu->pssch_startsym = *sl_bwp->sl_BWP_Generic_r16->sl_StartSymbol_r16; nr_sl_pssch_pscch_pdu->pssch_startsym = *sl_bwp->sl_BWP_Generic_r16->sl_StartSymbol_r16;
nr_sl_pssch_pscch_pdu->sci2_beta_offset = *sl_res_pool->sl_PSSCH_Config_r16->choice.setup->sl_BetaOffsets2ndSCI_r16->list.array[sci_pdu->beta_offset_indicator]; nr_sl_pssch_pscch_pdu->sci2_beta_offset = *sl_res_pool->sl_PSSCH_Config_r16->choice.setup->sl_BetaOffsets2ndSCI_r16->list.array[sci_pdu->beta_offset_indicator];
if (sl_res_pool->sl_PowerControl_r16) if (sl_res_pool->sl_PowerControl_r16) {
nr_sl_pssch_pscch_pdu->sci2_alpha_times_100 = (*sl_res_pool->sl_PowerControl_r16->sl_Alpha_PSSCH_PSCCH_r16 == 0) ? 0 : (3+(*sl_res_pool->sl_PowerControl_r16->sl_Alpha_PSSCH_PSCCH_r16))*100; nr_sl_pssch_pscch_pdu->sci2_alpha_times_100=50 + (*sl_res_pool->sl_PowerControl_r16->sl_Alpha_PSSCH_PSCCH_r16)*15;
if (*sl_res_pool->sl_PowerControl_r16->sl_Alpha_PSSCH_PSCCH_r16 == 3) nr_sl_pssch_pscch_pdu->sci2_alpha_times_100=100;
else nr_sl_pssch_pscch_pdu->sci2_alpha_times_100 = 100; } else nr_sl_pssch_pscch_pdu->sci2_alpha_times_100 = 100;
switch(format1) { switch(format1) {
case NR_SL_SCI_FORMAT_1A: case NR_SL_SCI_FORMAT_1A:
// priority 3 bits // priority 3 bits
fsize=3; fsize=3;
for (int i = 0; i < fsize; i++) LOG_D(NR_MAC,"SCI1A: priority (%d,%d) in position %d\n",sci_pdu->priority,fsize,pos);
*sci_payload |= (((uint64_t)sci_pdu->priority >> (fsize - i - 1)) & 1) << (sci_size - pos++); for (int i = 0; i < fsize; i++)
*sci_payload |= (((uint64_t)sci_pdu->priority >> (fsize - i - 1)) & 1) << (sci_size - pos++ - 1);
// frequency resource assignment // frequency resource assignment
fsize = sci_pdu->frequency_resource_assignment.nbits; fsize = sci_pdu->frequency_resource_assignment.nbits;
LOG_D(NR_MAC,"SCI1A: frequency resource assignment (%d,%d) in position %d\n",sci_pdu->frequency_resource_assignment.val,fsize,pos);
for (int i = 0; i < fsize; i++) for (int i = 0; i < fsize; i++)
*sci_payload |= (((uint64_t)sci_pdu->frequency_resource_assignment.val >> (fsize - i - 1)) & 1) << (sci_size - pos++); *sci_payload |= (((uint64_t)sci_pdu->frequency_resource_assignment.val >> (fsize - i - 1)) & 1) << (sci_size - pos++ -1);
// time-domain-assignment // time-domain-assignment
fsize = sci_pdu->time_resource_assignment.nbits; fsize = sci_pdu->time_resource_assignment.nbits;
LOG_D(NR_MAC,"SCI1A: time resource assignment (%d,%d) in position %d\n",sci_pdu->time_resource_assignment.val,fsize,pos);
for (int i = 0; i < fsize; i++) for (int i = 0; i < fsize; i++)
*sci_payload |= (((uint64_t)sci_pdu->time_resource_assignment.val >> (fsize - i - 1)) & 1) << (sci_size - pos++); *sci_payload |= (((uint64_t)sci_pdu->time_resource_assignment.val >> (fsize - i - 1)) & 1) << (sci_size - pos++ - 1);
// resource reservation period // resource reservation period
fsize = sci_pdu->resource_reservation_period.nbits; fsize = sci_pdu->resource_reservation_period.nbits;
LOG_D(NR_MAC,"SCI1A: resource_reservation_period (%d,%d) in position %d\n",sci_pdu->resource_reservation_period.val,fsize,pos);
for (int i = 0; i < fsize; i++) for (int i = 0; i < fsize; i++)
*sci_payload |= (((uint64_t)sci_pdu->resource_reservation_period.val >> (fsize - i - 1)) & 1) << (sci_size - pos++); *sci_payload |= (((uint64_t)sci_pdu->resource_reservation_period.val >> (fsize - i - 1)) & 1) << (sci_size - pos++ -1);
// DMRS pattern // DMRS pattern
fsize = sci_pdu->dmrs_pattern.nbits; fsize = sci_pdu->dmrs_pattern.nbits;
LOG_D(NR_MAC,"SCI1A: dmrs_pattern (%d,%d) in position %d\n",sci_pdu->dmrs_pattern.val,fsize,pos);
for (int i = 0; i < fsize; i++) for (int i = 0; i < fsize; i++)
*sci_payload |= (((uint64_t)sci_pdu->dmrs_pattern.val >> (fsize - i - 1)) & 1) << (sci_size - pos++); *sci_payload |= (((uint64_t)sci_pdu->dmrs_pattern.val >> (fsize - i - 1)) & 1) << (sci_size - pos++ -1);
// second_stage_sci_format // 2 bits - Table 8.3.1.1-1 // second_stage_sci_format // 2 bits - Table 8.3.1.1-1
fsize = 2; fsize = 2;
LOG_D(NR_MAC,"SCI1A: second_stage_sci_format (%d,%d) in position %d\n",sci_pdu->second_stage_sci_format,fsize,pos);
for (int i = 0; i < fsize; i++) for (int i = 0; i < fsize; i++)
*sci_payload |= (((uint64_t)sci_pdu->second_stage_sci_format >> (fsize - i - 1)) & 1) << (sci_size - pos++); *sci_payload |= (((uint64_t)sci_pdu->second_stage_sci_format >> (fsize - i - 1)) & 1) << (sci_size - pos++ -1);
// beta_offset_indicator // 2 bits - depending sl-BetaOffsets2ndSCI and Table 8.3.1.1-2 // beta_offset_indicator // 2 bits - depending sl-BetaOffsets2ndSCI and Table 8.3.1.1-2
fsize = 2; fsize = 2;
LOG_D(NR_MAC,"SCI1A: beta_offset_indicator (%d,%d) in position %d\n",sci_pdu->beta_offset_indicator,fsize,pos);
for (int i = 0; i < fsize; i++) for (int i = 0; i < fsize; i++)
*sci_payload |= (((uint64_t)sci_pdu->beta_offset_indicator >> (fsize - i - 1)) & 1) << (sci_size - pos++); *sci_payload |= (((uint64_t)sci_pdu->beta_offset_indicator >> (fsize - i - 1)) & 1) << (sci_size - pos++ -1);
// number_of_dmrs_port // 1 bit - Table 8.3.1.1-3 // number_of_dmrs_port // 1 bit - Table 8.3.1.1-3
fsize = 1; fsize = 1;
*sci_payload |= (((uint64_t)sci_pdu->number_of_dmrs_port&1)) << (sci_size - pos++); LOG_D(NR_MAC,"SCI1A: number_of_dmrs_port (%d,%d) in pos %d\n",sci_pdu->number_of_dmrs_port,fsize,pos);
*sci_payload |= (((uint64_t)sci_pdu->number_of_dmrs_port&1)) << (sci_size - pos++ -1);
// mcs // 5 bits // mcs // 5 bits
fsize = 5; fsize = 5;
for (int i = 0; i < fsize; i++) for (int i = 0; i < fsize; i++)
*sci_payload |= (((uint64_t)sci_pdu->mcs >> (fsize - i - 1)) & 1) << (sci_size - pos++); *sci_payload |= (((uint64_t)sci_pdu->mcs >> (fsize - i - 1)) & 1) << (sci_size - pos++ -1);
LOG_D(NR_MAC,"SCI1A: mcs (%d,%d) in pos %d\n",sci_pdu->mcs,fsize,pos);
// additional_mcs; // depending on sl-Additional-MCS-Table // additional_mcs; // depending on sl-Additional-MCS-Table
fsize = sci_pdu->additional_mcs.nbits; fsize = sci_pdu->additional_mcs.nbits;
for (int i = 0; i < fsize; i++) for (int i = 0; i < fsize; i++)
*sci_payload |= (((uint64_t)sci_pdu->additional_mcs.val >> (fsize - i - 1)) & 1) << (sci_size - pos++); *sci_payload |= (((uint64_t)sci_pdu->additional_mcs.val >> (fsize - i - 1)) & 1) << (sci_size - pos++ -1);
// psfch_overhead; // depending on sl-PSFCH-Period // psfch_overhead; // depending on sl-PSFCH-Period
fsize = sci_pdu->psfch_overhead.nbits; fsize = sci_pdu->psfch_overhead.nbits;
for (int i = 0; i < fsize; i++) for (int i = 0; i < fsize; i++)
*sci_payload |= (((uint64_t)sci_pdu->psfch_overhead.val >> (fsize - i - 1)) & 1) << (sci_size - pos++);
// reserved; // depending on N_reserved (sl-NumReservedBits) and sl-IndicationUE-B // reserved; // depending on N_reserved (sl-NumReservedBits) and sl-IndicationUE-B
fsize = sci_pdu->reserved.nbits; fsize = sci_pdu->reserved.nbits;
for (int i = 0; i < fsize; i++) for (int i = 0; i < fsize; i++)
*sci_payload |= (((uint64_t)sci_pdu->reserved.val >> (fsize - i - 1)) & 1) << (sci_size - pos++); *sci_payload |= (((uint64_t)sci_pdu->reserved.val >> (fsize - i - 1)) & 1) << (sci_size - pos++ -1 );
// conflict_information_receiver; // depending on sl-IndicationUE-B // conflict_information_receiver; // depending on sl-IndicationUE-B
fsize = sci_pdu->conflict_information_receiver.nbits; fsize = sci_pdu->conflict_information_receiver.nbits;
for (int i = 0; i < fsize; i++) for (int i = 0; i < fsize; i++)
*sci_payload |= (((uint64_t)sci_pdu->conflict_information_receiver.val >> (fsize - i - 1)) & 1) << (sci_size - pos++); *sci_payload |= (((uint64_t)sci_pdu->conflict_information_receiver.val >> (fsize - i - 1)) & 1) << (sci_size - pos++ -1);
break; break;
default: default:
AssertFatal(1==0,"Unknown format1 %d\n",format1); AssertFatal(1==0,"Unknown format1 %d\n",format1);
...@@ -336,12 +343,22 @@ void fill_pssch_pscch_pdu(sl_nr_tx_config_pscch_pssch_pdu_t *nr_sl_pssch_pscch_p ...@@ -336,12 +343,22 @@ void fill_pssch_pscch_pdu(sl_nr_tx_config_pscch_pssch_pdu_t *nr_sl_pssch_pscch_p
int mcs_tb_ind = 0; int mcs_tb_ind = 0;
if (sci_pdu->additional_mcs.nbits > 0) if (sci_pdu->additional_mcs.nbits > 0)
mcs_tb_ind = sci_pdu->additional_mcs.val; mcs_tb_ind = sci_pdu->additional_mcs.val;
nr_sl_pssch_pscch_pdu->mcs=sci_pdu->mcs;
int nohPRB = (sl_res_pool->sl_X_Overhead_r16) ? 3*(*sl_res_pool->sl_X_Overhead_r16) : 0; int nohPRB = (sl_res_pool->sl_X_Overhead_r16) ? 3*(*sl_res_pool->sl_X_Overhead_r16) : 0;
int nREDMRS = get_nREDMRS(sl_res_pool); int nREDMRS = get_nREDMRS(sl_res_pool);
int N_REprime = 12*nr_sl_pssch_pscch_pdu->pssch_numsym - nohPRB - nREDMRS; int N_REprime = 12*nr_sl_pssch_pscch_pdu->pssch_numsym - nohPRB - nREDMRS;
int N_REsci1 = 12*nr_sl_pssch_pscch_pdu->pscch_numrbs*nr_sl_pssch_pscch_pdu->pscch_numsym; int N_REsci1 = 12*nr_sl_pssch_pscch_pdu->pscch_numrbs*nr_sl_pssch_pscch_pdu->pscch_numsym;
int N_REsci2 = get_NREsci2(sl_res_pool,nr_sl_pssch_pscch_pdu,mcs_tb_ind); AssertFatal(*sl_res_pool->sl_PSSCH_Config_r16->choice.setup->sl_Scaling_r16 < 4, "Illegal index %d to alpha table\n",(int)*sl_res_pool->sl_PSSCH_Config_r16->choice.setup->sl_Scaling_r16);
int N_REsci2 = get_NREsci2(nr_sl_pssch_pscch_pdu->sci2_alpha_times_100,
nr_sl_pssch_pscch_pdu->sci2_payload_len,
nr_sl_pssch_pscch_pdu->sci2_beta_offset,
nr_sl_pssch_pscch_pdu->pssch_numsym,
nr_sl_pssch_pscch_pdu->pscch_numsym,
nr_sl_pssch_pscch_pdu->pscch_numrbs,
nr_sl_pssch_pscch_pdu->l_subch,
nr_sl_pssch_pscch_pdu->subchannel_size,
nr_sl_pssch_pscch_pdu->mcs,
mcs_tb_ind);
int N_RE = N_REprime*nr_sl_pssch_pscch_pdu->l_subch*nr_sl_pssch_pscch_pdu->subchannel_size - N_REsci1 - N_REsci2; int N_RE = N_REprime*nr_sl_pssch_pscch_pdu->l_subch*nr_sl_pssch_pscch_pdu->subchannel_size - N_REsci1 - N_REsci2;
nr_sl_pssch_pscch_pdu->mod_order = nr_get_Qm_ul(sci_pdu->mcs,mcs_tb_ind); nr_sl_pssch_pscch_pdu->mod_order = nr_get_Qm_ul(sci_pdu->mcs,mcs_tb_ind);
...@@ -502,99 +519,126 @@ void config_pscch_pdu_rx(sl_nr_rx_config_pscch_pdu_t *nr_sl_pscch_pdu, ...@@ -502,99 +519,126 @@ void config_pscch_pdu_rx(sl_nr_rx_config_pscch_pdu_t *nr_sl_pscch_pdu,
} }
void extract_pscch_pdu(uint64_t *sci1_payload, void extract_pscch_pdu(uint64_t *sci1_payload, int len,
const NR_SL_BWP_ConfigCommon_r16_t *sl_bwp, const NR_SL_BWP_ConfigCommon_r16_t *sl_bwp,
const NR_SL_ResourcePool_r16_t *sl_res_pool, const NR_SL_ResourcePool_r16_t *sl_res_pool,
nr_sci_pdu_t *sci_pdu) { nr_sci_pdu_t *sci_pdu) {
int pos=0,fsize; int pos=0,fsize;
int sci1_size = nr_sci_size(sl_res_pool,sci_pdu,NR_SL_SCI_FORMAT_1A); int sci1_size = nr_sci_size(sl_res_pool,sci_pdu,NR_SL_SCI_FORMAT_1A);
AssertFatal(sci1_size == len,"sci1a size %d is not the same sci_indication %d\n",sci1_size,len);
// priority 3 bits // priority 3 bits
fsize=3; fsize=3;
pos=fsize; pos=fsize;
sci_pdu->priority = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1); sci_pdu->priority = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1);
LOG_D(NR_MAC,"priority (%d) in pos %d\n",sci_pdu->priority,pos-fsize);
// frequency resource assignment // frequency resource assignment
fsize = sci_pdu->frequency_resource_assignment.nbits; fsize = sci_pdu->frequency_resource_assignment.nbits;
pos+=fsize; pos+=fsize;
sci_pdu->frequency_resource_assignment.val = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1); sci_pdu->frequency_resource_assignment.val = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1);
LOG_D(NR_MAC,"frequency_resource_assignment(%d) in pos %d\n",sci_pdu->frequency_resource_assignment.val,pos-fsize);
// time-domain-assignment // time-domain-assignment
fsize = sci_pdu->time_resource_assignment.nbits; fsize = sci_pdu->time_resource_assignment.nbits;
pos+=fsize; pos+=fsize;
sci_pdu->time_resource_assignment.val = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1); sci_pdu->time_resource_assignment.val = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1);
LOG_D(NR_MAC,"time_resource_assignment(%d) in pos %d\n",sci_pdu->time_resource_assignment.val,pos-fsize);
// resource reservation period // resource reservation period
fsize = sci_pdu->resource_reservation_period.nbits; fsize = sci_pdu->resource_reservation_period.nbits;
pos+=fsize; pos+=fsize;
sci_pdu->resource_reservation_period.val = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1); sci_pdu->resource_reservation_period.val = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1);
LOG_D(NR_MAC,"resource_reservation_period (%d) in pos %d\n",sci_pdu->resource_reservation_period.val,pos-fsize);
// DMRS pattern // DMRS pattern
fsize = sci_pdu->dmrs_pattern.nbits; fsize = sci_pdu->dmrs_pattern.nbits;
pos+=fsize; pos+=fsize;
sci_pdu->dmrs_pattern.val = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1); sci_pdu->dmrs_pattern.val = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1);
LOG_D(NR_MAC,"dmrs_pattern_val (%d) in pos %d\n",sci_pdu->dmrs_pattern.val,pos-fsize);
// second_stage_sci_format // 2 bits - Table 8.3.1.1-1 // second_stage_sci_format // 2 bits - Table 8.3.1.1-1
fsize = 2; fsize = 2;
pos+=fsize; pos+=fsize;
sci_pdu->second_stage_sci_format = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1); sci_pdu->second_stage_sci_format = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1);
LOG_D(NR_MAC,"second_stage_sci_format (%d) in pos %d\n",sci_pdu->second_stage_sci_format,pos-fsize);
// beta_offset_indicator // 2 bits - depending sl-BetaOffsets2ndSCI and Table 8.3.1.1-2 // beta_offset_indicator // 2 bits - depending sl-BetaOffsets2ndSCI and Table 8.3.1.1-2
fsize = 2; fsize = 2;
pos+=fsize; pos+=fsize;
sci_pdu->beta_offset_indicator = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1); sci_pdu->beta_offset_indicator = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1);
LOG_D(NR_MAC,"beta_offset_indicator (%d) in pos %d\n",sci_pdu->beta_offset_indicator,pos-fsize);
// number_of_dmrs_port // 1 bit - Table 8.3.1.1-3 // number_of_dmrs_port // 1 bit - Table 8.3.1.1-3
fsize = 1; fsize = 1;
pos+=fsize; pos+=fsize;
sci_pdu->number_of_dmrs_port = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1); sci_pdu->number_of_dmrs_port = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1);
LOG_D(NR_MAC,"number_of_dmrs_port (%d) in pos %d\n",sci_pdu->number_of_dmrs_port,pos-fsize);
// mcs // 5 bits // mcs // 5 bits
fsize = 5; fsize = 5;
pos+=fsize; pos+=fsize;
sci_pdu->mcs = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1); sci_pdu->mcs = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1);
LOG_D(NR_MAC,"mcs (%d,%d) in pos %d\n",sci_pdu->mcs,5,pos-fsize);
// additional_mcs; // depending on sl-Additional-MCS-Table // additional_mcs; // depending on sl-Additional-MCS-Table
fsize = sci_pdu->additional_mcs.nbits; fsize = sci_pdu->additional_mcs.nbits;
pos+=fsize; pos+=fsize;
sci_pdu->additional_mcs.val = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1); sci_pdu->additional_mcs.val = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1);
LOG_D(NR_MAC,"additional mcs (%d,%d) in pos %d\n",sci_pdu->additional_mcs.val,sci_pdu->additional_mcs.nbits,pos-fsize);
// psfch_overhead; // depending on sl-PSFCH-Period // psfch_overhead; // depending on sl-PSFCH-Period
fsize = sci_pdu->psfch_overhead.nbits; fsize = sci_pdu->psfch_overhead.nbits;
pos+=fsize; pos+=fsize;
sci_pdu->psfch_overhead.val = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1); sci_pdu->psfch_overhead.val = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1);
LOG_D(NR_MAC,"psfch overhead (%d,%d) in pos %d\n",sci_pdu->psfch_overhead.val,sci_pdu->psfch_overhead.nbits,pos-fsize);
// reserved; // depending on N_reserved (sl-NumReservedBits) and sl-IndicationUE-B // reserved; // depending on N_reserved (sl-NumReservedBits) and sl-IndicationUE-B
fsize = sci_pdu->reserved.nbits; fsize = sci_pdu->reserved.nbits;
pos+=fsize; pos+=fsize;
sci_pdu->reserved.val = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1); sci_pdu->reserved.val = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1);
LOG_D(NR_MAC,"reserved (%d,%d) in pos %d, pos=%d\n",sci_pdu->reserved.val,sci_pdu->reserved.nbits,pos-fsize,pos);
// conflict_information_receiver; // depending on sl-IndicationUE-B // conflict_information_receiver; // depending on sl-IndicationUE-B
fsize = sci_pdu->conflict_information_receiver.nbits; fsize = sci_pdu->conflict_information_receiver.nbits;
pos+=fsize; pos+=fsize;
sci_pdu->conflict_information_receiver.val = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1); sci_pdu->conflict_information_receiver.val = *sci1_payload>>(sci1_size-pos)&((1<<fsize)-1);
LOG_D(NR_MAC,"conflict_information (%d, %d) in pos %d, pos=%d\n",sci_pdu->conflict_information_receiver.val,sci_pdu->conflict_information_receiver.nbits,pos-fsize,pos);
} }
int nr_ue_process_sci1_indication_pdu(NR_UE_MAC_INST_t *mac,frame_t frame, int slot, sl_nr_sci_indication_pdu_t *sci) { int nr_ue_process_sci1_indication_pdu(NR_UE_MAC_INST_t *mac,module_id_t mod_id,frame_t frame, int slot, sl_nr_sci_indication_pdu_t *sci,void *phy_data) {
nr_sci_pdu_t sci_pdu; //&mac->def_sci_pdu[slot][sci->sci_format_type]; nr_sci_pdu_t sci_pdu; //&mac->def_sci_pdu[slot][sci->sci_format_type];
sl_nr_rx_config_pssch_sci_pdu_t nr_sl_pssch_sci_pdu;
const NR_SL_BWP_ConfigCommon_r16_t *sl_bwp = mac->sl_bwp; const NR_SL_BWP_ConfigCommon_r16_t *sl_bwp = mac->sl_bwp;
const NR_SL_ResourcePool_r16_t *sl_res_pool = mac->sl_rx_res_pool; const NR_SL_ResourcePool_r16_t *sl_res_pool = mac->sl_rx_res_pool;
LOG_D(MAC,"Received sci indication (sci format %d, Nid %x, subChannelIndex %d, payloadSize %d,payload %llx)\n", LOG_I(NR_MAC,"Received sci indication (sci format %d, Nid %x, subChannelIndex %d, payloadSize %d,payload %llx)\n",
sci->sci_format_type,sci->Nid,sci->subch_index,sci->sci_payloadlen,*(unsigned long long*)sci->sci_payloadBits); sci->sci_format_type,sci->Nid,sci->subch_index,sci->sci_payloadlen,*(unsigned long long*)sci->sci_payloadBits);
AssertFatal(sci->sci_format_type == SL_SCI_FORMAT_1A_ON_PSCCH, "need to have format 1A here only\n"); AssertFatal(sci->sci_format_type == SL_SCI_FORMAT_1A_ON_PSCCH, "need to have format 1A here only\n");
extract_pscch_pdu((uint64_t *)sci->sci_payloadBits, sl_bwp, sl_res_pool, &sci_pdu); extract_pscch_pdu((uint64_t *)sci->sci_payloadBits, sci->sci_payloadlen,sl_bwp, sl_res_pool, &sci_pdu);
config_pssch_sci_pdu_rx(&nr_sl_pssch_sci_pdu, LOG_I(NR_MAC,"SCI1A: frequency_resource %d, time_resource %d, dmrs_pattern %d, beta_offset_indicator %d, mcs %d, number_of_dmrs_port %d, 2nd stage SCI format %d\n",
sci_pdu.frequency_resource_assignment.val,sci_pdu.time_resource_assignment.val,sci_pdu.dmrs_pattern.val,sci_pdu.beta_offset_indicator,sci_pdu.mcs,sci_pdu.number_of_dmrs_port,sci_pdu.second_stage_sci_format);
// send schedule response
sl_nr_rx_config_request_t rx_config;
rx_config.number_pdus = 1;
rx_config.sfn = frame;
rx_config.slot = slot;
config_pssch_sci_pdu_rx(&rx_config.sl_rx_config_list[0].rx_sci2_config_pdu,
NR_SL_SCI_FORMAT_2A, NR_SL_SCI_FORMAT_2A,
&sci_pdu, &sci_pdu,
sci->Nid, sci->Nid,
sci->subch_index, sci->subch_index,
sl_bwp, sl_bwp,
sl_res_pool); sl_res_pool);
// send schedule response rx_config.sl_rx_config_list[0].pdu_type = SL_NR_CONFIG_TYPE_RX_PSSCH_SCI;
nr_scheduled_response_t scheduled_response;
memset(&scheduled_response,0, sizeof(nr_scheduled_response_t));
fill_scheduled_response(&scheduled_response,NULL,NULL,NULL,&rx_config,NULL,mod_id,0,frame,slot,phy_data);
LOG_I(NR_MAC, "[UE%d] TTI-%d:%d RX PSSCH_SCI REQ \n", mod_id,frame, slot);
if ((mac->if_module != NULL) && (mac->if_module->scheduled_response != NULL))
mac->if_module->scheduled_response(&scheduled_response);
return 1; return 1;
} }
...@@ -615,7 +659,8 @@ void config_pssch_sci_pdu_rx(sl_nr_rx_config_pssch_sci_pdu_t *nr_sl_pssch_sci_pd ...@@ -615,7 +659,8 @@ void config_pssch_sci_pdu_rx(sl_nr_rx_config_pssch_sci_pdu_t *nr_sl_pssch_sci_pd
nr_sl_pssch_sci_pdu->sci2_beta_offset = *sl_res_pool->sl_PSSCH_Config_r16->choice.setup->sl_BetaOffsets2ndSCI_r16->list.array[sci_pdu->beta_offset_indicator]; nr_sl_pssch_sci_pdu->sci2_beta_offset = *sl_res_pool->sl_PSSCH_Config_r16->choice.setup->sl_BetaOffsets2ndSCI_r16->list.array[sci_pdu->beta_offset_indicator];
// Used to determine number of SCI2 modulated symbols // Used to determine number of SCI2 modulated symbols
//Values will be sl-scaling*100 (sl-scaling values 0.5, 0.65, 0.8, 1) //Values will be sl-scaling*100 (sl-scaling values 0.5, 0.65, 0.8, 1)
nr_sl_pssch_sci_pdu->sci2_alpha_times_100=(*sl_res_pool->sl_PowerControl_r16->sl_Alpha_PSSCH_PSCCH_r16 == 0) ? 0 : (3+(*sl_res_pool->sl_PowerControl_r16->sl_Alpha_PSSCH_PSCCH_r16))*100; nr_sl_pssch_sci_pdu->sci2_alpha_times_100=50 + (*sl_res_pool->sl_PowerControl_r16->sl_Alpha_PSSCH_PSCCH_r16)*15;
if (*sl_res_pool->sl_PowerControl_r16->sl_Alpha_PSSCH_PSCCH_r16 == 3) nr_sl_pssch_sci_pdu->sci2_alpha_times_100=100;
int mcs_tb_ind = 0; int mcs_tb_ind = 0;
if (sci_pdu->additional_mcs.nbits > 0) if (sci_pdu->additional_mcs.nbits > 0)
......
...@@ -1442,6 +1442,14 @@ static void handle_sl_bch(module_id_t module_id,uint8_t *const sl_mib, ...@@ -1442,6 +1442,14 @@ static void handle_sl_bch(module_id_t module_id,uint8_t *const sl_mib,
return ; return ;
} }
void handle_sl_sci1a(module_id_t module_id,uint32_t frame, uint32_t slot, sl_nr_sci_indication_pdu_t *const sci,void *phy_data) {
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
nr_ue_process_sci1_indication_pdu(mac,module_id,frame,slot,sci,phy_data);
}
/* /*
if PSBCH rx - handle_psbch() if PSBCH rx - handle_psbch()
- Extract FN, Slot - Extract FN, Slot
...@@ -1476,6 +1484,7 @@ void sl_nr_process_rx_ind(uint16_t mod_id, ...@@ -1476,6 +1484,7 @@ void sl_nr_process_rx_ind(uint16_t mod_id,
break; break;
case SL_NR_RX_PDU_TYPE_SLSCH: case SL_NR_RX_PDU_TYPE_SLSCH:
break; break;
default : default :
...@@ -1484,6 +1493,27 @@ void sl_nr_process_rx_ind(uint16_t mod_id, ...@@ -1484,6 +1493,27 @@ void sl_nr_process_rx_ind(uint16_t mod_id,
} }
} }
/* Process SCI indication from PHY */
void sl_nr_process_sci_ind(uint16_t module_id, uint32_t frame, uint32_t slot, sl_nr_ue_mac_params_t *sl_mac, sl_nr_sci_indication_t *sci_ind, void *phy_data) {
uint8_t num_SCIs = sci_ind->number_of_SCIs;
for (int idx=0;idx<num_SCIs;idx++) {
switch (sci_ind->sci_pdu[idx].sci_format_type) {
case SL_SCI_FORMAT_1A_ON_PSCCH:
LOG_I(NR_MAC,"%d.%d Received PSCCH PDU %d/%d PSCCH RSRP %d, length %d, sub-channel index %d, Nid %x, payload %llx\n", sci_ind->sfn,sci_ind->slot,1+idx,num_SCIs,sci_ind->sci_pdu[idx].pscch_rsrp,sci_ind->sci_pdu[idx].sci_payloadlen,sci_ind->sci_pdu[idx].subch_index,sci_ind->sci_pdu[idx].Nid,*(unsigned long long*)sci_ind->sci_pdu[idx].sci_payloadBits);
handle_sl_sci1a(module_id,frame,slot,&sci_ind->sci_pdu[idx],phy_data);
break;
default:
AssertFatal(1==0,"Unhandled or unknown sci format %d\n",sci_ind->sci_pdu[idx].sci_format_type);
break;
}
}
}
/* /*
* Sidelink indication is sent from PHY->MAC. * Sidelink indication is sent from PHY->MAC.
* This interface function handles these * This interface function handles these
...@@ -1504,10 +1534,12 @@ int nr_ue_sl_indication(nr_sidelink_indication_t *sl_indication) ...@@ -1504,10 +1534,12 @@ int nr_ue_sl_indication(nr_sidelink_indication_t *sl_indication)
if (sl_indication->rx_ind) { if (sl_indication->rx_ind) {
sl_nr_process_rx_ind(module_id, frame, slot, sl_mac, sl_indication->rx_ind); sl_nr_process_rx_ind(module_id, frame, slot, sl_mac, sl_indication->rx_ind);
} if (sl_indication->sci_ind) {
sl_nr_process_sci_ind(module_id, frame, slot, sl_mac, sl_indication->sci_ind,sl_indication->phy_data);
} else { } else {
nr_ue_sidelink_scheduler(sl_indication); nr_ue_sidelink_scheduler(sl_indication);
} }
LOG_I(NR_MAC,"returning from nr_sl_indication\n");
return 0; return 0;
} }
...@@ -183,7 +183,10 @@ static void prepare_NR_SL_ResourcePool(NR_SL_ResourcePool_r16_t *sl_res_pool, ...@@ -183,7 +183,10 @@ static void prepare_NR_SL_ResourcePool(NR_SL_ResourcePool_r16_t *sl_res_pool,
sl_res_pool->sl_PriorityThreshold_UL_URLLC_r16 = NULL; sl_res_pool->sl_PriorityThreshold_UL_URLLC_r16 = NULL;
sl_res_pool->sl_PriorityThreshold_r16 = NULL; sl_res_pool->sl_PriorityThreshold_r16 = NULL;
sl_res_pool->sl_X_Overhead_r16 = NULL; sl_res_pool->sl_X_Overhead_r16 = NULL;
sl_res_pool->sl_PowerControl_r16 = NULL; sl_res_pool->sl_PowerControl_r16 = calloc(1,sizeof(*sl_res_pool->sl_PowerControl_r16));
sl_res_pool->sl_PowerControl_r16->sl_Alpha_PSSCH_PSCCH_r16 = calloc(1,sizeof(*sl_res_pool->sl_PowerControl_r16->sl_Alpha_PSSCH_PSCCH_r16));
*sl_res_pool->sl_PowerControl_r16->sl_Alpha_PSSCH_PSCCH_r16 = 0;
sl_res_pool->sl_TxPercentageList_r16 = NULL; sl_res_pool->sl_TxPercentageList_r16 = NULL;
sl_res_pool->sl_MinMaxMCS_List_r16 = NULL; sl_res_pool->sl_MinMaxMCS_List_r16 = NULL;
......
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