summaryrefslogtreecommitdiff
path: root/test/c/string_of_bits.sail
diff options
context:
space:
mode:
authorJon French2018-12-28 15:12:00 +0000
committerJon French2018-12-28 15:12:00 +0000
commitb59fba68e535f39b6285ec7f4f693107b6e34148 (patch)
tree3135513ac4b23f96b41f3d521990f1ce91206c99 /test/c/string_of_bits.sail
parent9f6a95882e1d3d057bcb83d098ba1b63925a4d1f (diff)
parent2c887e7d01331d3165120695594eac7a2650ec03 (diff)
Merge branch 'sail2' into rmem_interpreter
Diffstat (limited to 'test/c/string_of_bits.sail')
-rw-r--r--test/c/string_of_bits.sail25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/c/string_of_bits.sail b/test/c/string_of_bits.sail
new file mode 100644
index 00000000..fcaeb3e1
--- /dev/null
+++ b/test/c/string_of_bits.sail
@@ -0,0 +1,25 @@
+default Order dec
+
+$include <prelude.sail>
+
+val "concat_str" : (string, string) -> string
+
+infixl 1 ++
+
+overload operator ++ = {concat_str}
+
+val "print_endline" : string -> unit
+
+val BitStr = "string_of_bits" : forall 'n. bits('n) -> string
+
+val DecStr = "decimal_string_of_bits" : forall 'n. bits('n) -> string
+
+function main(() : unit) -> unit = {
+ foreach (i from 0 to 5) {
+ let x = "Hello";
+ let y = "World";
+ let z = 0b1111_0000_111;
+ let w = 0xFF;
+ print_endline(x ++ y ++ BitStr(z) ++ " " ++ BitStr(w))
+ }
+} \ No newline at end of file