summaryrefslogtreecommitdiff
path: root/riscv/riscv_sys.sail
diff options
context:
space:
mode:
authorPrashanth Mundkur2018-04-20 08:43:03 -0700
committerPrashanth Mundkur2018-04-20 08:43:03 -0700
commit8d74837e5b95866ed24795e81d1e685499067cfa (patch)
treedfe64fd8b33978b5c62a5d38f8a7df0eb2b69d1d /riscv/riscv_sys.sail
parent85d6051f04a5ffa93f35f3a6f4471aebfecd5c29 (diff)
Some cleanup and comments.
Diffstat (limited to 'riscv/riscv_sys.sail')
-rw-r--r--riscv/riscv_sys.sail11
1 files changed, 7 insertions, 4 deletions
diff --git a/riscv/riscv_sys.sail b/riscv/riscv_sys.sail
index 10abeaab..5551220f 100644
--- a/riscv/riscv_sys.sail
+++ b/riscv/riscv_sys.sail
@@ -1,10 +1,8 @@
-/* machine mode registers */
-
/* privilege level */
register cur_privilege : Privilege
-/* FIXME: currently we have only those used by riscv-tests. */
+/* M-mode registers */
bitfield Misa : bits(64) = {
MXL : 63 .. 62,
@@ -188,6 +186,8 @@ function legalize_medeleg(o : Medeleg, v : xlenbits) -> Medeleg = {
m
}
+/* registers for trap handling */
+
bitfield Mtvec : bits(64) = {
Base : 63 .. 2,
Mode : 1 .. 0
@@ -605,8 +605,9 @@ function handle_exception_ctl(cur_priv : Privilege, ctl : ctl_result,
}
}
-function init_sys () : unit -> unit = {
+function init_sys() -> unit = {
cur_privilege = Machine;
+
misa->MXL() = arch_to_bits(RV64);
misa->C() = true;
misa->U() = true;
@@ -615,4 +616,6 @@ function init_sys () : unit -> unit = {
mstatus->SXL() = misa.MXL();
mstatus->UXL() = misa.MXL();
mstatus->SD() = false;
+
+ mhartid = EXTZ(0b0);
}