summaryrefslogtreecommitdiff
path: root/riscv
diff options
context:
space:
mode:
authorPrashanth Mundkur2018-02-06 15:45:14 -0800
committerPrashanth Mundkur2018-02-06 15:45:14 -0800
commit89204a6d600733f1ae00fab31d33929f72b952df (patch)
tree6300dbb962c03ddcb7eceb2ef3008e0fadbb40ee /riscv
parent14f2feae793d9fef39268f6caabf2378ad9d0d9f (diff)
Add a system initialization function. For now, it merely initializes support for RVC in the misa.
Diffstat (limited to 'riscv')
-rw-r--r--riscv/main.sail1
-rw-r--r--riscv/riscv_sys.sail5
2 files changed, 6 insertions, 0 deletions
diff --git a/riscv/main.sail b/riscv/main.sail
index 4209b7d1..0cc34061 100644
--- a/riscv/main.sail
+++ b/riscv/main.sail
@@ -56,6 +56,7 @@ function dump_state () : unit -> unit = {
function main () = {
PC = __GetSlice_int(64, elf_entry(), 0);
try {
+ init_sys ();
fetch_and_execute()
} catch {
Error_not_implemented(s) => print_string("Error: Not implemented: ", s),
diff --git a/riscv/riscv_sys.sail b/riscv/riscv_sys.sail
index ccbe58fb..2956caae 100644
--- a/riscv/riscv_sys.sail
+++ b/riscv/riscv_sys.sail
@@ -346,3 +346,8 @@ function handle_exception_ctl(cur_priv : privilege, ctl : ctl_result,
mepc
}
}
+
+function init_sys () : unit -> unit = {
+ cur_privilege = MACHINE;
+ misa->C() = true;
+}