summaryrefslogtreecommitdiff
path: root/riscv/riscv_platform.sail
diff options
context:
space:
mode:
Diffstat (limited to 'riscv/riscv_platform.sail')
-rw-r--r--riscv/riscv_platform.sail12
1 files changed, 12 insertions, 0 deletions
diff --git a/riscv/riscv_platform.sail b/riscv/riscv_platform.sail
index c878f2a7..aee72e47 100644
--- a/riscv/riscv_platform.sail
+++ b/riscv/riscv_platform.sail
@@ -281,3 +281,15 @@ function handle_illegal() -> unit = {
excinfo = info };
nextPC = handle_exception(cur_privilege, CTL_TRAP(t), PC)
}
+
+/* Platform-specific wait-for-interrupt */
+
+function platform_wfi() -> unit = {
+ /* speed execution by getting the timer to fire at the next instruction,
+ * since we currently don't have any other devices raising interrupts.
+ */
+ if mtime <_u mtimecmp then {
+ mtime = mtimecmp;
+ mcycle = mtimecmp;
+ }
+} \ No newline at end of file