Added Turbo Decoder

This commit is contained in:
ismagom 2014-05-13 16:00:49 +01:00
parent c40d1e5dbf
commit caff6d85ad
9 changed files with 81 additions and 24 deletions

View File

@ -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<nof_slots || nof_slots == -1) {
while(nf<nof_frames || nof_frames == -1) {
for (ns=0;ns<NSLOTS_X_FRAME;ns++) {
bzero(slot_buffer, sizeof(cf_t) * slot_n_re);

View File

@ -58,7 +58,7 @@
#define NOF_PORTS 2
float find_threshold = 30.0, track_threshold = 10.0;
int max_track_lost = 20, nof_slots = -1;
int max_track_lost = 20, nof_frames = -1;
int track_len=300;
char *input_file_name = NULL;
int disable_plots = 0;
@ -89,7 +89,7 @@ void usage(char *prog) {
#else
printf("\t UHD is disabled. CUHD library not available\n");
#endif
printf("\t-n nof_frames [Default %d]\n", nof_slots);
printf("\t-n nof_frames [Default %d]\n", nof_frames);
printf("\t-p PSS threshold [Default %f]\n", find_threshold);
#ifndef DISABLE_GRAPHICS
printf("\t-d disable plots [Default enabled]\n");
@ -119,7 +119,7 @@ void parse_args(int argc, char **argv) {
find_threshold = atof(argv[optind]);
break;
case 'n':
nof_slots = atoi(argv[optind]);
nof_frames = atoi(argv[optind]);
break;
case 'd':
disable_plots = 1;
@ -375,7 +375,7 @@ int main(int argc, char **argv) {
sync_set_threshold(&sfind, find_threshold);
sync_force_N_id_2(&sfind, -1);
while(!go_exit && (frame_cnt < nof_slots || nof_slots==-1)) {
while(!go_exit && (frame_cnt < nof_frames || nof_frames==-1)) {
INFO(" ----- RECEIVING %d SAMPLES ---- \n", FLEN);
if (input_file_name) {
n = filesource_read(&fsrc, input_buffer, FLEN);

View File

@ -35,7 +35,7 @@
#include "lte.h"
#include "cuhd.h"
int nof_slots=1000;
int nof_frames=1000;
int band;
cf_t *input_buffer, *fft_buffer;
@ -52,7 +52,7 @@ void usage(char *prog) {
printf("Usage: %s [nvse] -b band\n", prog);
printf("\t-s earfcn_start [Default All]\n");
printf("\t-e earfcn_end [Default All]\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-v [set verbose to debug, default none]\n");
}
@ -70,7 +70,7 @@ void parse_args(int argc, char **argv) {
earfcn_end = atoi(argv[optind]);
break;
case 'n':
nof_slots = atoi(argv[optind]);
nof_frames = atoi(argv[optind]);
break;
case 'v':
verbose++;
@ -132,7 +132,7 @@ int main(int argc, char **argv) {
frame_cnt = 0;
nsamples=0;
rssi[i]=0;
while(frame_cnt < nof_slots) {
while(frame_cnt < nof_frames) {
nsamples += cuhd_recv(uhd, input_buffer, 1920, 1);
rssi[i] += vec_avg_power_cf(input_buffer, 1920);
frame_cnt++;

View File

@ -35,7 +35,7 @@
char *input_file_name;
char *output_file_name="abs_corr.txt";
int nof_slots=100, frame_length=9600, symbol_sz=128;
int nof_frames=100, frame_length=9600, symbol_sz=128;
float corr_peak_threshold=25.0;
int out_N_id_2 = 0, force_N_id_2=-1;
@ -46,7 +46,7 @@ void usage(char *prog) {
printf("Usage: %s [olntsNfcv] -i input_file\n", prog);
printf("\t-o output_file [Default %s]\n", output_file_name);
printf("\t-l frame_length [Default %d]\n", frame_length);
printf("\t-n number of frames [Default %d]\n", nof_slots);
printf("\t-n number of frames [Default %d]\n", nof_frames);
printf("\t-t correlation threshold [Default %g]\n", corr_peak_threshold);
printf("\t-s symbol_sz [Default %d]\n", symbol_sz);
printf("\t-N out_N_id_2 [Default %d]\n", out_N_id_2);
@ -66,7 +66,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 'l':
frame_length = atoi(argv[optind]);
@ -143,12 +143,12 @@ int main(int argc, char **argv) {
perror("malloc");
exit(-1);
}
cfo = malloc(nof_slots*sizeof(float));
cfo = malloc(nof_frames*sizeof(float));
if (!cfo) {
perror("malloc");
exit(-1);
}
exec_time = malloc(nof_slots*sizeof(int));
exec_time = malloc(nof_frames*sizeof(int));
if (!exec_time) {
perror("malloc");
exit(-1);
@ -192,7 +192,7 @@ int main(int argc, char **argv) {
/* read all file or nof_frames */
frame_cnt = 0;
while (frame_length == filesource_read(&fsrc, input, frame_length)
&& frame_cnt < nof_slots) {
&& frame_cnt < nof_frames) {
gettimeofday(&tdata[1], NULL);
if (force_cfo != CFO_AUTO) {

View File

@ -54,6 +54,9 @@
#include "lte/fec/viterbi.h"
#include "lte/fec/convcoder.h"
#include "lte/fec/crc.h"
#include "lte/fec/tc_interl.h"
#include "lte/fec/turbocoder.h"
#include "lte/fec/turbodecoder.h"
#include "lte/filter/filter2d.h"

View File

@ -91,6 +91,8 @@ int lte_voffset(int symbol_id, int cell_id, int nof_ports);
#define NOF_LTE_BANDS 29
#define NOF_TC_CB_SIZES 188
typedef enum {
SINGLE_ANTENNA,TX_DIVERSITY, SPATIAL_MULTIPLEX
@ -109,6 +111,9 @@ enum band_geographical_area {
ALL, NAR, APAC, EMEA, JAPAN, CALA, NA
};
int lte_cb_size(int index);
int lte_find_cb_index(int long_cb);
float lte_band_fd(int earfcn);
int lte_band_get_fd_band(int band, lte_earfcn_t *earfcn, int earfcn_start, int earfcn_end, int max_elems);
int lte_band_get_fd_band_all(int band, lte_earfcn_t *earfcn, int max_nelems);

View File

@ -34,6 +34,43 @@
#include "lte/common/base.h"
const int tc_cb_sizes[NOF_TC_CB_SIZES] = { 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120,
128, 136, 144, 152, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232,
240, 248, 256, 264, 272, 280, 288, 296, 304, 312, 320, 328, 336, 344,
352, 360, 368, 376, 384, 392, 400, 408, 416, 424, 432, 440, 448, 456,
464, 472, 480, 488, 496, 504, 512, 528, 544, 560, 576, 592, 608, 624,
640, 656, 672, 688, 704, 720, 736, 752, 768, 784, 800, 816, 832, 848,
864, 880, 896, 912, 928, 944, 960, 976, 992, 1008, 1024, 1056, 1088,
1120, 1152, 1184, 1216, 1248, 1280, 1312, 1344, 1376, 1408, 1440, 1472,
1504, 1536, 1568, 1600, 1632, 1664, 1696, 1728, 1760, 1792, 1824, 1856,
1888, 1920, 1952, 1984, 2016, 2048, 2112, 2176, 2240, 2304, 2368, 2432,
2496, 2560, 2624, 2688, 2752, 2816, 2880, 2944, 3008, 3072, 3136, 3200,
3264, 3328, 3392, 3456, 3520, 3584, 3648, 3712, 3776, 3840, 3904, 3968,
4032, 4096, 4160, 4224, 4288, 4352, 4416, 4480, 4544, 4608, 4672, 4736,
4800, 4864, 4928, 4992, 5056, 5120, 5184, 5248, 5312, 5376, 5440, 5504,
5568, 5632, 5696, 5760, 5824, 5888, 5952, 6016, 6080, 6144 };
int lte_cb_size(int index) {
if (index >= 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;

View File

@ -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
########################################################################

View File

@ -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");