Modify polartest, smallblocktest and ldpctest to return '0' on success
- Updated polartest, smallblocktest, and ldpctest to check BLER and return appropriate status: - Returns '0' if BLER equals 0.000000 (indicating success). - Returns '1' for all other BLER values (indicating failure). - This change improves consistency in return values across the test physims.
This commit is contained in:
@@ -432,7 +432,7 @@ int main(int argc, char *argv[])
|
|||||||
short max_iterations = 5;
|
short max_iterations = 5;
|
||||||
int n_segments = 1;
|
int n_segments = 1;
|
||||||
// double rate=0.333;
|
// double rate=0.333;
|
||||||
|
int ret = 1;
|
||||||
int nom_rate = 1;
|
int nom_rate = 1;
|
||||||
int denom_rate = 3;
|
int denom_rate = 3;
|
||||||
double SNR0 = -2.0;
|
double SNR0 = -2.0;
|
||||||
@@ -618,8 +618,10 @@ int main(int argc, char *argv[])
|
|||||||
dec_iter[i].n_iter_max);
|
dec_iter[i].n_iter_max);
|
||||||
|
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
if (decoded_errors[i - 1] == 0)
|
if (decoded_errors[i - 1] == 0) {
|
||||||
|
ret = 0;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
LOG_M("ldpctestStats.m", "SNR", &dec_iter[0].snr, i, 1, 7);
|
LOG_M("ldpctestStats.m", "SNR", &dec_iter[0].snr, i, 1, 7);
|
||||||
@@ -630,5 +632,5 @@ int main(int argc, char *argv[])
|
|||||||
loader_reset();
|
loader_reset();
|
||||||
logTerm();
|
logTerm();
|
||||||
|
|
||||||
return (0);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ configmodule_interface_t *uniqCfg = NULL;
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// Default simulation values (Aim for iterations = 1000000.)
|
// Default simulation values (Aim for iterations = 1000000.)
|
||||||
|
int ret = 1;
|
||||||
int decoder_int16 = 0;
|
int decoder_int16 = 0;
|
||||||
int itr, iterations = 1000, arguments, polarMessageType = 0; // 0=PBCH, 1=DCI, 2=UCI
|
int itr, iterations = 1000, arguments, polarMessageType = 0; // 0=PBCH, 1=DCI, 2=UCI
|
||||||
double SNRstart = -20.0, SNRstop = 0.0, SNRinc = 0.5; // dB
|
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)timeEncoder.diff / timeEncoder.trials / (get_cpu_freq_GHz() * 1000.0),
|
||||||
(double)timeDecoder.diff / timeDecoder.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;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
blockErrorCumulative = 0;
|
blockErrorCumulative = 0;
|
||||||
bitErrorCumulative = 0;
|
bitErrorCumulative = 0;
|
||||||
@@ -398,5 +401,5 @@ int main(int argc, char *argv[])
|
|||||||
print_meas(&timeDecoder, "polar_decoder", NULL, NULL);
|
print_meas(&timeDecoder, "polar_decoder", NULL, NULL);
|
||||||
if (logFlag)
|
if (logFlag)
|
||||||
fclose(logFile);
|
fclose(logFile);
|
||||||
return (0);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ int main(int argc, char *argv[])
|
|||||||
reset_meas(&timeDecoder);
|
reset_meas(&timeDecoder);
|
||||||
randominit(0);
|
randominit(0);
|
||||||
|
|
||||||
|
int ret = 1;
|
||||||
int arguments, iterations = 1000, messageLength = 11;
|
int arguments, iterations = 1000, messageLength = 11;
|
||||||
// int matlabDebug = 0;
|
// int matlabDebug = 0;
|
||||||
uint32_t testInput, encoderOutput, codingDifference, nBitError = 0, blockErrorState = 0, blockErrorCumulative = 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);
|
uint16_t mask = 0x07ff >> (11 - messageLength);
|
||||||
for (SNR = SNRstart; SNR <= SNRstop; SNR += SNRinc) {
|
for (SNR = SNRstart; SNR <= SNRstop; SNR += SNRinc) {
|
||||||
|
blockErrorCumulative = 0;
|
||||||
|
bitErrorCumulative = 0;
|
||||||
printf("SNR %f\n", SNR);
|
printf("SNR %f\n", SNR);
|
||||||
SNR_lin = pow(10, SNR / 10.0);
|
SNR_lin = pow(10, SNR / 10.0);
|
||||||
sigma = 1.0 / sqrt(SNR_lin);
|
sigma = 1.0 / sqrt(SNR_lin);
|
||||||
@@ -161,13 +164,14 @@ int main(int argc, char *argv[])
|
|||||||
((double)blockErrorCumulative / iterations),
|
((double)blockErrorCumulative / iterations),
|
||||||
((double)timeEncoder.diff / timeEncoder.trials) / (get_cpu_freq_GHz()),
|
((double)timeEncoder.diff / timeEncoder.trials) / (get_cpu_freq_GHz()),
|
||||||
((double)timeDecoder.diff / timeDecoder.trials) / (get_cpu_freq_GHz() * 1000.0));
|
((double)timeDecoder.diff / timeDecoder.trials) / (get_cpu_freq_GHz() * 1000.0));
|
||||||
|
|
||||||
blockErrorCumulative = 0;
|
|
||||||
bitErrorCumulative = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print_meas(&timeEncoder, "smallblock_encoder", NULL, NULL);
|
print_meas(&timeEncoder, "smallblock_encoder", NULL, NULL);
|
||||||
print_meas(&timeDecoder, "smallblock_decoder", NULL, NULL);
|
print_meas(&timeDecoder, "smallblock_decoder", NULL, NULL);
|
||||||
|
|
||||||
return (0);
|
if (blockErrorCumulative == 0) {
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user