Line 97... |
Line 97... |
/**********************************************************************//**
|
/**********************************************************************//**
|
* Main function; test all available operations of the NEORV32 'Zfinx' extensions using bit floating-point hardware intrinsics and software-only reference functions (emulation).
|
* Main function; test all available operations of the NEORV32 'Zfinx' extensions using bit floating-point hardware intrinsics and software-only reference functions (emulation).
|
*
|
*
|
* @note This program requires the Zfinx CPU extension.
|
* @note This program requires the Zfinx CPU extension.
|
*
|
*
|
* @return Irrelevant.
|
* @return 0 if execution was successful
|
**************************************************************************/
|
**************************************************************************/
|
int main() {
|
int main() {
|
|
|
uint32_t err_cnt = 0;
|
uint32_t err_cnt = 0;
|
uint32_t err_cnt_total = 0;
|
uint32_t err_cnt_total = 0;
|
Line 121... |
Line 121... |
|
|
// check available hardware extensions and compare with compiler flags
|
// check available hardware extensions and compare with compiler flags
|
neorv32_rte_check_isa(0); // silent = 0 -> show message if isa mismatch
|
neorv32_rte_check_isa(0); // silent = 0 -> show message if isa mismatch
|
|
|
// check if Zfinx extension is implemented at all
|
// 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");
|
neorv32_uart_print("Error! <Zfinx> extension not synthesized!\n");
|
return 0;
|
return 1;
|
}
|
}
|
|
|
|
|
// Disable compilation by default
|
// Disable compilation by default
|
#ifndef RUN_TEST
|
#ifndef RUN_CHECK
|
#warning Program HAS NOT BEEN COMPILED! Use >>make USER_FLAGS+=-DRUN_TEST clean_all exe<< to compile it.
|
#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
|
// 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
|
#endif
|
|
|
|
|
// intro
|
// intro
|
neorv32_uart_printf("<<< Zfinx extension test >>>\n");
|
neorv32_uart_printf("<<< Zfinx extension test >>>\n");
|
Line 811... |
Line 811... |
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
|
|
if (err_cnt_total != 0) {
|
if (err_cnt_total != 0) {
|
neorv32_uart_printf("\n%c[1m[ZFINX EXTENSION VERIFICATION FAILED!]%c[0m\n", 27, 27);
|
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);
|
neorv32_uart_printf("%u errors in %u test cases\n", err_cnt_total, test_cnt*(uint32_t)NUM_TEST_CASES);
|
|
return 1;
|
}
|
}
|
else {
|
else {
|
neorv32_uart_printf("\n%c[1m[Zfinx extension verification successful!]%c[0m\n", 27, 27);
|
neorv32_uart_printf("\n%c[1m[Zfinx extension verification successful!]%c[0m\n", 27, 27);
|
|
return 0;
|
}
|
}
|
|
|
return 0;
|
|
}
|
}
|
|
|
|
|
/**********************************************************************//**
|
/**********************************************************************//**
|
* Generate 32-bit test data (including special values like INFINITY every now and then).
|
* Generate 32-bit test data (including special values like INFINITY every now and then).
|