Commit 2d7336a6 authored by Khodr Saaifan's avatar Khodr Saaifan Committed by Thomas Schlichter

Fix UE measurements and add TM4 feedback CQI and Rank Indicator

parent 8a14d72a
*.cproject
*.project
*.c~
cmake_targets/*.txt
cmake_targets/log/*
cmake_targets/lte_noS1_build_oai/*.txt
cmake_targets/lte_noS1_build_oai/build/*
cmake_targets/rxsig_frame0.dat
targets/bin/*
\ No newline at end of file
......@@ -37,7 +37,8 @@
#endif
#include "assertions.h"
//SFN
#include "sudas_tm4.h"
//#define DEBUG_HARQ
#include "LAYER2/MAC/extern.h"
......@@ -7072,9 +7073,10 @@ void fill_CQI(LTE_UE_ULSCH_t *ulsch,PHY_MEASUREMENTS *meas,uint8_t eNB_id,uint8_
else
sinr_tmp = (double) meas->wideband_cqi_avg[eNB_id];
//LOG_I(PHY,"[UE][UCI] Filling CQI format %d for eNB %d N_RB_DL %d\n",uci_format,eNB_id,N_RB_DL);
//LOG_I(PHY,"[UE][UCI--->PUSCH] Filling CQI format %d for eNB %d N_RB_DL %d\n",uci_format,eNB_id,N_RB_DL);
//SFN
//sudas_LOG_PHY(debug_sudas_LOG_PHY,"[UE][UCI--->PUSCH] meas->rank[eNB_id] %d Filling CQI format %d for eNB %d N_RB_DL %d flag_LA %d\n",meas->rank[eNB_id],uci_format,eNB_id,N_RB_DL,flag_LA);
//fflush(debug_sudas_LOG_PHY);
switch (N_RB_DL) {
......@@ -7146,6 +7148,9 @@ void fill_CQI(LTE_UE_ULSCH_t *ulsch,PHY_MEASUREMENTS *meas,uint8_t eNB_id,uint8_
break;
case HLC_subband_cqi_nopmi:
//SFN
//sudas_LOG_PHY(debug_sudas_LOG_PHY,"[UE][UCI--->PUSCH] HLC_subband_cqi_nopmi\n");
//fflush(debug_sudas_LOG_PHY);
((HLC_subband_cqi_nopmi_5MHz *)o)->cqi1 = sinr2cqi(sinr_tmp,trans_mode);
((HLC_subband_cqi_nopmi_5MHz *)o)->diffcqi1 = fill_subband_cqi(meas,eNB_id,trans_mode,7);
break;
......@@ -7654,6 +7659,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
// ulsch->harq_processes[harq_pid]->status = ACTIVE;
if (cqi_req == 1) {
if( (AntennaInfoDedicated__transmissionMode_tm3 == transmission_mode) || (AntennaInfoDedicated__transmissionMode_tm4 == transmission_mode) )
......@@ -7664,6 +7670,8 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
{
ulsch->O_RI = 0;
}
//sudas_LOG_PHY(debug_sudas_LOG_PHY,"[UE][UCI--->PUSCH] transmission_mode %d ulsch->O_RI %d\n",transmission_mode,ulsch->O_RI);
//fflush(debug_sudas_LOG_PHY);
//ulsch->O_RI = 0; //we only support 2 antenna ports, so this is always 1 according to 3GPP 36.213 Table
switch(transmission_mode) {
......
......@@ -37,6 +37,11 @@
#include "PHY/sse_intrin.h"
#include "T.h"
//SFN
#include "sudas_tm4.h"
#ifndef USER_MODE
#define NOCYGWIN_STATIC static
#else
......@@ -147,6 +152,8 @@ int rx_pdsch(PHY_VARS_UE *ue,
break;
case PDSCH:
//sudas_LOG_PHY(debug_sudas_LOG_PHY,"ue->DLSCH: PDSCH; \n");
//fflush(debug_sudas_LOG_PHY);
pdsch_vars = ue->pdsch_vars[ue->current_thread_id[subframe]];
dlsch = ue->dlsch[ue->current_thread_id[subframe]][eNB_id];
//printf("status TB0 = %d, status TB1 = %d \n", dlsch[0]->harq_processes[harq_pid]->status, dlsch[1]->harq_processes[harq_pid]->status);
......@@ -319,7 +326,8 @@ int rx_pdsch(PHY_VARS_UE *ue,
dlsch0_harq->mimo_mode);
}
} else if (beamforming_mode==0) { //else if nb_antennas_ports_eNB==1 && beamforming_mode == 0
nb_rb = dlsch_extract_rbs_single(common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF,
//1)
nb_rb = dlsch_extract_rbs_single(common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF,
common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id],
pdsch_vars[eNB_id]->rxdataF_ext,
pdsch_vars[eNB_id]->dl_ch_estimates_ext,
......@@ -776,6 +784,9 @@ int rx_pdsch(PHY_VARS_UE *ue,
} */
}
} else {
//sudas_LOG_PHY(debug_sudas_LOG_PHY,"ue->measurements: rx_pdsch: dlsch_detection_mrc(); \n");
//fflush(debug_sudas_LOG_PHY);
dlsch_detection_mrc(frame_parms,
pdsch_vars[eNB_id]->rxdataF_comp0,
pdsch_vars[eNB_id_i]->rxdataF_comp0,
......@@ -803,6 +814,9 @@ int rx_pdsch(PHY_VARS_UE *ue,
nb_rb);
*/
} else if (dlsch0_harq->mimo_mode == ALAMOUTI) {
//sudas_LOG_PHY(debug_sudas_LOG_PHY,"ue->measurements: rx_pdsch: dlsch_alamouti(); \n");
// fflush(debug_sudas_LOG_PHY);
dlsch_alamouti(frame_parms,
pdsch_vars[eNB_id]->rxdataF_comp0,
pdsch_vars[eNB_id]->dl_ch_mag0,
......@@ -3457,7 +3471,7 @@ void dlsch_scale_channel(int **dl_ch_estimates_ext,
unsigned char aatx,aarx,pilots=0,symbol_mod;
__m128i *dl_ch128, ch_amp128;
symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;//0:6
if ((symbol_mod == 0) || (symbol_mod == (4-frame_parms->Ncp))) {
if (frame_parms->mode1_flag==1) // 10 out of 12 so don't reduce size
......@@ -3467,6 +3481,8 @@ void dlsch_scale_channel(int **dl_ch_estimates_ext,
}
// Determine scaling amplitude based the symbol
//dlsch_ue[0]->sqrt_rho_b//pilot position
//dlsch_ue[0]->sqrt_rho_a//data position
ch_amp = ((pilots) ? (dlsch_ue[0]->sqrt_rho_b) : (dlsch_ue[0]->sqrt_rho_a));
......
......@@ -23,6 +23,9 @@ extern unsigned int dlsch_tbs25[27][25],TBStable[27][110],TBStable1C[32];
extern unsigned short lte_cqi_eff1024[16];
extern char lte_cqi_snr_dB[15];
extern short conjugate[8],conjugate2[8];
//sfn
extern short mmvariable[8],mmvariable1[8],mmvariable2[8],mmvariable3[8];
extern short minus_one[8];
extern short minus_one[8];
extern short *ul_ref_sigs[30][2][33];
......
This diff is collapsed.
......@@ -41,7 +41,8 @@
#include "extern.h"
#include "SIMULATION/ETH_TRANSPORT/extern.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
//SFN
#include "sudas_tm4.h"
//#define DEBUG_ULSCH_CODING
//#define DEBUG_ULSCH_FREE 1
......@@ -207,7 +208,7 @@ uint32_t ulsch_encoding(uint8_t *a,
uint8_t control_only_flag,
uint8_t Nbundled)
{
// PHY statistics for RRC decisions
time_stats_t *seg_stats=&ue->ulsch_segmentation_stats;
time_stats_t *rm_stats=&ue->ulsch_rate_matching_stats;
time_stats_t *te_stats=&ue->ulsch_turbo_encoding_stats;
......@@ -220,7 +221,7 @@ uint32_t ulsch_encoding(uint8_t *a,
uint32_t A;
uint8_t Q_m=0;
uint32_t Kr=0,Kr_bytes,r,r_offset=0;
uint8_t y[6*14*1200],*yptr;;
uint8_t y[6*14*1200],*yptr;// y matrix max(Q_m)*14 symbols*12*100
uint8_t *columnset;
uint32_t sumKr=0;
uint32_t Qprime,L,G,Q_CQI=0,Q_RI=0,Q_ACK=0,H=0,Hprime=0,Hpp=0,Cmux=0,Rmux=0,Rmux_prime=0;
......@@ -263,8 +264,11 @@ uint32_t ulsch_encoding(uint8_t *a,
if (ulsch->O>0) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING_FILL_CQI, VCD_FUNCTION_IN);
rnti = ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti;
//sfn target function : we start here CQI/PMI for tm_4 CQI1 and CQI2
fill_CQI(ulsch,meas,0,harq_pid,ue->frame_parms.N_RB_DL,rnti, tmode,ue->sinr_eff);
//sudas_LOG_PHY(debug_sudas_LOG_PHY,"[UE][UCI--->PUSCH] harq_pid %d subframe_Tx %d, CQI ON, RI ON \n",harq_pid,(subframe_rx+4)%10);
//fflush(debug_sudas_LOG_PHY);
LOG_D(PHY,"ULSCH Encoding rnti %x \n", rnti);
print_CQI(ulsch->o,ulsch->uci_format,0,ue->frame_parms.N_RB_DL);
......@@ -619,8 +623,14 @@ uint32_t ulsch_encoding(uint8_t *a,
i=0;
//SFN
// Do RI coding
if (ulsch->O_RI == 1) {
//sudas_LOG_PHY(debug_sudas_LOG_PHY,"[UE][UCI--->PUSCH] ulsch->O_RI= %d, ulsch->o_RI[0]=%d meas->rank[eNB_id]%d\n", ulsch->O_RI, ulsch->o_RI[0],meas->rank[0]);
//fflush(debug_sudas_LOG_PHY);
switch (Q_m) {
case 2:
ulsch->q_RI[0] = ulsch->o_RI[0];
......@@ -756,15 +766,18 @@ uint32_t ulsch_encoding(uint8_t *a,
// channel multiplexing/interleaving
start_meas(m_stats);
Hpp = Hprime + Q_RI;
Qprime_RI = Q_RI / Q_m;
Qprime_ACK = Q_ACK / Q_m;
Qprime_CQI = Q_CQI / Q_m;
//fix Hpp SFN
Hpp = Hprime + Qprime_RI;
Cmux = ulsch->Nsymb_pusch;
Rmux = Hpp*Q_m/Cmux;
Rmux_prime = Rmux/Q_m;
Qprime_RI = Q_RI / Q_m;
Qprime_ACK = Q_ACK / Q_m;
Qprime_CQI = Q_CQI / Q_m;
// printf("Qprime_CQI = %d\n",Qprime_CQI);
// RI BITS
......
......@@ -62,6 +62,11 @@ unsigned char ue_power_offsets[25] = {14,11,9,8,7,6,6,5,4,4,4,3,3,3,2,2,2,1,1,1,
short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1};
short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
short mmvariable[8]__attribute__((aligned(16))) = {23170,23170,23170,23170,23170,23170,23170,23170};//45
short mmvariable1[8]__attribute__((aligned(16))) = {23170,-23170,23170,-23170,23170,-23170,23170,-23170};//-45
short mmvariable2[8]__attribute__((aligned(16))) = {0,23170,0,23170,0,23170,0,23170};//90
short mmvariable3[8]__attribute__((aligned(16))) = {23170,0,23170,0,23170,0,23170,0};//0
int qam64_table[8],qam16_table[4];
unsigned char cs_ri_normal[4] = {1,4,7,10};
......
......@@ -54,7 +54,8 @@
#include "LAYER2/MAC/extern.h"
#include "LAYER2/MAC/defs.h"
#include "UTIL/LOG/log.h"
//SFN
#include "sudas_tm4.h"
#ifdef EMOS
fifo_dump_emos_UE emos_dump_UE;
#endif
......@@ -411,8 +412,10 @@ uint8_t is_cqi_TXOp(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id)
{
int subframe = proc->subframe_tx;
int frame = proc->frame_tx;
CQI_REPORTPERIODIC *cqirep = &ue->cqi_report_config[eNB_id].CQI_ReportPeriodic;
CQI_REPORTPERIODIC *cqirep = &ue->cqi_report_config[eNB_id].CQI_ReportPeriodic;
//sudas_LOG_PHY(debug_sudas_LOG_PHY,"[UE][UCI--->PUSCH] CQI_ReportPeriodic cqirep->Npd %d cqirep->N_OFFSET_CQI %d \n",cqirep->Npd,cqirep->N_OFFSET_CQI);
//fflush(debug_sudas_LOG_PHY);
//LOG_I(PHY,"[UE %d][CRNTI %x] AbsSubFrame %d.%d Checking for CQI TXOp (cqi_ConfigIndex %d) isCQIOp %d\n",
// ue->Mod_id,ue->pdcch_vars[eNB_id]->crnti,frame,subframe,
// cqirep->cqi_PMI_ConfigIndex,
......@@ -1527,6 +1530,8 @@ void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_OUT);
}
// UL UE Procedure for Shared Channel
void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag) {
int harq_pid;
......@@ -1534,20 +1539,22 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
int subframe_tx=proc->subframe_tx;
int Mod_id = ue->Mod_id;
int CC_id = ue->CC_id;
uint8_t Msg3_flag=0;
uint16_t first_rb, nb_rb;
uint8_t Msg3_flag=0;//schedule RRC request
uint16_t first_rb, nb_rb;//indicate the first RB in the virtual RB array
unsigned int input_buffer_length;
int i;
int aa;
int tx_amp;
uint8_t ulsch_input_buffer[5477] __attribute__ ((aligned(32)));
uint8_t access_mode;
uint8_t ulsch_input_buffer[5477] __attribute__ ((aligned(32)));//32 bytes aligned for SIMD operation
uint8_t access_mode;//indicate PUSCH or PUCCH
uint8_t Nbundled=0;
uint8_t NbundledCw1=0;
uint8_t ack_status_cw0=0;
uint8_t ack_status_cw1=0;
uint8_t cqi_status = 0;
uint8_t ri_status = 0;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC,VCD_FUNCTION_IN);
// get harq_pid from subframe relationship
......@@ -1591,9 +1598,9 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
Msg3_flag=0;
}
}
// Check and test if the schedulig ifo are valid for PUSCH channel
// it uses isBad to test the validation of the parms first_rb, nb_rb, and RV index
if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag == 1) {
uint8_t isBad = 0;
if (ue->frame_parms.N_RB_UL <= ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb) {
LOG_D(PHY,"Invalid PUSCH first_RB=%d for N_RB_UL=%d\n",
......@@ -1635,6 +1642,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0;
}
}
if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag == 1) {
ue->generate_ul_signal[eNB_id] = 1;
......@@ -1642,13 +1650,14 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
// deactivate service request
// ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0;
LOG_D(PHY,"Generating PUSCH (Abssubframe: %d.%d): harq-Id: %d, round: %d, MaxReTrans: %d \n",frame_tx,subframe_tx,harq_pid,ue->ulsch[eNB_id]->harq_processes[harq_pid]->round,ue->ulsch[eNB_id]->Mlimit);
// Control HARQ process round=0,...,Mlimit - 1, where Mlimit = 4
if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->round >= (ue->ulsch[eNB_id]->Mlimit - 1))
{
LOG_D(PHY,"PUSCH MAX Retransmission achieved ==> send last pusch\n");
ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0;
ue->ulsch[eNB_id]->harq_processes[harq_pid]->round = 0;
}
// Get ack status for cw0 for antenna 0 for PDSCH
ack_status_cw0 = reset_ack(&ue->frame_parms,
ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->harq_ack,
subframe_tx,
......@@ -1656,6 +1665,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
ue->ulsch[eNB_id]->o_ACK,
&Nbundled,
0);
// Reset ack status for cw1 for antenna 1 for PDSCH ()
ack_status_cw1 = reset_ack(&ue->frame_parms,
ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][1]->harq_ack,
subframe_tx,
......
......@@ -19,7 +19,7 @@
#define FHG_TM4
//#define FHG_TM4_LOG
#define FHG_TM4_LOG_CQI
#define FHG_LOG
......
......@@ -75,6 +75,8 @@ unsigned short config_frames[4] = {2,9,11,13};
#endif
#include "system.h"
//SFN
#include "sudas_tm4.h"
#ifdef XFORMS
#include "PHY/TOOLS/lte_phy_scope.h"
......@@ -125,7 +127,9 @@ int UE_scan_carrier = 0;
runmode_t mode = normal_txrx;
FILE *input_fd=NULL;
//sfn
FILE *debug_sudas_LOG_PHY;
FILE *debug_sudas_LOG_MAC;
#if MAX_NUM_CCs == 1
rx_gain_t rx_gain_mode[MAX_NUM_CCs][4] = {{max_gain,max_gain,max_gain,max_gain}};
......@@ -1382,6 +1386,15 @@ void init_openair0() {
int main( int argc, char **argv ) {
int i,j,k,aa,re;
debug_sudas_LOG_PHY = fopen("debug_sudas_LOG_PHY.txt", "w");
debug_sudas_LOG_MAC = fopen("debug_sudas_LOG_MAC.txt", "w");
sudas_LOG_PHY(debug_sudas_LOG_PHY,"main();\n");
fflush(debug_sudas_LOG_PHY);
#if defined (XFORMS)
void *status;
#endif
......@@ -2013,6 +2026,7 @@ int main( int argc, char **argv ) {
terminate_opt();
logClean();
fclose(debug_sudas_LOG_PHY);
fclose(debug_sudas_LOG_MAC);
return 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