summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cesar/ce/rx/bitloading/doc/bitloading.rst12
-rw-r--r--cesar/ce/rx/bitloading/inc/ber.h4
-rw-r--r--cesar/ce/rx/bitloading/src/ber.c13
-rw-r--r--cesar/ce/rx/bitloading/src/transition.c2
-rw-r--r--cesar/ce/rx/bitloading/test/common-define.mk12
-rw-r--r--cesar/ce/rx/bitloading/test/common-rule.mk4
-rw-r--r--cesar/ce/rx/bitloading/test/data/ber_quantify.data100
-rw-r--r--cesar/ce/rx/bitloading/test/data/test_content.txt14
-rw-r--r--cesar/ce/rx/bitloading/test/src/ce_rx_bl_stub.c3
-rw-r--r--cesar/ce/rx/bitloading/test/src/test_bl.c47
10 files changed, 167 insertions, 44 deletions
diff --git a/cesar/ce/rx/bitloading/doc/bitloading.rst b/cesar/ce/rx/bitloading/doc/bitloading.rst
index 5b9e28af8a..6c32e763b3 100644
--- a/cesar/ce/rx/bitloading/doc/bitloading.rst
+++ b/cesar/ce/rx/bitloading/doc/bitloading.rst
@@ -455,15 +455,19 @@ BER sliding means
^^^^^^^^^^^^^^^^^
The hardware returns the number of bits which have been corrected on PBs with a
-good CRC.
-This is what is called the BER sum.
+good CRC: this is called the BER sum and is used to compute the BER for good PBs.
+
+For PBs with bad CRC, as the number of corrected bits is unknown, the BER is
+estimated to 2 * ber_reached.
To quantify the BER, the following formula is used::
// pb_size can be 136 or 520
- div = good_crc_pb_count * pb_size
+ div1 = measure->total_pb_count * pb_size;
+ num2 = measure->false_pb_count * ber_reached;
+ div2 = measure->total_pb_count;
- ber_q53 = ber_sum * ((2^53 + div / 2) / div)
+ ber_q53 = ber_sum * ((2^53 + div1 / 2) / div1) + 2 * ((num2 + div2 / 2) / div2)
The BER sliding means are computed using the following algorithm (see ยง
2.2.1.2.1 of TNS specification)::
diff --git a/cesar/ce/rx/bitloading/inc/ber.h b/cesar/ce/rx/bitloading/inc/ber.h
index 0345d5dcfc..732cd8c833 100644
--- a/cesar/ce/rx/bitloading/inc/ber.h
+++ b/cesar/ce/rx/bitloading/inc/ber.h
@@ -19,6 +19,7 @@
#include "ce/rx/bitloading/bitloading.h"
#include "ce/common/mod.h"
#include "hal/phy/defs.h"
+#include "ce/rx/inc/measure.h"
/**
* Degree maximum of polynomial.
@@ -168,7 +169,8 @@ ce_rx_bl_ber_sliding_mean_update (ce_rx_bitloading_t *bl, u64 ber);
* \return the BER in in quantified format
*/
u64
-ce_rx_bl_ber_quantify (u32 ber_sum, u8 good_crc_pb_count, u16 pb_size);
+ce_rx_bl_ber_quantify (ce_rx_measure_mbox_t *measure, u64 ber_reached,
+ u16 pb_size);
/**
* Get theoretical BER target for a ROBO tone map.
diff --git a/cesar/ce/rx/bitloading/src/ber.c b/cesar/ce/rx/bitloading/src/ber.c
index e92abf95af..e40cf1811c 100644
--- a/cesar/ce/rx/bitloading/src/ber.c
+++ b/cesar/ce/rx/bitloading/src/ber.c
@@ -295,11 +295,16 @@ ce_rx_bl_ber_sliding_mean_update (ce_rx_bitloading_t *bl, u64 ber)
}
u64
-ce_rx_bl_ber_quantify (u32 ber_sum, u8 good_crc_pb_count, u16 pb_size)
+ce_rx_bl_ber_quantify (ce_rx_measure_mbox_t *measure, u64 ber_reached,
+ u16 pb_size)
{
- u64 num = CE_RX_BL_BER_QUANT_FACTOR;
- u64 div = good_crc_pb_count * pb_size;
- return ber_sum * ROUND_DIV (num, div);
+ u64 num1 = CE_RX_BL_BER_QUANT_FACTOR;
+ u64 div1 = measure->total_pb_count * pb_size;
+ u64 num2 = measure->false_pb_count * ber_reached;
+ u64 div2 = measure->total_pb_count;
+ u64 res1 = measure->ber_sum * (ROUND_DIV (num1, div1));
+ u64 res2 = 2 * (ROUND_DIV (num2, div2));
+ return (res1 + res2 );
}
u64
diff --git a/cesar/ce/rx/bitloading/src/transition.c b/cesar/ce/rx/bitloading/src/transition.c
index 33a1b22898..8e2e01d31f 100644
--- a/cesar/ce/rx/bitloading/src/transition.c
+++ b/cesar/ce/rx/bitloading/src/transition.c
@@ -342,7 +342,7 @@ ce_rx_bl_fsm__TRACKING__data (ce_rx_t *ce_rx,
&& !(good_pb_count == 1 && pb_size < tm->bits_per_symbol))
ce_rx_bl_ber_sliding_mean_update
(bl, ce_rx_bl_ber_quantify
- (measure->ber_sum, good_pb_count, pb_size));
+ (measure, tm->ber_target_reached, pb_size));
/* Update PB Error Rate sliding mean. */
ce_rx_bl_pber_update (&bl->pber, measure->total_pb_count,
diff --git a/cesar/ce/rx/bitloading/test/common-define.mk b/cesar/ce/rx/bitloading/test/common-define.mk
index 2292a41e8b..eea97f142d 100644
--- a/cesar/ce/rx/bitloading/test/common-define.mk
+++ b/cesar/ce/rx/bitloading/test/common-define.mk
@@ -25,7 +25,9 @@ bl_test_vectors_tns = nsr_on_sound.data mean_on_sound_nsr.data \
tonemap_initial_3db_nsr_margin_0_01_ber_margin.data \
tonemap_initial_under_ber_0db_nsr_margin_0_00_ber_margin.data \
bl_iteratif_tm_update_new_tm_IN_1_tone_map_input.data \
- bl_iteratif_tm_update_new_tm_OUT_1_tone_map_output.data \
+ bl_iteratif_tm_update_new_tm_OUT_1_tone_map_output.data
+
+bl_test_vectors_ber_tns = ber_quantify.data
# Test vectors from scilab.
bl_test_vectors_scilab = polynomial_nsr.data polynomial_raw.data
@@ -34,7 +36,7 @@ bl_test_vectors_tm_update = bl_iteratif_opti_table_shift.data \
bl_iteratif_tm_update_new_tm_IN_2_opti_table.data \
bl_iteratif_tm_update_new_tm_IN_3_ber_input.data \
bl_iteratif_tm_update_new_tm_IN_4_cursor_input.data \
- bl_iteratif_tm_update_new_tm_OUT_2_cursor_output.data \
+ bl_iteratif_tm_update_new_tm_OUT_2_cursor_output.data
# Test vectors for Pber.
bl_test_vectors_pber = pber_vector.data
@@ -52,16 +54,18 @@ bl_test_vectors_scilab_h = $(bl_test_vectors_scilab:%.data=$(OBJ_INC_DIR)/%.h)
bl_test_vectors_tm_update_h = $(bl_test_vectors_tm_update:%.data=$(OBJ_INC_DIR)/%.h)
bl_test_vectors_pber_h = $(bl_test_vectors_pber:%.data=$(OBJ_INC_DIR)/%.h)
bl_test_vectors_ber_margin_update_h = $(bl_test_vectors_ber_margin_update:%.data=$(OBJ_INC_DIR)/%.h)
+bl_test_vectors_ber_tns_h = $(bl_test_vectors_ber_tns:%.data=$(OBJ_INC_DIR)/%.h)
# Add it to the compile dependencies.
COMPILE_DEPS += $(bl_test_vectors_tns_h) \
$(bl_test_vectors_scilab_h) \
$(bl_test_vectors_tm_update_h) \
$(bl_test_vectors_pber_h) \
- $(bl_test_vectors_ber_margin_update_h)
+ $(bl_test_vectors_ber_margin_update_h) \
+ $(bl_test_vectors_ber_tns_h)
# Add it to the clean rule.
-CLEAN_FILES += $(bl_test_vectors_tns_h) $(bl_test_vectors_scilab_h) \
+CLEAN_FILES += $(bl_test_vectors_tns_h) $(bl_test_vectors_scilab_h) $(bl_test_vectors_ber_tns_h) \
$(bl_test_vectors_scilab:%=$(bl_test_vectors_dir)/%) \
$(bl_test_vectors_tm_update_h:%=$(bl_test_vectors_dir_h)/%) \
$(bl_test_vectors_pber_h:%=$(bl_test_vectors_dir_h)/%.) \
diff --git a/cesar/ce/rx/bitloading/test/common-rule.mk b/cesar/ce/rx/bitloading/test/common-rule.mk
index 56148710ef..96c6564af4 100644
--- a/cesar/ce/rx/bitloading/test/common-rule.mk
+++ b/cesar/ce/rx/bitloading/test/common-rule.mk
@@ -4,6 +4,10 @@ $(bl_test_vectors_tns_h): $(OBJ_INC_DIR)/%.h : $(bl_test_vectors_dir)/%.data \
$(bl_test_vector_tools) $(OBJ_INC_DIR_STAMP)
$(bl_test_vector_tools) $(@:$(OBJ_INC_DIR)/%.h=%) -f < $< > $@
+$(bl_test_vectors_ber_tns_h): $(OBJ_INC_DIR)/%.h : $(bl_test_vectors_dir)/%.data \
+ $(bl_test_vector_tools) $(OBJ_INC_DIR_STAMP)
+ $(bl_test_vector_tools) $(@:$(OBJ_INC_DIR)/%.h=%) -u < $< > $@
+
$(bl_test_vectors_scilab_h): $(OBJ_INC_DIR)/%.h : $(bl_test_vectors_dir)/%.data \
$(bl_test_vector_tools) $(OBJ_INC_DIR_STAMP)
$(bl_test_vector_tools) $(@:$(OBJ_INC_DIR)/%.h=%) -d < $< > $@
diff --git a/cesar/ce/rx/bitloading/test/data/ber_quantify.data b/cesar/ce/rx/bitloading/test/data/ber_quantify.data
new file mode 100644
index 0000000000..12317be9cb
--- /dev/null
+++ b/cesar/ce/rx/bitloading/test/data/ber_quantify.data
@@ -0,0 +1,100 @@
+1758961486542412 4160 22 49 28891 2856099412114626
+3009750250994060 4160 87 168 80530 4155115867765324
+2039891791559254 4160 93 170 71252 3139377310429434
+2459873256786676 4160 56 116 66314 3612830651485708
+3771955792609823 4160 31 53 22201 5319446973351009
+1894578446790238 4160 112 230 120698 2981391007008506
+2924276484039228 4160 56 123 77277 4023077384795534
+1070741752334450 4160 135 238 92021 2051863100802543
+360145210903885 4160 30 79 48157 1593390759348137
+1066707107416155 4160 47 89 43719 2190230368145081
+235036440157646 4160 121 239 133815 1450267795812551
+380567465192575 4160 117 228 120632 1536158963620716
+3600000815255017 4160 2 6 4843 4147671456592713
+2384642254137135 4160 41 80 37816 3467744629653081
+297784035049743 4160 118 215 98820 1322052643787949
+4356753550827243 4160 119 220 114664 5841713342382722
+3544868996671669 4160 11 18 10366 5579527751736596
+450310919498836 4160 130 247 116891 1498673328612456
+3532969481052034 4160 19 40 19604 4417481669198605
+3680028253730681 4160 25 59 37226 4484794150232116
+2201757823772156 4160 6 10 5157 3758698969216475
+4262409464461759 4160 12 30 21642 4971897173100694
+2505276475513636 4160 35 69 31768 3538451838051081
+1681859573164379 4160 42 75 36422 2935157758021594
+3268152380557187 4160 110 223 121457 4403458583314304
+2306217777999925 4160 3 13 10688 2844529241374813
+3254593255722171 4160 120 251 142455 4340816040019869
+3123506748861617 4160 71 134 63665 4338693397030395
+1746988066715519 4160 88 190 113855 2915725523880278
+721642775187529 4160 55 100 52240 1924903420657411
+2889013326168822 4160 65 129 69107 4071330735110105
+443387443646343 4160 89 174 88527 1555177750187469
+3133811295591955 4160 5 9 3503 4324753442467495
+2600028333645297 4160 8 10 1760 4541119148456132
+3923280207478337 4160 41 69 30321 5613909674533207
+281146365431284 4160 60 149 94460 1599071223583716
+656410718145132 4160 14 25 12242 1795431285827733
+1225118767299371 4160 65 122 60557 2380188356369898
+1259048330250952 4160 106 218 108339 2300426587282000
+3152034604480463 4160 95 212 125335 4105004388123995
+2776139565902066 4160 16 32 14685 3769759766141485
+13822248186663 4160 4 5 2028 900317524435908
+2809987845751925 4160 34 54 22176 4427675447290956
+3419902713645548 4160 15 26 8408 4646231416390780
+2537330911476939 4160 109 212 102931 3660394007948506
+260890698252165 4160 22 47 27700 1520319418803200
+946975713445961 4160 0 1 1187 2570083056581144
+4166950107714560 4160 113 240 145438 5235966404727502
+1974416212158213 4160 77 159 88866 3122465788474917
+589386383470469 4160 50 89 41485 1671479031457015
+1119036202434375 4160 97 188 93138 2227418551811453
+2350457612944946 4160 78 139 67880 3695285102913281
+1677249658958164 4160 86 181 105444 2855212486977607
+3540395974650289 4160 82 158 81022 4785146433427222
+1018243311851200 4160 80 156 79709 2150668136347863
+861329200503240 4160 9 16 9409 2242263646657762
+1073006924150565 4160 104 215 112314 2169148041621175
+3689395844896547 4160 53 107 60531 4879786955999073
+1420357610767272 4160 72 148 88365 2674720935062389
+2717614307381737 4160 91 169 82008 3977330651012261
+4358567635562608 4160 84 176 87251 5233832620352664
+1213562918608226 4160 2 6 4880 2570064876954204
+474426253941797 4160 58 113 59780 1632465760190967
+3404097311043618 4160 57 128 76991 4334120317403637
+797926844767386 4160 54 114 64683 1984449313030330
+3844494047412709 4160 132 251 117518 5057352498323246
+1481364354618606 4160 64 144 85913 2608561032852359
+1286842242217432 4160 4 5 1614 2757871606641736
+1314149437835613 4160 11 26 13091 2202146837967175
+1754155691113802 4160 113 221 111597 2887186118374609
+2502872889072853 4160 117 231 110809 3574004461536038
+1159503435561335 4160 120 232 122157 2339543962850046
+2716197180223105 4160 65 152 82063 3492024967589930
+2701231366869994 4160 90 186 93365 3700939833968086
+1786020935874408 4160 43 79 36452 2943333974112240
+3198649450525735 4160 115 230 126604 4390484164621928
+4373080251790921 4160 130 245 122877 5726747667937474
+3973959573723128 4160 15 34 19177 4727666960610963
+667840987338810 4160 109 206 97478 1731300648281676
+1864376789728785 4160 73 157 91166 2991024948351597
+4019324927704891 4160 15 25 10720 5751624297965323
+2049118617890816 4160 47 84 40259 3330781190294878
+1920706820203816 4160 80 181 106891 2976533939473778
+669019980216396 4160 49 82 33111 1673849202797697
+2821435328966840 4160 9 19 8187 3605908625146780
+807594008246809 4160 88 160 68534 1815786392431498
+2682531690591886 4160 48 104 63785 3804132905922775
+1204869527635493 4160 28 66 39925 2332090746661928
+1827831449649917 4160 12 32 20851 2781699245745584
+2793638991323705 4160 66 140 85097 3950083581552833
+2112035795607250 4160 137 244 116231 3403115796266912
+1401890420103179 4160 44 94 48265 2424142075034386
+2449015101620479 4160 74 161 94193 3518013523004532
+2896044698173233 4160 92 176 90397 4139767598339911
+4100312415454234 4160 96 205 107352 4974135069027384
+4215799515442006 4160 110 198 103412 5815064352495860
+490761967790007 4160 46 100 55617 1655715916498849
+202780470270380 4160 32 70 39301 1401030942017040
+3159118738052021 4160 77 148 76154 4401299506872395
+298732906454979 4160 80 162 90296 1501885515257783
diff --git a/cesar/ce/rx/bitloading/test/data/test_content.txt b/cesar/ce/rx/bitloading/test/data/test_content.txt
index 890c999225..a00eaa18f3 100644
--- a/cesar/ce/rx/bitloading/test/data/test_content.txt
+++ b/cesar/ce/rx/bitloading/test/data/test_content.txt
@@ -1,11 +1,11 @@
----------------------------- Script file information -----------------------------
+test generated on = 02-Oct-2012 at 13:3
test vectors generated using:
-SubWCRev: 'E:\projet\PLC\DSP_chain\DSP_350_test_vector_generation\Simu\BitLoading\testVectorGeneration.m'
-Last committed at revision 18358
-Updated to revision 18579
+SubWCRev: 'E:\projet\PLC\DSP_chain_oct_2012\Simu\BitLoading\testVectorGeneration.m'
+Last committed at revision 18959
+Updated to revision 18959
--------------------------------- bitloading test ---------------------------------
-test generated on = 09-Aug-2012 at 14:12
SNR = 10 dB
tonemap_initial_under_ber_Xdb_nsr_margin_X_XX_ber_margin generated for 0.76 coderate
final tonemap code rate is 0.76
@@ -35,3 +35,9 @@ CE_RX_BL_BMU_POLY_SUP_A = 7635808116
CE_RX_BL_BMU_POLY_SUP_B = -5001454315980
PBER_LIMIT_MIN = 327
PBER_LIMIT_MAX = 3276
+-------------------------------- Ber compute test --------------------------------
+file test for ber compute taking into account false PBs
+each line of file test contains (in this order): ber_reached, pb_size,
+measure.false_pb_count, measure.total_pb_count, measure.ber_sum, expected_ber
+ber for false PBs is equal to 2 * ber_reached
+ber computing error between matlab and software versions should not exceed 65536
diff --git a/cesar/ce/rx/bitloading/test/src/ce_rx_bl_stub.c b/cesar/ce/rx/bitloading/test/src/ce_rx_bl_stub.c
index a2857ba190..0976df2765 100644
--- a/cesar/ce/rx/bitloading/test/src/ce_rx_bl_stub.c
+++ b/cesar/ce/rx/bitloading/test/src/ce_rx_bl_stub.c
@@ -20,7 +20,8 @@ const u64 ce_rx_bl_initial_bpt[PHY_FEC_RATE_NB] = {
};
u64
-ce_rx_bl_ber_quantify (u32 ber_sum, u8 good_crc_pb_count, u16 pb_size)
+ce_rx_bl_ber_quantify (ce_rx_measure_mbox_t *measure, u64 ber_reached,
+ u16 pb_size)
{
return 0;
}
diff --git a/cesar/ce/rx/bitloading/test/src/test_bl.c b/cesar/ce/rx/bitloading/test/src/test_bl.c
index 13bcd1459d..68630e26b7 100644
--- a/cesar/ce/rx/bitloading/test/src/test_bl.c
+++ b/cesar/ce/rx/bitloading/test/src/test_bl.c
@@ -52,6 +52,7 @@
#include "bl_iteratif_tm_update_new_tm_IN_4_cursor_input.h"
#include "bl_iteratif_tm_update_new_tm_OUT_1_tone_map_output.h"
#include "bl_iteratif_tm_update_new_tm_OUT_2_cursor_output.h"
+#include "ber_quantify.h"
#include <float.h>
#include <stdio.h>
@@ -510,32 +511,30 @@ test_suite_ce_rx_bl_ber (test_t t)
test_begin (t, "BER quantification")
{
- const uint pb[2] = { 1, 255 };
- const s64 ber[][2] =
- {
- /* From hardware, result. */
- { 0, 0 }, /* Minimum. */
- /* 64: 12.3% of bits corrected. */
- { 8 * 64, 1108578369814276LL }, /* Max. */
- /* A random value. */
- { 42, 90938069398827LL } ,
- };
+ ce_rx_measure_mbox_t measure;
+
/* According to TNS, 16 bits of error is tolerated. */
const s64 error_tolerated = 1 << 16;
- uint i, j;
- for (i = 0; i < COUNT (ber); i++)
+ uint i, pb_size;
+ u64 ber_reached, res;
+ s64 diff;
+
+ for (i = 0; i < ber_quantify_height; i++)
{
- for (j = 0; j < 2; j++)
- {
- /* Quantify. */
- u64 res = ce_rx_bl_ber_quantify
- (ber[i][0] * pb[j], pb[j], 520 * 8);
- /* Compute diff. */
- s64 diff = ber[i][1] - res;
- /* Check if over tolerated error. */
- test_fail_if
- (ABS (diff) > error_tolerated);
- }
+ ber_reached = ber_quantify[i][0];
+ pb_size = ber_quantify[i][1];
+ measure.false_pb_count = ber_quantify[i][2];
+ measure.total_pb_count = ber_quantify[i][3];
+ measure.ber_sum = ber_quantify[i][4];
+
+ /* Quantify. */
+ res = ce_rx_bl_ber_quantify (&measure, ber_reached, pb_size);
+
+ /* Compute difference between expected and computed ber. */
+ diff = ber_quantify[i][5] - res;
+
+ /* Check if over tolerated error. */
+ test_fail_if (ABS (diff) > error_tolerated);
}
} test_end;
}
@@ -2032,8 +2031,6 @@ main (int argc, char **argv)
/* Disable NSR margin (by setting it to 1 *
* CE_RX_BL_NSR_MARGIN_QUANT_FACTOR). */
ce_rx_bl_nsr_margin_set (CE_RX_BL_NSR_MARGIN_QUANT_FACTOR);
- /* Disable BER target margin. */
- ce_rx_bl_ber_margin_set (ber_margin_disable);
/* Disable BER target margin. */
ce_rx_bl_ber_margin_set (ber_margin_disable);