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/lib
- from Rev 43 to Rev 44
- ↔ Reverse comparison
Rev 43 → Rev 44
/include/neorv32.h
327,9 → 327,9
* CPU <b>mstatus</b> CSR (r/w): Machine status (RISC-V spec.) |
**************************************************************************/ |
enum NEORV32_CSR_MSTATUS_enum { |
CSR_MSTATUS_MIE = 3, /**< CPU mstatus CSR (3): MIE - Machine interrupt enable bit (r/w) */ |
CSR_MSTATUS_UBE = 6, /**< CPU mstatus CSR (6): UBE - User-mode endianness (little-endian=0, big-endian=1) (r/-) */ |
CSR_MSTATUS_MPIE = 7, /**< CPU mstatus CSR (7): MPIE - Machine previous interrupt enable bit (r/w) */ |
CSR_MSTATUS_MIE = 3, /**< CPU mstatus CSR (3): MIE - Machine interrupt enable bit (r/w) */ |
CSR_MSTATUS_UBE = 6, /**< CPU mstatus CSR (6): UBE - User-mode endianness (little-endian=0, big-endian=1) (r/-) */ |
CSR_MSTATUS_MPIE = 7, /**< CPU mstatus CSR (7): MPIE - Machine previous interrupt enable bit (r/w) */ |
CSR_MSTATUS_MPP_L = 11, /**< CPU mstatus CSR (11): MPP_L - Machine previous privilege mode bit low (r/w) */ |
CSR_MSTATUS_MPP_H = 12 /**< CPU mstatus CSR (12): MPP_H - Machine previous privilege mode bit high (r/w) */ |
}; |
366,8 → 366,8
* CPU <b>mie</b> CSR (r/w): Machine interrupt enable (RISC-V spec.) |
**************************************************************************/ |
enum NEORV32_CSR_MIE_enum { |
CSR_MIE_MSIE = 3, /**< CPU mie CSR (3): MSIE - Machine software interrupt enable (r/w) */ |
CSR_MIE_MTIE = 7, /**< CPU mie CSR (7): MTIE - Machine timer interrupt enable bit (r/w) */ |
CSR_MIE_MSIE = 3, /**< CPU mie CSR (3): MSIE - Machine software interrupt enable (r/w) */ |
CSR_MIE_MTIE = 7, /**< CPU mie CSR (7): MTIE - Machine timer interrupt enable bit (r/w) */ |
CSR_MIE_MEIE = 11, /**< CPU mie CSR (11): MEIE - Machine external interrupt enable bit (r/w) */ |
CSR_MIE_FIRQ0E = 16, /**< CPU mie CSR (16): FIRQ0E - Fast interrupt channel 0 enable bit (r/w) */ |
CSR_MIE_FIRQ1E = 17, /**< CPU mie CSR (17): FIRQ1E - Fast interrupt channel 1 enable bit (r/w) */ |
380,8 → 380,8
* CPU <b>mip</b> CSR (r/-): Machine interrupt pending (RISC-V spec.) |
**************************************************************************/ |
enum NEORV32_CSR_MIP_enum { |
CSR_MIP_MSIP = 3, /**< CPU mip CSR (3): MSIP - Machine software interrupt pending (r/-) */ |
CSR_MIP_MTIP = 7, /**< CPU mip CSR (7): MTIP - Machine timer interrupt pending (r/-) */ |
CSR_MIP_MSIP = 3, /**< CPU mip CSR (3): MSIP - Machine software interrupt pending (r/-) */ |
CSR_MIP_MTIP = 7, /**< CPU mip CSR (7): MTIP - Machine timer interrupt pending (r/-) */ |
CSR_MIP_MEIP = 11, /**< CPU mip CSR (11): MEIP - Machine external interrupt pending (r/-) */ |
|
CSR_MIP_FIRQ0P = 16, /**< CPU mip CSR (16): FIRQ0P - Fast interrupt channel 0 pending (r/-) */ |
398,9 → 398,7
CSR_MISA_A_EXT = 0, /**< CPU misa CSR (0): A: Atomic instructions CPU extension available (r/-)*/ |
CSR_MISA_B_EXT = 1, /**< CPU misa CSR (1): B: Bit manipulation CPU extension available (r/-)*/ |
CSR_MISA_C_EXT = 2, /**< CPU misa CSR (2): C: Compressed instructions CPU extension available (r/-)*/ |
CSR_MISA_D_EXT = 3, /**< CPU misa CSR (3): D: Floating point (double-precision) extension available (r/-) */ |
CSR_MISA_E_EXT = 4, /**< CPU misa CSR (4): E: Embedded CPU extension available (r/-) */ |
CSR_MISA_F_EXT = 5, /**< CPU misa CSR (5): F: Floating point (single-precision) extension available (r/-) */ |
CSR_MISA_I_EXT = 8, /**< CPU misa CSR (8): I: Base integer ISA CPU extension available (r/-) */ |
CSR_MISA_M_EXT = 12, /**< CPU misa CSR (12): M: Multiplier/divider CPU extension available (r/-)*/ |
CSR_MISA_U_EXT = 20, /**< CPU misa CSR (20): U: User mode CPU extension available (r/-)*/ |
415,7 → 413,8
**************************************************************************/ |
enum NEORV32_CSR_MZEXT_enum { |
CSR_MZEXT_ZICSR = 0, /**< CPU mzext CSR (0): Zicsr extension available when set (r/-) */ |
CSR_MZEXT_ZIFENCEI = 1 /**< CPU mzext CSR (1): Zifencei extension available when set (r/-) */ |
CSR_MZEXT_ZIFENCEI = 1, /**< CPU mzext CSR (1): Zifencei extension available when set (r/-) */ |
CSR_MZEXT_ZBB = 2 /**< CPU mzext CSR (2): Zbb extension available when set (r/-) */ |
}; |
|
|
807,24 → 806,24
* SYSINFO_FEATURES (r/-): Implemented processor devices/features |
**************************************************************************/ |
enum NEORV32_SYSINFO_FEATURES_enum { |
SYSINFO_FEATURES_BOOTLOADER = 0, /**< SYSINFO_FEATURES (0) (r/-): Bootloader implemented when 1 (via BOOTLOADER_USE generic) */ |
SYSINFO_FEATURES_MEM_EXT = 1, /**< SYSINFO_FEATURES (1) (r/-): External bus interface implemented when 1 (via MEM_EXT_USE generic) */ |
SYSINFO_FEATURES_MEM_INT_IMEM = 2, /**< SYSINFO_FEATURES (2) (r/-): Processor-internal instruction memory implemented when 1 (via MEM_INT_IMEM_USE generic) */ |
SYSINFO_FEATURES_BOOTLOADER = 0, /**< SYSINFO_FEATURES (0) (r/-): Bootloader implemented when 1 (via BOOTLOADER_EN generic) */ |
SYSINFO_FEATURES_MEM_EXT = 1, /**< SYSINFO_FEATURES (1) (r/-): External bus interface implemented when 1 (via MEM_EXT_EN generic) */ |
SYSINFO_FEATURES_MEM_INT_IMEM = 2, /**< SYSINFO_FEATURES (2) (r/-): Processor-internal instruction memory implemented when 1 (via MEM_INT_IMEM_EN generic) */ |
SYSINFO_FEATURES_MEM_INT_IMEM_ROM = 3, /**< SYSINFO_FEATURES (3) (r/-): Processor-internal instruction memory implemented as ROM when 1 (via MEM_INT_IMEM_ROM generic) */ |
SYSINFO_FEATURES_MEM_INT_DMEM = 4, /**< SYSINFO_FEATURES (4) (r/-): Processor-internal data memory implemented when 1 (via MEM_INT_DMEM_USE generic) */ |
SYSINFO_FEATURES_MEM_INT_DMEM = 4, /**< SYSINFO_FEATURES (4) (r/-): Processor-internal data memory implemented when 1 (via MEM_INT_DMEM_EN generic) */ |
SYSINFO_FEATURES_MEM_EXT_ENDIAN = 5, /**< SYSINFO_FEATURES (5) (r/-): External bus interface uses BIG-endian byte-order when 1 (via package.xbus_big_endian_c constant) */ |
SYSINFO_FEATURES_ICACHE = 6, /**< SYSINFO_FEATURES (6) (r/-): Processor-internal instruction cache implemented when 1 (via ICACHE_USE generic) */ |
SYSINFO_FEATURES_ICACHE = 6, /**< SYSINFO_FEATURES (6) (r/-): Processor-internal instruction cache implemented when 1 (via ICACHE_EN generic) */ |
|
SYSINFO_FEATURES_IO_GPIO = 16, /**< SYSINFO_FEATURES (16) (r/-): General purpose input/output port unit implemented when 1 (via IO_GPIO_USE generic) */ |
SYSINFO_FEATURES_IO_MTIME = 17, /**< SYSINFO_FEATURES (17) (r/-): Machine system timer implemented when 1 (via IO_MTIME_USE generic) */ |
SYSINFO_FEATURES_IO_UART = 18, /**< SYSINFO_FEATURES (18) (r/-): Universal asynchronous receiver/transmitter implemented when 1 (via IO_UART_USE generic) */ |
SYSINFO_FEATURES_IO_SPI = 19, /**< SYSINFO_FEATURES (19) (r/-): Serial peripheral interface implemented when 1 (via IO_SPI_USE generic) */ |
SYSINFO_FEATURES_IO_TWI = 20, /**< SYSINFO_FEATURES (20) (r/-): Two-wire interface implemented when 1 (via IO_TWI_USE generic) */ |
SYSINFO_FEATURES_IO_PWM = 21, /**< SYSINFO_FEATURES (21) (r/-): Pulse-width modulation unit implemented when 1 (via IO_PWM_USE generic) */ |
SYSINFO_FEATURES_IO_WDT = 22, /**< SYSINFO_FEATURES (22) (r/-): Watchdog timer implemented when 1 (via IO_WDT_USE generic) */ |
SYSINFO_FEATURES_IO_CFU0 = 23, /**< SYSINFO_FEATURES (23) (r/-): Custom functions unit 0 implemented when 1 (via IO_CFU0_USE generic) */ |
SYSINFO_FEATURES_IO_TRNG = 24, /**< SYSINFO_FEATURES (24) (r/-): True random number generator implemented when 1 (via IO_TRNG_USE generic) */ |
SYSINFO_FEATURES_IO_CFU1 = 25 /**< SYSINFO_FEATURES (25) (r/-): Custom functions unit 1 implemented when 1 (via IO_CFU1_USE generic) */ |
SYSINFO_FEATURES_IO_GPIO = 16, /**< SYSINFO_FEATURES (16) (r/-): General purpose input/output port unit implemented when 1 (via IO_GPIO_EN generic) */ |
SYSINFO_FEATURES_IO_MTIME = 17, /**< SYSINFO_FEATURES (17) (r/-): Machine system timer implemented when 1 (via IO_MTIME_EN generic) */ |
SYSINFO_FEATURES_IO_UART = 18, /**< SYSINFO_FEATURES (18) (r/-): Universal asynchronous receiver/transmitter implemented when 1 (via IO_UART_EN generic) */ |
SYSINFO_FEATURES_IO_SPI = 19, /**< SYSINFO_FEATURES (19) (r/-): Serial peripheral interface implemented when 1 (via IO_SPI_EN generic) */ |
SYSINFO_FEATURES_IO_TWI = 20, /**< SYSINFO_FEATURES (20) (r/-): Two-wire interface implemented when 1 (via IO_TWI_EN generic) */ |
SYSINFO_FEATURES_IO_PWM = 21, /**< SYSINFO_FEATURES (21) (r/-): Pulse-width modulation unit implemented when 1 (via IO_PWM_EN generic) */ |
SYSINFO_FEATURES_IO_WDT = 22, /**< SYSINFO_FEATURES (22) (r/-): Watchdog timer implemented when 1 (via IO_WDT_EN generic) */ |
SYSINFO_FEATURES_IO_CFU0 = 23, /**< SYSINFO_FEATURES (23) (r/-): Custom functions unit 0 implemented when 1 (via IO_CFU0_EN generic) */ |
SYSINFO_FEATURES_IO_TRNG = 24, /**< SYSINFO_FEATURES (24) (r/-): True random number generator implemented when 1 (via IO_TRNG_EN generic) */ |
SYSINFO_FEATURES_IO_CFU1 = 25 /**< SYSINFO_FEATURES (25) (r/-): Custom functions unit 1 implemented when 1 (via IO_CFU1_EN generic) */ |
}; |
|
/**********************************************************************//** |
/include/neorv32_cfu.h
3,7 → 3,7
// # ********************************************************************************************* # |
// # BSD 3-Clause License # |
// # # |
// # Copyright (c) 2020, Stephan Nolting. All rights reserved. # |
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. # |
// # # |
// # Redistribution and use in source and binary forms, with or without modification, are # |
// # permitted provided that the following conditions are met: # |
41,7 → 41,7
* @warning There are no "real" CFU driver functions available here, because these functions are defined by the actual hardware. |
* @warning Hence, the CFU designer has to provide the actual driver functions. |
* |
* @note These functions should only be used if the CFU0/CFU1 was synthesized (IO_CFU0_USE/IO_CFU1_USE = true). |
* @note These functions should only be used if the CFU0/CFU1 was synthesized (IO_CFU0_EN/IO_CFU1_EN = true). |
**************************************************************************/ |
|
#ifndef neorv32_cfu_h |
/include/neorv32_gpio.h
3,7 → 3,7
// # ********************************************************************************************* # |
// # BSD 3-Clause License # |
// # # |
// # Copyright (c) 2020, Stephan Nolting. All rights reserved. # |
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. # |
// # # |
// # Redistribution and use in source and binary forms, with or without modification, are # |
// # permitted provided that the following conditions are met: # |
38,7 → 38,7
* @author Stephan Nolting |
* @brief General purpose input/output port unit (GPIO) HW driver header file. |
* |
* @note These functions should only be used if the GPIO unit was synthesized (IO_GPIO_USE = true). |
* @note These functions should only be used if the GPIO unit was synthesized (IO_GPIO_EN = true). |
**************************************************************************/ |
|
#ifndef neorv32_gpio_h |
/include/neorv32_mtime.h
3,7 → 3,7
// # ********************************************************************************************* # |
// # BSD 3-Clause License # |
// # # |
// # Copyright (c) 2020, Stephan Nolting. All rights reserved. # |
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. # |
// # # |
// # Redistribution and use in source and binary forms, with or without modification, are # |
// # permitted provided that the following conditions are met: # |
38,7 → 38,7
* @author Stephan Nolting |
* @brief Machine System Timer (MTIME) HW driver header file. |
* |
* @note These functions should only be used if the MTIME unit was synthesized (IO_MTIME_USE = true). |
* @note These functions should only be used if the MTIME unit was synthesized (IO_MTIME_EN = true). |
**************************************************************************/ |
|
#ifndef neorv32_mtime_h |
/include/neorv32_pwm.h
3,7 → 3,7
// # ********************************************************************************************* # |
// # BSD 3-Clause License # |
// # # |
// # Copyright (c) 2020, Stephan Nolting. All rights reserved. # |
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. # |
// # # |
// # Redistribution and use in source and binary forms, with or without modification, are # |
// # permitted provided that the following conditions are met: # |
38,7 → 38,7
* @author Stephan Nolting |
* @brief Pulse-Width Modulation Controller (PWM) HW driver header file. |
* |
* @note These functions should only be used if the PWM unit was synthesized (IO_PWM_USE = true). |
* @note These functions should only be used if the PWM unit was synthesized (IO_PWM_EN = true). |
**************************************************************************/ |
|
#ifndef neorv32_pwm_h |
/include/neorv32_rte.h
3,7 → 3,7
// # ********************************************************************************************* # |
// # BSD 3-Clause License # |
// # # |
// # Copyright (c) 2020, Stephan Nolting. All rights reserved. # |
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. # |
// # # |
// # Redistribution and use in source and binary forms, with or without modification, are # |
// # permitted provided that the following conditions are met: # |
43,7 → 43,7
#define neorv32_rte_h |
|
/**********************************************************************//** |
* RTE trap IDs. |
* NEORV32 runtime environment trap IDs. |
**************************************************************************/ |
enum NEORV32_RTE_TRAP_enum { |
RTE_TRAP_I_MISALIGNED = 0, /**< Instruction address misaligned */ |
76,4 → 76,7
void neorv32_rte_print_logo(void); |
void neorv32_rte_print_license(void); |
|
uint32_t neorv32_rte_get_compiler_isa(void); |
int neorv32_rte_check_isa(int silent); |
|
#endif // neorv32_rte_h |
/include/neorv32_spi.h
3,7 → 3,7
// # ********************************************************************************************* # |
// # BSD 3-Clause License # |
// # # |
// # Copyright (c) 2020, Stephan Nolting. All rights reserved. # |
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. # |
// # # |
// # Redistribution and use in source and binary forms, with or without modification, are # |
// # permitted provided that the following conditions are met: # |
38,7 → 38,7
* @author Stephan Nolting |
* @brief Serial peripheral interface controller (SPI) HW driver header file. |
* |
* @note These functions should only be used if the SPI unit was synthesized (IO_SPI_USE = true). |
* @note These functions should only be used if the SPI unit was synthesized (IO_SPI_EN = true). |
**************************************************************************/ |
|
#ifndef neorv32_spi_h |
/include/neorv32_trng.h
3,7 → 3,7
// # ********************************************************************************************* # |
// # BSD 3-Clause License # |
// # # |
// # Copyright (c) 2020, Stephan Nolting. All rights reserved. # |
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. # |
// # # |
// # Redistribution and use in source and binary forms, with or without modification, are # |
// # permitted provided that the following conditions are met: # |
38,7 → 38,7
* @author Stephan Nolting |
* @brief True Random Number Generator (TRNG) HW driver header file. |
* |
* @note These functions should only be used if the TRNG unit was synthesized (IO_TRNG_USE = true). |
* @note These functions should only be used if the TRNG unit was synthesized (IO_TRNG_EN = true). |
**************************************************************************/ |
|
#ifndef neorv32_trng_h |
/include/neorv32_twi.h
3,7 → 3,7
// # ********************************************************************************************* # |
// # BSD 3-Clause License # |
// # # |
// # Copyright (c) 2020, Stephan Nolting. All rights reserved. # |
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. # |
// # # |
// # Redistribution and use in source and binary forms, with or without modification, are # |
// # permitted provided that the following conditions are met: # |
38,7 → 38,7
* @author Stephan Nolting |
* @brief Two-Wire Interface Controller (TWI) HW driver header file. |
* |
* @note These functions should only be used if the TWI unit was synthesized (IO_TWI_USE = true). |
* @note These functions should only be used if the TWI unit was synthesized (IO_TWI_EN = true). |
**************************************************************************/ |
|
#ifndef neorv32_twi_h |
/include/neorv32_uart.h
3,7 → 3,7
// # ********************************************************************************************* # |
// # BSD 3-Clause License # |
// # # |
// # Copyright (c) 2020, Stephan Nolting. All rights reserved. # |
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. # |
// # # |
// # Redistribution and use in source and binary forms, with or without modification, are # |
// # permitted provided that the following conditions are met: # |
38,7 → 38,7
* @author Stephan Nolting |
* @brief Universal asynchronous receiver/transmitter (UART) HW driver header file |
* |
* @note These functions should only be used if the UART unit was synthesized (IO_UART_USE = true). |
* @note These functions should only be used if the UART unit was synthesized (IO_UART_EN = true). |
**************************************************************************/ |
|
#ifndef neorv32_uart_h |
/include/neorv32_wdt.h
3,7 → 3,7
// # ********************************************************************************************* # |
// # BSD 3-Clause License # |
// # # |
// # Copyright (c) 2020, Stephan Nolting. All rights reserved. # |
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. # |
// # # |
// # Redistribution and use in source and binary forms, with or without modification, are # |
// # permitted provided that the following conditions are met: # |
38,7 → 38,7
* @author Stephan Nolting |
* @brief Watchdog Timer (WDT) HW driver header file. |
* |
* @note These functions should only be used if the WDT unit was synthesized (IO_WDT_USE = true). |
* @note These functions should only be used if the WDT unit was synthesized (IO_WDT_EN = true). |
**************************************************************************/ |
|
#ifndef neorv32_wdt_h |
/source/neorv32_cfu.c
3,7 → 3,7
// # ********************************************************************************************* # |
// # BSD 3-Clause License # |
// # # |
// # Copyright (c) 2020, Stephan Nolting. All rights reserved. # |
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. # |
// # # |
// # Redistribution and use in source and binary forms, with or without modification, are # |
// # permitted provided that the following conditions are met: # |
41,7 → 41,7
* @warning There are no "real" CFU driver functions available here, because these functions are defined by the actual hardware. |
* @warning Hence, the CFU designer has to provide the actual driver functions. |
* |
* @note These functions should only be used if the CFU0/CFU1 was synthesized (IO_CFU0_USE/IO_CFU1_USE = true). |
* @note These functions should only be used if the CFU0/CFU1 was synthesized (IO_CFU0_EN/IO_CFU1_EN = true). |
**************************************************************************/ |
|
#include "neorv32.h" |
/source/neorv32_gpio.c
3,7 → 3,7
// # ********************************************************************************************* # |
// # BSD 3-Clause License # |
// # # |
// # Copyright (c) 2020, Stephan Nolting. All rights reserved. # |
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. # |
// # # |
// # Redistribution and use in source and binary forms, with or without modification, are # |
// # permitted provided that the following conditions are met: # |
38,7 → 38,7
* @author Stephan Nolting |
* @brief General purpose input/output port unit (GPIO) HW driver source file. |
* |
* @note These functions should only be used if the GPIO unit was synthesized (IO_GPIO_USE = true). |
* @note These functions should only be used if the GPIO unit was synthesized (IO_GPIO_EN = true). |
**************************************************************************/ |
|
#include "neorv32.h" |
/source/neorv32_mtime.c
3,7 → 3,7
// # ********************************************************************************************* # |
// # BSD 3-Clause License # |
// # # |
// # Copyright (c) 2020, Stephan Nolting. All rights reserved. # |
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. # |
// # # |
// # Redistribution and use in source and binary forms, with or without modification, are # |
// # permitted provided that the following conditions are met: # |
38,7 → 38,7
* @author Stephan Nolting |
* @brief Machine System Timer (MTIME) HW driver source file. |
* |
* @note These functions should only be used if the MTIME unit was synthesized (IO_MTIME_USE = true). |
* @note These functions should only be used if the MTIME unit was synthesized (IO_MTIME_EN = true). |
**************************************************************************/ |
|
#include "neorv32.h" |
/source/neorv32_pwm.c
3,7 → 3,7
// # ********************************************************************************************* # |
// # BSD 3-Clause License # |
// # # |
// # Copyright (c) 2020, Stephan Nolting. All rights reserved. # |
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. # |
// # # |
// # Redistribution and use in source and binary forms, with or without modification, are # |
// # permitted provided that the following conditions are met: # |
38,7 → 38,7
* @author Stephan Nolting |
* @brief Pulse-Width Modulation Controller (PWM) HW driver source file. |
* |
* @note These functions should only be used if the PWM unit was synthesized (IO_PWM_USE = true). |
* @note These functions should only be used if the PWM unit was synthesized (IO_PWM_EN = true). |
**************************************************************************/ |
|
#include "neorv32.h" |
/source/neorv32_rte.c
314,6 → 314,9
if (tmp & (1<<CSR_MZEXT_ZIFENCEI)) { |
neorv32_uart_printf("Zifencei "); |
} |
if (tmp & (1<<CSR_MZEXT_ZBB)) { |
neorv32_uart_printf("Zbb "); |
} |
|
// check physical memory protection |
neorv32_uart_printf("\nPMP: "); |
596,3 → 599,71
); |
} |
|
|
/**********************************************************************//** |
* NEORV32 runtime environment: Get MISA CSR value according to *compiler/toolchain configuration*. |
* |
* @return MISA content according to compiler configuration. |
**************************************************************************/ |
uint32_t neorv32_rte_get_compiler_isa(void) { |
|
uint32_t misa_cc = 0; |
|
#ifdef __riscv_atomic |
misa_cc |= 1 << CSR_MISA_A_EXT; |
#endif |
|
#ifdef __riscv_compressed |
misa_cc |= 1 << CSR_MISA_C_EXT; |
#endif |
|
#ifdef __riscv_32e |
misa_cc |= 1 << CSR_MISA_E_EXT; |
#else |
misa_cc |= 1 << CSR_MISA_I_EXT; |
#endif |
|
#ifdef __riscv_mul |
misa_cc |= 1 << CSR_MISA_M_EXT; |
#endif |
|
#if (__riscv_xlen == 32) |
misa_cc |= 1 << CSR_MISA_MXL_LO_EXT; |
#elif (__riscv_xlen == 64) |
misa_cc |= 2 << CSR_MISA_MXL_LO_EXT; |
#else |
misa_cc |= 3 << CSR_MISA_MXL_LO_EXT; |
#endif |
|
return misa_cc; |
} |
|
|
/**********************************************************************//** |
* NEORV32 runtime environment: Check required ISA extensions (via compiler flags) against available ISA extensions (via MISA csr). |
* |
* @param[in] silent Show error message (via neorv32.uart) if isa_sw > isa_hw when != 0. |
* @return MISA content according to compiler configuration. |
**************************************************************************/ |
int neorv32_rte_check_isa(int silent) { |
|
uint32_t misa_sw = neorv32_rte_get_compiler_isa(); |
uint32_t misa_hw = neorv32_cpu_csr_read(CSR_MISA); |
|
// mask hardware features that are not used by software |
uint32_t check = misa_hw & misa_sw; |
|
// |
if (check == misa_sw) { |
return 0; |
} |
else { |
if (silent == 0) { |
neorv32_uart_printf("\nWARNING! SW_ISA (features required) vs HW_ISA (features available) mismatch!\n" |
"SW_ISA = 0x%x (compiler flags)\n" |
"HW_ISA = 0x%x (misa csr)\n\n", misa_sw, misa_hw); |
} |
return 1; |
} |
} |
|
/source/neorv32_spi.c
3,7 → 3,7
// # ********************************************************************************************* # |
// # BSD 3-Clause License # |
// # # |
// # Copyright (c) 2020, Stephan Nolting. All rights reserved. # |
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. # |
// # # |
// # Redistribution and use in source and binary forms, with or without modification, are # |
// # permitted provided that the following conditions are met: # |
38,7 → 38,7
* @author Stephan Nolting |
* @brief Serial peripheral interface controller (SPI) HW driver source file. |
* |
* @note These functions should only be used if the SPI unit was synthesized (IO_SPI_USE = true). |
* @note These functions should only be used if the SPI unit was synthesized (IO_SPI_EN = true). |
**************************************************************************/ |
|
#include "neorv32.h" |
/source/neorv32_trng.c
3,7 → 3,7
// # ********************************************************************************************* # |
// # BSD 3-Clause License # |
// # # |
// # Copyright (c) 2020, Stephan Nolting. All rights reserved. # |
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. # |
// # # |
// # Redistribution and use in source and binary forms, with or without modification, are # |
// # permitted provided that the following conditions are met: # |
38,7 → 38,7
* @author Stephan Nolting |
* @brief True Random Number Generator (TRNG) HW driver source file. |
* |
* @note These functions should only be used if the TRNG unit was synthesized (IO_TRNG_USE = true). |
* @note These functions should only be used if the TRNG unit was synthesized (IO_TRNG_EN = true). |
**************************************************************************/ |
|
#include "neorv32.h" |
/source/neorv32_twi.c
3,7 → 3,7
// # ********************************************************************************************* # |
// # BSD 3-Clause License # |
// # # |
// # Copyright (c) 2020, Stephan Nolting. All rights reserved. # |
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. # |
// # # |
// # Redistribution and use in source and binary forms, with or without modification, are # |
// # permitted provided that the following conditions are met: # |
38,7 → 38,7
* @author Stephan Nolting |
* @brief Two-Wire Interface Controller (TWI) HW driver source file. |
* |
* @note These functions should only be used if the TWI unit was synthesized (IO_TWI_USE = true). |
* @note These functions should only be used if the TWI unit was synthesized (IO_TWI_EN = true). |
**************************************************************************/ |
|
#include "neorv32.h" |
/source/neorv32_uart.c
3,7 → 3,7
// # ********************************************************************************************* # |
// # BSD 3-Clause License # |
// # # |
// # Copyright (c) 2020, Stephan Nolting. All rights reserved. # |
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. # |
// # # |
// # Redistribution and use in source and binary forms, with or without modification, are # |
// # permitted provided that the following conditions are met: # |
38,7 → 38,7
* @author Stephan Nolting |
* @brief Universal asynchronous receiver/transmitter (UART) HW driver source file. |
* |
* @note These functions should only be used if the UART unit was synthesized (IO_UART_USE = true). |
* @note These functions should only be used if the UART unit was synthesized (IO_UART_EN = true). |
**************************************************************************/ |
|
#include "neorv32.h" |
/source/neorv32_wdt.c
3,7 → 3,7
// # ********************************************************************************************* # |
// # BSD 3-Clause License # |
// # # |
// # Copyright (c) 2020, Stephan Nolting. All rights reserved. # |
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. # |
// # # |
// # Redistribution and use in source and binary forms, with or without modification, are # |
// # permitted provided that the following conditions are met: # |
38,7 → 38,7
* @author Stephan Nolting |
* @brief Watchdog Timer (WDT) HW driver source file. |
* |
* @note These functions should only be used if the WDT unit was synthesized (IO_WDT_USE = true). |
* @note These functions should only be used if the WDT unit was synthesized (IO_WDT_EN = true). |
**************************************************************************/ |
|
#include "neorv32.h" |