NEORV32 Software Framework Documentation
The NEORV32 RISC-V Processor
Loading...
Searching...
No Matches
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>

User configuration

#define BAUD_RATE   (19200)
 
#define NUM_TEST_CASES   (1000)
 
#define SILENT_MODE   (1)
 
volatile uint32_t amo_var
 
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)
 
void trap_handler_emulate_amo (void)
 
int main ()
 

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   (1000)

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.

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

◆ trap_handler_emulate_amo()

void trap_handler_emulate_amo ( void )

Emulate atomic memory operation.

Note
This is a RTE "second-level" trap handler.

Variable Documentation

◆ amo_var

volatile uint32_t amo_var

UART BAUD rate