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

Function gen_qm4_llr

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

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

Source from the content-addressed store, hash-verified

1718 * Modulation, AWGN and LLR estimation from max log development
1719 */
1720static void
1721gen_qm4_llr(int8_t *llrs, uint32_t i, double N0, double llr_max)
1722{
1723 int qm = 4;
1724 int qam = 16;
1725 int m, k;
1726 double I, Q, p0, p1, llr_, b[qm], log_syml_prob[qam];
1727 /* 5.1.4 of TS38.211 */
1728 const double symbols_I[16] = {1, 1, 3, 3, 1, 1, 3, 3,
1729 -1, -1, -3, -3, -1, -1, -3, -3};
1730 const double symbols_Q[16] = {1, 3, 1, 3, -1, -3, -1, -3,
1731 1, 3, 1, 3, -1, -3, -1, -3};
1732 /* Average constellation point energy */
1733 N0 *= 10.0;
1734 for (k = 0; k < qm; k++)
1735 b[k] = llrs[qm * i + k] < 0 ? 1.0 : 0.0;
1736 /* 5.1.4 of TS38.211 */
1737 I = (1 - 2 * b[0]) * (2 - (1 - 2 * b[2]));
1738 Q = (1 - 2 * b[1]) * (2 - (1 - 2 * b[3]));
1739 /* AWGN channel */
1740 I += sqrt(N0 / 2) * randn(0);
1741 Q += sqrt(N0 / 2) * randn(1);
1742 /*
1743 * Calculate the log of the probability that each of
1744 * the constellation points was transmitted
1745 */
1746 for (m = 0; m < qam; m++)
1747 log_syml_prob[m] = -(pow(I - symbols_I[m], 2.0)
1748 + pow(Q - symbols_Q[m], 2.0)) / N0;
1749 /* Calculate an LLR for each of the k_64QAM bits in the set */
1750 for (k = 0; k < qm; k++) {
1751 p0 = -999999;
1752 p1 = -999999;
1753 /* For each constellation point */
1754 for (m = 0; m < qam; m++) {
1755 if ((m >> (qm - k - 1)) & 1)
1756 p1 = maxstar(p1, log_syml_prob[m]);
1757 else
1758 p0 = maxstar(p0, log_syml_prob[m]);
1759 }
1760 /* Calculate the LLR */
1761 llr_ = p0 - p1;
1762 llr_ *= (1 << ldpc_llr_decimals);
1763 llr_ = round(llr_);
1764 if (llr_ > llr_max)
1765 llr_ = llr_max;
1766 if (llr_ < -llr_max)
1767 llr_ = -llr_max;
1768 llrs[qm * i + k] = (int8_t) llr_;
1769 }
1770}
1771
1772static void
1773gen_qm2_llr(int8_t *llrs, uint32_t j, double N0, double llr_max)

Callers 1

generate_llr_inputFunction · 0.85

Calls 2

randnFunction · 0.85
maxstarFunction · 0.85

Tested by

no test coverage detected