diff options
| author | Alasdair Armstrong | 2018-02-15 19:54:55 +0000 |
|---|---|---|
| committer | Alasdair Armstrong | 2018-02-16 13:52:32 +0000 |
| commit | 00ca0aa4dce0abdcba574ce907e9a8a62d9d2255 (patch) | |
| tree | 31b1b0308d68210b483088346b471dfd468bb9d7 /test | |
| parent | 737ec26cf494affb346504c482e9b91127b68636 (diff) | |
Can now compile aarch64/duopod to C
Goes through the C compiler without any errors, but as we still don't
have all the requisite builtins it won't actually produce an
executable. There are still a few things that don't work properly,
such as vectors of non-bit types - but once those are fixed and the
Sail library is implemented fully it should work.
Diffstat (limited to 'test')
| -rw-r--r-- | test/c/bv_literal.expect | 1 | ||||
| -rw-r--r-- | test/c/bv_literal.sail | 12 | ||||
| -rw-r--r-- | test/c/struct.expect | 3 | ||||
| -rw-r--r-- | test/c/struct.sail | 17 |
4 files changed, 33 insertions, 0 deletions
diff --git a/test/c/bv_literal.expect b/test/c/bv_literal.expect new file mode 100644 index 00000000..78d1026a --- /dev/null +++ b/test/c/bv_literal.expect @@ -0,0 +1 @@ +y = 4'0xD diff --git a/test/c/bv_literal.sail b/test/c/bv_literal.sail new file mode 100644 index 00000000..1955b5dd --- /dev/null +++ b/test/c/bv_literal.sail @@ -0,0 +1,12 @@ + +default Order dec + +val "print_bits" : forall 'n. (string, vector('n, dec, bit)) -> unit + +val main : unit -> unit + +function main () = { + let x : bit = bitone; + let y : vector(4, dec, bit) = [x, bitone, bitzero, x]; + print_bits("y = ", y); +}
\ No newline at end of file diff --git a/test/c/struct.expect b/test/c/struct.expect new file mode 100644 index 00000000..ecf6e2e1 --- /dev/null +++ b/test/c/struct.expect @@ -0,0 +1,3 @@ +x.A = 4'0x8 +x.A = 4'0xF +(struct {A = 0b1111, B = 0b11} : test).B = 2'0x3 diff --git a/test/c/struct.sail b/test/c/struct.sail new file mode 100644 index 00000000..f3f2b071 --- /dev/null +++ b/test/c/struct.sail @@ -0,0 +1,17 @@ +default Order dec + +val "print_bits" : forall 'n. (string, vector('n, dec, bit)) -> unit + +struct test = { + A : vector(4, dec, bit), + B : vector(2, dec, bit), +} + +function main (() : unit) -> unit = { + x : test = struct { A = 0b1010, B = 0b11 }; + x.A = 0b1000; + print_bits("x.A = ", x.A); + x.A = 0b1111; + print_bits("x.A = ", x.A); + print_bits("(struct {A = 0b1111, B = 0b11} : test).B = ", (struct {A = 0b1111, B = 0b11} : test).B); +}
\ No newline at end of file |
