|
|
@ -35,10 +35,20 @@ static int16_t c_short[Nc + MAX_SEQ_LEN + 31];
|
|
|
|
static int8_t c_char[Nc + MAX_SEQ_LEN + 31];
|
|
|
|
static int8_t c_char[Nc + MAX_SEQ_LEN + 31];
|
|
|
|
static uint8_t c_packed[MAX_SEQ_LEN / 8];
|
|
|
|
static uint8_t c_packed[MAX_SEQ_LEN / 8];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static float ones_float[Nc + MAX_SEQ_LEN + 31];
|
|
|
|
|
|
|
|
static int16_t ones_short[Nc + MAX_SEQ_LEN + 31];
|
|
|
|
|
|
|
|
static int8_t ones_char[Nc + MAX_SEQ_LEN + 31];
|
|
|
|
|
|
|
|
static uint8_t ones_packed[MAX_SEQ_LEN / 8];
|
|
|
|
|
|
|
|
|
|
|
|
static int test_sequence(srslte_sequence_t* sequence, uint32_t seed, uint32_t length, uint32_t repetitions)
|
|
|
|
static int test_sequence(srslte_sequence_t* sequence, uint32_t seed, uint32_t length, uint32_t repetitions)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int ret = SRSLTE_SUCCESS;
|
|
|
|
int ret = SRSLTE_SUCCESS;
|
|
|
|
struct timeval t[3] = {};
|
|
|
|
struct timeval t[3] = {};
|
|
|
|
|
|
|
|
uint64_t interval_gen_us = 0;
|
|
|
|
|
|
|
|
uint64_t interval_xor_float_us = 0;
|
|
|
|
|
|
|
|
uint64_t interval_xor_short_us = 0;
|
|
|
|
|
|
|
|
uint64_t interval_xor_char_us = 0;
|
|
|
|
|
|
|
|
|
|
|
|
gettimeofday(&t[1], NULL);
|
|
|
|
gettimeofday(&t[1], NULL);
|
|
|
|
|
|
|
|
|
|
|
|
// Generate sequence
|
|
|
|
// Generate sequence
|
|
|
@ -48,6 +58,7 @@ static int test_sequence(srslte_sequence_t* sequence, uint32_t seed, uint32_t le
|
|
|
|
|
|
|
|
|
|
|
|
gettimeofday(&t[2], NULL);
|
|
|
|
gettimeofday(&t[2], NULL);
|
|
|
|
get_time_interval(t);
|
|
|
|
get_time_interval(t);
|
|
|
|
|
|
|
|
interval_gen_us = t->tv_sec * 1000000UL + t->tv_usec;
|
|
|
|
|
|
|
|
|
|
|
|
// Generate gold sequence
|
|
|
|
// Generate gold sequence
|
|
|
|
for (uint32_t n = 0; n < 31; n++) {
|
|
|
|
for (uint32_t n = 0; n < 31; n++) {
|
|
|
@ -70,35 +81,77 @@ static int test_sequence(srslte_sequence_t* sequence, uint32_t seed, uint32_t le
|
|
|
|
srslte_bit_pack_vector(c, c_packed, length);
|
|
|
|
srslte_bit_pack_vector(c, c_packed, length);
|
|
|
|
|
|
|
|
|
|
|
|
if (memcmp(c, sequence->c, length) != 0) {
|
|
|
|
if (memcmp(c, sequence->c, length) != 0) {
|
|
|
|
ERROR("Unmatched c\n");
|
|
|
|
ERROR("Unmatched c");
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Check Float sequence
|
|
|
|
if (memcmp(c_float, sequence->c_float, length * sizeof(float)) != 0) {
|
|
|
|
if (memcmp(c_float, sequence->c_float, length * sizeof(float)) != 0) {
|
|
|
|
ERROR("Unmatched c_float\n");
|
|
|
|
ERROR("Unmatched c_float");
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Test in-place Float XOR
|
|
|
|
|
|
|
|
gettimeofday(&t[1], NULL);
|
|
|
|
|
|
|
|
for (uint32_t r = 0; r < repetitions; r++) {
|
|
|
|
|
|
|
|
srslte_sequence_apply_f(ones_float, sequence->c_float, length, seed);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
gettimeofday(&t[2], NULL);
|
|
|
|
|
|
|
|
get_time_interval(t);
|
|
|
|
|
|
|
|
interval_xor_float_us = t->tv_sec * 1000000UL + t->tv_usec;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Check Short Sequence
|
|
|
|
if (memcmp(c_short, sequence->c_short, length * sizeof(int16_t)) != 0) {
|
|
|
|
if (memcmp(c_short, sequence->c_short, length * sizeof(int16_t)) != 0) {
|
|
|
|
ERROR("Unmatched c_short\n");
|
|
|
|
ERROR("Unmatched XOR c_short");
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Test in-place Short XOR
|
|
|
|
|
|
|
|
gettimeofday(&t[1], NULL);
|
|
|
|
|
|
|
|
for (uint32_t r = 0; r < repetitions; r++) {
|
|
|
|
|
|
|
|
srslte_sequence_apply_s(ones_short, sequence->c_short, length, seed);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
gettimeofday(&t[2], NULL);
|
|
|
|
|
|
|
|
get_time_interval(t);
|
|
|
|
|
|
|
|
interval_xor_short_us = t->tv_sec * 1000000UL + t->tv_usec;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (memcmp(c_short, sequence->c_short, length * sizeof(int16_t)) != 0) {
|
|
|
|
|
|
|
|
ERROR("Unmatched XOR c_short");
|
|
|
|
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Check Char Sequence
|
|
|
|
if (memcmp(c_char, sequence->c_char, length * sizeof(int8_t)) != 0) {
|
|
|
|
if (memcmp(c_char, sequence->c_char, length * sizeof(int8_t)) != 0) {
|
|
|
|
ERROR("Unmatched c_char\n");
|
|
|
|
ERROR("Unmatched c_char");
|
|
|
|
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Test in-place Char XOR
|
|
|
|
|
|
|
|
gettimeofday(&t[1], NULL);
|
|
|
|
|
|
|
|
for (uint32_t r = 0; r < repetitions; r++) {
|
|
|
|
|
|
|
|
srslte_sequence_apply_c(ones_char, sequence->c_char, length, seed);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
gettimeofday(&t[2], NULL);
|
|
|
|
|
|
|
|
get_time_interval(t);
|
|
|
|
|
|
|
|
interval_xor_char_us = t->tv_sec * 1000000UL + t->tv_usec;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (memcmp(c_char, sequence->c_char, length * sizeof(int8_t)) != 0) {
|
|
|
|
|
|
|
|
ERROR("Unmatched XOR c_char");
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (memcmp(c_packed, sequence->c_bytes, length / 8) != 0) {
|
|
|
|
if (memcmp(c_packed, sequence->c_bytes, length / 8) != 0) {
|
|
|
|
ERROR("Unmatched c_packed\n");
|
|
|
|
ERROR("Unmatched c_packed");
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
ret = SRSLTE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint64_t elapsed_us = t->tv_usec + t->tv_sec * 1000000UL;
|
|
|
|
printf("%08x; %8d; %8.1f; %8.1f; %8.1f; %8.1f; %8c\n",
|
|
|
|
printf("%08x; %8d; %8.1f; %8c\n",
|
|
|
|
|
|
|
|
seed,
|
|
|
|
seed,
|
|
|
|
length,
|
|
|
|
length,
|
|
|
|
(double)(length * repetitions) / (double)elapsed_us,
|
|
|
|
(double)(length * repetitions) / (double)interval_gen_us,
|
|
|
|
|
|
|
|
(double)(length * repetitions) / (double)interval_xor_float_us,
|
|
|
|
|
|
|
|
(double)(length * repetitions) / (double)interval_xor_short_us,
|
|
|
|
|
|
|
|
(double)(length * repetitions) / (double)interval_xor_char_us,
|
|
|
|
ret == SRSLTE_SUCCESS ? 'y' : 'n');
|
|
|
|
ret == SRSLTE_SUCCESS ? 'y' : 'n');
|
|
|
|
|
|
|
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
@ -113,10 +166,20 @@ int main(int argc, char** argv)
|
|
|
|
srslte_sequence_t sequence = {};
|
|
|
|
srslte_sequence_t sequence = {};
|
|
|
|
srslte_random_t random_gen = srslte_random_init(0);
|
|
|
|
srslte_random_t random_gen = srslte_random_init(0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Initialise vectors with ones
|
|
|
|
|
|
|
|
for (uint32_t i = 0; i < MAX_SEQ_LEN; i++) {
|
|
|
|
|
|
|
|
ones_float[i] = 1.0F;
|
|
|
|
|
|
|
|
ones_short[i] = 1;
|
|
|
|
|
|
|
|
ones_char[i] = 1;
|
|
|
|
|
|
|
|
if (i < MAX_SEQ_LEN / 8) {
|
|
|
|
|
|
|
|
ones_packed[i] = UINT8_MAX;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Initialise sequence object
|
|
|
|
// Initialise sequence object
|
|
|
|
srslte_sequence_init(&sequence, max_length);
|
|
|
|
srslte_sequence_init(&sequence, max_length);
|
|
|
|
|
|
|
|
|
|
|
|
printf("%8s; %8s; %8s; %8s\n", "seed", "length", "Rate M/s", "Passed");
|
|
|
|
printf("%8s; %8s; %8s; %8s; %8s; %8s; %8s\n", "seed", "length", "GEN", "XOR PS", "XOR 16", "XOR 8", "Passed");
|
|
|
|
|
|
|
|
|
|
|
|
for (uint32_t length = min_length; length <= max_length; length = (length * 5) / 4) {
|
|
|
|
for (uint32_t length = min_length; length <= max_length; length = (length * 5) / 4) {
|
|
|
|
test_sequence(&sequence, (uint32_t)srslte_random_uniform_int_dist(random_gen, 1, INT32_MAX), length, repetitions);
|
|
|
|
test_sequence(&sequence, (uint32_t)srslte_random_uniform_int_dist(random_gen, 1, INT32_MAX), length, repetitions);
|
|
|
@ -127,4 +190,4 @@ int main(int argc, char** argv)
|
|
|
|
srslte_random_free(random_gen);
|
|
|
|
srslte_random_free(random_gen);
|
|
|
|
|
|
|
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|