Commit 77974857 authored by francescomani's avatar francescomani

fixes for physical simulators

parent f3126586
...@@ -178,13 +178,13 @@ void rx_func(void *param) ...@@ -178,13 +178,13 @@ void rx_func(void *param)
// disactivate PHY stats if UE is inactive for a given number of frames // disactivate PHY stats if UE is inactive for a given number of frames
for (int i = 0; i < MAX_MOBILES_PER_GNB; i++) { for (int i = 0; i < MAX_MOBILES_PER_GNB; i++) {
NR_gNB_PHY_STATS_t *stats = &gNB->phy_stats[i]; NR_gNB_PHY_STATS_t *stats = &gNB->phy_stats[i];
if(stats->active && (((frame_rx - stats->frame + 1024) % 1024) > NUMBER_FRAMES_PHY_UE_INACTIVE)) if(stats->active && (((frame_tx - stats->frame + 1024) % 1024) > NUMBER_FRAMES_PHY_UE_INACTIVE))
stats->active = false; stats->active = false;
} }
// disactivate ULSCH structure if it is inactive for a given number of frames // disactivate ULSCH structure if it is inactive for a given number of frames
for (int i = 0; i < gNB->max_nb_pusch; i++) { for (int i = 0; i < gNB->max_nb_pusch; i++) {
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[i]; NR_gNB_ULSCH_t *ulsch = gNB->ulsch[i];
if (ulsch->active && (((frame_rx - ulsch->harq_process->frame + 1024) % 1024) > NUMBER_FRAMES_PHY_UE_INACTIVE)) if (ulsch->active && (((frame_tx - ulsch->harq_process->frame + 1024) % 1024) > NUMBER_FRAMES_PHY_UE_INACTIVE))
ulsch->active = false; ulsch->active = false;
} }
......
...@@ -729,10 +729,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB) ...@@ -729,10 +729,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB)
pusch_vars[ULSCH_id]->llr = (int16_t *)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) ); // [hna] 6144 is LTE and (8*((3*8*6144)+12)) is not clear pusch_vars[ULSCH_id]->llr = (int16_t *)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) ); // [hna] 6144 is LTE and (8*((3*8*6144)+12)) is not clear
pusch_vars[ULSCH_id]->ul_valid_re_per_slot = (int16_t *)malloc16_clear( sizeof(int16_t)*fp->symbols_per_slot); pusch_vars[ULSCH_id]->ul_valid_re_per_slot = (int16_t *)malloc16_clear( sizeof(int16_t)*fp->symbols_per_slot);
} //ulsch_id } //ulsch_id
/*
for (ulsch_id=0; ulsch_id<NUMBER_OF_UE_MAX; ulsch_id++) gNB->pusch_vars = pusch_vars;
gNB->UE_stats_ptr[ulsch_id] = &gNB->UE_stats[ulsch_id];
*/
return (0); return (0);
} }
...@@ -877,6 +875,7 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) ...@@ -877,6 +875,7 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
free_and_zero(pusch_vars[ULSCH_id]->llr); free_and_zero(pusch_vars[ULSCH_id]->llr);
free_and_zero(pusch_vars[ULSCH_id]); free_and_zero(pusch_vars[ULSCH_id]);
} //ULSCH_id } //ULSCH_id
free(gNB->pusch_vars);
} }
//Adding nr_schedule_handler //Adding nr_schedule_handler
...@@ -1042,6 +1041,7 @@ void reset_DLSCH_struct(const PHY_VARS_gNB *gNB, processingData_L1tx_t *msg) ...@@ -1042,6 +1041,7 @@ void reset_DLSCH_struct(const PHY_VARS_gNB *gNB, processingData_L1tx_t *msg)
} }
free(msg->dlsch[i]); free(msg->dlsch[i]);
} }
free(msg->dlsch);
} }
void init_nr_transport(PHY_VARS_gNB *gNB) void init_nr_transport(PHY_VARS_gNB *gNB)
...@@ -1075,8 +1075,8 @@ void init_nr_transport(PHY_VARS_gNB *gNB) ...@@ -1075,8 +1075,8 @@ void init_nr_transport(PHY_VARS_gNB *gNB)
else else
buffer_ul_slots = (nb_ul_slots_period < slot_ahead) ? nb_ul_slots_period : slot_ahead; buffer_ul_slots = (nb_ul_slots_period < slot_ahead) ? nb_ul_slots_period : slot_ahead;
gNB->max_nb_pucch = MAX_MOBILES_PER_GNB * buffer_ul_slots; gNB->max_nb_pucch = buffer_ul_slots ? MAX_MOBILES_PER_GNB * buffer_ul_slots : 1;
gNB->max_nb_pusch = MAX_MOBILES_PER_GNB * buffer_ul_slots; gNB->max_nb_pusch = buffer_ul_slots ? MAX_MOBILES_PER_GNB * buffer_ul_slots : 1;
gNB->max_nb_srs = buffer_ul_slots << 1; // assuming at most 2 SRS per slot gNB->max_nb_srs = buffer_ul_slots << 1; // assuming at most 2 SRS per slot
gNB->measurements.ulsch_measurements = (ULSCH_MEASUREMENTS_gNB *) malloc16(gNB->max_nb_pusch * sizeof(ULSCH_MEASUREMENTS_gNB)); gNB->measurements.ulsch_measurements = (ULSCH_MEASUREMENTS_gNB *) malloc16(gNB->max_nb_pusch * sizeof(ULSCH_MEASUREMENTS_gNB));
...@@ -1125,4 +1125,6 @@ void reset_nr_transport(PHY_VARS_gNB *gNB) ...@@ -1125,4 +1125,6 @@ void reset_nr_transport(PHY_VARS_gNB *gNB)
for (int i = 0; i < gNB->max_nb_pusch; i++) for (int i = 0; i < gNB->max_nb_pusch; i++)
free_gNB_ulsch(&gNB->ulsch[i], fp->N_RB_UL); free_gNB_ulsch(&gNB->ulsch[i], fp->N_RB_UL);
free(gNB->ulsch); free(gNB->ulsch);
free(gNB->measurements.ulsch_measurements);
} }
...@@ -212,7 +212,6 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq ...@@ -212,7 +212,6 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq
{ {
int rx_power_tot = 0; int rx_power_tot = 0;
int rx_power[NB_ANTENNAS_RX];
unsigned short rx_power_avg_dB; unsigned short rx_power_avg_dB;
unsigned short rx_power_tot_dB; unsigned short rx_power_tot_dB;
...@@ -223,6 +222,7 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq ...@@ -223,6 +222,7 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq
int ch_offset = fp->ofdm_symbol_size * symbol; int ch_offset = fp->ofdm_symbol_size * symbol;
int N_RB_UL = gNB->ulsch[ulsch_id]->harq_process->ulsch_pdu.rb_size; int N_RB_UL = gNB->ulsch[ulsch_id]->harq_process->ulsch_pdu.rb_size;
int rx_power[fp->nb_antennas_rx];
for (int aarx = 0; aarx < fp->nb_antennas_rx; aarx++){ for (int aarx = 0; aarx < fp->nb_antennas_rx; aarx++){
rx_power[aarx] = 0; rx_power[aarx] = 0;
......
...@@ -430,7 +430,6 @@ int main(int argc, char **argv) ...@@ -430,7 +430,6 @@ int main(int argc, char **argv)
uint16_t length_dmrs = 1; uint16_t length_dmrs = 1;
uint8_t Nl = 1; uint8_t Nl = 1;
uint8_t rvidx = 0; uint8_t rvidx = 0;
dlsch->rnti = 1;
/*dlsch->harq_processes[0]->mcs = Imcs; /*dlsch->harq_processes[0]->mcs = Imcs;
dlsch->harq_processes[0]->rvidx = rvidx;*/ dlsch->harq_processes[0]->rvidx = rvidx;*/
//printf("dlschsim harqid %d nb_rb %d, mscs %d\n",dlsch->harq_ids[subframe], //printf("dlschsim harqid %d nb_rb %d, mscs %d\n",dlsch->harq_ids[subframe],
......
...@@ -623,7 +623,7 @@ int main(int argc, char **argv) ...@@ -623,7 +623,7 @@ int main(int argc, char **argv)
if(format==0){ if(format==0){
nfapi_nr_uci_pucch_pdu_format_0_1_t uci_pdu; nfapi_nr_uci_pucch_pdu_format_0_1_t uci_pdu;
nfapi_nr_pucch_pdu_t pucch_pdu; nfapi_nr_pucch_pdu_t pucch_pdu;
gNB->uci_stats[0].rnti = 0x1234; gNB->phy_stats[0].rnti = 0x1234;
pucch_pdu.rnti = 0x1234; pucch_pdu.rnti = 0x1234;
pucch_pdu.subcarrier_spacing = 1; pucch_pdu.subcarrier_spacing = 1;
pucch_pdu.group_hop_flag = PUCCH_GroupHopping&1; pucch_pdu.group_hop_flag = PUCCH_GroupHopping&1;
......
...@@ -456,7 +456,7 @@ int main(int argc, char **argv) ...@@ -456,7 +456,7 @@ int main(int argc, char **argv)
uint8_t UE_id = 0; uint8_t UE_id = 0;
NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id]; NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id];
NR_UL_gNB_HARQ_t *harq_process_gNB = ulsch_gNB->harq_processes[harq_pid]; NR_UL_gNB_HARQ_t *harq_process_gNB = ulsch_gNB->harq_process;
nfapi_nr_pusch_pdu_t *rel15_ul = &harq_process_gNB->ulsch_pdu; nfapi_nr_pusch_pdu_t *rel15_ul = &harq_process_gNB->ulsch_pdu;
nr_phy_data_tx_t phy_data = {0}; nr_phy_data_tx_t phy_data = {0};
...@@ -614,7 +614,7 @@ int main(int argc, char **argv) ...@@ -614,7 +614,7 @@ int main(int argc, char **argv)
errors_bit = 0; errors_bit = 0;
for (i = 0; i < TBS; i++) { for (i = 0; i < TBS; i++) {
estimated_output_bit[i] = (ulsch_gNB->harq_processes[harq_pid]->b[i/8] & (1 << (i & 7))) >> (i & 7); estimated_output_bit[i] = (ulsch_gNB->harq_process->b[i/8] & (1 << (i & 7))) >> (i & 7);
test_input_bit[i] = (test_input[i / 8] & (1 << (i & 7))) >> (i & 7); // Further correct for multiple segments test_input_bit[i] = (test_input[i / 8] & (1 << (i & 7))) >> (i & 7); // Further correct for multiple segments
if (estimated_output_bit[i] != test_input_bit[i]) { if (estimated_output_bit[i] != test_input_bit[i]) {
......
...@@ -754,7 +754,7 @@ int main(int argc, char **argv) ...@@ -754,7 +754,7 @@ int main(int argc, char **argv)
NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id]; NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id];
//nfapi_nr_ul_config_ulsch_pdu *rel15_ul = &ulsch_gNB->harq_processes[harq_pid]->ulsch_pdu; //nfapi_nr_ul_config_ulsch_pdu *rel15_ul = &ulsch_gNB->harq_process->ulsch_pdu;
nfapi_nr_ul_tti_request_t *UL_tti_req = malloc(sizeof(*UL_tti_req)); nfapi_nr_ul_tti_request_t *UL_tti_req = malloc(sizeof(*UL_tti_req));
NR_Sched_Rsp_t *Sched_INFO = malloc(sizeof(*Sched_INFO)); NR_Sched_Rsp_t *Sched_INFO = malloc(sizeof(*Sched_INFO));
memset((void*)Sched_INFO,0,sizeof(*Sched_INFO)); memset((void*)Sched_INFO,0,sizeof(*Sched_INFO));
...@@ -1477,7 +1477,7 @@ int main(int argc, char **argv) ...@@ -1477,7 +1477,7 @@ int main(int argc, char **argv)
for (i = 0; i < TBS; i++) { for (i = 0; i < TBS; i++) {
estimated_output_bit[i] = (ulsch_gNB->harq_processes[harq_pid]->b[i / 8] & (1 << (i & 7))) >> (i & 7); estimated_output_bit[i] = (ulsch_gNB->harq_process->b[i / 8] & (1 << (i & 7))) >> (i & 7);
test_input_bit[i] = (UE->ul_harq_processes[harq_pid].b[i / 8] & (1 << (i & 7))) >> (i & 7); test_input_bit[i] = (UE->ul_harq_processes[harq_pid].b[i / 8] & (1 << (i & 7))) >> (i & 7);
if (estimated_output_bit[i] != test_input_bit[i]) { if (estimated_output_bit[i] != test_input_bit[i]) {
...@@ -1489,12 +1489,12 @@ int main(int argc, char **argv) ...@@ -1489,12 +1489,12 @@ int main(int argc, char **argv)
if (n_trials == 1) { if (n_trials == 1) {
for (int r = 0; r < UE->ul_harq_processes[harq_pid].C; r++) for (int r = 0; r < UE->ul_harq_processes[harq_pid].C; r++)
for (int i = 0; i < UE->ul_harq_processes[harq_pid].K >> 3; i++) { for (int i = 0; i < UE->ul_harq_processes[harq_pid].K >> 3; i++) {
if ((UE->ul_harq_processes[harq_pid].c[r][i] ^ ulsch_gNB->harq_processes[harq_pid]->c[r][i]) != 0) if ((UE->ul_harq_processes[harq_pid].c[r][i] ^ ulsch_gNB->harq_process->c[r][i]) != 0)
printf("************"); printf("************");
/*printf("r %d: in[%d] %x, out[%d] %x (%x)\n",r, /*printf("r %d: in[%d] %x, out[%d] %x (%x)\n",r,
i,UE->ul_harq_processes[harq_pid].c[r][i], i,UE->ul_harq_processes[harq_pid].c[r][i],
i,ulsch_gNB->harq_processes[harq_pid]->c[r][i], i,ulsch_gNB->harq_process->c[r][i],
UE->ul_harq_processes[harq_pid].c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]);*/ UE->ul_harq_processes[harq_pid].c[r][i]^ulsch_gNB->harq_process->c[r][i]);*/
} }
} }
if (errors_decoding > 0 && error_flag == 0) { if (errors_decoding > 0 && error_flag == 0) {
......
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