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/include
- from Rev 4 to Rev 6
- ↔ Reverse comparison
Rev 4 → Rev 6
/neorv32.h
60,10 → 60,10
* Available CPU Control and Status Registers (CSRs) |
**************************************************************************/ |
enum NEORV32_CPU_CSRS_enum { |
CSR_MSTATUS = 0x300, /**< 0x300 - mstatus (r/w): Machine status register */ |
CSR_MISA = 0x301, /**< 0x301 - misa (r/-): CPU ISA and extensions */ |
CSR_MIE = 0x304, /**< 0x304 - mie (r/w): Machine interrupt-enable register */ |
CSR_MTVEC = 0x305, /**< 0x305 - mtvec (r/w): Machine trap-handler base address (for ALL traps) */ |
CSR_MSTATUS = 0x300, /**< 0x300 - mstatus (r/w): Machine status register */ |
CSR_MISA = 0x301, /**< 0x301 - misa (r/-): CPU ISA and extensions */ |
CSR_MIE = 0x304, /**< 0x304 - mie (r/w): Machine interrupt-enable register */ |
CSR_MTVEC = 0x305, /**< 0x305 - mtvec (r/w): Machine trap-handler base address (for ALL traps) */ |
|
CSR_MSCRATCH = 0x340, /**< 0x340 - mscratch (r/w): Machine scratch register */ |
CSR_MEPC = 0x341, /**< 0x341 - mepc (r/w): Machine exception program counter */ |
127,6 → 127,21
|
|
/**********************************************************************//** |
* CPU <b>misa</b> CSR (r/w): Machine instruction set extensions (RISC-V spec.) |
**************************************************************************/ |
enum NEORV32_CPU_MISA_enum { |
CPU_MISA_C_EXT = 2, /**< CPU misa CSR (2): C: Compressed instructions CPU extension available (r/w), can be switched on/off */ |
CPU_MISA_E_EXT = 4, /**< CPU misa CSR (3): E: Embedded CPU extension available (r/-) */ |
CPU_MISA_I_EXT = 8, /**< CPU misa CSR (8): I: Base integer ISA CPU extension available (r/-) */ |
CPU_MISA_M_EXT = 12, /**< CPU misa CSR (12): M: Multiplier/divider CPU extension available (r/w), can be switched on/off */ |
CPU_MISA_X_EXT = 23, /**< CPU misa CSR (23): X: Non-standard CPU extension available (r/-) */ |
CPU_MISA_Z_EXT = 25, /**< CPU misa CSR (25): Z: Privileged architecture CPU extension available (r/-) */ |
CPU_MISA_MXL_LO_EXT = 30, /**< CPU misa CSR (30): MXL.lo: CPU data width (r/-) */ |
CPU_MISA_MXL_HI_EXT = 31 /**< CPU misa CSR (31): MXL.Hi: CPU data width (r/-) */ |
}; |
|
|
/**********************************************************************//** |
* CPU <b>mfeatures</b> CSR (r/-): Implemented processor devices/features (CUSTOM) |
**************************************************************************/ |
enum NEORV32_CPU_MFEATURES_enum { |
135,6 → 150,7
CPU_MFEATURES_MEM_INT_IMEM = 2, /**< CPU mfeatures CSR (2) (r/-): Processor-internal instruction memory implemented when 1 (via MEM_INT_IMEM_USE generic) */ |
CPU_MFEATURES_MEM_INT_IMEM_ROM = 3, /**< CPU mfeatures CSR (3) (r/-): Processor-internal instruction memory implemented as ROM when 1 (via MEM_INT_IMEM_ROM generic) */ |
CPU_MFEATURES_MEM_INT_DMEM = 4, /**< CPU mfeatures CSR (4) (r/-): Processor-internal data memory implemented when 1 (via MEM_INT_DMEM_USE generic) */ |
CPU_MFEATURES_CSR_COUNTERS = 5, /**< CPU mfeatures CSR (5) (r/-): RISC-V performance counters implemented when 1 (via CSR_COUNTERS_USE generic) */ |
|
CPU_MFEATURES_IO_GPIO = 16, /**< CPU mfeatures CSR (16) (r/-): General purpose input/output port unit implemented when 1 (via IO_GPIO_USE generic) */ |
CPU_MFEATURES_IO_MTIME = 17, /**< CPU mfeatures CSR (17) (r/-): Machine system timer implemented when 1 (via IO_MTIME_USE generic) */ |
211,13 → 227,13
**************************************************************************/ |
/**@{*/ |
/** instruction memory base address (r/w/x) */ |
#define INSTR_MEM_BASE_ADDR 0x00000000 |
// -> use value from MEM_ISPACE_BASE CSR |
/** data memory base address (r/w/x) */ |
#define DATA_MEM_BASE_ADDR 0x80000000 |
// -> use value from MEM_DSPACE_BASE CSR |
/** bootloader memory base address (r/-/x) */ |
#define BOOTLOADER_BASE_ADDRESS 0xFFFF0000 |
#define BOOTLOADER_BASE_ADDRESS (0xFFFF0000UL) |
/** peripheral/IO devices memory base address (r/w/x) */ |
#define IO_BASE_ADDRESS 0xFFFFFF80 |
#define IO_BASE_ADDRESS (0xFFFFFF80UL) |
/**@}*/ |
|
|
226,9 → 242,9
**************************************************************************/ |
/**@{*/ |
/** GPIO parallel input port (r/-) */ |
#define GPIO_INPUT (*(IO_ROM32 0xFFFFFF80)) |
#define GPIO_INPUT (*(IO_ROM32 0xFFFFFF80UL)) |
/** GPIO parallel output port (r/w) */ |
#define GPIO_OUTPUT (*(IO_REG32 0xFFFFFF84)) |
#define GPIO_OUTPUT (*(IO_REG32 0xFFFFFF84UL)) |
/**@}*/ |
|
|
237,7 → 253,7
**************************************************************************/ |
/**@{*/ |
/** CLIC control register (r/w) */ |
#define CLIC_CT (*(IO_REG32 0xFFFFFF88)) |
#define CLIC_CT (*(IO_REG32 0xFFFFFF88UL)) |
|
/** CLIC control register bits */ |
enum NEORV32_CLIC_CT_enum { |
284,7 → 300,7
**************************************************************************/ |
/**@{*/ |
/** Watchdog control register (r/w) */ |
#define WDT_CT (*(IO_REG32 0xFFFFFF8C)) |
#define WDT_CT (*(IO_REG32 0xFFFFFF8CUL)) |
|
/** WTD control register bits */ |
enum NEORV32_WDT_CT_enum { |
310,13 → 326,13
**************************************************************************/ |
/**@{*/ |
/** MTIME (time register) low word (r/-) */ |
#define MTIME_LO (*(IO_ROM32 0xFFFFFF90)) |
#define MTIME_LO (*(IO_ROM32 0xFFFFFF90UL)) |
/** MTIME (time register) high word (r/-) */ |
#define MTIME_HI (*(IO_ROM32 0xFFFFFF94)) |
#define MTIME_HI (*(IO_ROM32 0xFFFFFF94UL)) |
/** MTIMECMP (time compare register) low word (r/w) */ |
#define MTIMECMP_LO (*(IO_REG32 0xFFFFFF98)) |
#define MTIMECMP_LO (*(IO_REG32 0xFFFFFF98UL)) |
/** MTIMECMP (time register) high word (r/w) */ |
#define MTIMECMP_HI (*(IO_REG32 0xFFFFFF9C)) |
#define MTIMECMP_HI (*(IO_REG32 0xFFFFFF9CUL)) |
|
/** MTIME (time register) 64-bit access (r/-) */ |
#define MTIME (*(IO_ROM64 (&MTIME_LO))) |
330,9 → 346,9
**************************************************************************/ |
/**@{*/ |
/** UART control register (r/w) */ |
#define UART_CT (*(IO_REG32 0xFFFFFFA0)) |
#define UART_CT (*(IO_REG32 0xFFFFFFA0UL)) |
/** UART receive/transmit data register (r/w) */ |
#define UART_DATA (*(IO_REG32 0xFFFFFFA4)) |
#define UART_DATA (*(IO_REG32 0xFFFFFFA4UL)) |
|
/** UART control register bits */ |
enum NEORV32_UART_CT_enum { |
373,9 → 389,9
**************************************************************************/ |
/**@{*/ |
/** SPI control register (r/w) */ |
#define SPI_CT (*(IO_REG32 0xFFFFFFA8)) |
#define SPI_CT (*(IO_REG32 0xFFFFFFA8UL)) |
/** SPI receive/transmit data register (r/w) */ |
#define SPI_DATA (*(IO_REG32 0xFFFFFFAC)) |
#define SPI_DATA (*(IO_REG32 0xFFFFFFACUL)) |
|
/** SPI control register bits */ |
enum NEORV32_SPI_CT_enum { |
409,9 → 425,9
**************************************************************************/ |
/**@{*/ |
/** TWI control register (r/w) */ |
#define TWI_CT (*(IO_REG32 0xFFFFFFB0)) |
#define TWI_CT (*(IO_REG32 0xFFFFFFB0UL)) |
/** TWI receive/transmit data register (r/w) */ |
#define TWI_DATA (*(IO_REG32 0xFFFFFFB4)) |
#define TWI_DATA (*(IO_REG32 0xFFFFFFB4UL)) |
|
/** TWI control register bits */ |
enum NEORV32_TWI_CT_enum { |
441,9 → 457,9
**************************************************************************/ |
/**@{*/ |
/** PWM control register (r/w) */ |
#define PWM_CT (*(IO_REG32 0xFFFFFFB8)) // r/w: control register |
#define PWM_CT (*(IO_REG32 0xFFFFFFB8UL)) // r/w: control register |
/** PWM duty cycle register (4-channels) (r/w) */ |
#define PWM_DUTY (*(IO_REG32 0xFFFFFFBC)) // r/w: duty cycle channel 1 and 0 |
#define PWM_DUTY (*(IO_REG32 0xFFFFFFBCUL)) // r/w: duty cycle channel 1 and 0 |
|
/** PWM control register bits */ |
enum NEORV32_PWM_CT_enum { |
472,9 → 488,9
**************************************************************************/ |
/**@{*/ |
/** TRNG control register (r/w) */ |
#define TRNG_CT (*(IO_REG32 0xFFFFFFC0)) |
#define TRNG_CT (*(IO_REG32 0xFFFFFFC0UL)) |
/** TRNG data register (r/-) */ |
#define TRNG_DATA (*(IO_ROM32 0xFFFFFFC4)) |
#define TRNG_DATA (*(IO_ROM32 0xFFFFFFC4UL)) |
|
/** TRNG control register bits */ |
enum NEORV32_TRNG_CT_enum { |
496,8 → 512,8
* @name IO Device: Dummy Device (DEVNULL) |
**************************************************************************/ |
/**@{*/ |
/** TRNG data register (r/w) */ |
#define DEVNULL_DATA (*(IO_REG32 0xFFFFFFFC)) |
/** DEVNULL data register (r/w) */ |
#define DEVNULL_DATA (*(IO_REG32 0xFFFFFFFCUL)) |
/**@}*/ |
|
|
/neorv32_cpu.h
64,7 → 64,7
|
register uint32_t csr_data; |
|
asm volatile ("csrrw %[result], %[input_i], zero" : [result] "=r" (csr_data) : [input_i] "i" (csr_id)); |
asm volatile ("csrr %[result], %[input_i]" : [result] "=r" (csr_data) : [input_i] "i" (csr_id)); |
|
return csr_data; |
} |
80,7 → 80,7
|
register uint32_t csr_data = data; |
|
asm volatile ("csrrw zero, %[input_i], %[input_j]" : : [input_i] "i" (csr_id), [input_j] "r" (csr_data)); |
asm volatile ("csrw %[input_i], %[input_j]" : : [input_i] "i" (csr_id), [input_j] "r" (csr_data)); |
} |
|
#endif // neorv32_cpu_h |
/neorv32_rte.h
44,7 → 44,8
|
// prototypes |
void neorv32_rte_enable_debug_mode(void); |
int neorv32_rte_exception_install(uint8_t exc_id, void (*handler)(void)); |
int neorv32_rte_exception_uninstall(uint8_t exc_id); |
int neorv32_rte_exception_install(uint8_t exc_id, void (*handler)(void)); |
int neorv32_rte_exception_uninstall(uint8_t exc_id); |
void neorv32_rte_print_hw_config(void); |
|
#endif // neorv32_rte_h |