Commit cb0eabe7 authored by knopp's avatar knopp

updated unitary simulations for new CCE interfaces. Cleaned up warnings in dlsim/pdcchsim/ulsim.

parent 1fc396f5
......@@ -2546,6 +2546,107 @@ uint16_t get_nCCE_mac(uint8_t Mod_id,uint8_t CC_id,int num_pdcch_symbols,int sub
get_mi(&PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms,subframe)));
}
int get_nCCE_offset_l1(int *CCE_table,
const unsigned char L,
const int nCCE,
const int common_dci,
const unsigned short rnti,
const unsigned char subframe)
{
int search_space_free,m,nb_candidates = 0,l,i;
unsigned int Yk;
/*
printf("CCE Allocation: ");
for (i=0;i<nCCE;i++)
printf("%d.",CCE_table[i]);
printf("\n");
*/
if (common_dci == 1) {
// check CCE(0 ... L-1)
nb_candidates = (L==4) ? 4 : 2;
nb_candidates = min(nb_candidates,nCCE/L);
// printf("Common DCI nb_candidates %d, L %d\n",nb_candidates,L);
for (m = nb_candidates-1 ; m >=0 ; m--) {
search_space_free = 1;
for (l=0; l<L; l++) {
// printf("CCE_table[%d] %d\n",(m*L)+l,CCE_table[(m*L)+l]);
if (CCE_table[(m*L) + l] == 1) {
search_space_free = 0;
break;
}
}
if (search_space_free == 1) {
// printf("returning %d\n",m*L);
for (l=0; l<L; l++)
CCE_table[(m*L)+l]=1;
return(m*L);
}
}
return(-1);
} else { // Find first available in ue specific search space
// according to procedure in Section 9.1.1 of 36.213 (v. 8.6)
// compute Yk
Yk = (unsigned int)rnti;
for (i=0; i<=subframe; i++)
Yk = (Yk*39827)%65537;
Yk = Yk % (nCCE/L);
switch (L) {
case 1:
case 2:
nb_candidates = 6;
break;
case 4:
case 8:
nb_candidates = 2;
break;
default:
DevParam(L, nCCE, rnti);
break;
}
LOG_D(MAC,"rnti %x, Yk = %d, nCCE %d (nCCE/L %d),nb_cand %d\n",rnti,Yk,nCCE,nCCE/L,nb_candidates);
for (m = 0 ; m < nb_candidates ; m++) {
search_space_free = 1;
for (l=0; l<L; l++) {
if (CCE_table[(((Yk+m)%(nCCE/L))*L) + l] == 1) {
search_space_free = 0;
break;
}
}
if (search_space_free == 1) {
for (l=0; l<L; l++)
CCE_table[(((Yk+m)%(nCCE/L))*L)+l]=1;
return(((Yk+m)%(nCCE/L))*L);
}
}
return(-1);
}
}
void dci_decoding_procedure0(LTE_UE_PDCCH **lte_ue_pdcch_vars,
int do_common,
uint8_t subframe,
......
......@@ -2667,7 +2667,7 @@ int generate_eNB_dlsch_params_from_dci(int frame,
dlsch1_harq->subframe = subframe;
}
//#ifdef DEBUG_DCI
#ifdef DEBUG_DCI
if (dlsch0) {
printf("dlsch0 eNB: dlsch0 %p\n",dlsch0);
......@@ -2683,7 +2683,7 @@ int generate_eNB_dlsch_params_from_dci(int frame,
printf("dlsch0 eNB: mimo_mode %d\n",dlsch0_harq->mimo_mode);
}
//#endif
#endif
// compute DL power control parameters
computeRhoA_eNB(pdsch_config_dedicated, dlsch[0],dlsch0_harq->dl_power_off);
......@@ -5534,7 +5534,7 @@ int generate_ue_dlsch_params_from_dci(int frame,
}
//#ifdef DEBUG_DCI
#ifdef DEBUG_DCI
if (dlsch[0]) {
printf("PDSCH dlsch0 UE: rnti %x\n",dlsch[0]->rnti);
......@@ -5548,7 +5548,7 @@ int generate_ue_dlsch_params_from_dci(int frame,
printf("PDSCH dlsch0 UE: pwr_off %d\n",dlsch0_harq->dl_power_off);
}
//#endif
#endif
dlsch[0]->active=1;
// compute DL power control parameters
......
......@@ -1595,6 +1595,12 @@ uint16_t computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs);
uint32_t pmi_extend(LTE_DL_FRAME_PARMS *frame_parms,uint8_t wideband_pmi);
int get_nCCE_offset_l1(int *CCE_table,
const unsigned char L,
const int nCCE,
const int common_dci,
const unsigned short rnti,
const unsigned char subframe);
uint16_t get_nCCE(uint8_t num_pdcch_symbols,LTE_DL_FRAME_PARMS *frame_parms,uint8_t mi);
......
......@@ -266,15 +266,15 @@ int main(int argc, char **argv)
unsigned int ret;
unsigned int coded_bits_per_codeword=0,nsymb,dci_cnt,tbs=0;
unsigned int tx_lev=0,tx_lev_dB=0,trials,errs[4]= {0,0,0,0},errs2[4]= {0,0,0,0},round_trials[4]= {0,0,0,0},dci_errors=0,dlsch_active=0,num_layers;
int re_allocated;
unsigned int tx_lev=0,tx_lev_dB=0,trials,errs[4]= {0,0,0,0},errs2[4]= {0,0,0,0},round_trials[4]= {0,0,0,0},dci_errors=0,dlsch_active=0;//,num_layers;
// int re_allocated;
char fname[32],vname[32];
FILE *bler_fd;
char bler_fname[256];
FILE *time_meas_fd;
char time_meas_fname[256];
FILE *tikz_fd;
char tikz_fname[256];
// FILE *tikz_fd;
// char tikz_fname[256];
FILE *input_trch_fd=NULL;
unsigned char input_trch_file=0;
......@@ -300,7 +300,7 @@ int main(int argc, char **argv)
uint8_t rx_sample_offset = 0;
//char stats_buffer[4096];
//int len;
uint8_t num_rounds = 4,fix_rounds=0;
uint8_t num_rounds = 4;//,fix_rounds=0;
uint8_t subframe=7;
int u;
int n=0;
......@@ -314,8 +314,8 @@ int main(int argc, char **argv)
// void *data;
// int ii;
int bler;
double blerr[4],uncoded_ber,avg_ber;
// int bler;
double blerr[4],uncoded_ber;//,avg_ber;
short *uncoded_ber_bit=NULL;
uint8_t N_RB_DL=25,osf=1;
uint8_t fdd_flag = 0;
......@@ -330,7 +330,7 @@ int main(int argc, char **argv)
int common_flag=0,TPC=0;
double cpu_freq_GHz;
time_stats_t ts;//,sts,usts;
// time_stats_t ts;//,sts,usts;
int avg_iter,iter_trials;
int rballocset=0;
int print_perf=0;
......@@ -344,17 +344,22 @@ int main(int argc, char **argv)
int TB0_active = 1;
uint32_t perfect_ce = 0;
LTE_DL_UE_HARQ_t *dlsch0_ue_harq;
LTE_DL_eNB_HARQ_t *dlsch0_eNB_harq;
// LTE_DL_UE_HARQ_t *dlsch0_ue_harq;
// LTE_DL_eNB_HARQ_t *dlsch0_eNB_harq;
uint8_t Kmimo;
uint8_t ue_category=4;
uint32_t Nsoft;
FILE *proc_fd = NULL;
char buf[64];
int CCE_table[800];
opp_enabled=1; // to enable the time meas
#if defined(__arm__)
FILE *proc_fd = NULL;
char buf[64];
proc_fd = fopen("/sys/devices/system/cpu/cpu4/cpufreq/cpuinfo_cur_freq", "r");
if(!proc_fd)
printf("cannot open /sys/devices/system/cpu/cpu4/cpufreq/cpuinfo_cur_freq");
......@@ -377,7 +382,7 @@ int main(int argc, char **argv)
// default parameters
n_frames = 1000;
snr0 = 0;
num_layers = 1;
// num_layers = 1;
perfect_ce = 0;
while ((c = getopt (argc, argv, "ahdpZDe:m:n:o:s:f:t:c:g:r:F:x:y:z:AM:N:I:i:O:R:S:C:T:b:u:U:v:w:B:PLl:Y")) != -1) {
......@@ -1328,7 +1333,7 @@ int main(int argc, char **argv)
dci_alloc[num_dci].L = 1;
dci_alloc[num_dci].rnti = SI_RNTI;
dci_alloc[num_dci].format = format1A;
dci_alloc[num_dci].nCCE = 0;
dci_alloc[num_dci].firstCCE = 0;
dump_dci(&PHY_vars_eNB->lte_frame_parms,&dci_alloc[num_dci]);
printf("Generating dlsch params for user %d\n",k);
......@@ -1635,7 +1640,7 @@ int main(int argc, char **argv)
dci_alloc[num_dci].L = 1;
dci_alloc[num_dci].rnti = SI_RNTI;
dci_alloc[num_dci].format = format1A;
dci_alloc[num_dci].nCCE = 0;
dci_alloc[num_dci].firstCCE = 0;
dump_dci(&PHY_vars_eNB->lte_frame_parms,&dci_alloc[num_dci]);
printf("Generating dlsch params for user %d\n",k);
......@@ -1943,7 +1948,7 @@ int main(int argc, char **argv)
dci_alloc[num_dci].L = 1;
dci_alloc[num_dci].rnti = SI_RNTI;
dci_alloc[num_dci].format = format1A;
dci_alloc[num_dci].nCCE = 0;
dci_alloc[num_dci].firstCCE = 0;
dump_dci(&PHY_vars_eNB->lte_frame_parms,&dci_alloc[num_dci]);
printf("Generating dlsch params for user %d\n",k);
......@@ -1974,7 +1979,7 @@ int main(int argc, char **argv)
dci_alloc[num_dci].L = 1;
dci_alloc[num_dci].rnti = n_rnti+k;
dci_alloc[num_dci].format = format1E_2A_M10PRB;
dci_alloc[num_dci].nCCE = 4*k;
dci_alloc[num_dci].firstCCE = 4*k;
printf("Generating dlsch params for user %d\n",k);
generate_eNB_dlsch_params_from_dci(0,
subframe,
......@@ -2019,17 +2024,20 @@ int main(int argc, char **argv)
if (n_frames==1) printf("%d\n",numCCE);
// apply RNTI-based nCCE allocation
memset(CCE_table,0,800*sizeof(int));
for (i=num_common_dci; i<num_dci; i++) {
dci_alloc[i].nCCE = get_nCCE_offset(1<<dci_alloc[i].L,
numCCE,
(dci_alloc[i].rnti==SI_RNTI)? 1 : 0,
dci_alloc[i].rnti,
subframe);
dci_alloc[i].firstCCE = get_nCCE_offset_l1(CCE_table,
1<<dci_alloc[i].L,
numCCE,
(dci_alloc[i].rnti==SI_RNTI)? 1 : 0,
dci_alloc[i].rnti,
subframe);
if (n_frames==1)
printf("dci %d: rnti %x, format %d : nCCE %d/%d\n",i,dci_alloc[i].rnti, dci_alloc[i].format,
dci_alloc[i].nCCE,numCCE);
dci_alloc[i].firstCCE,numCCE);
}
for (k=0; k<n_users; k++) {
......@@ -2112,7 +2120,7 @@ int main(int argc, char **argv)
round_trials[3] = 0;
dci_errors=0;
avg_ber = 0;
// avg_ber = 0;
round=0;
avg_iter = 0;
......@@ -2697,13 +2705,13 @@ PMI_FEEDBACK:
}
start_meas(&PHY_vars_eNB->dlsch_modulation_stats);
re_allocated = dlsch_modulation(PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id],
AMP,
subframe,
&PHY_vars_eNB->lte_frame_parms,
num_pdcch_symbols,
PHY_vars_eNB->dlsch_eNB[k][0],
PHY_vars_eNB->dlsch_eNB[k][1]);
dlsch_modulation(PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id],
AMP,
subframe,
&PHY_vars_eNB->lte_frame_parms,
num_pdcch_symbols,
PHY_vars_eNB->dlsch_eNB[k][0],
PHY_vars_eNB->dlsch_eNB[k][1]);
stop_meas(&PHY_vars_eNB->dlsch_modulation_stats);
/*
if (trials==0 && round==0)
......
This diff is collapsed.
......@@ -74,7 +74,7 @@ extern short *ul_ref_sigs[30][2][33];
PHY_VARS_eNB *PHY_vars_eNB;
PHY_VARS_UE *PHY_vars_UE;
#define MCS_COUNT 23//added for PHY abstraction
//#define MCS_COUNT 23//added for PHY abstraction
channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];
channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX];
......@@ -168,7 +168,7 @@ int main(int argc, char **argv)
int aarx,aatx;
double channelx,channely;
double sigma2, sigma2_dB=10,SNR,SNR2,snr0=-2.0,snr1,SNRmeas,rate,saving_bler;
double sigma2, sigma2_dB=10,SNR,SNR2,snr0=-2.0,snr1,SNRmeas,rate,saving_bler=0;
double input_snr_step=.2,snr_int=30;
double blerr;
......@@ -199,7 +199,7 @@ int main(int argc, char **argv)
unsigned int coded_bits_per_codeword,nsymb;
int subframe=3;
unsigned int tx_lev=0,tx_lev_dB,trials,errs[4]= {0,0,0,0},round_trials[4]= {0,0,0,0};
uint8_t transmission_mode=1,n_rx=1,n_tx=1;
uint8_t transmission_mode=1,n_rx=1;
FILE *bler_fd=NULL;
char bler_fname[512];
......@@ -414,10 +414,6 @@ int main(int argc, char **argv)
exit(-1);
}
if (transmission_mode>1) {
n_tx = 1;
}
break;
case 'y':
......@@ -701,8 +697,8 @@ int main(int argc, char **argv)
// Create transport channel structures for 2 transport blocks (MIMO)
for (i=0; i<2; i++) {
PHY_vars_eNB->dlsch_eNB[0][i] = new_eNB_dlsch(1,8,N_RB_DL,0);
PHY_vars_UE->dlsch_ue[0][i] = new_ue_dlsch(1,8,MAX_TURBO_ITERATIONS,N_RB_DL,0);
PHY_vars_eNB->dlsch_eNB[0][i] = new_eNB_dlsch(1,8,1827072,N_RB_DL,0);
PHY_vars_UE->dlsch_ue[0][i] = new_ue_dlsch(1,8,1827072,MAX_TURBO_ITERATIONS,N_RB_DL,0);
if (!PHY_vars_eNB->dlsch_eNB[0][i]) {
printf("Can't get eNB dlsch structures\n");
......@@ -717,7 +713,7 @@ int main(int argc, char **argv)
PHY_vars_eNB->dlsch_eNB[0][i]->rnti = 14;
PHY_vars_UE->dlsch_ue[0][i]->rnti = 14;
}
}
switch (PHY_vars_eNB->lte_frame_parms.N_RB_UL) {
......@@ -905,11 +901,11 @@ int main(int argc, char **argv)
harq_pid = subframe2harq_pid(&PHY_vars_UE->lte_frame_parms,PHY_vars_UE->frame_tx,subframe);
input_buffer_length = PHY_vars_UE->ulsch_ue[0]->harq_processes[harq_pid]->TBS/8;
input_buffer = (unsigned char *)malloc(input_buffer_length+4);
// printf("UL frame %d/subframe %d, harq_pid %d\n",PHY_vars_UE->frame,subframe,harq_pid);
if (input_fdUL == NULL) {
input_buffer_length = PHY_vars_UE->ulsch_ue[0]->harq_processes[harq_pid]->TBS/8;
input_buffer = (unsigned char *)malloc(input_buffer_length+4);
if (n_frames == 1) {
trch_out_fdUL= fopen("ulsch_trchUL.txt","w");
......@@ -931,7 +927,7 @@ int main(int argc, char **argv)
i=0;
while (!feof(input_fdUL)) {
fscanf(input_fdUL,"%s %s",input_val_str,input_val_str2);//&input_val1,&input_val2);
ret=fscanf(input_fdUL,"%s %s",input_val_str,input_val_str2);//&input_val1,&input_val2);
if ((i%4)==0) {
((short*)txdata[0])[i/2] = (short)((1<<15)*strtod(input_val_str,NULL));
......@@ -1261,6 +1257,7 @@ int main(int argc, char **argv)
start_meas(&PHY_vars_eNB->phy_proc_rx);
start_meas(&PHY_vars_eNB->ofdm_demod_stats);
lte_eNB_I0_measurements(PHY_vars_eNB,
subframe,
0,
1);
......
......@@ -540,6 +540,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
LOG_D(MAC,"FrameP %d, subframeP %d : Scheduling CCEs\n",frameP,subframeP);
// Allocate CCEs for good after scheduling is done
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++)
allocate_CCEs(module_idP,CC_id,subframeP,0);
......
......@@ -543,7 +543,6 @@ schedule_ue_spec(
UE_list);
// update UL DAI after DLSCH scheduling
set_ul_DAI(module_idP,UE_id,CC_id,frameP,subframeP,frame_parms);
}
if (continue_flag == 1 ) {
......
......@@ -1027,10 +1027,10 @@ int allocate_CCEs(int module_idP,
}
else { // number of CCEs left can potentially hold this allocation
if ((fCCE = get_nCCE_offset(CCE_table,
1<<(dci_alloc->L),
nCCE_max,
(i<DCI_pdu->Num_common_dci) ? 1 : 0,
dci_alloc->rnti,
1<<(dci_alloc->L),
nCCE_max,
(i<DCI_pdu->Num_common_dci) ? 1 : 0,
dci_alloc->rnti,
subframeP))>=0) {// the allocation is feasible, rnti rule passes
LOG_D(MAC,"Allocating at nCCE %d\n",fCCE);
......
......@@ -762,6 +762,7 @@ void dlsch_scheduler_pre_processor_reset (int module_idP,
ue_sched_ctl->dl_pow_off[CC_id] = 2;
nb_rbs_required_remaining[CC_id][UE_id] = 0;
// Initialize Subbands according to VRB map
for (i=0; i<N_RBG; i++) {
ue_sched_ctl->rballoc_sub_UE[CC_id][UE_id] = 0;
rballoc_sub[CC_id][i] = 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