diff options
author | Wojciech Kosior <kwojtus@protonmail.com> | 2020-10-03 21:45:24 +0200 |
---|---|---|
committer | Wojciech Kosior <kwojtus@protonmail.com> | 2020-10-05 10:13:38 +0200 |
commit | 7a61f213fb9be8ab7f9bd0fb33940b21fa143b05 (patch) | |
tree | 1bd5beab68c778d4d3a2543cf3661bfcb23445c2 /tests | |
parent | c548c0ce5b2e7ca2784257966ebdd386e1f31218 (diff) | |
download | AGH-engineering-thesis-7a61f213fb9be8ab7f9bd0fb33940b21fa143b05.tar.gz AGH-engineering-thesis-7a61f213fb9be8ab7f9bd0fb33940b21fa143b05.zip |
fixes, conditional if-not jump and translation of if-else instruction from wasm
Diffstat (limited to 'tests')
l--------- | tests/wasm_compile_if_else/Makefile | 1 | ||||
-rw-r--r-- | tests/wasm_compile_if_else/instructions.wat | 19 | ||||
l--------- | tests/wasm_compile_if_else/test.v | 1 | ||||
-rw-r--r-- | tests/wasm_compile_if_else/words_to_verify.mem | 5 | ||||
-rw-r--r-- | tests/wasm_compile_simple_module/test.v | 6 |
5 files changed, 29 insertions, 3 deletions
diff --git a/tests/wasm_compile_if_else/Makefile b/tests/wasm_compile_if_else/Makefile new file mode 120000 index 0000000..e451c8b --- /dev/null +++ b/tests/wasm_compile_if_else/Makefile @@ -0,0 +1 @@ +../wasm_compile_simple_module/Makefile
\ No newline at end of file diff --git a/tests/wasm_compile_if_else/instructions.wat b/tests/wasm_compile_if_else/instructions.wat new file mode 100644 index 0000000..14faa6f --- /dev/null +++ b/tests/wasm_compile_if_else/instructions.wat @@ -0,0 +1,19 @@ +(module + (memory 0 2) + (func $eq10 (param $x i32) (result i32) + (if (result i32) + (i32.sub + (get_local $x) + (i32.const 10)) + (then + (i32.add (i32.const -3) (i32.const 3))) + (else + (i32.const -1)))) + (func $main + ;; write 0x00000000 at MEMORY_BOTTOM_ADDR + (i32.store offset=0x0 align=2 (i32.const 0x0) + (call $eq10 (i32.const 12))) + ;; write 0xFFFFFFFF at MEMORY_BOTTOM_ADDR + 0x4 + (i32.store offset=0x0 align=2 (i32.const 0x4) + (call $eq10 (i32.const 10)))) + (export "main" (func $main))) diff --git a/tests/wasm_compile_if_else/test.v b/tests/wasm_compile_if_else/test.v new file mode 120000 index 0000000..f0235d8 --- /dev/null +++ b/tests/wasm_compile_if_else/test.v @@ -0,0 +1 @@ +../wasm_compile_simple_module/test.v
\ No newline at end of file diff --git a/tests/wasm_compile_if_else/words_to_verify.mem b/tests/wasm_compile_if_else/words_to_verify.mem new file mode 100644 index 0000000..75a6c84 --- /dev/null +++ b/tests/wasm_compile_if_else/words_to_verify.mem @@ -0,0 +1,5 @@ +// address value + 0FFFFC 23 + + 200 00000000 + 204 FFFFFFFF diff --git a/tests/wasm_compile_simple_module/test.v b/tests/wasm_compile_simple_module/test.v index 686a7fc..80f5590 100644 --- a/tests/wasm_compile_simple_module/test.v +++ b/tests/wasm_compile_simple_module/test.v @@ -159,7 +159,7 @@ module wasm_compile_test(); CLK <= 0; RST <= 1; - for (i = 0; i < 3500; i++) begin + for (i = 0; i < 5000; i++) begin #1; CLK <= ~CLK; @@ -194,9 +194,9 @@ module wasm_compile_test(); $finish; end // if (M_finished) - end // for (i = 0; i < 3500; i++) + end // for (i = 0; i < 5000; i++) - $display("error: cpu hasn't finished its operations in 1750 ticks"); + $display("error: cpu hasn't finished its operations in 2500 ticks"); $finish; end // initial begin endmodule // stack_machine_test |