diff --git a/examples/pbch_enodeb.c b/examples/pbch_enodeb.c index 21a10b514..4cf26bb68 100644 --- a/examples/pbch_enodeb.c +++ b/examples/pbch_enodeb.c @@ -39,7 +39,7 @@ #endif char *output_file_name = NULL; -int nof_slots=-1; +int nof_frames=-1; int cell_id = 1; int nof_prb = 6; char *uhd_args = ""; @@ -66,7 +66,7 @@ void usage(char *prog) { printf("\t UHD is disabled. CUHD library not available\n"); #endif printf("\t-o output_file [Default USRP]\n"); - printf("\t-n number of frames [Default %d]\n", nof_slots); + printf("\t-n number of frames [Default %d]\n", nof_frames); printf("\t-c cell id [Default %d]\n", cell_id); printf("\t-p nof_prb [Default %d]\n", nof_prb); printf("\t-v [set verbose to debug, default none]\n"); @@ -92,7 +92,7 @@ void parse_args(int argc, char **argv) { output_file_name = argv[optind]; break; case 'n': - nof_slots = atoi(argv[optind]); + nof_frames = atoi(argv[optind]); break; case 'p': nof_prb = atoi(argv[optind]); @@ -238,7 +238,7 @@ int main(int argc, char **argv) { nf = 0; - while(nf= 0 && index < NOF_TC_CB_SIZES) { + return tc_cb_sizes[index]; + } else { + return -1; + } +} + +int lte_find_cb_index(int long_cb) { + int j = 0; + while (j < NOF_TC_CB_SIZES && tc_cb_sizes[j] < long_cb) { + j++; + } + + if (j == NOF_TC_CB_SIZES) { + return -1; + } else { + return j; + } +} + const int lte_symbol_sz(int nof_prb) { if (nof_prb<=0) { return -1; diff --git a/lte/lib/fec/test/CMakeLists.txt b/lte/lib/fec/test/CMakeLists.txt index 72768b3b2..2428a2d34 100644 --- a/lte/lib/fec/test/CMakeLists.txt +++ b/lte/lib/fec/test/CMakeLists.txt @@ -19,6 +19,18 @@ # and at http://www.gnu.org/licenses/. # + +######################################################################## +# Turbo Coder TEST +######################################################################## +ADD_EXECUTABLE(turbocoder_test turbocoder_test.c) +TARGET_LINK_LIBRARIES(turbocoder_test lte) + +ADD_TEST(turbocoder_test_504_1 turbocoder_test -n 100 -s 1 -l 504 -e 1.0 -t) +ADD_TEST(turbocoder_test_504_2 turbocoder_test -n 100 -s 1 -l 504 -e 2.0 -t) +ADD_TEST(turbocoder_test_6114_1_5 turbocoder_test -n 100 -s 1 -l 6144 -e 1.5 -t) +ADD_TEST(turbocoder_test_known turbocoder_test -n 1 -s 1 -k -e 0.5) + ######################################################################## # Viterbi TEST ######################################################################## diff --git a/lte/lib/fec/test/viterbi_test.c b/lte/lib/fec/test/viterbi_test.c index e7ee9e92c..76dd14754 100644 --- a/lte/lib/fec/test/viterbi_test.c +++ b/lte/lib/fec/test/viterbi_test.c @@ -39,7 +39,7 @@ typedef _Complex float cf_t; -int frame_length = 1000, nof_slots = 128; +int frame_length = 1000, nof_frames = 128; float ebno_db = 100.0; unsigned int seed = 0; bool tail_biting = false; @@ -54,7 +54,7 @@ int K = -1; void usage(char *prog) { printf("Usage: %s [nlestk]\n", prog); - printf("\t-n nof_frames [Default %d]\n", nof_slots); + printf("\t-n nof_frames [Default %d]\n", nof_frames); printf("\t-l frame_length [Default %d]\n", frame_length); printf("\t-e ebno in dB [Default scan]\n"); printf("\t-s seed [Default 0=time]\n"); @@ -67,7 +67,7 @@ void parse_args(int argc, char **argv) { while ((opt = getopt(argc, argv, "nlstek")) != -1) { switch (opt) { case 'n': - nof_slots = atoi(argv[optind]); + nof_frames = atoi(argv[optind]); break; case 'l': frame_length = atoi(argv[optind]); @@ -254,7 +254,7 @@ int main(int argc, char **argv) { for (j = 0; j < NTYPES; j++) { errors[j] = 0; } - while (frame_cnt < nof_slots) { + while (frame_cnt < nof_frames) { /* generate data_tx */ for (j = 0; j < frame_length; j++) { @@ -291,7 +291,7 @@ int main(int argc, char **argv) { } frame_cnt++; printf("Eb/No: %3.2f %10d/%d ", - SNR_MIN + i * ebno_inc,frame_cnt,nof_slots); + SNR_MIN + i * ebno_inc,frame_cnt,nof_frames); for (n=0;n<1+ncods;n++) { printf("BER: %.2e ",(float) errors[n] / (frame_cnt * frame_length)); } @@ -324,7 +324,7 @@ int main(int argc, char **argv) { } if (snr_points == 1) { - int expected_errors = get_expected_errors(nof_slots, + int expected_errors = get_expected_errors(nof_frames, seed, frame_length, K, tail_biting, ebno_db); if (expected_errors == -1) { fprintf(stderr, "Test parameters not defined in test_results.h\n");