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

CPU/Processor test/verification program. More...

#include <neorv32.h>
#include <string.h>

Macros

User configuration
#define BAUD_RATE   (19200)
 
#define ADDR_UNALIGNED_1   (0x00000001UL)
 
#define ADDR_UNALIGNED_3   (0x00000003UL)
 
#define ADDR_UNREACHABLE   (NEORV32_DM_BASE)
 
#define EXT_MEM_BASE   (0xF0000000UL)
 
#define SIM_TRIG_BASE   (0xFF000000UL)
 
UART print macros
#define PRINT_STANDARD(...)
 
#define PRINT_CRITICAL(...)
 

Functions

void sim_irq_trigger (uint32_t sel)
 
void global_trap_handler (void)
 
void rte_service_handler (void)
 
void vectored_irq_table (void)
 
void vectored_global_handler (void)
 
void vectored_mei_handler (void)
 
void hw_breakpoint_handler (void)
 
void trigger_module_dummy (void)
 
void xirq_trap_handler0 (void)
 
void xirq_trap_handler1 (void)
 
void test_ok (void)
 
void test_fail (void)
 
int main ()
 

Variables

const uint32_t mcause_never_c = 0x80000000UL
 
volatile int cnt_fail = 0
 
volatile int cnt_ok = 0
 
volatile int cnt_test = 0
 
volatile uint32_t num_hpm_cnts_global = 0
 
volatile int vectored_mei_handler_ack = 0
 
volatile uint32_t xirq_trap_handler_ack = 0
 
volatile uint32_t hw_brk_mscratch_ok = 0
 
volatile uint32_t dma_src
 
volatile uint32_t store_access_addr [2]
 
volatile uint32_t amo_var
 
volatile uint32_t pmp_access [2]
 
volatile uint32_t trap_cnt
 
volatile uint32_t pmp_num_regions
 

Detailed Description

CPU/Processor test/verification program.

Author
Stephan Nolting

Macro Definition Documentation

◆ PRINT_CRITICAL

#define PRINT_CRITICAL ( ...)
Value:
neorv32_uart0_printf(__VA_ARGS__)

◆ PRINT_STANDARD

#define PRINT_STANDARD ( ...)
Value:
neorv32_uart0_printf(__VA_ARGS__)

Function Documentation

◆ global_trap_handler()

void global_trap_handler ( void )

Trap handler for ALL exceptions/interrupts.

◆ hw_breakpoint_handler()

void hw_breakpoint_handler ( void )

Hardware-breakpoint trap handler

◆ main()

int main ( void )

High-level CPU/processor test program.

Warning
This test is intended for simulation only.
This test requires all optional extensions/modules to be enabled.
Returns
0 if execution was successful

◆ rte_service_handler()

void rte_service_handler ( void )

RTE's ecall "system service handler"; modifies application context to provide "system services"

◆ sim_irq_trigger()

void sim_irq_trigger ( uint32_t sel)

Simulation-based function to set/clear CPU interrupts (MSI, MEI).

Parameters
[in]selIRQ select mask (bit positions according to NEORV32_CSR_MIE_enum).

◆ test_fail()

void test_fail ( void )

Test results helper function: Shows "[FAIL]" and increments global cnt_fail

◆ test_ok()

void test_ok ( void )

Test results helper function: Shows "[ok]" and increments global cnt_ok

◆ trigger_module_dummy()

void trigger_module_dummy ( void )

Test function for the trigger module

◆ vectored_global_handler()

void vectored_global_handler ( void )

Vectored trap handler for ALL exceptions/interrupts.

◆ vectored_irq_table()

void vectored_irq_table ( void )

Vectored mtvec mode jump table.

◆ vectored_mei_handler()

void vectored_mei_handler ( void )

Machine external interrupt handler.

◆ xirq_trap_handler0()

void xirq_trap_handler0 ( void )

XIRQ handler channel 0.

◆ xirq_trap_handler1()

void xirq_trap_handler1 ( void )

XIRQ handler channel 1.