MCPcopy Create free account
hub / github.com/F-Stack/f-stack / gen_qm6_llr

Function gen_qm6_llr

dpdk/app/test-bbdev/test_bbdev_perf.c:1656–1714  ·  view source on GitHub ↗

* Generate Qm LLRS for Qm==6 * Modulation, AWGN and LLR estimation from max log development */

Source from the content-addressed store, hash-verified

1654 * Modulation, AWGN and LLR estimation from max log development
1655 */
1656static void
1657gen_qm6_llr(int8_t *llrs, uint32_t i, double N0, double llr_max)
1658{
1659 int qm = 6;
1660 int qam = 64;
1661 int m, k;
1662 double I, Q, p0, p1, llr_, b[qm], log_syml_prob[qam];
1663 /* 5.1.4 of TS38.211 */
1664 const double symbols_I[64] = {
1665 3, 3, 1, 1, 3, 3, 1, 1, 5, 5, 7, 7, 5, 5, 7, 7,
1666 3, 3, 1, 1, 3, 3, 1, 1, 5, 5, 7, 7, 5, 5, 7, 7,
1667 -3, -3, -1, -1, -3, -3, -1, -1, -5, -5, -7, -7,
1668 -5, -5, -7, -7, -3, -3, -1, -1, -3, -3, -1, -1,
1669 -5, -5, -7, -7, -5, -5, -7, -7};
1670 const double symbols_Q[64] = {
1671 3, 1, 3, 1, 5, 7, 5, 7, 3, 1, 3, 1, 5, 7, 5, 7,
1672 -3, -1, -3, -1, -5, -7, -5, -7, -3, -1, -3, -1,
1673 -5, -7, -5, -7, 3, 1, 3, 1, 5, 7, 5, 7, 3, 1, 3, 1,
1674 5, 7, 5, 7, -3, -1, -3, -1, -5, -7, -5, -7,
1675 -3, -1, -3, -1, -5, -7, -5, -7};
1676 /* Average constellation point energy */
1677 N0 *= 42.0;
1678 for (k = 0; k < qm; k++)
1679 b[k] = llrs[qm * i + k] < 0 ? 1.0 : 0.0;
1680 /* 5.1.4 of TS38.211 */
1681 I = (1 - 2 * b[0])*(4 - (1 - 2 * b[2]) * (2 - (1 - 2 * b[4])));
1682 Q = (1 - 2 * b[1])*(4 - (1 - 2 * b[3]) * (2 - (1 - 2 * b[5])));
1683 /* AWGN channel */
1684 I += sqrt(N0 / 2) * randn(0);
1685 Q += sqrt(N0 / 2) * randn(1);
1686 /*
1687 * Calculate the log of the probability that each of
1688 * the constellation points was transmitted
1689 */
1690 for (m = 0; m < qam; m++)
1691 log_syml_prob[m] = -(pow(I - symbols_I[m], 2.0)
1692 + pow(Q - symbols_Q[m], 2.0)) / N0;
1693 /* Calculate an LLR for each of the k_64QAM bits in the set */
1694 for (k = 0; k < qm; k++) {
1695 p0 = -999999;
1696 p1 = -999999;
1697 /* For each constellation point */
1698 for (m = 0; m < qam; m++) {
1699 if ((m >> (qm - k - 1)) & 1)
1700 p1 = maxstar(p1, log_syml_prob[m]);
1701 else
1702 p0 = maxstar(p0, log_syml_prob[m]);
1703 }
1704 /* Calculate the LLR */
1705 llr_ = p0 - p1;
1706 llr_ *= (1 << ldpc_llr_decimals);
1707 llr_ = round(llr_);
1708 if (llr_ > llr_max)
1709 llr_ = llr_max;
1710 if (llr_ < -llr_max)
1711 llr_ = -llr_max;
1712 llrs[qm * i + k] = (int8_t) llr_;
1713 }

Callers 1

generate_llr_inputFunction · 0.85

Calls 2

randnFunction · 0.85
maxstarFunction · 0.85

Tested by

no test coverage detected