Commit 58523405 authored by Florian Kaltenberger's avatar Florian Kaltenberger

some improvements too pdcchsim

parent f9c54ec7
...@@ -51,7 +51,9 @@ void lte_param_init(unsigned char N_tx, ...@@ -51,7 +51,9 @@ void lte_param_init(unsigned char N_tx,
lte_frame_parms->nb_antennas_tx = N_tx; lte_frame_parms->nb_antennas_tx = N_tx;
lte_frame_parms->nb_antennas_rx = N_rx; lte_frame_parms->nb_antennas_rx = N_rx;
lte_frame_parms->nb_antennas_tx_eNB = (transmission_mode == 1)? 1 : 2; lte_frame_parms->nb_antennas_tx_eNB = (transmission_mode == 1)? 1 : 2;
lte_frame_parms->phich_config_common.phich_resource = one; lte_frame_parms->phich_config_common.phich_resource = oneSixth;
lte_frame_parms->phich_config_common.phich_duration = normal;
lte_frame_parms->tdd_config = tdd_config; lte_frame_parms->tdd_config = tdd_config;
lte_frame_parms->frame_type = frame_type; lte_frame_parms->frame_type = frame_type;
// lte_frame_parms->Csrs = 2; // lte_frame_parms->Csrs = 2;
......
...@@ -57,15 +57,17 @@ PHY_VARS_UE *PHY_vars_UE; ...@@ -57,15 +57,17 @@ PHY_VARS_UE *PHY_vars_UE;
#define CCCH_RB_ALLOC computeRIV(PHY_vars_eNB->lte_frame_parms.N_RB_UL,0,2) #define CCCH_RB_ALLOC computeRIV(PHY_vars_eNB->lte_frame_parms.N_RB_UL,0,2)
#define DLSCH_RB_ALLOC ((uint16_t)0x1fbf) // igore DC component,RB13 #define DLSCH_RB_ALLOC ((uint16_t)0x1fbf) // igore DC component,RB13
#define msg printf
DCI_PDU DCI_pdu; DCI_PDU DCI_pdu;
DCI_PDU *get_dci(LTE_DL_FRAME_PARMS *lte_frame_parms,uint8_t log2L, uint8_t log2Lcommon, uint8_t format_selector, uint32_t rnti) DCI_PDU *get_dci(LTE_DL_FRAME_PARMS *lte_frame_parms,uint8_t log2L, uint8_t log2Lcommon, DCI_format_t format_selector[MAX_NUM_DCI], uint8_t num_dci, uint32_t rnti)
{ {
uint32_t BCCH_alloc_pdu[2]; uint32_t BCCH_alloc_pdu[2];
uint32_t DLSCH_alloc_pdu[2]; uint32_t DLSCH_alloc_pdu[2];
uint32_t UL_alloc_pdu[2]; uint32_t UL_alloc_pdu[2];
int i; int ind;
int dci_length_bytes=0,dci_length=0; int dci_length_bytes=0,dci_length=0;
int BCCH_pdu_size_bits=0, BCCH_pdu_size_bytes=0; int BCCH_pdu_size_bits=0, BCCH_pdu_size_bytes=0;
int UL_pdu_size_bits=0, UL_pdu_size_bytes=0; int UL_pdu_size_bits=0, UL_pdu_size_bytes=0;
...@@ -360,40 +362,40 @@ DCI_PDU *get_dci(LTE_DL_FRAME_PARMS *lte_frame_parms,uint8_t log2L, uint8_t log2 ...@@ -360,40 +362,40 @@ DCI_PDU *get_dci(LTE_DL_FRAME_PARMS *lte_frame_parms,uint8_t log2L, uint8_t log2
} }
} }
for (ind = 0; ind<num_dci; ind++) {
if (format_selector[ind]==format1A) {
// add common dci // add common dci
DCI_pdu.dci_alloc[0].dci_length = BCCH_pdu_size_bits; DCI_pdu.dci_alloc[ind].dci_length = BCCH_pdu_size_bits;
DCI_pdu.dci_alloc[0].L = log2Lcommon; DCI_pdu.dci_alloc[ind].L = log2Lcommon;
DCI_pdu.dci_alloc[0].rnti = SI_RNTI; DCI_pdu.dci_alloc[ind].rnti = SI_RNTI;
DCI_pdu.dci_alloc[0].format = format1A; DCI_pdu.dci_alloc[ind].format = format1A;
DCI_pdu.dci_alloc[0].ra_flag = 0; DCI_pdu.dci_alloc[ind].ra_flag = 0;
memcpy((void*)&DCI_pdu.dci_alloc[0].dci_pdu[0], &BCCH_alloc_pdu[0], BCCH_pdu_size_bytes); memcpy((void*)&DCI_pdu.dci_alloc[0].dci_pdu[0], &BCCH_alloc_pdu[0], BCCH_pdu_size_bytes);
DCI_pdu.Num_common_dci++; DCI_pdu.Num_common_dci++;
if (lte_frame_parms->N_RB_DL >= 25) { }
if (format_selector[ind]==format1) {
// add ue specific dci // add ue specific dci
DCI_pdu.dci_alloc[1].dci_length = dci_length; DCI_pdu.dci_alloc[ind].dci_length = dci_length;
DCI_pdu.dci_alloc[1].L = log2L; DCI_pdu.dci_alloc[ind].L = log2L;
DCI_pdu.dci_alloc[1].rnti = rnti; DCI_pdu.dci_alloc[ind].rnti = rnti;
DCI_pdu.dci_alloc[1].format = format1; DCI_pdu.dci_alloc[ind].format = format1;
DCI_pdu.dci_alloc[1].ra_flag = 0; DCI_pdu.dci_alloc[ind].ra_flag = 0;
memcpy((void*)&DCI_pdu.dci_alloc[1].dci_pdu[0], &DLSCH_alloc_pdu[0], dci_length_bytes); memcpy((void*)&DCI_pdu.dci_alloc[ind].dci_pdu[0], &DLSCH_alloc_pdu[0], dci_length_bytes);
DCI_pdu.Num_ue_spec_dci++; DCI_pdu.Num_ue_spec_dci++;
}
if (lte_frame_parms->N_RB_DL >= 50) { if (format_selector[ind]==format0) {
DCI_pdu.dci_alloc[2].dci_length = UL_pdu_size_bits; DCI_pdu.dci_alloc[ind].dci_length = UL_pdu_size_bits;
DCI_pdu.dci_alloc[2].L = log2L; DCI_pdu.dci_alloc[ind].L = log2L;
DCI_pdu.dci_alloc[2].rnti = rnti; DCI_pdu.dci_alloc[ind].rnti = rnti;
DCI_pdu.dci_alloc[2].format = format0; DCI_pdu.dci_alloc[ind].format = format0;
DCI_pdu.dci_alloc[2].ra_flag = 0; DCI_pdu.dci_alloc[ind].ra_flag = 0;
memcpy((void*)&DCI_pdu.dci_alloc[0].dci_pdu[0], &UL_alloc_pdu[0], UL_pdu_size_bytes); memcpy((void*)&DCI_pdu.dci_alloc[ind].dci_pdu[0], &UL_alloc_pdu[0], UL_pdu_size_bytes);
DCI_pdu.Num_ue_spec_dci++; DCI_pdu.Num_ue_spec_dci++;
} }
} }
return(&DCI_pdu); return(&DCI_pdu);
} }
...@@ -428,7 +430,9 @@ int main(int argc, char **argv) ...@@ -428,7 +430,9 @@ int main(int argc, char **argv)
// int8_t interf1=-128,interf2=-128; // int8_t interf1=-128,interf2=-128;
uint8_t dci_cnt=0; uint8_t dci_cnt=0;
LTE_DL_FRAME_PARMS *frame_parms; LTE_DL_FRAME_PARMS *frame_parms;
uint8_t log2L=2, log2Lcommon=2, format_selector=0; uint8_t log2L=2, log2Lcommon=2;
DCI_format_t format_selector[MAX_NUM_DCI];
uint8_t num_dci=0;
uint8_t numCCE,common_active=0,ul_active=0,dl_active=0; uint8_t numCCE,common_active=0,ul_active=0,dl_active=0;
uint32_t n_trials_common=0,n_trials_ul=0,n_trials_dl=0,false_detection_cnt=0; uint32_t n_trials_common=0,n_trials_ul=0,n_trials_dl=0,false_detection_cnt=0;
...@@ -470,6 +474,11 @@ int main(int argc, char **argv) ...@@ -470,6 +474,11 @@ int main(int argc, char **argv)
rxdata[0] = (int *)malloc16(FRAME_LENGTH_BYTES); rxdata[0] = (int *)malloc16(FRAME_LENGTH_BYTES);
rxdata[1] = (int *)malloc16(FRAME_LENGTH_BYTES); rxdata[1] = (int *)malloc16(FRAME_LENGTH_BYTES);
*/ */
logInit();
while ((c = getopt (argc, argv, "hapFg:R:c:n:s:x:y:z:L:M:N:I:f:i:S:P:Y")) != -1) { while ((c = getopt (argc, argv, "hapFg:R:c:n:s:x:y:z:L:M:N:I:f:i:S:P:Y")) != -1) {
switch (c) { switch (c) {
case 'a': case 'a':
...@@ -613,7 +622,15 @@ int main(int argc, char **argv) ...@@ -613,7 +622,15 @@ int main(int argc, char **argv)
break; break;
case 'N': case 'N':
format_selector = atoi(optarg); format_selector[num_dci] = (DCI_format_t) atoi(optarg);
if ((format_selector[num_dci]<format0) || (format_selector[num_dci] > format1A)) {
printf("only formats 0, 1, and 1A supported for the moment\n");
exit(-1);
}
if (format_selector[num_dci]==format0) ul_active=1;
if (format_selector[num_dci]==format1A) common_active=1;
if (format_selector[num_dci]==format1) dl_active=1;
num_dci++;
break; break;
case 'O': case 'O':
...@@ -663,25 +680,27 @@ int main(int argc, char **argv) ...@@ -663,25 +680,27 @@ int main(int argc, char **argv)
printf("-y Number of TX antennas used in eNB\n"); printf("-y Number of TX antennas used in eNB\n");
printf("-z Number of RX antennas used in UE\n"); printf("-z Number of RX antennas used in UE\n");
printf("-P Number of interfering PHICH\n"); printf("-P Number of interfering PHICH\n");
printf("-L log2 of Aggregation level for UE Specific DCI (1,2,4,8)\n"); printf("-L log2 of Aggregation level for UE Specific DCI (0,1,2,3)\n");
printf("-M log2 Aggregation level for Common DCI (4,8)\n"); printf("-M log2 Aggregation level for Common DCI (4,8)\n");
printf("-N Format for UE Spec DCI (0 - format1,\n"); printf("-N Format for UE Spec DCI (0 - format0,\n");
printf(" 1 - format1A,\n"); printf(" 1 - format1,\n");
printf(" 2 - format1B_2A,\n"); printf(" 2 - format1A,\n");
printf(" 3 - format1B_4A,\n"); printf(" 3 - format1B_2A,\n");
printf(" 4 - format1C,\n"); printf(" 4 - format1B_4A,\n");
printf(" 5 - format1D_2A,\n"); printf(" 5 - format1C,\n");
printf(" 6 - format1D_4A,\n"); printf(" 6 - format1D_2A,\n");
printf(" 7 - format2A_2A_L10PRB,\n"); printf(" 7 - format1D_4A,\n");
printf(" 8 - format2A_2A_M10PRB,\n"); printf(" 8 - format2A_2A_L10PRB,\n");
printf(" 9 - format2A_4A_L10PRB,\n"); printf(" 9 - format2A_2A_M10PRB,\n");
printf(" 10 - format2A_4A_M10PRB,\n"); printf(" 10 - format2A_4A_L10PRB,\n");
printf(" 11 - format2_2A_L10PRB,\n"); printf(" 11 - format2A_4A_M10PRB,\n");
printf(" 12 - format2_2A_M10PRB,\n"); printf(" 12 - format2_2A_L10PRB,\n");
printf(" 13 - format2_4A_L10PRB,\n"); printf(" 13 - format2_2A_M10PRB,\n");
printf(" 14 - format2_4A_M10PRB\n"); printf(" 14 - format2_4A_L10PRB,\n");
printf(" 15 - format2_2D_M10PRB\n"); printf(" 15 - format2_4A_M10PRB\n");
printf(" 16 - format2_2D_L10PRB\n"); printf(" 16 - format2_2D_M10PRB\n");
printf(" 17 - format2_2D_L10PRB\n");
printf(" can be called multiple times to add more than one DCI\n");
printf("-O Oversampling factor\n"); printf("-O Oversampling factor\n");
printf("-I Cell Id\n"); printf("-I Cell Id\n");
printf("-F Input sample stream\n"); printf("-F Input sample stream\n");
...@@ -690,11 +709,6 @@ int main(int argc, char **argv) ...@@ -690,11 +709,6 @@ int main(int argc, char **argv)
} }
} }
logInit();
if ((transmission_mode>1) && (n_tx==1)) if ((transmission_mode>1) && (n_tx==1))
n_tx=2; n_tx=2;
...@@ -730,7 +744,7 @@ int main(int argc, char **argv) ...@@ -730,7 +744,7 @@ int main(int argc, char **argv)
printf("SNR0 %f, SNR1 %f\n",snr0,snr1); printf("SNR0 %f, SNR1 %f\n",snr0,snr1);
frame_parms = &PHY_vars_eNB->lte_frame_parms; frame_parms = &PHY_vars_eNB->lte_frame_parms;
get_dci(frame_parms, log2L, log2Lcommon, format_selector, n_rnti); get_dci(frame_parms, log2L, log2Lcommon, format_selector, num_dci, n_rnti);
txdata = PHY_vars_eNB->lte_eNB_common_vars.txdata[eNb_id]; txdata = PHY_vars_eNB->lte_eNB_common_vars.txdata[eNb_id];
...@@ -864,15 +878,14 @@ int main(int argc, char **argv) ...@@ -864,15 +878,14 @@ int main(int argc, char **argv)
if (input_fd == NULL) { if (input_fd == NULL) {
numCCE=0; numCCE=0;
if (common_active==1) {
n_trials_common++; n_trials_common++;
common_active = 1; }
if (PHY_vars_eNB->lte_frame_parms.N_RB_DL >= 50) { if (ul_active==1) {
n_trials_ul++; n_trials_ul++;
ul_active = 1;
} }
if (PHY_vars_eNB->lte_frame_parms.N_RB_DL >= 25) { if (dl_active==1) {
n_trials_dl++; n_trials_dl++;
dl_active = 1;
} }
num_pdcch_symbols = get_num_pdcch_symbols(DCI_pdu.Num_common_dci+DCI_pdu.Num_ue_spec_dci, num_pdcch_symbols = get_num_pdcch_symbols(DCI_pdu.Num_common_dci+DCI_pdu.Num_ue_spec_dci,
...@@ -1236,7 +1249,7 @@ int main(int argc, char **argv) ...@@ -1236,7 +1249,7 @@ int main(int argc, char **argv)
} //trials } //trials
printf("SNR %f : n_errors_common = %d/%d (%e)\n", SNR,n_errors_common,n_trials_common,(double)n_errors_common/n_trials_common); if (common_active) printf("SNR %f : n_errors_common = %d/%d (%e)\n", SNR,n_errors_common,n_trials_common,(double)n_errors_common/n_trials_common);
if (ul_active==1) printf("SNR %f : n_errors_ul = %d/%d (%e)\n", SNR,n_errors_ul,n_trials_ul,(double)n_errors_ul/n_trials_ul); if (ul_active==1) printf("SNR %f : n_errors_ul = %d/%d (%e)\n", SNR,n_errors_ul,n_trials_ul,(double)n_errors_ul/n_trials_ul);
if (dl_active==1) printf("SNR %f : n_errors_dl = %d/%d (%e)\n", SNR,n_errors_dl,n_trials_dl,(double)n_errors_dl/n_trials_dl); if (dl_active==1) printf("SNR %f : n_errors_dl = %d/%d (%e)\n", SNR,n_errors_dl,n_trials_dl,(double)n_errors_dl/n_trials_dl);
printf("SNR %f : n_errors_cfi = %d/%d (%e)\n", SNR,n_errors_cfi,trial,(double)n_errors_cfi/trial); printf("SNR %f : n_errors_cfi = %d/%d (%e)\n", SNR,n_errors_cfi,trial,(double)n_errors_cfi/trial);
......
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