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

Find prime numbers by combining the power of both CPU cores. More...

#include <neorv32.h>

Macros

#define BAUD_RATE   19200
 
#define NUM_MAX   100
 

Functions

uint32_t is_prime (uint32_t n)
 
uint32_t count_primes (uint32_t beg, uint32_t end)
 
int core1_entry (void)
 
int main (void)
 

Variables

volatile uint8_t core1_stack [2048]
 

Detailed Description

Find prime numbers by combining the power of both CPU cores.

Macro Definition Documentation

◆ BAUD_RATE

#define BAUD_RATE   19200

User configuration

Function Documentation

◆ core1_entry()

int core1_entry ( void )

Main function for core 1 (secondary core).

Returns
Irrelevant (but can be inspected by the debugger).

◆ count_primes()

uint32_t count_primes ( uint32_t beg,
uint32_t end )

Count all prime numbers in range.

Parameters
[in]begStart of number range.
[in]endEnd of number range.
Returns
Number of primes in range.

◆ is_prime()

uint32_t is_prime ( uint32_t n)

Check if number is prime.

Parameters
[in]nNumber to check.
Returns
1 if number is prime; 0 otherwise.

◆ main()

int main ( void )

Find prime numbers by combining the power of both CPU cores.

Note
This program requires the dual-core configuration, the CLINT and UART0.
Returns
Irrelevant (but can be inspected by the debugger).

Variable Documentation

◆ core1_stack

volatile uint8_t core1_stack[2048]

Global variables