mirror of https://github.com/PentHertz/srsLTE.git
PHY: Initialize pucch3_w_n_oc_5 using precomputed constants when compiled with clang
Fixes the following clang-7's error srsLTE/lib/src/phy/phch/pucch.c:307:9: error: initializer element is not a compile-time constant {1, cexpf(I * 2 * M_PI / 5), cexpf(I * 4 * M_PI / 5), cexpf(I * 6 * M_PI / 5), cexpf(I * 8 * M_PI / 5)}, ^~~~~~~~~~~~~~~~~~~~~~~ Add SRSLTE_PUCCH_FORMAT_3 in the pucch_test
This commit is contained in:
parent
a44671fc77
commit
ef9d16a3cf
|
@ -302,6 +302,31 @@ static const float w_n_oc[2][3][4] = {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
|
||||||
|
/* Precomputed constants printed with printf %a specifier (hexadecimal notation) for maximum precision
|
||||||
|
* cf_t val = cexpf(I * 2 * M_PI / 5));
|
||||||
|
* printf("%a + %aI\n", str, creal(val), cimag(val));
|
||||||
|
*
|
||||||
|
* clang expects compile-time contant expressions in the initializer list and using cexpf results
|
||||||
|
* in the following error
|
||||||
|
* error: initializer element is not a compile-time constant
|
||||||
|
*/
|
||||||
|
static const cf_t cexpf_i_2_mpi_5 = 0x1.3c6ef2p-2 + 0x1.e6f0e2p-1I;
|
||||||
|
static const cf_t cexpf_i_4_mpi_5 = -0x1.9e377cp-1 + 0x1.2cf22ep-1I;
|
||||||
|
static const cf_t cexpf_i_6_mpi_5 = -0x1.9e3778p-1 + -0x1.2cf234p-1I;
|
||||||
|
static const cf_t cexpf_i_8_mpi_5 = 0x1.3c6efcp-2 + -0x1.e6f0ep-1I;
|
||||||
|
|
||||||
|
static cf_t pucch3_w_n_oc_5[5][5] = {
|
||||||
|
{1, 1, 1, 1, 1},
|
||||||
|
{1, cexpf_i_2_mpi_5, cexpf_i_4_mpi_5, cexpf_i_6_mpi_5, cexpf_i_8_mpi_5},
|
||||||
|
{1, cexpf_i_4_mpi_5, cexpf_i_8_mpi_5, cexpf_i_2_mpi_5, cexpf_i_6_mpi_5},
|
||||||
|
{1, cexpf_i_6_mpi_5, cexpf_i_2_mpi_5, cexpf_i_8_mpi_5, cexpf_i_4_mpi_5},
|
||||||
|
{1, cexpf_i_8_mpi_5, cexpf_i_6_mpi_5, cexpf_i_4_mpi_5, cexpf_i_2_mpi_5},
|
||||||
|
};
|
||||||
|
|
||||||
|
#else // defined(__clang__)
|
||||||
|
|
||||||
static const cf_t pucch3_w_n_oc_5[5][5] = {
|
static const cf_t pucch3_w_n_oc_5[5][5] = {
|
||||||
{1, 1, 1, 1, 1},
|
{1, 1, 1, 1, 1},
|
||||||
{1, cexpf(I * 2 * M_PI / 5), cexpf(I * 4 * M_PI / 5), cexpf(I * 6 * M_PI / 5), cexpf(I * 8 * M_PI / 5)},
|
{1, cexpf(I * 2 * M_PI / 5), cexpf(I * 4 * M_PI / 5), cexpf(I * 6 * M_PI / 5), cexpf(I * 8 * M_PI / 5)},
|
||||||
|
@ -309,6 +334,8 @@ static const cf_t pucch3_w_n_oc_5[5][5] = {
|
||||||
{1, cexpf(I * 6 * M_PI / 5), cexpf(I * 2 * M_PI / 5), cexpf(I * 8 * M_PI / 5), cexpf(I * 4 * M_PI / 5)},
|
{1, cexpf(I * 6 * M_PI / 5), cexpf(I * 2 * M_PI / 5), cexpf(I * 8 * M_PI / 5), cexpf(I * 4 * M_PI / 5)},
|
||||||
{1, cexpf(I * 8 * M_PI / 5), cexpf(I * 6 * M_PI / 5), cexpf(I * 4 * M_PI / 5), cexpf(I * 2 * M_PI / 5)}};
|
{1, cexpf(I * 8 * M_PI / 5), cexpf(I * 6 * M_PI / 5), cexpf(I * 4 * M_PI / 5), cexpf(I * 2 * M_PI / 5)}};
|
||||||
|
|
||||||
|
#endif // defined(__clang__)
|
||||||
|
|
||||||
static const cf_t pucch3_w_n_oc_4[4][4] = {{+1, +1, +1, +1}, {+1, -1, +1, -1}, {+1, +1, -1, -1}, {+1, -1, -1, +1}};
|
static const cf_t pucch3_w_n_oc_4[4][4] = {{+1, +1, +1, +1}, {+1, -1, +1, -1}, {+1, +1, -1, -1}, {+1, -1, -1, +1}};
|
||||||
|
|
||||||
static uint32_t get_N_sf(srslte_pucch_format_t format, uint32_t slot_idx, bool shortened)
|
static uint32_t get_N_sf(srslte_pucch_format_t format, uint32_t slot_idx, bool shortened)
|
||||||
|
|
|
@ -176,8 +176,8 @@ int main(int argc, char **argv) {
|
||||||
srslte_ul_sf_cfg_t ul_sf;
|
srslte_ul_sf_cfg_t ul_sf;
|
||||||
ZERO_OBJECT(ul_sf);
|
ZERO_OBJECT(ul_sf);
|
||||||
|
|
||||||
srslte_pucch_format_t format;
|
srslte_pucch_format_t format;
|
||||||
for (format=0;format<=SRSLTE_PUCCH_FORMAT_2B;format++) {
|
for (format = 0; format <= SRSLTE_PUCCH_FORMAT_3; format++) {
|
||||||
for (uint32_t d=1;d<=3;d++) {
|
for (uint32_t d=1;d<=3;d++) {
|
||||||
for (uint32_t ncs=0;ncs<8;ncs+=d) {
|
for (uint32_t ncs=0;ncs<8;ncs+=d) {
|
||||||
for (uint32_t n_pucch=1;n_pucch<130;n_pucch+=50) {
|
for (uint32_t n_pucch=1;n_pucch<130;n_pucch+=50) {
|
||||||
|
@ -208,6 +208,7 @@ int main(int argc, char **argv) {
|
||||||
break;
|
break;
|
||||||
case SRSLTE_PUCCH_FORMAT_1B:
|
case SRSLTE_PUCCH_FORMAT_1B:
|
||||||
case SRSLTE_PUCCH_FORMAT_2B:
|
case SRSLTE_PUCCH_FORMAT_2B:
|
||||||
|
case SRSLTE_PUCCH_FORMAT_3:
|
||||||
uci_data.value.ack.ack_value[0] = 1;
|
uci_data.value.ack.ack_value[0] = 1;
|
||||||
uci_data.value.ack.ack_value[1] = 1;
|
uci_data.value.ack.ack_value[1] = 1;
|
||||||
uci_data.cfg.ack[0].nof_acks = 2;
|
uci_data.cfg.ack[0].nof_acks = 2;
|
||||||
|
@ -238,7 +239,7 @@ int main(int argc, char **argv) {
|
||||||
INFO("format %d, n_pucch: %d, ncs: %d, d: %d, t_exec=%ld us\n", format, n_pucch, ncs, d, t[0].tv_usec);
|
INFO("format %d, n_pucch: %d, ncs: %d, d: %d, t_exec=%ld us\n", format, n_pucch, ncs, d, t[0].tv_usec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
Loading…
Reference in New Issue