URL
https://opencores.org/ocsvn/neorv32/neorv32/trunk
Subversion Repositories neorv32
Compare Revisions
- This comparison shows the changes necessary to convert path
/neorv32/trunk/sw/example
- from Rev 59 to Rev 60
- ↔ Reverse comparison
Rev 59 → Rev 60
/bit_manipulation/main.c
File deleted
/bit_manipulation/neorv32_b_extension_intrinsics.h
File deleted
\ No newline at end of file
/bit_manipulation/README.md
File deleted
/bit_manipulation/makefile
File deleted
/blink_led/main.c
69,7 → 69,7
* |
* @note This program requires the GPIO controller to be synthesized (the UART is optional). |
* |
* @return Irrelevant. |
* @return 0 if execution was successful |
**************************************************************************/ |
int main() { |
|
/coremark/core_portme.c
51,7 → 51,7
#error \ |
"You must implement a method to measure time in barebones_clock()! This function should return current time.\n" |
*/ |
return 0; |
return 1; |
} |
/* Define : TIMER_RES_DIVIDER |
Divider to trade off timer resolution and total time that can be |
/demo_freeRTOS/main.c
234,6 → 234,6
// init UART at default baud rate, no parity bits, ho hw flow control |
neorv32_uart_setup(BAUD_RATE, PARITY_NONE, FLOW_CONTROL_NONE); |
neorv32_uart_print("ERROR! FreeRTOS has not been compiled. Use >>make USER_FLAGS+=-DRUN_FREERTOS_DEMO clean_all exe<< to compile it.\n"); |
return 0; |
return 1; |
} |
#endif |
/demo_gpio_irq/main.c
65,7 → 65,7
* @note This program assumes high-active buttons connected to gpio.in(7:0). |
* @note This program assumes high-active LEDS connected to gpio.out(7:0). |
* |
* @return Irrelevant. |
* @return 0 if execution was successful |
**************************************************************************/ |
int main() { |
|
82,7 → 82,7
// check if GPIO unit is implemented at all |
if (neorv32_gpio_available() == 0) { |
neorv32_uart_print("ERROR! GPIO unit not synthesized!\n"); |
return 0; |
return 1; |
} |
|
// say hello |
113,7 → 113,7
|
if (install_err) { |
neorv32_uart_printf("RTE install error!\n"); |
return 0; |
return 1; |
} |
|
// activate fast interrupt channel 8 (which is GPIO_PIN_CHANGE) |
121,7 → 121,7
|
if (install_err) { |
neorv32_uart_printf("IRQ enable error!\n"); |
return 0; |
return 1; |
} |
|
// activate GPIO pin-change irq only for input pins 0 to 7 |
/demo_nco/main.c
63,7 → 63,7
* |
* @note This program requires the NCO and the UART modules. |
* |
* @return Irrelevant. |
* @return 0 if execution was successful |
**************************************************************************/ |
int main() { |
|
83,7 → 83,7
// check if NCO unit is implemented at all |
if (neorv32_nco_available() == 0) { |
neorv32_uart_printf("ERROR! NCO unit not synthesized!\n"); |
return 0; |
return 1; |
} |
|
// say hello |
/demo_neopixel/main.c
62,7 → 62,7
* @note This program requires the NEOLED controller to be synthesized (UART0 is optional). |
* @note NeoPixel stripe connection: NEORV32.neoled_o -> Stripe A ("NUM_LEDS_24BIT" RGB-LEDs) -> Stripe B ("NUM_LEDS_32BIT" RGBW LEDs) |
* |
* @return Irrelevant. |
* @return 0 if execution was successful |
**************************************************************************/ |
int main() { |
|
80,7 → 80,7
// check if NEOLED unit is implemented at all, abort if not |
if (neorv32_neoled_available() == 0) { |
neorv32_uart_printf("Error! No NEOLED unit synthesized!\n"); |
return 0; |
return 1; |
} |
|
|
/demo_pwm/main.c
58,13 → 58,13
* |
* @note This program requires the PWM controller to be synthesized (the UART is optional). |
* |
* @return Irrelevant. |
* @return 0 if execution was successful |
**************************************************************************/ |
int main() { |
|
// check if PWM unit is implemented at all |
if (neorv32_pwm_available() == 0) { |
return 0; |
return 1; |
} |
|
|
/demo_trng/main.c
61,13 → 61,13
* |
* @note This program requires the UART and the TRNG to be synthesized. |
* |
* @return Irrelevant. |
* @return 0 if execution was successful |
**************************************************************************/ |
int main(void) { |
|
// check if UART unit is implemented at all |
if (neorv32_uart_available() == 0) { |
return 0; |
return 1; |
} |
|
// capture all exceptions and give debug info via UART |
87,7 → 87,7
// check if TRNG unit is implemented at all |
if (neorv32_trng_available() == 0) { |
neorv32_uart_printf("No TRNG implemented."); |
return 0; |
return 1; |
} |
|
// enable TRNG |
/demo_twi/main.c
64,7 → 64,7
* |
* @note This program requires the UART and the PWM to be synthesized. |
* |
* @return Irrelevant. |
* @return 0 if execution was successful |
**************************************************************************/ |
int main() { |
|
74,7 → 74,7
|
// check if UART unit is implemented at all |
if (neorv32_uart_available() == 0) { |
return 0; |
return 1; |
} |
|
|
96,7 → 96,7
// check if TWI unit is implemented at all |
if (neorv32_twi_available() == 0) { |
neorv32_uart_printf("No TWI unit implemented."); |
return 0; |
return 1; |
} |
|
|
/demo_wdt/main.c
56,18 → 56,18
* |
* @note This program requires the WDT and the UART to be synthesized. |
* |
* @return Irrelevant. |
* @return 0 if execution was successful |
**************************************************************************/ |
int main() { |
|
// check if WDT unit is implemented at all |
if (neorv32_wdt_available() == 0) { |
return 0; // nope, no WDT unit synthesized |
return 1; // nope, no WDT unit synthesized |
} |
|
// check if UART unit is implemented at all |
if (neorv32_uart_available() == 0) { |
return 0; // nope, no UART unit synthesized |
return 1; // nope, no UART unit synthesized |
} |
|
|
/floating_point_test/main.c
99,7 → 99,7
* |
* @note This program requires the Zfinx CPU extension. |
* |
* @return Irrelevant. |
* @return 0 if execution was successful |
**************************************************************************/ |
int main() { |
|
123,20 → 123,20
neorv32_rte_check_isa(0); // silent = 0 -> show message if isa mismatch |
|
// check if Zfinx extension is implemented at all |
if (neorv32_check_zextension(CSR_MZEXT_ZFINX) == 0) { |
if (neorv32_cpu_check_zext(CSR_MZEXT_ZFINX) == 0) { |
neorv32_uart_print("Error! <Zfinx> extension not synthesized!\n"); |
return 0; |
return 1; |
} |
|
|
// Disable compilation by default |
#ifndef RUN_TEST |
#warning Program HAS NOT BEEN COMPILED! Use >>make USER_FLAGS+=-DRUN_TEST clean_all exe<< to compile it. |
#ifndef RUN_CHECK |
#warning Program HAS NOT BEEN COMPILED! Use >>make USER_FLAGS+=-DRUN_CHECK clean_all exe<< to compile it. |
|
// inform the user if you are actually executing this |
neorv32_uart_printf("ERROR! Program has not been compiled. Use >>make USER_FLAGS+=-DRUN_TEST clean_all exe<< to compile it.\n"); |
neorv32_uart_printf("ERROR! Program has not been compiled. Use >>make USER_FLAGS+=-DRUN_CHECK clean_all exe<< to compile it.\n"); |
|
return 0; |
return 1; |
#endif |
|
|
813,12 → 813,13
if (err_cnt_total != 0) { |
neorv32_uart_printf("\n%c[1m[ZFINX EXTENSION VERIFICATION FAILED!]%c[0m\n", 27, 27); |
neorv32_uart_printf("%u errors in %u test cases\n", err_cnt_total, test_cnt*(uint32_t)NUM_TEST_CASES); |
return 1; |
} |
else { |
neorv32_uart_printf("\n%c[1m[Zfinx extension verification successful!]%c[0m\n", 27, 27); |
return 0; |
} |
|
return 0; |
} |
|
|
/game_of_life/main.c
82,13 → 82,13
* |
* @note This program requires the UART to be synthesized (the TRNG is optional). |
* |
* @return Irrelevant. |
* @return 0 if execution was successful |
**************************************************************************/ |
int main(void) { |
|
// check if UART unit is implemented at all |
if (neorv32_uart_available() == 0) { |
return 0; |
return 1; |
} |
|
|
/hello_world/main.c
57,7 → 57,7
* |
* @note This program requires the UART interface to be synthesized. |
* |
* @return Irrelevant. |
* @return 0 if execution was successful |
**************************************************************************/ |
int main() { |
|
/hex_viewer/main.c
65,7 → 65,7
* |
* @note This program requires the UART to be synthesized. |
* |
* @return Irrelevant. |
* @return 0 if execution was successful |
**************************************************************************/ |
int main() { |
|
74,7 → 74,7
|
// check if UART unit is implemented at all |
if (neorv32_uart_available() == 0) { |
return 0; |
return 1; |
} |
|
|
/processor_check/check.sh
0,0 → 1,38
#!/bin/bash |
|
# Compiles and generates executables for all example projects from `sw/example/`, compiles and installs the default |
# bootloader and compiles and installs the `sw/example/processor_check` CPU test program. |
|
# Abort if any command returns != 0 |
set -e |
|
cd $(dirname "$0") |
|
# List files |
#ls -al .. |
#ls -al ../../bootloader |
|
# Check toolchain |
make check |
|
# Generate executables for all example projects |
make -C .. \ |
clean_all \ |
exe |
|
# Compile and install bootloader |
make -C ../../bootloader \ |
clean_all \ |
info \ |
bootloader |
|
# Compile and install test application |
# Redirect UART0 TX to text.io simulation output via <UART0_SIM_MODE> user flag |
echo "Compiling and installing CPU (/Processor) test application" |
make \ |
clean_all \ |
USER_FLAGS+=-DRUN_CHECK \ |
USER_FLAGS+=-DUART0_SIM_MODE \ |
MARCH=-march=rv32imac \ |
info \ |
all |
/processor_check/main.c
83,7 → 83,7
* |
* @note Applications has to be compiler with <USER_FLAGS+=-DRUN_CPUTEST> |
* |
* @return Irrelevant. |
* @return 0 if execution was successful |
**************************************************************************/ |
int main() { |
|
103,7 → 103,7
// inform the user if you are actually executing this |
neorv32_uart_printf("ERROR! processor_check has not been compiled. Use >>make USER_FLAGS+=-DRUN_CHECK clean_all exe<< to compile it.\n"); |
|
return 0; |
return 1; |
#endif |
|
// check if this is a simulation (using primary UART0) |
166,7 → 166,7
|
if (install_err) { |
neorv32_uart_printf("RTE install error (%i)!\n", install_err); |
return 0; |
return 1; |
} |
|
// enable interrupt sources |
789,7 → 789,7
// Machine timer interrupt (MTIME) |
// ---------------------------------------------------------- |
neorv32_cpu_csr_write(CSR_MCAUSE, 0); |
neorv32_uart_printf("[%i] MTI (machine timer) IRQ: ", cnt_test); |
neorv32_uart_printf("[%i] MTI (via MTIME): ", cnt_test); |
|
if (neorv32_mtime_available()) { |
cnt_test++; |
828,7 → 828,7
// Machine software interrupt (MSI) via testbench |
// ---------------------------------------------------------- |
neorv32_cpu_csr_write(CSR_MCAUSE, 0); |
neorv32_uart_printf("[%i] MSI (via testbench) IRQ: ", cnt_test); |
neorv32_uart_printf("[%i] MSI (via testbench): ", cnt_test); |
|
if (is_simulation) { // check if this is a simulation |
cnt_test++; |
856,7 → 856,7
// Machine external interrupt (MEI) via testbench |
// ---------------------------------------------------------- |
neorv32_cpu_csr_write(CSR_MCAUSE, 0); |
neorv32_uart_printf("[%i] MEI (via testbench) IRQ: ", cnt_test); |
neorv32_uart_printf("[%i] MEI (via testbench): ", cnt_test); |
|
if (is_simulation) { // check if this is a simulation |
cnt_test++; |
884,7 → 884,7
// Non-maskable interrupt (NMI) via testbench |
// ---------------------------------------------------------- |
neorv32_cpu_csr_write(CSR_MCAUSE, 0); |
neorv32_uart_printf("[%i] NMI (via testbench) IRQ: ", cnt_test); |
neorv32_uart_printf("[%i] NMI (via testbench): ", cnt_test); |
|
if (is_simulation) { // check if this is a simulation |
cnt_test++; |
1691,12 → 1691,13
// final result |
if (cnt_fail == 0) { |
neorv32_uart_printf("%c[1m[CPU TEST COMPLETED SUCCESSFULLY!]%c[0m\n", 27, 27); |
return 0; |
} |
else { |
neorv32_uart_printf("%c[1m[CPU TEST FAILED!]%c[0m\n", 27, 27); |
return 1; |
} |
|
return 0; |
} |
|
|