NEORV32 Software Framework Documentation
The NEORV32 RISC-V Processor
Loading...
Searching...
No Matches
main.c File Reference

Verification program for the NEORV32 'Zfinx' extension (floating-point in x registers) using pseudo-random data as input; compares results from hardware against pure-sw reference functions. More...

#include <neorv32.h>
#include <float.h>
#include <math.h>
#include "neorv32_zfinx_extension_intrinsics.h"

Macros

User configuration
#define BAUD_RATE   (19200)
 
#define NUM_TEST_CASES   (1000000)
 
#define SILENT_MODE   (1)
 
#define RUN_CSR_TESTS   (1)
 
#define RUN_EXC_TESTS   (1)
 
#define RUN_CONV_TESTS   (1)
 
#define RUN_ADDSUB_TESTS   (1)
 
#define RUN_MUL_TESTS   (1)
 
#define RUN_MINMAX_TESTS   (1)
 
#define RUN_COMPARE_TESTS   (1)
 
#define RUN_SGNINJ_TESTS   (1)
 
#define RUN_CLASSIFY_TESTS   (1)
 
#define RUN_UNAVAIL_TESTS   (1)
 
#define RUN_TIMING_TESTS   (0)
 
Special floating-point encodings
#define FLOAT32_SNAN   ( (uint32_t)(0x7fa00000U) )
 
#define FLOAT32_PMIN   ( (uint32_t)(0x00800000U) )
 
#define FLOAT32_PMAX   ( (uint32_t)(0x7f7fffffU) )
 

Functions

uint32_t get_test_vector (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)
 
int main ()
 

Detailed Description

Verification program for the NEORV32 'Zfinx' extension (floating-point in x registers) 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

◆ NUM_TEST_CASES

#define NUM_TEST_CASES   (1000000)

UART BAUD rate

◆ RUN_ADDSUB_TESTS

#define RUN_ADDSUB_TESTS   (1)

UART BAUD rate

◆ RUN_CLASSIFY_TESTS

#define RUN_CLASSIFY_TESTS   (1)

UART BAUD rate

◆ RUN_COMPARE_TESTS

#define RUN_COMPARE_TESTS   (1)

UART BAUD rate

◆ RUN_CONV_TESTS

#define RUN_CONV_TESTS   (1)

UART BAUD rate

◆ RUN_CSR_TESTS

#define RUN_CSR_TESTS   (1)

UART BAUD rate

◆ RUN_EXC_TESTS

#define RUN_EXC_TESTS   (1)

UART BAUD rate

◆ RUN_MINMAX_TESTS

#define RUN_MINMAX_TESTS   (1)

UART BAUD rate

◆ RUN_MUL_TESTS

#define RUN_MUL_TESTS   (1)

UART BAUD rate

◆ RUN_SGNINJ_TESTS

#define RUN_SGNINJ_TESTS   (1)

UART BAUD rate

◆ RUN_TIMING_TESTS

#define RUN_TIMING_TESTS   (0)

UART BAUD rate

◆ RUN_UNAVAIL_TESTS

#define RUN_UNAVAIL_TESTS   (1)

UART BAUD rate

◆ SILENT_MODE

#define SILENT_MODE   (1)

UART BAUD rate

Function Documentation

◆ get_test_vector()

uint32_t get_test_vector ( void )

Generate 32-bit test data (including special values like INFINITY every now and then).

Returns
Test data (32-bit).

◆ main()

int main ( void )

Main function; test all available operations of the NEORV32 'Zfinx' extensions using floating-point * hardware intrinsics and software-only reference functions (emulation).

Note
This program requires the Zfinx CPU extension.
Returns
0 if execution was successful

◆ print_report()

void print_report ( uint32_t num_err)

Print test report.

Parameters
[in]num_errNumber or errors in this test.

◆ verify_result()

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

Verify results (software reference vs. actual hardware).

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