diff --git a/openair1/PHY/CODING/TESTBENCH/ldpctest.c b/openair1/PHY/CODING/TESTBENCH/ldpctest.c index 5912c9d0b4..a5479f788b 100644 --- a/openair1/PHY/CODING/TESTBENCH/ldpctest.c +++ b/openair1/PHY/CODING/TESTBENCH/ldpctest.c @@ -432,7 +432,7 @@ int main(int argc, char *argv[]) short max_iterations = 5; int n_segments = 1; // double rate=0.333; - + int ret = 1; int nom_rate = 1; int denom_rate = 3; double SNR0 = -2.0; @@ -618,8 +618,10 @@ int main(int argc, char *argv[]) dec_iter[i].n_iter_max); i = i + 1; - if (decoded_errors[i - 1] == 0) + if (decoded_errors[i - 1] == 0) { + ret = 0; break; + } } fclose(fd); LOG_M("ldpctestStats.m", "SNR", &dec_iter[0].snr, i, 1, 7); @@ -630,5 +632,5 @@ int main(int argc, char *argv[]) loader_reset(); logTerm(); - return (0); + return ret; } diff --git a/openair1/PHY/CODING/TESTBENCH/polartest.c b/openair1/PHY/CODING/TESTBENCH/polartest.c index beab44c689..e84a62775b 100644 --- a/openair1/PHY/CODING/TESTBENCH/polartest.c +++ b/openair1/PHY/CODING/TESTBENCH/polartest.c @@ -22,6 +22,7 @@ configmodule_interface_t *uniqCfg = NULL; int main(int argc, char *argv[]) { // Default simulation values (Aim for iterations = 1000000.) + int ret = 1; int decoder_int16 = 0; int itr, iterations = 1000, arguments, polarMessageType = 0; // 0=PBCH, 1=DCI, 2=UCI double SNRstart = -20.0, SNRstop = 0.0, SNRinc = 0.5; // dB @@ -387,8 +388,10 @@ int main(int argc, char *argv[]) (double)timeEncoder.diff / timeEncoder.trials / (get_cpu_freq_GHz() * 1000.0), (double)timeDecoder.diff / timeDecoder.trials / (get_cpu_freq_GHz() * 1000.0)); - if (blockErrorCumulative == 0 && bitErrorCumulative == 0) + if (blockErrorCumulative == 0 && bitErrorCumulative == 0) { + ret = 0; break; + } blockErrorCumulative = 0; bitErrorCumulative = 0; @@ -398,5 +401,5 @@ int main(int argc, char *argv[]) print_meas(&timeDecoder, "polar_decoder", NULL, NULL); if (logFlag) fclose(logFile); - return (0); + return ret; } diff --git a/openair1/PHY/CODING/TESTBENCH/smallblocktest.c b/openair1/PHY/CODING/TESTBENCH/smallblocktest.c index 3759b1eab7..a701a49d1a 100644 --- a/openair1/PHY/CODING/TESTBENCH/smallblocktest.c +++ b/openair1/PHY/CODING/TESTBENCH/smallblocktest.c @@ -15,6 +15,7 @@ int main(int argc, char *argv[]) reset_meas(&timeDecoder); randominit(0); + int ret = 1; int arguments, iterations = 1000, messageLength = 11; // int matlabDebug = 0; uint32_t testInput, encoderOutput, codingDifference, nBitError = 0, blockErrorState = 0, blockErrorCumulative = 0, @@ -86,6 +87,8 @@ int main(int argc, char *argv[]) uint16_t mask = 0x07ff >> (11 - messageLength); for (SNR = SNRstart; SNR <= SNRstop; SNR += SNRinc) { + blockErrorCumulative = 0; + bitErrorCumulative = 0; printf("SNR %f\n", SNR); SNR_lin = pow(10, SNR / 10.0); sigma = 1.0 / sqrt(SNR_lin); @@ -161,13 +164,14 @@ int main(int argc, char *argv[]) ((double)blockErrorCumulative / iterations), ((double)timeEncoder.diff / timeEncoder.trials) / (get_cpu_freq_GHz()), ((double)timeDecoder.diff / timeDecoder.trials) / (get_cpu_freq_GHz() * 1000.0)); - - blockErrorCumulative = 0; - bitErrorCumulative = 0; } print_meas(&timeEncoder, "smallblock_encoder", NULL, NULL); print_meas(&timeDecoder, "smallblock_decoder", NULL, NULL); - return (0); + if (blockErrorCumulative == 0) { + ret = 0; + } + + return ret; }