NEORV32 - Software Framework Documentation
Functions
main.c File Reference

Test program for the NEORV32 'B` extension using pseudo-random data as input; compares results from hardware against pure-sw reference functions. More...

#include <neorv32.h>
#include "neorv32_b_extension_intrinsics.h"

Macros

User configuration
#define BAUD_RATE   (19200)
 
#define NUM_TEST_CASES   (1000000)
 
#define ENABLE_ZBB   (1)
 
#define ENABLE_ZBA   (1)
 
#define ENABLE_ZBS   (1)
 
#define ENABLE_ZBC   (1)
 

Functions

uint32_t check_result (uint32_t num, uint32_t opa, uint32_t opb, uint32_t ref, uint32_t res)
 
void print_report (int num_err, int num_tests)
 
int main ()
 
void __neorv32_crt0_after_main (int32_t return_code)
 
Prototypes
uint32_t xorshift32 (void)
 

Detailed Description

Test program for the NEORV32 'B` extension using pseudo-random data as input; compares results from hardware against pure-sw reference functions.

Author
Stephan Nolting

Macro Definition Documentation

◆ BAUD_RATE

#define BAUD_RATE   (19200)

UART BAUD rate

◆ ENABLE_ZBA

#define ENABLE_ZBA   (1)

UART BAUD rate

◆ ENABLE_ZBB

#define ENABLE_ZBB   (1)

UART BAUD rate

◆ ENABLE_ZBC

#define ENABLE_ZBC   (1)

UART BAUD rate

◆ ENABLE_ZBS

#define ENABLE_ZBS   (1)

UART BAUD rate

◆ NUM_TEST_CASES

#define NUM_TEST_CASES   (1000000)

UART BAUD rate

Function Documentation

◆ __neorv32_crt0_after_main()

void __neorv32_crt0_after_main ( int32_t  return_code)

"after-main" handler that is executed after the application's main function returns (called by crt0.S start-up code)

◆ check_result()

uint32_t check_result ( uint32_t  num,
uint32_t  opa,
uint32_t  opb,
uint32_t  ref,
uint32_t  res 
)

Check results (reference (SW) vs actual hardware).

Parameters
[in]numTest case number
[in]opaOperand 1
[in]opbOperand 2
[in]refSoftware reference
[in]resActual results
Returns
zero if results are equal.

◆ main()

int main ( void  )

Main function; test all available operations of the NEORV32 'B' extension using bit manipulation intrinsics and software-only reference functions (emulation).

Note
This program requires the bit-manipulation CPU extension.
Returns
Irrelevant.

◆ print_report()

void print_report ( int  num_err,
int  num_tests 
)

Print test report.

Parameters
[in]num_errNumber or errors in this test.
[in]num_testsTotal number of conducted tests.

◆ xorshift32()

uint32_t xorshift32 ( void  )

Pseudo-Random Number Generator (to generate deterministic test vectors).

Returns
Random data (32-bit).

Simple pseudo random number generator.

Returns
Random number.

PSEUDO-RANDOM number generator.

Returns
Random data (32-bit).