summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrashanth Mundkur2018-04-18 14:56:42 -0700
committerPrashanth Mundkur2018-04-18 14:56:42 -0700
commite5da122d95fe77fcc44bc832f90c79435b947a8a (patch)
treeee511fb35b995fa1997d089fec3cf2914a15df6f
parent3194f0f124b4f1e83d1248a4c52ed05eb3de2837 (diff)
Use the generated num_of_E function for enum E instead of defining one by hand.
-rw-r--r--riscv/riscv_sys.sail2
-rw-r--r--riscv/riscv_types.sail22
2 files changed, 1 insertions, 23 deletions
diff --git a/riscv/riscv_sys.sail b/riscv/riscv_sys.sail
index cee3ede4..dfed02c4 100644
--- a/riscv/riscv_sys.sail
+++ b/riscv/riscv_sys.sail
@@ -459,7 +459,7 @@ function check_CSR(csr : csreg, p : Privilege, isWrite : bool) -> bool =
* it occured, returns the privilege at which it should be handled.
*/
function exception_delegatee(e : ExceptionType, p : Privilege) -> Privilege = {
- let idx = exceptionType_to_nat(e);
+ let idx = num_of_ExceptionType(e);
let super = medeleg.bits()[idx];
let user = sedeleg.bits()[idx];
let deleg = /* if misa.N() == true & user then User
diff --git a/riscv/riscv_types.sail b/riscv/riscv_types.sail
index 78b0ea89..1b79e461 100644
--- a/riscv/riscv_types.sail
+++ b/riscv/riscv_types.sail
@@ -150,28 +150,6 @@ function exceptionType_to_bits(e) = {
}
}
-val cast exceptionType_to_nat : ExceptionType -> range(0, 15)
-function exceptionType_to_nat(e) = {
- match (e) {
- E_Fetch_Addr_Align => 0,
- E_Fetch_Access_Fault => 1,
- E_Illegal_Instr => 2,
- E_Breakpoint => 3,
- E_Load_Addr_Align => 4,
- E_Load_Access_Fault => 5,
- E_SAMO_Addr_Align => 6,
- E_SAMO_Access_Fault => 7,
- E_U_EnvCall => 8,
- E_S_EnvCall => 9,
- E_Reserved_10 => 10,
- E_M_EnvCall => 11,
- E_Fetch_Page_Fault => 12,
- E_Load_Page_Fault => 13,
- E_Reserved_14 => 14,
- E_SAMO_Page_Fault => 15
- }
-}
-
enum InterruptType = {
I_U_Software,
I_S_Software,