NEORV32 - Software Framework Documentation
Loading...
Searching...
No Matches
Functions
main.c File Reference

Test program for the NEORV32 'A' ISA extension - check the emulation of the AMO (read-modify-write) operations. More...

#include <neorv32.h>

Functions

int main ()
 

User configuration

#define BAUD_RATE   (19200)
 
#define NUM_TEST_CASES   (10000)
 
#define SILENT_MODE   (1)
 
volatile uint32_t amo_var
 
uint32_t xorshift32 (void)
 
uint32_t check_result (uint32_t num, uint32_t amo_var_old, uint32_t amo_var_pre, uint32_t amo_var_new, uint32_t amo_var)
 
void print_report (int num_err, int num_tests)
 
static int32_t MAX (int32_t a, int32_t b)
 
static int32_t MIN (int32_t a, int32_t b)
 
static int32_t MAXU (uint32_t a, uint32_t b)
 
static int32_t MINU (uint32_t a, uint32_t b)
 

Detailed Description

Test program for the NEORV32 'A' ISA extension - check the emulation of the AMO (read-modify-write) operations.

Author
Stephan Nolting

Macro Definition Documentation

◆ BAUD_RATE

#define BAUD_RATE   (19200)

UART BAUD rate

◆ NUM_TEST_CASES

#define NUM_TEST_CASES   (10000)

UART BAUD rate

◆ SILENT_MODE

#define SILENT_MODE   (1)

UART BAUD rate

Function Documentation

◆ check_result()

uint32_t check_result ( uint32_t num,
uint32_t amo_var_old,
uint32_t amo_var_pre,
uint32_t amo_var_new,
uint32_t amo_var )

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

Parameters
[in]numTest case number
[in]amo_var_oldInitial value of atomic variable.
[in]amo_var_preValue of atomic variable read from memory (before operation).
[in]amo_var_newExpected new value of atomic variable.
[in]amo_varActual new value of atomic variable.
Returns
zero if results are correct.

◆ main()

int main ( void )

Main function; test all provided AMO emulation functions.

Note
This program requires the RISC-V A CPU extension.
Returns
Irrelevant.

◆ MAX()

static int32_t MAX ( int32_t a,
int32_t b )
inlinestatic

MIN/MAX helpers.

◆ MAXU()

static int32_t MAXU ( uint32_t a,
uint32_t b )
inlinestatic

UART BAUD rate

◆ MIN()

static int32_t MIN ( int32_t a,
int32_t b )
inlinestatic

UART BAUD rate

◆ MINU()

static int32_t MINU ( uint32_t a,
uint32_t b )
inlinestatic

UART BAUD rate

◆ 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).

Variable Documentation

◆ amo_var

volatile uint32_t amo_var

UART BAUD rate