Merge branch 'next' into raa

master
Ismael Gomez 7 years ago
commit 7c276318b2

@ -120,6 +120,8 @@ SRSLTE_API void srslte_vec_abs_square_cf_simd(const cf_t *x, float *z, const int
/* Other Functions */ /* Other Functions */
SRSLTE_API void srslte_vec_lut_sss_simd(const short *x, const unsigned short *lut, short *y, const int len); SRSLTE_API void srslte_vec_lut_sss_simd(const short *x, const unsigned short *lut, short *y, const int len);
SRSLTE_API void srslte_vec_convert_if_simd(const int16_t *x, float *z, const float scale, const int len);
SRSLTE_API void srslte_vec_convert_fi_simd(const float *x, int16_t *z, const float scale, const int len); SRSLTE_API void srslte_vec_convert_fi_simd(const float *x, int16_t *z, const float scale, const int len);
SRSLTE_API void srslte_vec_cp_simd(const cf_t *src, cf_t *dst, int len); SRSLTE_API void srslte_vec_cp_simd(const cf_t *src, cf_t *dst, int len);

@ -460,15 +460,15 @@ int srslte_ue_dl_cfg_grant(srslte_ue_dl_t *q, srslte_ra_dl_grant_t *grant, uint3
pmi = grant->pinfo - 1; pmi = grant->pinfo - 1;
} else { } else {
ERROR("Not Implemented (nof_tb=%d, pinfo=%d)", nof_tb, grant->pinfo); ERROR("Not Implemented (nof_tb=%d, pinfo=%d)", nof_tb, grant->pinfo);
return SRSLTE_ERROR; pmi = grant->pinfo % 4;
} }
} else { } else {
if (grant->pinfo < 2) { if (grant->pinfo == 2) {
pmi = grant->pinfo; ERROR("Not implemented codebook index (nof_tb=%d, pinfo=%d)", nof_tb, grant->pinfo);
} else { } else if (grant->pinfo > 2) {
ERROR("Not Implemented (nof_tb=%d, pinfo=%d)", nof_tb, grant->pinfo); ERROR("Reserved codebook index (nof_tb=%d, pinfo=%d)", nof_tb, grant->pinfo);
return SRSLTE_ERROR;
} }
pmi = grant->pinfo % 2;
} }
} }
if(SRSLTE_SF_MBSFN == grant->sf_type) { if(SRSLTE_SF_MBSFN == grant->sf_type) {

@ -452,6 +452,28 @@ TEST(srslte_vec_convert_fi,
free(z); free(z);
) )
TEST(srslte_vec_convert_if,
MALLOC(int16_t, x);
MALLOC(float, z);
float scale = 1000.0f;
float gold;
float k = 1.0f/scale;
for (int i = 0; i < block_size; i++) {
x[i] = (int16_t) RANDOM_S();
}
TEST_CALL(srslte_vec_convert_if(x, scale, z, block_size))
for (int i = 0; i < block_size; i++) {
gold = ((float)x[i]) * k;
mse += fabsf(gold - z[i]);
}
free(x);
free(z);
)
TEST(srslte_vec_prod_fff, TEST(srslte_vec_prod_fff,
MALLOC(float, x); MALLOC(float, x);
MALLOC(float, y); MALLOC(float, y);
@ -753,6 +775,9 @@ int main(int argc, char **argv) {
passed[func_count][size_count] = test_srslte_vec_convert_fi(func_names[func_count], &timmings[func_count][size_count], block_size); passed[func_count][size_count] = test_srslte_vec_convert_fi(func_names[func_count], &timmings[func_count][size_count], block_size);
func_count++; func_count++;
passed[func_count][size_count] = test_srslte_vec_convert_if(func_names[func_count], &timmings[func_count][size_count], block_size);
func_count++;
passed[func_count][size_count] = test_srslte_vec_prod_fff(func_names[func_count], &timmings[func_count][size_count], block_size); passed[func_count][size_count] = test_srslte_vec_prod_fff(func_names[func_count], &timmings[func_count][size_count], block_size);
func_count++; func_count++;

@ -93,10 +93,7 @@ void srslte_vec_sc_prod_ccc(const cf_t *x, const cf_t h, cf_t *z, const uint32_t
// Used in turbo decoder // Used in turbo decoder
void srslte_vec_convert_if(const int16_t *x, const float scale, float *z, const uint32_t len) { void srslte_vec_convert_if(const int16_t *x, const float scale, float *z, const uint32_t len) {
int i; srslte_vec_convert_if_simd(x, z, scale, len);
for (i=0;i<len;i++) {
z[i] = ((float) x[i])/scale;
}
} }
void srslte_vec_convert_fi(const float *x, const float scale, int16_t *z, const uint32_t len) { void srslte_vec_convert_fi(const float *x, const float scale, int16_t *z, const uint32_t len) {

@ -228,6 +228,36 @@ void srslte_vec_lut_sss_simd(const short *x, const unsigned short *lut, short *y
} }
} }
void srslte_vec_convert_if_simd(const int16_t *x, float *z, const float scale, const int len) {
int i = 0;
const float gain = 1.0f / scale;
#ifdef LV_HAVE_SSE
__m128 s = _mm_set1_ps(gain);
if (SRSLTE_IS_ALIGNED(z)) {
for (; i < len - 3; i += 4) {
__m64 *ptr = (__m64 *) &x[i];
__m128 fl = _mm_cvtpi16_ps(*ptr);
__m128 v = _mm_mul_ps(fl, s);
_mm_store_ps(&z[i], v);
}
} else {
for (; i < len - 3; i += 4) {
__m64 *ptr = (__m64 *) &x[i];
__m128 fl = _mm_cvtpi16_ps(*ptr);
__m128 v = _mm_mul_ps(fl, s);
_mm_storeu_ps(&z[i], v);
}
}
#endif /* LV_HAVE_SSE */
for (; i < len; i++) {
z[i] = ((float) x[i]) * gain;
}
}
void srslte_vec_convert_fi_simd(const float *x, int16_t *z, const float scale, const int len) { void srslte_vec_convert_fi_simd(const float *x, int16_t *z, const float scale, const int len) {
int i = 0; int i = 0;

@ -87,6 +87,9 @@ public:
uint32_t last_ul_tti[2*HARQ_DELAY_MS]; uint32_t last_ul_tti[2*HARQ_DELAY_MS];
srslte_mod_t last_ul_mod[2*HARQ_DELAY_MS]; srslte_mod_t last_ul_mod[2*HARQ_DELAY_MS];
uint8_t last_ri;
uint8_t last_pmi;
phch_common(uint32_t max_mutex = 3); phch_common(uint32_t max_mutex = 3);
void init(phy_interface_rrc::phy_cfg_t *config, void init(phy_interface_rrc::phy_cfg_t *config,
phy_args_t *args, phy_args_t *args,

@ -48,6 +48,8 @@ phch_common::phch_common(uint32_t max_mutex_) : tx_mutex(max_mutex_)
max_mutex = max_mutex_; max_mutex = max_mutex_;
nof_mutex = 0; nof_mutex = 0;
rx_gain_offset = 0; rx_gain_offset = 0;
last_ri = 0;
last_pmi = 0;
bzero(&dl_metrics, sizeof(dl_metrics_t)); bzero(&dl_metrics, sizeof(dl_metrics_t));
dl_metrics_read = true; dl_metrics_read = true;

@ -890,19 +890,20 @@ void phch_worker::set_uci_periodic_cqi()
int cqi_fixed = phy->args->cqi_fixed; int cqi_fixed = phy->args->cqi_fixed;
int cqi_max = phy->args->cqi_max; int cqi_max = phy->args->cqi_max;
uint8_t ri = (uint8_t) ue_dl.ri; float sinr = ue_dl.sinr[phy->last_ri & SRSLTE_MAX_LAYERS][phy->last_pmi % SRSLTE_MAX_CODEBOOKS];
uint8_t pmi = (uint8_t) ue_dl.pmi[ri];
float sinr = ue_dl.sinr[ri][pmi];
if (period_cqi.configured && rnti_is_set) { if (period_cqi.configured && rnti_is_set) {
if (period_cqi.ri_idx_present && srslte_ri_send(period_cqi.pmi_idx, period_cqi.ri_idx, TTI_TX(tti))) { if (period_cqi.ri_idx_present && srslte_ri_send(period_cqi.pmi_idx, period_cqi.ri_idx, TTI_TX(tti))) {
/* Compute RI, PMI and SINR */ /* Compute RI, PMI and SINR */
compute_ri(&ri, &pmi, &sinr); compute_ri(&phy->last_ri, &phy->last_pmi, &sinr);
uci_data.uci_ri = ri; uci_data.uci_ri = phy->last_ri;
uci_data.uci_ri_len = 1; uci_data.uci_ri_len = 1;
uci_data.ri_periodic_report = true; uci_data.ri_periodic_report = true;
Debug("PUCCH: Periodic ri=%d\n", ri); Debug("PUCCH: Periodic ri=%d, SINR=%.1f\n", phy->last_ri, sinr);
} else if (srslte_cqi_send(period_cqi.pmi_idx, TTI_TX(tti))) { } else if (srslte_cqi_send(period_cqi.pmi_idx, TTI_TX(tti))) {
compute_ri(NULL, NULL, NULL);
phy->last_pmi = (uint8_t) ue_dl.pmi[phy->last_ri % SRSLTE_MAX_LAYERS];
srslte_cqi_value_t cqi_report = {0}; srslte_cqi_value_t cqi_report = {0};
if (period_cqi.format_is_subband) { if (period_cqi.format_is_subband) {
// TODO: Implement subband periodic reports // TODO: Implement subband periodic reports
@ -923,8 +924,8 @@ void phch_worker::set_uci_periodic_cqi()
} }
if (phy->config->dedicated.antenna_info_explicit_value.tx_mode == LIBLTE_RRC_TRANSMISSION_MODE_4) { if (phy->config->dedicated.antenna_info_explicit_value.tx_mode == LIBLTE_RRC_TRANSMISSION_MODE_4) {
cqi_report.wideband.pmi_present = true; cqi_report.wideband.pmi_present = true;
cqi_report.wideband.pmi = pmi; cqi_report.wideband.pmi = phy->last_pmi;
cqi_report.wideband.rank_is_not_one = (ri != 0); cqi_report.wideband.rank_is_not_one = (phy->last_ri != 0);
} }
Debug("PUCCH: Periodic CQI=%d, SNR=%.1f dB\n", cqi_report.wideband.wideband_cqi, phy->avg_snr_db); Debug("PUCCH: Periodic CQI=%d, SNR=%.1f dB\n", cqi_report.wideband.wideband_cqi, phy->avg_snr_db);
} }
@ -936,13 +937,11 @@ void phch_worker::set_uci_periodic_cqi()
void phch_worker::set_uci_aperiodic_cqi() void phch_worker::set_uci_aperiodic_cqi()
{ {
uint8_t ri = (uint8_t) ue_dl.ri; float sinr_db = ue_dl.sinr[phy->last_ri % SRSLTE_MAX_LAYERS][phy->last_pmi%SRSLTE_MAX_CODEBOOKS];
uint8_t pmi = (uint8_t) ue_dl.pmi[ri];
float sinr_db = ue_dl.sinr[ri][pmi];
if (phy->config->dedicated.cqi_report_cnfg.report_mode_aperiodic_present) { if (phy->config->dedicated.cqi_report_cnfg.report_mode_aperiodic_present) {
/* Compute RI, PMI and SINR */ /* Compute RI, PMI and SINR */
compute_ri(&ri, &pmi, &sinr_db); compute_ri(&phy->last_ri, &phy->last_pmi, &sinr_db);
switch(phy->config->dedicated.cqi_report_cnfg.report_mode_aperiodic) { switch(phy->config->dedicated.cqi_report_cnfg.report_mode_aperiodic) {
case LIBLTE_RRC_CQI_REPORT_MODE_APERIODIC_RM30: case LIBLTE_RRC_CQI_REPORT_MODE_APERIODIC_RM30:
@ -977,7 +976,7 @@ void phch_worker::set_uci_aperiodic_cqi()
/* Set RI = 1 */ /* Set RI = 1 */
if (phy->config->dedicated.antenna_info_explicit_value.tx_mode == LIBLTE_RRC_TRANSMISSION_MODE_3 || if (phy->config->dedicated.antenna_info_explicit_value.tx_mode == LIBLTE_RRC_TRANSMISSION_MODE_3 ||
phy->config->dedicated.antenna_info_explicit_value.tx_mode == LIBLTE_RRC_TRANSMISSION_MODE_4) { phy->config->dedicated.antenna_info_explicit_value.tx_mode == LIBLTE_RRC_TRANSMISSION_MODE_4) {
uci_data.uci_ri = ri; uci_data.uci_ri = phy->last_ri;
uci_data.uci_ri_len = 1; uci_data.uci_ri_len = 1;
} else { } else {
uci_data.uci_ri_len = 0; uci_data.uci_ri_len = 0;
@ -1007,13 +1006,13 @@ void phch_worker::set_uci_aperiodic_cqi()
cqi_report.subband_hl.wideband_cqi_cw0 = srslte_cqi_from_snr(sinr_db); cqi_report.subband_hl.wideband_cqi_cw0 = srslte_cqi_from_snr(sinr_db);
cqi_report.subband_hl.subband_diff_cqi_cw0 = 0; // Always report zero offset on all subbands cqi_report.subband_hl.subband_diff_cqi_cw0 = 0; // Always report zero offset on all subbands
if (ri > 0) { if (phy->last_ri > 0) {
cqi_report.subband_hl.rank_is_not_one = true; cqi_report.subband_hl.rank_is_not_one = true;
cqi_report.subband_hl.wideband_cqi_cw1 = srslte_cqi_from_snr(sinr_db); cqi_report.subband_hl.wideband_cqi_cw1 = srslte_cqi_from_snr(sinr_db);
cqi_report.subband_hl.subband_diff_cqi_cw1 = 0; // Always report zero offset on all subbands cqi_report.subband_hl.subband_diff_cqi_cw1 = 0; // Always report zero offset on all subbands
} }
cqi_report.subband_hl.pmi = pmi; cqi_report.subband_hl.pmi = phy->last_pmi;
cqi_report.subband_hl.pmi_present = true; cqi_report.subband_hl.pmi_present = true;
cqi_report.subband_hl.four_antenna_ports = (cell.nof_ports == 4); cqi_report.subband_hl.four_antenna_ports = (cell.nof_ports == 4);
@ -1027,7 +1026,7 @@ void phch_worker::set_uci_aperiodic_cqi()
} }
uci_data.uci_cqi_len = (uint32_t) cqi_len; uci_data.uci_cqi_len = (uint32_t) cqi_len;
uci_data.uci_ri_len = 1; uci_data.uci_ri_len = 1;
uci_data.uci_ri = ri; uci_data.uci_ri = phy->last_ri;
char cqi_str[SRSLTE_CQI_STR_MAX_CHAR] = {0}; char cqi_str[SRSLTE_CQI_STR_MAX_CHAR] = {0};
srslte_cqi_to_str(uci_data.uci_cqi, uci_data.uci_cqi_len, cqi_str, SRSLTE_CQI_STR_MAX_CHAR); srslte_cqi_to_str(uci_data.uci_cqi, uci_data.uci_cqi_len, cqi_str, SRSLTE_CQI_STR_MAX_CHAR);
@ -1035,11 +1034,11 @@ void phch_worker::set_uci_aperiodic_cqi()
if (cqi_report.subband_hl.rank_is_not_one) { if (cqi_report.subband_hl.rank_is_not_one) {
Info("PUSCH: Aperiodic RM31 ri~1, CQI=%02d/%02d, SINR=%2.1f/%2.1fdB, pmi=%d for %d subbands\n", Info("PUSCH: Aperiodic RM31 ri~1, CQI=%02d/%02d, SINR=%2.1f/%2.1fdB, pmi=%d for %d subbands\n",
cqi_report.subband_hl.wideband_cqi_cw0, cqi_report.subband_hl.wideband_cqi_cw1, cqi_report.subband_hl.wideband_cqi_cw0, cqi_report.subband_hl.wideband_cqi_cw1,
sinr_db, sinr_db, pmi, cqi_report.subband_hl.N); sinr_db, sinr_db, phy->last_pmi, cqi_report.subband_hl.N);
} else { } else {
Info("PUSCH: Aperiodic RM31 ri=1, CQI=%02d, SINR=%2.1f, pmi=%d for %d subbands\n", Info("PUSCH: Aperiodic RM31 ri=1, CQI=%02d, SINR=%2.1f, pmi=%d for %d subbands\n",
cqi_report.subband_hl.wideband_cqi_cw0, cqi_report.subband_hl.wideband_cqi_cw0,
sinr_db, pmi, cqi_report.subband_hl.N); sinr_db, phy->last_pmi, cqi_report.subband_hl.N);
} }
} }
break; break;

Loading…
Cancel
Save