Commit 1dc94f57 authored by Fang-WANG's avatar Fang-WANG

changes for 100M--40M test ok

parent 18fae95f
...@@ -125,8 +125,8 @@ int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB) { ...@@ -125,8 +125,8 @@ int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB) {
/* TS 38.214 ch. 6.1.2.2.2 - Resource allocation type 1 for DL and UL */ /* TS 38.214 ch. 6.1.2.2.2 - Resource allocation type 1 for DL and UL */
int PRBalloc_to_locationandbandwidth0(int NPRB,int RBstart,int BWPsize) { int PRBalloc_to_locationandbandwidth0(int NPRB,int RBstart,int BWPsize) {
AssertFatal(NPRB>0 && (NPRB + RBstart <= BWPsize),"Illegal NPRB/RBstart Configuration (%d,%d) for BWPsize %d\n",NPRB,RBstart,BWPsize); //AssertFatal(NPRB>0 && (NPRB + RBstart <= BWPsize),"Illegal NPRB/RBstart Configuration (%d,%d) for BWPsize %d\n",NPRB,RBstart,BWPsize);
AssertFatal(NPRB>0 && (NPRB <= BWPsize),"Illegal NPRB/RBstart Configuration (%d,%d) for BWPsize %d\n",NPRB,RBstart,BWPsize);
if (NPRB <= 1+(BWPsize>>1)) return(BWPsize*(NPRB-1)+RBstart); if (NPRB <= 1+(BWPsize>>1)) return(BWPsize*(NPRB-1)+RBstart);
else return(BWPsize*(BWPsize+1-NPRB) + (BWPsize-1-RBstart)); else return(BWPsize*(BWPsize+1-NPRB) + (BWPsize-1-RBstart));
} }
......
...@@ -490,6 +490,12 @@ int main( int argc, char **argv ) { ...@@ -490,6 +490,12 @@ int main( int argc, char **argv ) {
nrUE_config->carrier_config.dl_frequency = (downlink_frequency[0][0] -(6*UE[CC_id]->frame_parms.N_RB_DL*(15000<<nrUE_config->ssb_config.scs_common)))/1000; nrUE_config->carrier_config.dl_frequency = (downlink_frequency[0][0] -(6*UE[CC_id]->frame_parms.N_RB_DL*(15000<<nrUE_config->ssb_config.scs_common)))/1000;
nrUE_config->carrier_config.uplink_frequency = (downlink_frequency[0][0] -(6*UE[CC_id]->frame_parms.N_RB_DL*(15000<<nrUE_config->ssb_config.scs_common)))/1000; nrUE_config->carrier_config.uplink_frequency = (downlink_frequency[0][0] -(6*UE[CC_id]->frame_parms.N_RB_DL*(15000<<nrUE_config->ssb_config.scs_common)))/1000;
nrUE_config->ssb_table.ssb_offset_point_a = (UE[CC_id]->frame_parms.N_RB_DL - 20)>>1; nrUE_config->ssb_table.ssb_offset_point_a = (UE[CC_id]->frame_parms.N_RB_DL - 20)>>1;
if (UE[CC_id]->frame_parms.N_RB_DL & 0x01 ==1)
{
nrUE_config->ssb_table.ssb_subcarrier_offset = 12; // 15khz
}
else
nrUE_config->ssb_table.ssb_subcarrier_offset = 0;
// Initialize values, will be updated upon SIB1 reception // Initialize values, will be updated upon SIB1 reception
nrUE_config->cell_config.frame_duplex_type = TDD; nrUE_config->cell_config.frame_duplex_type = TDD;
......
...@@ -622,7 +622,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -622,7 +622,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
} }
if (err_flag == 1) { if (err_flag == 1) {
LOG_D(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n", LOG_I(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n",
phy_vars_ue->Mod_id, frame, nr_slot_rx, harq_pid,harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs,Kr,r,harq_process->round); phy_vars_ue->Mod_id, frame, nr_slot_rx, harq_pid,harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs,Kr,r,harq_process->round);
harq_process->harq_ack.ack = 0; harq_process->harq_ack.ack = 0;
...@@ -645,7 +645,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -645,7 +645,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
return((1 + dlsch->max_ldpc_iterations)); return((1 + dlsch->max_ldpc_iterations));
} else { } else {
LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for nr_slot_rx %d TBS %d mcs %d nb_rb %d harq_process->round %d\n", LOG_I(PHY,"[UE %d] DLSCH: Setting ACK for nr_slot_rx %d TBS %d mcs %d nb_rb %d harq_process->round %d\n",
phy_vars_ue->Mod_id,nr_slot_rx,harq_process->TBS,harq_process->mcs,harq_process->nb_rb, harq_process->round); phy_vars_ue->Mod_id,nr_slot_rx,harq_process->TBS,harq_process->mcs,harq_process->nb_rb, harq_process->round);
harq_process->status = SCH_IDLE; harq_process->status = SCH_IDLE;
......
...@@ -231,7 +231,9 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, ...@@ -231,7 +231,9 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA); uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA);
cfg->ssb_table.ssb_offset_point_a = absolute_diff/(12*scs_scaling) - 10; cfg->ssb_table.ssb_offset_point_a = absolute_diff/(12*scs_scaling) - 10;
cfg->ssb_table.ssb_period = *scc->ssb_periodicityServingCell; cfg->ssb_table.ssb_period = *scc->ssb_periodicityServingCell;
cfg->ssb_table.ssb_subcarrier_offset = 0; // TODO currently not in RRC? cfg->ssb_table.ssb_subcarrier_offset =( absolute_diff % (12*scs_scaling) )* scs_scaling; // TODO currently not in RRC?
LOG_I(PHY, "in config ue scc, point A %d, ssb_subcarrier_offset is %d\n", cfg->ssb_table.ssb_offset_point_a, cfg->ssb_table.ssb_subcarrier_offset);
switch (scc->ssb_PositionsInBurst->present) { switch (scc->ssb_PositionsInBurst->present) {
case 1 : case 1 :
......
...@@ -160,7 +160,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id, ...@@ -160,7 +160,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
uint8_t scs_ssb = get_softmodem_params()->numerology; uint8_t scs_ssb = get_softmodem_params()->numerology;
uint32_t band = get_softmodem_params()->band; uint32_t band = get_softmodem_params()->band;
uint16_t ssb_start_symbol = get_ssb_start_symbol(band,scs_ssb,ssb_index); uint16_t ssb_start_symbol = get_ssb_start_symbol(band,scs_ssb,ssb_index);
uint16_t ssb_offset_point_a = (ssb_start_subcarrier - ssb_subcarrier_offset)/12; uint16_t ssb_offset_point_a = (ssb_start_subcarrier - ssb_subcarrier_offset / 2)/12;
get_type0_PDCCH_CSS_config_parameters(&mac->type0_PDCCH_CSS_config, get_type0_PDCCH_CSS_config_parameters(&mac->type0_PDCCH_CSS_config,
frame, frame,
...@@ -173,7 +173,8 @@ int8_t nr_ue_decode_mib(module_id_t module_id, ...@@ -173,7 +173,8 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
ssb_index, ssb_index,
ssb_offset_point_a); ssb_offset_point_a);
LOG_I(MAC,"ssb_start_subcarrier %d, ssb_subcarrier_offset %d, ssb_offset_point_a %d\n",
ssb_start_subcarrier, ssb_subcarrier_offset, ssb_offset_point_a );
mac->type0_pdcch_ss_mux_pattern = mac->type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern; mac->type0_pdcch_ss_mux_pattern = mac->type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern;
mac->type0_pdcch_ss_sfn_c = mac->type0_PDCCH_CSS_config.sfn_c; mac->type0_pdcch_ss_sfn_c = mac->type0_PDCCH_CSS_config.sfn_c;
mac->type0_pdcch_ss_n_c = mac->type0_PDCCH_CSS_config.n_c; mac->type0_pdcch_ss_n_c = mac->type0_PDCCH_CSS_config.n_c;
......
...@@ -318,17 +318,22 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts ...@@ -318,17 +318,22 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts
scs_scaling = scs_scaling>>2; scs_scaling = scs_scaling>>2;
uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA); uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA);
uint16_t sco = absolute_diff%(12*scs_scaling); uint16_t sco = absolute_diff%(12*scs_scaling);
AssertFatal(sco==0,"absoluteFrequencySSB has a subcarrier offset of %d while it should be alligned with CRBs\n",sco); //AssertFatal(sco==0,"absoluteFrequencySSB has a subcarrier offset of %d while it should be alligned with CRBs\n",sco);
cfg->ssb_table.ssb_offset_point_a.value = absolute_diff/(12*scs_scaling) - 10; //absoluteFrequencySSB is the central frequency of SSB which is made by 20RBs in total cfg->ssb_table.ssb_offset_point_a.value = absolute_diff/(12*scs_scaling) - 10; //absoluteFrequencySSB is the central frequency of SSB which is made by 20RBs in total
cfg->ssb_table.ssb_offset_point_a.tl.tag = NFAPI_NR_CONFIG_SSB_OFFSET_POINT_A_TAG; cfg->ssb_table.ssb_offset_point_a.tl.tag = NFAPI_NR_CONFIG_SSB_OFFSET_POINT_A_TAG;
cfg->num_tlv++; cfg->num_tlv++;
cfg->ssb_table.ssb_period.value = *scc->ssb_periodicityServingCell; cfg->ssb_table.ssb_period.value = *scc->ssb_periodicityServingCell;
cfg->ssb_table.ssb_period.tl.tag = NFAPI_NR_CONFIG_SSB_PERIOD_TAG; cfg->ssb_table.ssb_period.tl.tag = NFAPI_NR_CONFIG_SSB_PERIOD_TAG;
cfg->num_tlv++; cfg->num_tlv++;
cfg->ssb_table.ssb_subcarrier_offset.value = ssb_SubcarrierOffset; cfg->ssb_table.ssb_subcarrier_offset.value = sco;
cfg->ssb_table.ssb_subcarrier_offset.tl.tag = NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG; cfg->ssb_table.ssb_subcarrier_offset.tl.tag = NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG;
cfg->num_tlv++; cfg->num_tlv++;
cfg->ssb_table.ssb_subcarrier_offset.value = sco; // sc numbers for 15khz
LOG_I(PHY, " sco is %d, scs_scaling is %d, ssbfreq %d, pointA %d absolute_diff %d ssb_subcarrier_offset\n",
sco, scs_scaling, *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB,
scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA, absolute_diff);
switch (scc->ssb_PositionsInBurst->present) { switch (scc->ssb_PositionsInBurst->present) {
case 1 : case 1 :
cfg->ssb_table.ssb_mask_list[0].ssb_mask.value = scc->ssb_PositionsInBurst->choice.shortBitmap.buf[0]<<24; cfg->ssb_table.ssb_mask_list[0].ssb_mask.value = scc->ssb_PositionsInBurst->choice.shortBitmap.buf[0]<<24;
......
...@@ -352,8 +352,8 @@ void schedule_control_sib1(module_id_t module_id, ...@@ -352,8 +352,8 @@ void schedule_control_sib1(module_id_t module_id,
AssertFatal(gNB_mac->sched_ctrlCommon->cce_index >= 0, "Could not find CCE for coreset0\n"); AssertFatal(gNB_mac->sched_ctrlCommon->cce_index >= 0, "Could not find CCE for coreset0\n");
const uint16_t bwpSize = type0_PDCCH_CSS_config->num_rbs; const uint16_t bwpSize = type0_PDCCH_CSS_config->num_rbs;
int rbStart = type0_PDCCH_CSS_config->cset_start_rb; int rbStart = 0; //type0_PDCCH_CSS_config->cset_start_rb;
LOG_I(PHY, "cset_start_rb is %d\n", type0_PDCCH_CSS_config->cset_start_rb);
int startSymbolIndex = 0; int startSymbolIndex = 0;
int nrOfSymbols = 0; int nrOfSymbols = 0;
...@@ -387,10 +387,10 @@ void schedule_control_sib1(module_id_t module_id, ...@@ -387,10 +387,10 @@ void schedule_control_sib1(module_id_t module_id,
TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx), TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx),
nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx), nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx),
rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0, 0,1) >> 3; rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0, 0,1) >> 3;
} while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && TBS < gNB_mac->sched_ctrlCommon->num_total_bytes); } while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize + type0_PDCCH_CSS_config->cset_start_rb] && TBS < gNB_mac->sched_ctrlCommon->num_total_bytes);
gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize = rbSize; gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize = rbSize;
gNB_mac->sched_ctrlCommon->sched_pdsch.rbStart = 0; gNB_mac->sched_ctrlCommon->sched_pdsch.rbStart = rbStart;
LOG_D(MAC,"startSymbolIndex = %i\n", startSymbolIndex); LOG_D(MAC,"startSymbolIndex = %i\n", startSymbolIndex);
LOG_D(MAC,"nrOfSymbols = %i\n", nrOfSymbols); LOG_D(MAC,"nrOfSymbols = %i\n", nrOfSymbols);
...@@ -402,7 +402,7 @@ void schedule_control_sib1(module_id_t module_id, ...@@ -402,7 +402,7 @@ void schedule_control_sib1(module_id_t module_id,
// Mark the corresponding RBs as used // Mark the corresponding RBs as used
for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize; rb++) { for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize; rb++) {
vrb_map[rb + rbStart] = 1; vrb_map[rb + rbStart + type0_PDCCH_CSS_config->cset_start_rb] = 1;
} }
} }
......
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