[sw/example] use functions from neorv32_aux

This commit is contained in:
stnolting 2024-06-29 17:05:18 +02:00
parent 723f339380
commit 1377399a91
13 changed files with 46 additions and 366 deletions

View file

@ -78,7 +78,6 @@
// Prototypes
uint32_t get_test_vector(void);
uint32_t xorshift32(void);
uint32_t verify_result(uint32_t num, uint32_t opa, uint32_t opb, uint32_t ref, uint32_t res);
void print_report(uint32_t num_err);
@ -901,9 +900,9 @@ uint32_t get_test_vector(void) {
float_conv_t tmp;
// generate special value "every" ~256th time this function is called
if ((xorshift32() & 0xff) == 0xff) {
if ((neorv32_aux_xorshift32() & 0xff) == 0xff) {
switch((xorshift32() >> 10) & 0x3) { // random decision which special value we are taking
switch((neorv32_aux_xorshift32() >> 10) & 0x3) { // random decision which special value we are taking
case 0: tmp.float_value = +INFINITY; break;
case 1: tmp.float_value = -INFINITY; break;
case 2: tmp.float_value = +0.0f; break;
@ -916,30 +915,13 @@ uint32_t get_test_vector(void) {
}
}
else {
tmp.binary_value = xorshift32();
tmp.binary_value = neorv32_aux_xorshift32();
}
return tmp.binary_value;
}
/**********************************************************************//**
* PSEUDO-RANDOM number generator.
*
* @return Random data (32-bit).
**************************************************************************/
uint32_t xorshift32(void) {
static uint32_t x32 = 314159265;
x32 ^= x32 << 13;
x32 ^= x32 >> 17;
x32 ^= x32 << 5;
return x32;
}
/**********************************************************************//**
* Verify results (software reference vs. actual hardware).
*