summaryrefslogtreecommitdiff
path: root/riscv/prelude.sail
diff options
context:
space:
mode:
authorAlasdair Armstrong2018-01-19 17:51:21 +0000
committerAlasdair Armstrong2018-01-19 18:51:35 +0000
commitb3cb23aeb3d555b6256fbb027e55378efc2cdc12 (patch)
tree55f582243f87a3184cdb1d2e613487a6ed71a859 /riscv/prelude.sail
parent715424f7dea8bb10526809e75a40fc5d6744646e (diff)
Got riscv spec to typecheck with sail2
Fix a typechecking bug involving constraints attached to type synonyms within existentials.
Diffstat (limited to 'riscv/prelude.sail')
-rw-r--r--riscv/prelude.sail17
1 files changed, 16 insertions, 1 deletions
diff --git a/riscv/prelude.sail b/riscv/prelude.sail
index b4e36507..ff11cf7e 100644
--- a/riscv/prelude.sail
+++ b/riscv/prelude.sail
@@ -276,9 +276,11 @@ val cast ex_int : int -> {'n, true. atom('n)}
function ex_int 'n = n
+/*
val cast ex_range : forall 'n 'm. range('n, 'm) -> {'o, 'n <= 'o <= 'm. atom('o)}
function ex_range (n as 'N) = n
+*/
val coerce_int_nat : int -> nat effect {escape}
@@ -297,6 +299,7 @@ val print_int = "print_int" : (string, int) -> unit
union exception = {
Error_not_implemented : string,
Error_misaligned_access,
+ Error_EBREAK,
}
val EXTS : forall 'n 'm , 'm >= 'n . bits('n) -> bits('m)
@@ -313,4 +316,16 @@ function operator <_u (x : bits('n), y : bits('n)) -> forall 'n. bool = unsigne
function operator >=_u (x : bits('n), y : bits('n)) -> forall 'n. bool = unsigned(x) >= unsigned(y)
val cast bool_to_bits : bool -> bits(1)
-function bool_to_bits x = if x then 0b1 else 0b0 \ No newline at end of file
+function bool_to_bits x = if x then 0b1 else 0b0
+
+val cast bit_to_bool : bit -> bool
+function bit_to_bool bitone = true
+and bit_to_bool bitzero = false
+
+infix 7 >>
+infix 7 <<
+
+val operator >> : forall 'n 'm. (bits('n), bits('m)) -> bits('n)
+val operator << : forall 'n 'm. (bits('n), bits('m)) -> bits('n)
+
+val vector64 : int -> bits(64) \ No newline at end of file