fix UE UL DMRS generation if start_rb != 0 in nr_ue_ulsch_procedures()
also do some code cleanup while at it...
This commit is contained in:
@@ -101,41 +101,39 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
|||||||
LOG_D(PHY,"nr_ue_ulsch_procedures hard_id %d %d.%d\n",harq_pid,frame,slot);
|
LOG_D(PHY,"nr_ue_ulsch_procedures hard_id %d %d.%d\n",harq_pid,frame,slot);
|
||||||
|
|
||||||
uint32_t available_bits;
|
uint32_t available_bits;
|
||||||
uint8_t mod_order, cwd_index, num_of_codewords, l;
|
uint8_t mod_order, cwd_index, l;
|
||||||
uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5];
|
uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5];
|
||||||
uint32_t ***pusch_dmrs;
|
|
||||||
int16_t **tx_layers;
|
int16_t **tx_layers;
|
||||||
int32_t **txdataF;
|
int32_t **txdataF;
|
||||||
uint16_t start_sc, start_rb;
|
|
||||||
int8_t Wf[2], Wt[2], l_prime[2], delta;
|
int8_t Wf[2], Wt[2], l_prime[2], delta;
|
||||||
uint16_t rnti, n_dmrs, code_rate, number_dmrs_symbols, nb_rb, k;
|
uint16_t rnti, code_rate, nb_rb;
|
||||||
uint8_t dmrs_type, nb_dmrs_re_per_rb, number_of_symbols, mcs, Nl;
|
uint8_t nb_dmrs_re_per_rb,mcs, Nl;
|
||||||
int ap, start_symbol, Nid_cell, i;
|
int ap, i;
|
||||||
int sample_offsetF, N_RE_prime, N_PRB_oh;
|
int sample_offsetF, N_RE_prime;
|
||||||
uint16_t ul_dmrs_symb_pos;
|
|
||||||
uint8_t L_ptrs, K_ptrs; // PTRS parameters
|
|
||||||
uint16_t beta_ptrs; // PTRS parameter related to power control
|
|
||||||
|
|
||||||
NR_UE_ULSCH_t *ulsch_ue;
|
|
||||||
NR_UL_UE_HARQ_t *harq_process_ul_ue=NULL;
|
|
||||||
NR_DL_FRAME_PARMS *frame_parms = &UE->frame_parms;
|
NR_DL_FRAME_PARMS *frame_parms = &UE->frame_parms;
|
||||||
NR_UE_PUSCH *pusch_ue = UE->pusch_vars[thread_id][gNB_id];
|
NR_UE_PUSCH *pusch_ue = UE->pusch_vars[thread_id][gNB_id];
|
||||||
// ptrs_UplinkConfig_t *ptrs_Uplink_Config = &UE->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig;
|
// ptrs_UplinkConfig_t *ptrs_Uplink_Config = &UE->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig;
|
||||||
|
|
||||||
num_of_codewords = 1; // tmp assumption
|
uint8_t num_of_codewords = 1; // tmp assumption
|
||||||
Nid_cell = 0;
|
int Nid_cell = 0;
|
||||||
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
|
||||||
number_dmrs_symbols = 0;
|
uint16_t number_dmrs_symbols = 0;
|
||||||
|
|
||||||
for (cwd_index = 0;cwd_index < num_of_codewords; cwd_index++) {
|
for (cwd_index = 0;cwd_index < num_of_codewords; cwd_index++) {
|
||||||
|
|
||||||
ulsch_ue = UE->ulsch[thread_id][gNB_id][cwd_index];
|
NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[thread_id][gNB_id][cwd_index];
|
||||||
harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid];
|
NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid];
|
||||||
|
|
||||||
start_symbol = harq_process_ul_ue->pusch_pdu.start_symbol_index;
|
int start_symbol = harq_process_ul_ue->pusch_pdu.start_symbol_index;
|
||||||
ul_dmrs_symb_pos = harq_process_ul_ue->pusch_pdu.ul_dmrs_symb_pos;
|
uint16_t ul_dmrs_symb_pos = harq_process_ul_ue->pusch_pdu.ul_dmrs_symb_pos;
|
||||||
number_of_symbols = harq_process_ul_ue->pusch_pdu.nr_of_symbols;
|
uint8_t number_of_symbols = harq_process_ul_ue->pusch_pdu.nr_of_symbols;
|
||||||
dmrs_type = harq_process_ul_ue->pusch_pdu.dmrs_config_type;
|
uint8_t dmrs_type = harq_process_ul_ue->pusch_pdu.dmrs_config_type;
|
||||||
|
uint16_t start_rb = harq_process_ul_ue->pusch_pdu.rb_start;
|
||||||
|
uint16_t start_sc = frame_parms->first_carrier_offset + start_rb*NR_NB_SC_PER_RB;
|
||||||
|
|
||||||
|
if (start_sc >= frame_parms->ofdm_symbol_size)
|
||||||
|
start_sc -= frame_parms->ofdm_symbol_size;
|
||||||
|
|
||||||
for (i = start_symbol; i < start_symbol + number_of_symbols; i++) {
|
for (i = start_symbol; i < start_symbol + number_of_symbols; i++) {
|
||||||
|
|
||||||
@@ -210,14 +208,10 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
|||||||
///////////
|
///////////
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////DMRS Modulation/////////////////////////
|
/////////////////////////DMRS Modulation/////////////////////////
|
||||||
///////////
|
///////////
|
||||||
pusch_dmrs = UE->nr_gold_pusch_dmrs[slot];
|
uint32_t ***pusch_dmrs = UE->nr_gold_pusch_dmrs[slot];
|
||||||
n_dmrs = (nb_rb*((dmrs_type == pusch_dmrs_type1) ? 6:4)*number_dmrs_symbols);
|
uint16_t n_dmrs = (start_rb+nb_rb)*((dmrs_type == pusch_dmrs_type1) ? 6:4);
|
||||||
int16_t mod_dmrs[n_dmrs<<1];
|
int16_t mod_dmrs[n_dmrs<<1];
|
||||||
///////////
|
///////////
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
@@ -226,16 +220,15 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
|||||||
/////////////////////////PTRS parameters' initialization/////////////////////////
|
/////////////////////////PTRS parameters' initialization/////////////////////////
|
||||||
///////////
|
///////////
|
||||||
|
|
||||||
int16_t mod_ptrs[(nb_rb/2)*(NR_SYMBOLS_PER_SLOT-1)*2]; // assume maximum number of PTRS per pusch allocation
|
int16_t mod_ptrs[nb_rb]; // assume maximum number of PTRS per pusch allocation
|
||||||
K_ptrs = 0; // just to avoid a warning
|
uint8_t L_ptrs, K_ptrs = 0;
|
||||||
|
uint16_t beta_ptrs = 1; // temp value until power control is implemented
|
||||||
|
|
||||||
if (harq_process_ul_ue->pusch_pdu.pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
|
if (harq_process_ul_ue->pusch_pdu.pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
|
||||||
|
|
||||||
K_ptrs = (harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_freq_density)?4:2;
|
K_ptrs = (harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_freq_density)?4:2;
|
||||||
L_ptrs = 1<<harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_time_density;
|
L_ptrs = 1<<harq_process_ul_ue->pusch_pdu.pusch_ptrs.ptrs_time_density;
|
||||||
|
|
||||||
beta_ptrs = 1; // temp value until power control is implemented
|
|
||||||
|
|
||||||
ulsch_ue->ptrs_symbols = 0;
|
ulsch_ue->ptrs_symbols = 0;
|
||||||
|
|
||||||
set_ptrs_symb_idx(&ulsch_ue->ptrs_symbols,
|
set_ptrs_symb_idx(&ulsch_ue->ptrs_symbols,
|
||||||
@@ -274,11 +267,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
|||||||
for (l = start_symbol; l < start_symbol + number_of_symbols; l++) {
|
for (l = start_symbol; l < start_symbol + number_of_symbols; l++) {
|
||||||
|
|
||||||
if((ul_dmrs_symb_pos >> l) & 0x01)
|
if((ul_dmrs_symb_pos >> l) & 0x01)
|
||||||
is_dmrs = 1;
|
|
||||||
else
|
|
||||||
is_dmrs = 0;
|
|
||||||
|
|
||||||
if (is_dmrs == 1)
|
|
||||||
nb_re_dmrs_per_rb = nb_dmrs_re_per_rb;
|
nb_re_dmrs_per_rb = nb_dmrs_re_per_rb;
|
||||||
else
|
else
|
||||||
nb_re_dmrs_per_rb = 0;
|
nb_re_dmrs_per_rb = 0;
|
||||||
@@ -303,47 +291,53 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
|||||||
|
|
||||||
txdataF = UE->common_vars.txdataF;
|
txdataF = UE->common_vars.txdataF;
|
||||||
|
|
||||||
start_rb = harq_process_ul_ue->pusch_pdu.rb_start;
|
|
||||||
start_sc = frame_parms->first_carrier_offset + start_rb*NR_NB_SC_PER_RB;
|
|
||||||
|
|
||||||
if (start_sc >= frame_parms->ofdm_symbol_size)
|
|
||||||
start_sc -= frame_parms->ofdm_symbol_size;
|
|
||||||
|
|
||||||
for (ap=0; ap< Nl; ap++) {
|
for (ap=0; ap< Nl; ap++) {
|
||||||
|
|
||||||
|
uint8_t k_prime = 0;
|
||||||
|
uint16_t m = 0;
|
||||||
|
|
||||||
// DMRS params for this ap
|
// DMRS params for this ap
|
||||||
get_Wt(Wt, ap, dmrs_type);
|
get_Wt(Wt, ap, dmrs_type);
|
||||||
get_Wf(Wf, ap, dmrs_type);
|
get_Wf(Wf, ap, dmrs_type);
|
||||||
delta = get_delta(ap, dmrs_type);
|
delta = get_delta(ap, dmrs_type);
|
||||||
|
|
||||||
|
|
||||||
uint8_t k_prime=0;
|
|
||||||
uint8_t is_dmrs, is_ptrs, is_dmrs_symbol;
|
|
||||||
uint16_t m=0, n=0, dmrs_idx=0, ptrs_idx = 0;
|
|
||||||
|
|
||||||
for (l=start_symbol; l<start_symbol+number_of_symbols; l++) {
|
for (l=start_symbol; l<start_symbol+number_of_symbols; l++) {
|
||||||
|
|
||||||
k = start_sc;
|
uint16_t k = start_sc;
|
||||||
n = 0;
|
uint16_t n = 0;
|
||||||
dmrs_idx = 0;
|
uint8_t is_dmrs_sym = 0;
|
||||||
|
uint8_t is_ptrs_sym = 0;
|
||||||
|
uint16_t dmrs_idx = 0, ptrs_idx = 0;
|
||||||
|
|
||||||
|
if ((ul_dmrs_symb_pos >> l) & 0x01) {
|
||||||
|
is_dmrs_sym = 1;
|
||||||
|
|
||||||
|
if (dmrs_type == pusch_dmrs_type1)
|
||||||
|
dmrs_idx = start_rb*6;
|
||||||
|
else
|
||||||
|
dmrs_idx = start_rb*4;
|
||||||
|
|
||||||
|
nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
|
||||||
|
|
||||||
|
} else if (harq_process_ul_ue->pusch_pdu.pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
|
||||||
|
|
||||||
|
if(is_ptrs_symbol(l, ulsch_ue->ptrs_symbols)) {
|
||||||
|
is_ptrs_sym = 1;
|
||||||
|
nr_modulation(pusch_dmrs[l][0], nb_rb, DMRS_MOD_ORDER, mod_ptrs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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_ptrs = 0;
|
||||||
|
|
||||||
sample_offsetF = l*frame_parms->ofdm_symbol_size + k;
|
sample_offsetF = l*frame_parms->ofdm_symbol_size + k;
|
||||||
|
|
||||||
is_dmrs = 0;
|
if (is_dmrs_sym) {
|
||||||
is_ptrs = 0;
|
|
||||||
is_dmrs_symbol = 0;
|
|
||||||
|
|
||||||
if((ul_dmrs_symb_pos >> l) & 0x01) {
|
|
||||||
is_dmrs_symbol = 1;
|
|
||||||
if (k == ((start_sc+get_dmrs_freq_idx_ul(n, k_prime, delta, dmrs_type))%frame_parms->ofdm_symbol_size))
|
if (k == ((start_sc+get_dmrs_freq_idx_ul(n, k_prime, delta, dmrs_type))%frame_parms->ofdm_symbol_size))
|
||||||
is_dmrs = 1;
|
is_dmrs = 1;
|
||||||
}
|
} else if (is_ptrs_sym) {
|
||||||
|
|
||||||
if (harq_process_ul_ue->pusch_pdu.pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS){
|
|
||||||
|
|
||||||
if(is_ptrs_symbol(l, ulsch_ue->ptrs_symbols))
|
|
||||||
is_ptrs = is_ptrs_subcarrier(k,
|
is_ptrs = is_ptrs_subcarrier(k,
|
||||||
rnti,
|
rnti,
|
||||||
ap,
|
ap,
|
||||||
@@ -357,10 +351,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
|||||||
|
|
||||||
if (is_dmrs == 1) {
|
if (is_dmrs == 1) {
|
||||||
|
|
||||||
if (k == start_sc){
|
|
||||||
nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
|
|
||||||
}
|
|
||||||
|
|
||||||
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[dmrs_idx<<1]) >> 15;
|
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[dmrs_idx<<1]) >> 15;
|
||||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15;
|
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15;
|
||||||
|
|
||||||
@@ -378,16 +368,12 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
|||||||
|
|
||||||
} else if (is_ptrs == 1) {
|
} else if (is_ptrs == 1) {
|
||||||
|
|
||||||
if (k == start_sc){
|
|
||||||
nr_modulation(pusch_dmrs[l][0], nb_rb, DMRS_MOD_ORDER, mod_ptrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (beta_ptrs*AMP*mod_ptrs[ptrs_idx<<1]) >> 15;
|
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (beta_ptrs*AMP*mod_ptrs[ptrs_idx<<1]) >> 15;
|
||||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (beta_ptrs*AMP*mod_ptrs[(ptrs_idx<<1) + 1]) >> 15;
|
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (beta_ptrs*AMP*mod_ptrs[(ptrs_idx<<1) + 1]) >> 15;
|
||||||
|
|
||||||
ptrs_idx++;
|
ptrs_idx++;
|
||||||
|
|
||||||
} else if (!is_dmrs_symbol || allowed_xlsch_re_in_dmrs_symbol(k,start_sc,harq_process_ul_ue->pusch_pdu.num_dmrs_cdm_grps_no_data,dmrs_type)) {
|
} else if (!is_dmrs_sym || allowed_xlsch_re_in_dmrs_symbol(k,start_sc,harq_process_ul_ue->pusch_pdu.num_dmrs_cdm_grps_no_data,dmrs_type)) {
|
||||||
|
|
||||||
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = ((int16_t *) ulsch_ue->y)[m<<1];
|
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = ((int16_t *) ulsch_ue->y)[m<<1];
|
||||||
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = ((int16_t *) ulsch_ue->y)[(m<<1) + 1];
|
((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = ((int16_t *) ulsch_ue->y)[(m<<1) + 1];
|
||||||
@@ -412,8 +398,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//}
|
|
||||||
NR_UL_UE_HARQ_t *harq_process_ulsch=NULL;
|
NR_UL_UE_HARQ_t *harq_process_ulsch=NULL;
|
||||||
harq_process_ulsch = UE->ulsch[thread_id][gNB_id][0]->harq_processes[harq_pid];
|
harq_process_ulsch = UE->ulsch[thread_id][gNB_id][0]->harq_processes[harq_pid];
|
||||||
harq_process_ulsch->status = SCH_IDLE;
|
harq_process_ulsch->status = SCH_IDLE;
|
||||||
|
|||||||
Reference in New Issue
Block a user