Fixes 256QAM, added pdsch table 2, fixed warnings

master
Guillem Foreman 6 years ago
parent 535325bc37
commit db4127ca64

@ -79,6 +79,7 @@ int mbsfn_area_id = -1;
char *rf_args = ""; char *rf_args = "";
char *rf_dev = ""; char *rf_dev = "";
float rf_amp = 0.8, rf_gain = 60.0, rf_freq = 2400000000; float rf_amp = 0.8, rf_gain = 60.0, rf_freq = 2400000000;
static bool enable_256qam = false;
float output_file_snr = +INFINITY; float output_file_snr = +INFINITY;
@ -145,13 +146,14 @@ void usage(char *prog) {
printf("\t-u listen TCP/UDP port for input data (if mbsfn is active then the stream is over mbsfn only) (-1 is random) [Default %d]\n", net_port); printf("\t-u listen TCP/UDP port for input data (if mbsfn is active then the stream is over mbsfn only) (-1 is random) [Default %d]\n", net_port);
printf("\t-v [set srslte_verbose to debug, default none]\n"); printf("\t-v [set srslte_verbose to debug, default none]\n");
printf("\t-s output file SNR [Default %f]\n", output_file_snr); printf("\t-s output file SNR [Default %f]\n", output_file_snr);
printf("\t-q Enable/Disable 256QAM modulation (default %s)\n", enable_256qam ? "enabled" : "disabled");
printf("\n"); printf("\n");
printf("\t*: See 3GPP 36.212 Table 5.3.3.1.5-4 for more information\n"); printf("\t*: See 3GPP 36.212 Table 5.3.3.1.5-4 for more information\n");
} }
void parse_args(int argc, char **argv) { void parse_args(int argc, char **argv) {
int opt; int opt;
while ((opt = getopt(argc, argv, "IadglfmoncpvutxbwMsB")) != -1) { while ((opt = getopt(argc, argv, "IadglfmoncpqvutxbwMsB")) != -1) {
switch (opt) { switch (opt) {
case 'I': case 'I':
@ -208,6 +210,9 @@ void parse_args(int argc, char **argv) {
case 'B': case 'B':
mbsfn_sf_mask = atoi(argv[optind]); mbsfn_sf_mask = atoi(argv[optind]);
break; break;
case 'q':
enable_256qam ^= true;
break;
default: default:
usage(argv[0]); usage(argv[0]);
exit(-1); exit(-1);
@ -920,7 +925,7 @@ int main(int argc, char **argv) {
} }
/* Configure pdsch_cfg parameters */ /* Configure pdsch_cfg parameters */
if (srslte_ra_dl_dci_to_grant(&cell, &dl_sf, transmission_mode, &dci_dl, &pdsch_cfg.grant)) { if (srslte_ra_dl_dci_to_grant(&cell, &dl_sf, transmission_mode, enable_256qam, &dci_dl, &pdsch_cfg.grant)) {
ERROR("Error configuring PDSCH\n"); ERROR("Error configuring PDSCH\n");
exit(-1); exit(-1);
} }
@ -955,7 +960,7 @@ int main(int argc, char **argv) {
dci_dl.format = SRSLTE_DCI_FORMAT1; dci_dl.format = SRSLTE_DCI_FORMAT1;
/* Configure pdsch_cfg parameters */ /* Configure pdsch_cfg parameters */
if (srslte_ra_dl_dci_to_grant(&cell, &dl_sf, SRSLTE_TM1, &dci_dl, &pmch_cfg.pdsch_cfg.grant)) { if (srslte_ra_dl_dci_to_grant(&cell, &dl_sf, SRSLTE_TM1, enable_256qam, &dci_dl, &pmch_cfg.pdsch_cfg.grant)) {
ERROR("Error configuring PDSCH\n"); ERROR("Error configuring PDSCH\n");
exit(-1); exit(-1);
} }

@ -109,6 +109,7 @@ typedef struct {
int tdd_special_sf; int tdd_special_sf;
int sf_config; int sf_config;
int verbose; int verbose;
bool enable_256qam;
}prog_args_t; }prog_args_t;
void args_default(prog_args_t* args) void args_default(prog_args_t* args)
@ -134,6 +135,7 @@ void args_default(prog_args_t* args)
args->rf_nof_rx_ant = 1; args->rf_nof_rx_ant = 1;
args->enable_cfo_ref = false; args->enable_cfo_ref = false;
args->average_subframe = false; args->average_subframe = false;
args->enable_256qam = false;
#ifdef ENABLE_AGC_DEFAULT #ifdef ENABLE_AGC_DEFAULT
args->rf_gain = -1.0; args->rf_gain = -1.0;
#else #else
@ -192,6 +194,7 @@ void usage(prog_args_t *args, char *prog) {
printf("\t-U remote TCP address to send data [Default %s]\n", args->net_address); printf("\t-U remote TCP address to send data [Default %s]\n", args->net_address);
printf("\t-M MBSFN area id [Default %d]\n", args->mbsfn_area_id); printf("\t-M MBSFN area id [Default %d]\n", args->mbsfn_area_id);
printf("\t-N Non-MBSFN region [Default %d]\n", args->non_mbsfn_region); printf("\t-N Non-MBSFN region [Default %d]\n", args->non_mbsfn_region);
printf("\t-q Enable/Disable 256QAM modulation (default %s)\n", args->enable_256qam ? "enabled" : "disabled");
printf("\t-v [set srslte_verbose to debug, default none]\n"); printf("\t-v [set srslte_verbose to debug, default none]\n");
} }
@ -199,7 +202,7 @@ void parse_args(prog_args_t *args, int argc, char **argv) {
int opt; int opt;
args_default(args); args_default(args);
while ((opt = getopt(argc, argv, "adAogliIpPcOCtdDFRnvrfuUsSZyWMNBTG")) != -1) { while ((opt = getopt(argc, argv, "adAogliIpPcOCtdDFRqnvrfuUsSZyWMNBTG")) != -1) {
switch (opt) { switch (opt) {
case 'i': case 'i':
args->input_file_name = argv[optind]; args->input_file_name = argv[optind];
@ -301,6 +304,9 @@ void parse_args(prog_args_t *args, int argc, char **argv) {
case 'B': case 'B':
args->mbsfn_sf_mask = atoi(argv[optind]); args->mbsfn_sf_mask = atoi(argv[optind]);
break; break;
case 'q':
args->enable_256qam ^= true;
break;
default: default:
usage(args, argv[0]); usage(args, argv[0]);
exit(-1); exit(-1);
@ -393,7 +399,7 @@ int main(int argc, char **argv) {
#endif /* ENABLE_GUI */ #endif /* ENABLE_GUI */
for (int i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { for (int i = 0; i < SRSLTE_MAX_CODEWORDS; i++) {
data[i] = srslte_vec_malloc(sizeof(uint8_t) * 1500 * 8); data[i] = srslte_vec_malloc(sizeof(uint8_t) * 2000 * 8);
if (!data[i]) { if (!data[i]) {
ERROR("Allocating data"); ERROR("Allocating data");
go_exit = true; go_exit = true;
@ -783,6 +789,7 @@ int main(int argc, char **argv) {
dl_sf.tti = tti; dl_sf.tti = tti;
dl_sf.sf_type = sf_type; dl_sf.sf_type = sf_type;
ue_dl_cfg.cfg.tm = (srslte_tm_t)tm; ue_dl_cfg.cfg.tm = (srslte_tm_t)tm;
ue_dl_cfg.pdsch_use_tbs_index_alt = prog_args.enable_256qam;
if ((ue_dl_cfg.cfg.tm == SRSLTE_TM1 && cell.nof_ports == 1) || if ((ue_dl_cfg.cfg.tm == SRSLTE_TM1 && cell.nof_ports == 1) ||
(ue_dl_cfg.cfg.tm > SRSLTE_TM1 && cell.nof_ports > 1)) { (ue_dl_cfg.cfg.tm > SRSLTE_TM1 && cell.nof_ports > 1)) {

@ -212,32 +212,32 @@ inline void hard_qam256_demod(const cf_t* in, uint8_t* out, uint32_t N)
out[8 * s + 4] = 0x1; out[8 * s + 4] = 0x1;
out[8 * s + 6] = 0x1; out[8 * s + 6] = 0x1;
} else if ((__real__ in[s] > QAM256_THRESHOLD_6) || (__real__ in[s] < -QAM256_THRESHOLD_6)) { } else if ((__real__ in[s] > QAM256_THRESHOLD_6) || (__real__ in[s] < -QAM256_THRESHOLD_6)) {
out[6 * s + 2] = 0x1; out[8 * s + 2] = 0x1;
out[6 * s + 4] = 0x1; out[8 * s + 4] = 0x1;
out[8 * s + 6] = 0x0; out[8 * s + 6] = 0x0;
} else if ((__real__ in[s] > QAM256_THRESHOLD_5) || (__real__ in[s] < -QAM256_THRESHOLD_5)) { } else if ((__real__ in[s] > QAM256_THRESHOLD_5) || (__real__ in[s] < -QAM256_THRESHOLD_5)) {
out[6 * s + 2] = 0x1; out[8 * s + 2] = 0x1;
out[6 * s + 4] = 0x0; out[8 * s + 4] = 0x0;
out[8 * s + 6] = 0x0; out[8 * s + 6] = 0x0;
} else if ((__real__ in[s] > QAM256_THRESHOLD_4) || (__real__ in[s] < -QAM256_THRESHOLD_4)) { } else if ((__real__ in[s] > QAM256_THRESHOLD_4) || (__real__ in[s] < -QAM256_THRESHOLD_4)) {
out[6 * s + 2] = 0x1; out[8 * s + 2] = 0x1;
out[6 * s + 4] = 0x0; out[8 * s + 4] = 0x0;
out[8 * s + 6] = 0x1; out[8 * s + 6] = 0x1;
} else if ((__real__ in[s] > QAM256_THRESHOLD_3) || (__real__ in[s] < -QAM256_THRESHOLD_3)) { } else if ((__real__ in[s] > QAM256_THRESHOLD_3) || (__real__ in[s] < -QAM256_THRESHOLD_3)) {
out[6 * s + 2] = 0x0; out[8 * s + 2] = 0x0;
out[6 * s + 4] = 0x0; out[8 * s + 4] = 0x0;
out[8 * s + 6] = 0x1; out[8 * s + 6] = 0x1;
} else if ((__real__ in[s] > QAM256_THRESHOLD_2) || (__real__ in[s] < -QAM256_THRESHOLD_2)) { } else if ((__real__ in[s] > QAM256_THRESHOLD_2) || (__real__ in[s] < -QAM256_THRESHOLD_2)) {
out[6 * s + 2] = 0x0; out[8 * s + 2] = 0x0;
out[6 * s + 4] = 0x1; out[8 * s + 4] = 0x1;
out[8 * s + 6] = 0x1; out[8 * s + 6] = 0x1;
} else if ((__real__ in[s] > QAM256_THRESHOLD_1) || (__real__ in[s] < -QAM256_THRESHOLD_1)) { } else if ((__real__ in[s] > QAM256_THRESHOLD_1) || (__real__ in[s] < -QAM256_THRESHOLD_1)) {
out[6 * s + 2] = 0x0; out[8 * s + 2] = 0x0;
out[6 * s + 4] = 0x1; out[8 * s + 4] = 0x1;
out[8 * s + 6] = 0x0; out[8 * s + 6] = 0x0;
} else { } else {
out[6 * s + 2] = 0x0; out[8 * s + 2] = 0x0;
out[6 * s + 4] = 0x0; out[8 * s + 4] = 0x0;
out[8 * s + 6] = 0x0; out[8 * s + 6] = 0x0;
} }
@ -252,32 +252,32 @@ inline void hard_qam256_demod(const cf_t* in, uint8_t* out, uint32_t N)
out[8 * s + 5] = 0x1; out[8 * s + 5] = 0x1;
out[8 * s + 7] = 0x1; out[8 * s + 7] = 0x1;
} else if ((__imag__ in[s] > QAM256_THRESHOLD_6) || (__imag__ in[s] < -QAM256_THRESHOLD_6)) { } else if ((__imag__ in[s] > QAM256_THRESHOLD_6) || (__imag__ in[s] < -QAM256_THRESHOLD_6)) {
out[6 * s + 3] = 0x1; out[8 * s + 3] = 0x1;
out[6 * s + 5] = 0x1; out[8 * s + 5] = 0x1;
out[8 * s + 7] = 0x0; out[8 * s + 7] = 0x0;
} else if ((__imag__ in[s] > QAM256_THRESHOLD_5) || (__imag__ in[s] < -QAM256_THRESHOLD_5)) { } else if ((__imag__ in[s] > QAM256_THRESHOLD_5) || (__imag__ in[s] < -QAM256_THRESHOLD_5)) {
out[6 * s + 3] = 0x1; out[8 * s + 3] = 0x1;
out[6 * s + 5] = 0x0; out[8 * s + 5] = 0x0;
out[8 * s + 7] = 0x0; out[8 * s + 7] = 0x0;
} else if ((__imag__ in[s] > QAM256_THRESHOLD_4) || (__imag__ in[s] < -QAM256_THRESHOLD_4)) { } else if ((__imag__ in[s] > QAM256_THRESHOLD_4) || (__imag__ in[s] < -QAM256_THRESHOLD_4)) {
out[6 * s + 3] = 0x1; out[8 * s + 3] = 0x1;
out[6 * s + 5] = 0x0; out[8 * s + 5] = 0x0;
out[8 * s + 7] = 0x1; out[8 * s + 7] = 0x1;
} else if ((__imag__ in[s] > QAM256_THRESHOLD_3) || (__imag__ in[s] < -QAM256_THRESHOLD_3)) { } else if ((__imag__ in[s] > QAM256_THRESHOLD_3) || (__imag__ in[s] < -QAM256_THRESHOLD_3)) {
out[6 * s + 3] = 0x0; out[8 * s + 3] = 0x0;
out[6 * s + 5] = 0x0; out[8 * s + 5] = 0x0;
out[8 * s + 7] = 0x1; out[8 * s + 7] = 0x1;
} else if ((__imag__ in[s] > QAM256_THRESHOLD_2) || (__imag__ in[s] < -QAM256_THRESHOLD_2)) { } else if ((__imag__ in[s] > QAM256_THRESHOLD_2) || (__imag__ in[s] < -QAM256_THRESHOLD_2)) {
out[6 * s + 3] = 0x0; out[8 * s + 3] = 0x0;
out[6 * s + 5] = 0x1; out[8 * s + 5] = 0x1;
out[8 * s + 7] = 0x1; out[8 * s + 7] = 0x1;
} else if ((__imag__ in[s] > QAM256_THRESHOLD_1) || (__imag__ in[s] < -QAM256_THRESHOLD_1)) { } else if ((__imag__ in[s] > QAM256_THRESHOLD_1) || (__imag__ in[s] < -QAM256_THRESHOLD_1)) {
out[6 * s + 3] = 0x0; out[8 * s + 3] = 0x0;
out[6 * s + 5] = 0x1; out[8 * s + 5] = 0x1;
out[8 * s + 7] = 0x0; out[8 * s + 7] = 0x0;
} else { } else {
out[6 * s + 3] = 0x0; out[8 * s + 3] = 0x0;
out[6 * s + 5] = 0x0; out[8 * s + 5] = 0x0;
out[8 * s + 7] = 0x0; out[8 * s + 7] = 0x0;
} }
} }

@ -23,17 +23,17 @@
/* Assume perfect amplitude and phase alignment. /* Assume perfect amplitude and phase alignment.
* Check threshold values for real case * Check threshold values for real case
* or implement dynamic threshold adjustent as a function of received symbol amplitudes */ * or implement dynamic threshold adjustent as a function of received symbol amplitudes */
#define QAM16_THRESHOLD 2/sqrt(10) #define QAM16_THRESHOLD (2 / sqrtf(10))
#define QAM64_THRESHOLD_1 2/sqrt(42) #define QAM64_THRESHOLD_1 (2 / sqrtf(42))
#define QAM64_THRESHOLD_2 4/sqrt(42) #define QAM64_THRESHOLD_2 (4 / sqrtf(42))
#define QAM64_THRESHOLD_3 6/sqrt(42) #define QAM64_THRESHOLD_3 (6 / sqrtf(42))
#define QAM256_THRESHOLD_1 2 / sqrt(170) #define QAM256_THRESHOLD_1 (2 / sqrtf(170))
#define QAM256_THRESHOLD_2 4 / sqrt(170) #define QAM256_THRESHOLD_2 (4 / sqrtf(170))
#define QAM256_THRESHOLD_3 6 / sqrt(170) #define QAM256_THRESHOLD_3 (6 / sqrtf(170))
#define QAM256_THRESHOLD_4 8 / sqrt(170) #define QAM256_THRESHOLD_4 (8 / sqrtf(170))
#define QAM256_THRESHOLD_5 10 / sqrt(170) #define QAM256_THRESHOLD_5 (10 / sqrtf(170))
#define QAM256_THRESHOLD_6 12 / sqrt(170) #define QAM256_THRESHOLD_6 (12 / sqrtf(170))
#define QAM256_THRESHOLD_7 14 / sqrt(170) #define QAM256_THRESHOLD_7 (14 / sqrtf(170))
void hard_bpsk_demod(const cf_t* in, void hard_bpsk_demod(const cf_t* in,
uint8_t* out, uint8_t* out,

@ -129,15 +129,6 @@ static int srslte_ra_dl_tbs_idx_from_mcs(uint32_t mcs)
} }
} }
static int srslte_ra_dl_tbs_idx_from_mcs2(uint32_t mcs)
{
if (mcs < 28) {
return dl_mcs_tbs_idx_table2[mcs];
} else {
return SRSLTE_ERROR;
}
}
static int srslte_ra_ul_tbs_idx_from_mcs(uint32_t mcs) static int srslte_ra_ul_tbs_idx_from_mcs(uint32_t mcs)
{ {
if (mcs < 29) { if (mcs < 29) {
@ -163,19 +154,6 @@ srslte_mod_t srslte_ra_dl_mod_from_mcs(uint32_t mcs)
} }
} }
srslte_mod_t srslte_ra_dl_mod_from_mcs2(uint32_t mcs)
{
if (mcs <= 4 || mcs == 28) {
return SRSLTE_MOD_QPSK;
} else if (mcs <= 10 || mcs == 29) {
return SRSLTE_MOD_16QAM;
} else if (mcs <= 19 || mcs == 30) {
return SRSLTE_MOD_64QAM;
} else {
return SRSLTE_MOD_256QAM;
}
}
srslte_mod_t srslte_ra_ul_mod_from_mcs(uint32_t mcs) srslte_mod_t srslte_ra_ul_mod_from_mcs(uint32_t mcs)
{ {
/* Table 8.6.1-1 on 36.213 */ /* Table 8.6.1-1 on 36.213 */
@ -200,16 +178,6 @@ static int srslte_ra_dl_mcs_from_tbs_idx(uint32_t tbs_idx)
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
static int srslte_ra_dl_mcs_from_tbs_idx2(uint32_t tbs_idx)
{
for (int i = 0; i < 28; i++) {
if (tbs_idx == dl_mcs_tbs_idx_table2[i]) {
return i;
}
}
return SRSLTE_ERROR;
}
static int srslte_ra_ul_mcs_from_tbs_idx(uint32_t tbs_idx) static int srslte_ra_ul_mcs_from_tbs_idx(uint32_t tbs_idx)
{ {
for (int i = 0; i < 29; i++) { for (int i = 0; i < 29; i++) {

@ -210,7 +210,7 @@ int main(int argc, char **argv) {
dci.type0_alloc.rbg_bitmask = 0xffffffff; dci.type0_alloc.rbg_bitmask = 0xffffffff;
dci.tb[0].mcs_idx = 2; dci.tb[0].mcs_idx = 2;
SRSLTE_DCI_TB_DISABLE(dci.tb[1]); SRSLTE_DCI_TB_DISABLE(dci.tb[1]);
srslte_ra_dl_dci_to_grant(&cell, &dl_sf, SRSLTE_TM1, &dci, &pmch_cfg.pdsch_cfg.grant); srslte_ra_dl_dci_to_grant(&cell, &dl_sf, SRSLTE_TM1, false, &dci, &pmch_cfg.pdsch_cfg.grant);
srslte_pdsch_res_t pdsch_res; srslte_pdsch_res_t pdsch_res;
pdsch_res.payload = data; pdsch_res.payload = data;

@ -246,7 +246,7 @@ int main(int argc, char **argv) {
dci.type0_alloc.rbg_bitmask = 0xffffffff; dci.type0_alloc.rbg_bitmask = 0xffffffff;
dci.tb[0].mcs_idx = mcs_idx; dci.tb[0].mcs_idx = mcs_idx;
SRSLTE_DCI_TB_DISABLE(dci.tb[1]); SRSLTE_DCI_TB_DISABLE(dci.tb[1]);
srslte_ra_dl_dci_to_grant(&cell, &dl_sf, SRSLTE_TM1, &dci, &pmch_cfg.pdsch_cfg.grant); srslte_ra_dl_dci_to_grant(&cell, &dl_sf, SRSLTE_TM1, false, &dci, &pmch_cfg.pdsch_cfg.grant);
for (int i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { for (int i = 0; i < SRSLTE_MAX_CODEWORDS; i++) {
if (pmch_cfg.pdsch_cfg.grant.tb[i].enabled) { if (pmch_cfg.pdsch_cfg.grant.tb[i].enabled) {

@ -31,17 +31,30 @@ set(ue_dl_max_mcs 28)
set(ue_dl_step_mcs 7) set(ue_dl_step_mcs 7)
foreach (cell_n_prb 6 15 25 50 75 100) foreach (cell_n_prb 6 15 25 50 75 100)
foreach (ue_dl_tm 1 2 3 4) foreach (allow_256 0 1)
foreach (ue_dl_mcs RANGE ${ue_dl_min_mcs} ${ue_dl_max_mcs} ${ue_dl_step_mcs}) foreach (ue_dl_tm 1 2 3 4)
set(phy_dl_test_args "") foreach (ue_dl_mcs RANGE ${ue_dl_min_mcs} ${ue_dl_max_mcs} ${ue_dl_step_mcs})
set(phy_dl_test_args "")
set(phy_dl_test_args ${phy_dl_test_args} -p ${cell_n_prb}) set(phy_dl_test_args ${phy_dl_test_args} -p ${cell_n_prb})
set(phy_dl_test_args ${phy_dl_test_args} -t ${ue_dl_tm}) set(phy_dl_test_args ${phy_dl_test_args} -t ${ue_dl_tm})
set(phy_dl_test_args ${phy_dl_test_args} -m ${ue_dl_mcs}) if (${allow_256})
if (${ue_dl_mcs} EQUAL 28)
if (${cell_n_prb} EQUAL 15)
set(ue_dl_mcs 26)
else (${cell_n_prb} EQUAL 15)
set(ue_dl_mcs 27)
endif (${cell_n_prb} EQUAL 15)
endif (${ue_dl_mcs} EQUAL 28)
string(REGEX REPLACE "\ " "" test_name_args ${phy_dl_test_args}) set(phy_dl_test_args ${phy_dl_test_args} -q)
endif (${allow_256})
set(phy_dl_test_args ${phy_dl_test_args} -m ${ue_dl_mcs})
add_test(phy_dl_test${test_name_args} phy_dl_test ${phy_dl_test_args}) string(REGEX REPLACE "\ " "" test_name_args ${phy_dl_test_args})
endforeach (ue_dl_mcs) message(${phy_dl_test_args})
endforeach(ue_dl_tm) add_test(phy_dl_test${test_name_args} phy_dl_test ${phy_dl_test_args})
endforeach (ue_dl_mcs)
endforeach (ue_dl_tm)
endforeach (allow_256 0 1)
endforeach (cell_n_prb) endforeach (cell_n_prb)

@ -37,14 +37,15 @@ srslte_cell_t cell = {
.phich_length = SRSLTE_PHICH_NORM .phich_length = SRSLTE_PHICH_NORM
}; };
uint32_t transmission_mode = 1; static uint32_t transmission_mode = 1;
uint32_t cfi = 1; static uint32_t cfi = 1;
uint32_t nof_rx_ant = 1; static uint32_t nof_rx_ant = 1;
uint32_t nof_subframes = 0; static uint32_t nof_subframes = 0;
uint16_t rnti = 0x1234; static uint16_t rnti = 0x1234;
bool print_dci_table; static bool print_dci_table;
uint32_t mcs = 20; static uint32_t mcs = 20;
int cross_carrier_indicator = -1; static int cross_carrier_indicator = -1;
static bool enable_256qam = false;
void usage(char *prog) { void usage(char *prog) {
printf("Usage: %s [cfpndvs]\n", prog); printf("Usage: %s [cfpndvs]\n", prog);
@ -62,6 +63,7 @@ void usage(char *prog) {
printf("\t\t-a carrier-indicator [Default none]\n"); printf("\t\t-a carrier-indicator [Default none]\n");
} }
printf("\t-v [set srslte_verbose to debug, default none]\n"); printf("\t-v [set srslte_verbose to debug, default none]\n");
printf("\t-q Enable/Disable 256QAM modulation (default %s)\n", enable_256qam ? "enabled" : "disabled");
} }
void parse_extensive_param(char* param, char* arg) void parse_extensive_param(char* param, char* arg)
@ -81,7 +83,17 @@ void parse_extensive_param(char* param, char* arg)
void parse_args(int argc, char **argv) { void parse_args(int argc, char **argv) {
int opt; int opt;
while ((opt = getopt(argc, argv, "cfapndvstm")) != -1) {
// Load default transmission mode to avoid wrong number of ports/antennas
if (transmission_mode == 0) {
cell.nof_ports = 1;
nof_rx_ant = 1;
} else if (transmission_mode < 4) {
cell.nof_ports = 2;
nof_rx_ant = 2;
}
while ((opt = getopt(argc, argv, "cfapndvqstm")) != -1) {
switch (opt) { switch (opt) {
case 't': case 't':
transmission_mode = (uint32_t)strtol(argv[optind], NULL, 10) - 1; transmission_mode = (uint32_t)strtol(argv[optind], NULL, 10) - 1;
@ -118,6 +130,9 @@ void parse_args(int argc, char **argv) {
case 'v': case 'v':
srslte_verbose++; srslte_verbose++;
break; break;
case 'q':
enable_256qam ^= true;
break;
default: default:
usage(argv[0]); usage(argv[0]);
exit(-1); exit(-1);
@ -145,7 +160,7 @@ int work_enb(srslte_enb_dl_t* enb_dl,
// Create pdsch config // Create pdsch config
srslte_pdsch_cfg_t pdsch_cfg; srslte_pdsch_cfg_t pdsch_cfg;
if (srslte_ra_dl_dci_to_grant(&cell, dl_sf, transmission_mode, dci, &pdsch_cfg.grant)) { if (srslte_ra_dl_dci_to_grant(&cell, dl_sf, transmission_mode, enable_256qam, dci, &pdsch_cfg.grant)) {
ERROR("Computing DL grant sf_idx=%d\n", dl_sf->tti); ERROR("Computing DL grant sf_idx=%d\n", dl_sf->tti);
goto quit; goto quit;
} }
@ -211,7 +226,8 @@ int work_ue(srslte_ue_dl_t* ue_dl,
srslte_dci_dl_info(&dci_dl[0], str, 512); srslte_dci_dl_info(&dci_dl[0], str, 512);
INFO("UE PDCCH: rnti=0x%x, %s\n", rnti, str); INFO("UE PDCCH: rnti=0x%x, %s\n", rnti, str);
if (srslte_ra_dl_dci_to_grant(&cell, sf_cfg_dl, transmission_mode, &dci_dl[0], &ue_dl_cfg->cfg.pdsch.grant)) { if (srslte_ra_dl_dci_to_grant(
&cell, sf_cfg_dl, transmission_mode, enable_256qam, &dci_dl[0], &ue_dl_cfg->cfg.pdsch.grant)) {
ERROR("Computing DL grant sf_idx=%d\n", sf_idx); ERROR("Computing DL grant sf_idx=%d\n", sf_idx);
return -1; return -1;
} }
@ -255,10 +271,8 @@ uint32_t prbset_to_bitmask() {
return reverse(mask) >> (32 - nb); return reverse(mask) >> (32 - nb);
} }
static srslte_enb_dl_t enb_dl; static int
static srslte_ue_dl_t ue_dl; check_softbits(srslte_enb_dl_t enb_dl, srslte_ue_dl_t ue_dl, srslte_ue_dl_cfg_t* ue_dl_cfg, uint32_t sf_idx, int tb)
static int check_softbits(srslte_ue_dl_cfg_t* ue_dl_cfg, uint32_t sf_idx, int tb)
{ {
int ret = SRSLTE_SUCCESS; int ret = SRSLTE_SUCCESS;
@ -292,11 +306,12 @@ static int check_softbits(srslte_ue_dl_cfg_t* ue_dl_cfg, uint32_t sf_idx, int tb
return ret; return ret;
} }
static int check_evm(srslte_ue_dl_cfg_t* ue_dl_cfg, int tb) static int check_evm(srslte_enb_dl_t enb_dl, srslte_ue_dl_t ue_dl, srslte_ue_dl_cfg_t* ue_dl_cfg, int tb)
{ {
int ret = SRSLTE_SUCCESS; int ret = SRSLTE_SUCCESS;
srslte_vec_sub_ccc(enb_dl.pdsch.d[tb], ue_dl.pdsch.d[tb], enb_dl.pdsch.d[tb], ue_dl_cfg->cfg.pdsch.grant.nof_re); srslte_vec_sub_ccc(enb_dl.pdsch.d[tb], ue_dl.pdsch.d[tb], enb_dl.pdsch.d[tb], ue_dl_cfg->cfg.pdsch.grant.nof_re);
float evm = srslte_vec_avg_power_cf(enb_dl.pdsch.d[tb], ue_dl_cfg->cfg.pdsch.grant.nof_re); uint32_t evm_max_i = srslte_vec_max_abs_ci(enb_dl.pdsch.d[tb], ue_dl_cfg->cfg.pdsch.grant.nof_re);
float evm = cabsf(enb_dl.pdsch.d[tb][evm_max_i]);
if (evm > 0.1f) { if (evm > 0.1f) {
printf("TB%d Constellation EVM (%.3f) is too high\n", tb, evm); printf("TB%d Constellation EVM (%.3f) is too high\n", tb, evm);
@ -307,6 +322,8 @@ static int check_evm(srslte_ue_dl_cfg_t* ue_dl_cfg, int tb)
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {
srslte_enb_dl_t* enb_dl = srslte_vec_malloc(sizeof(srslte_enb_dl_t));
srslte_ue_dl_t* ue_dl = srslte_vec_malloc(sizeof(srslte_ue_dl_t));
srslte_random_t random = srslte_random_init(0); srslte_random_t random = srslte_random_init(0);
struct timeval t[3] = {}; struct timeval t[3] = {};
size_t tx_nof_bits = 0, rx_nof_bits = 0; size_t tx_nof_bits = 0, rx_nof_bits = 0;
@ -374,17 +391,17 @@ int main(int argc, char **argv) {
/* /*
* Initialise eNb * Initialise eNb
*/ */
if (srslte_enb_dl_init(&enb_dl, signal_buffer, cell.nof_prb)) { if (srslte_enb_dl_init(enb_dl, signal_buffer, cell.nof_prb)) {
ERROR("Error initiating eNb downlink\n"); ERROR("Error initiating eNb downlink\n");
goto quit; goto quit;
} }
if (srslte_enb_dl_set_cell(&enb_dl, cell)) { if (srslte_enb_dl_set_cell(enb_dl, cell)) {
ERROR("Error setting eNb DL cell\n"); ERROR("Error setting eNb DL cell\n");
goto quit; goto quit;
} }
if (srslte_enb_dl_add_rnti(&enb_dl, rnti)) { if (srslte_enb_dl_add_rnti(enb_dl, rnti)) {
ERROR("Error adding RNTI\n"); ERROR("Error adding RNTI\n");
goto quit; goto quit;
} }
@ -392,17 +409,17 @@ int main(int argc, char **argv) {
/* /*
* Initialise UE * Initialise UE
*/ */
if (srslte_ue_dl_init(&ue_dl, signal_buffer, cell.nof_prb, nof_rx_ant)) { if (srslte_ue_dl_init(ue_dl, signal_buffer, cell.nof_prb, nof_rx_ant)) {
ERROR("Error initiating UE downlink\n"); ERROR("Error initiating UE downlink\n");
goto quit; goto quit;
} }
if (srslte_ue_dl_set_cell(&ue_dl, cell)) { if (srslte_ue_dl_set_cell(ue_dl, cell)) {
ERROR("Error setting UE downlink cell\n"); ERROR("Error setting UE downlink cell\n");
goto quit; goto quit;
} }
srslte_ue_dl_set_rnti(&ue_dl, rnti); srslte_ue_dl_set_rnti(ue_dl, rnti);
/* /*
* Create PDCCH Allocations * Create PDCCH Allocations
@ -417,7 +434,7 @@ int main(int argc, char **argv) {
sf_cfg_dl.cfi = cfi; sf_cfg_dl.cfi = cfi;
sf_cfg_dl.sf_type = SRSLTE_SF_NORM; sf_cfg_dl.sf_type = SRSLTE_SF_NORM;
nof_locations[i] = srslte_pdcch_ue_locations(&enb_dl.pdcch, &sf_cfg_dl, dci_locations[i], MAX_CANDIDATES_UE, rnti); nof_locations[i] = srslte_pdcch_ue_locations(&enb_dl->pdcch, &sf_cfg_dl, dci_locations[i], MAX_CANDIDATES_UE, rnti);
location_counter += nof_locations[i]; location_counter += nof_locations[i];
} }
@ -529,7 +546,7 @@ int main(int argc, char **argv) {
INFO("--- Process eNb ---\n"); INFO("--- Process eNb ---\n");
gettimeofday(&t[1], NULL); gettimeofday(&t[1], NULL);
if (work_enb(&enb_dl, &sf_cfg_dl, &dci_cfg, &dci, softbuffer_tx, data_tx)) { if (work_enb(enb_dl, &sf_cfg_dl, &dci_cfg, &dci, softbuffer_tx, data_tx)) {
goto quit; goto quit;
} }
gettimeofday(&t[2], NULL); gettimeofday(&t[2], NULL);
@ -576,6 +593,7 @@ int main(int argc, char **argv) {
ue_dl_cfg.chest_cfg.cfo_estimate_sf_mask = false; ue_dl_cfg.chest_cfg.cfo_estimate_sf_mask = false;
ue_dl_cfg.chest_cfg.sync_error_enable = false; ue_dl_cfg.chest_cfg.sync_error_enable = false;
ue_dl_cfg.dci_cfg = dci_cfg; ue_dl_cfg.dci_cfg = dci_cfg;
ue_dl_cfg.pdsch_use_tbs_index_alt = enable_256qam;
srslte_pdsch_res_t pdsch_res[SRSLTE_MAX_CODEWORDS]; srslte_pdsch_res_t pdsch_res[SRSLTE_MAX_CODEWORDS];
for (int i = 0; i < SRSLTE_MAX_CODEWORDS; i++) { for (int i = 0; i < SRSLTE_MAX_CODEWORDS; i++) {
@ -584,7 +602,7 @@ int main(int argc, char **argv) {
pdsch_res[i].crc = false; pdsch_res[i].crc = false;
ue_dl_cfg.cfg.pdsch.softbuffers.rx[i] = softbuffer_rx[i]; ue_dl_cfg.cfg.pdsch.softbuffers.rx[i] = softbuffer_rx[i];
} }
if (work_ue(&ue_dl, &sf_cfg_dl, &ue_dl_cfg, dci_dl, sf_idx, pdsch_res)) { if (work_ue(ue_dl, &sf_cfg_dl, &ue_dl_cfg, dci_dl, sf_idx, pdsch_res)) {
goto quit; goto quit;
} }
@ -594,15 +612,15 @@ int main(int argc, char **argv) {
for (int i = 0; i < SRSLTE_MAX_TB; i++) { for (int i = 0; i < SRSLTE_MAX_TB; i++) {
if (ue_dl_cfg.cfg.pdsch.grant.tb[i].enabled) { if (ue_dl_cfg.cfg.pdsch.grant.tb[i].enabled) {
if (check_evm(&ue_dl_cfg, i)) { if (check_evm(*enb_dl, *ue_dl, &ue_dl_cfg, i)) {
count_failures++; count_failures++;
} else if (check_softbits(&ue_dl_cfg, sf_idx, i) != SRSLTE_SUCCESS) { } else if (check_softbits(*enb_dl, *ue_dl, &ue_dl_cfg, sf_idx, i) != SRSLTE_SUCCESS) {
printf("TB%d: The received softbits in subframe %d DO NOT match the encoded bits (crc=%d)\n", printf("TB%d: The received softbits in subframe %d DO NOT match the encoded bits (crc=%d)\n",
i, i,
sf_idx, sf_idx,
pdsch_res[i].crc); pdsch_res[i].crc);
srslte_vec_fprint_byte(stdout, (uint8_t*)enb_dl.pdsch.e[i], ue_dl_cfg.cfg.pdsch.grant.tb[i].nof_bits / 8); srslte_vec_fprint_byte(stdout, (uint8_t*)enb_dl->pdsch.e[i], ue_dl_cfg.cfg.pdsch.grant.tb[i].nof_bits / 8);
srslte_vec_fprint_byte(stdout, (uint8_t*)ue_dl.pdsch.e[i], ue_dl_cfg.cfg.pdsch.grant.tb[i].nof_bits / 8); srslte_vec_fprint_byte(stdout, (uint8_t*)ue_dl->pdsch.e[i], ue_dl_cfg.cfg.pdsch.grant.tb[i].nof_bits / 8);
count_failures++; count_failures++;
} else if (!pdsch_res[i].crc || } else if (!pdsch_res[i].crc ||
memcmp(data_tx[i], data_rx[i], (uint32_t)ue_dl_cfg.cfg.pdsch.grant.tb[i].tbs / 8) != 0) { memcmp(data_tx[i], data_rx[i], (uint32_t)ue_dl_cfg.cfg.pdsch.grant.tb[i].tbs / 8) != 0) {
@ -637,18 +655,14 @@ int main(int argc, char **argv) {
printf("BLER: %5.1f%%\n", (float) count_failures / (float) count_tbs * 100.0f); printf("BLER: %5.1f%%\n", (float) count_failures / (float) count_tbs * 100.0f);
quit: quit:
srslte_enb_dl_free(&enb_dl); srslte_enb_dl_free(enb_dl);
srslte_ue_dl_free(&ue_dl); srslte_ue_dl_free(ue_dl);
srslte_random_free(random); srslte_random_free(random);
for ( for (int i = 0; i < cell.nof_ports; i++) {
int i = 0; if (signal_buffer[i]) {
i < cell. free(signal_buffer[i]);
nof_ports; }
i++) {
if (signal_buffer[i]) {
free(signal_buffer[i]);
}
} }
for ( for (

@ -772,8 +772,8 @@ void sched_tester::test_collisions()
for (uint32_t i = 0; i < tti_data.sched_result_dl.nof_data_elems; ++i) { for (uint32_t i = 0; i < tti_data.sched_result_dl.nof_data_elems; ++i) {
alloc_mask.reset(); alloc_mask.reset();
srslte_pdsch_grant_t grant; srslte_pdsch_grant_t grant;
CondError(srslte_ra_dl_dci_to_grant(&cfg.cell, &dl_sf, SRSLTE_TM1, &tti_data.sched_result_dl.data[i].dci, &grant) == CondError(srslte_ra_dl_dci_to_grant(
SRSLTE_ERROR, &cfg.cell, &dl_sf, SRSLTE_TM1, false, &tti_data.sched_result_dl.data[i].dci, &grant) == SRSLTE_ERROR,
"Failed to decode PDSCH grant\n"); "Failed to decode PDSCH grant\n");
for (uint32_t i = 0; i < alloc_mask.size(); ++i) { for (uint32_t i = 0; i < alloc_mask.size(); ++i) {
if (grant.prb_idx[0][i]) { if (grant.prb_idx[0][i]) {
@ -792,8 +792,8 @@ void sched_tester::test_collisions()
} }
for (uint32_t i = 0; i < tti_data.sched_result_dl.nof_bc_elems; ++i) { for (uint32_t i = 0; i < tti_data.sched_result_dl.nof_bc_elems; ++i) {
srslte_pdsch_grant_t grant; srslte_pdsch_grant_t grant;
CondError(srslte_ra_dl_dci_to_grant(&cfg.cell, &dl_sf, SRSLTE_TM1, &tti_data.sched_result_dl.bc[i].dci, &grant) == CondError(srslte_ra_dl_dci_to_grant(
SRSLTE_ERROR, &cfg.cell, &dl_sf, SRSLTE_TM1, false, &tti_data.sched_result_dl.bc[i].dci, &grant) == SRSLTE_ERROR,
"Failed to decode PDSCH grant\n"); "Failed to decode PDSCH grant\n");
alloc_mask.reset(); alloc_mask.reset();
for (uint32_t i = 0; i < alloc_mask.size(); ++i) { for (uint32_t i = 0; i < alloc_mask.size(); ++i) {
@ -811,8 +811,8 @@ void sched_tester::test_collisions()
for (uint32_t i = 0; i < tti_data.sched_result_dl.nof_rar_elems; ++i) { for (uint32_t i = 0; i < tti_data.sched_result_dl.nof_rar_elems; ++i) {
alloc_mask.reset(); alloc_mask.reset();
srslte_pdsch_grant_t grant; srslte_pdsch_grant_t grant;
CondError(srslte_ra_dl_dci_to_grant(&cfg.cell, &dl_sf, SRSLTE_TM1, &tti_data.sched_result_dl.rar[i].dci, &grant) == CondError(srslte_ra_dl_dci_to_grant(
SRSLTE_ERROR, &cfg.cell, &dl_sf, SRSLTE_TM1, false, &tti_data.sched_result_dl.rar[i].dci, &grant) == SRSLTE_ERROR,
"Failed to decode PDSCH grant\n"); "Failed to decode PDSCH grant\n");
for (uint32_t i = 0; i < alloc_mask.size(); ++i) { for (uint32_t i = 0; i < alloc_mask.size(); ++i) {
if (grant.prb_idx[0][i]) { if (grant.prb_idx[0][i]) {

Loading…
Cancel
Save