mirror of
https://github.com/openhwgroup/cvw
synced 2025-01-23 21:14:37 +00:00
20 lines
329 B
C
20 lines
329 B
C
#include "fail.h"
|
|
#include "uart.h"
|
|
#include "riscv.h"
|
|
#include "time.h"
|
|
|
|
void fail() {
|
|
// Get address that led to failure
|
|
register uint64_t addr;
|
|
asm volatile ("mv %0, ra" : "=r"(addr) : : "memory");
|
|
|
|
// Print message
|
|
print_time();
|
|
println_with_addr("Failed at: 0x", addr);
|
|
|
|
// Loop forever
|
|
while(1) {
|
|
|
|
}
|
|
}
|