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/source
- from Rev 10 to Rev 11
- ↔ Reverse comparison
Rev 10 → Rev 11
/neorv32_cpu.c
44,54 → 44,6
|
|
/**********************************************************************//** |
* Enable/disable CPU extension during runtime via the 'misa' CSR. |
* |
* @warning This is still highly experimental! This function requires the Zicsr + Zifencei CPU extensions. |
* |
* @param[in] sel Bit to be set in misa CSR / extension to be enabled. See #NEORV32_CPU_MISA_enum. |
* @param[in] state Set 1 to enable the selected extension, set 0 to disable it; |
* return 0 if success, 1 if error (invalid sel or extension cannot be enabled). |
**************************************************************************/ |
int neorv32_cpu_switch_extension(int sel, int state) { |
|
// get current misa setting |
uint32_t misa_curr = neorv32_cpu_csr_read(CSR_MISA); |
uint32_t misa_prev = misa_curr; |
|
// abort if misa.z is cleared |
if ((misa_curr & (1 << CPU_MISA_Z_EXT)) == 0) { |
return 1; |
} |
|
// out of range? |
if (sel > 25) { |
return 1; |
} |
|
// enable/disable selected extension |
if (state & 1) { |
misa_curr |= (1 << sel); |
} |
else { |
misa_curr &= ~(1 << sel); |
} |
|
// try updating misa |
neorv32_cpu_csr_write(CSR_MISA, misa_curr); |
asm volatile("fence.i"); // required to flush prefetch buffers |
asm volatile("nop"); |
|
// dit it work? |
if (neorv32_cpu_csr_read(CSR_MISA) == misa_prev) { |
return 1; // nope |
} |
else { |
return 0; // fine |
} |
} |
|
|
/**********************************************************************//** |
* Enable specific CPU interrupt. |
* |
* @note Interrupts have to be globally enabled via neorv32_cpu_eint(void), too. |
/neorv32_mtime.c
62,10 → 62,23
|
|
/**********************************************************************//** |
* Get current system time since reset. |
* Set current system time. |
* |
* @note The MTIME timer increments with the primary processor clock. |
* |
* @param[in] time New system time (uint64_t) |
**************************************************************************/ |
void neorv32_mtime_set_time(uint64_t time) { |
|
MTIME = time; |
} |
|
|
/**********************************************************************//** |
* Get current system time. |
* |
* @note The MTIME timer increments with the primary processor clock. |
* |
* @return Current system time (uint64_t) |
**************************************************************************/ |
uint64_t neorv32_mtime_get_time(void) { |
/neorv32_rte.c
373,3 → 373,16
} |
} |
} |
|
|
/**********************************************************************//** |
* NEORV32 runtime environment: Print project credits |
**************************************************************************/ |
void neorv32_rte_print_credits(void) { |
|
neorv32_uart_print("\n\nThe NEORV32 Processor Project\n" |
"by Stephan Nolting\n" |
"https://github.com/stnolting/neorv32\n" |
"made in Hannover, Germany\n\n"); |
} |
|