From 522571f364e11b52c5232e0b714926244e35d2c0 Mon Sep 17 00:00:00 2001 From: Diego Camarmas Date: Sat, 8 Feb 2025 13:34:56 +0100 Subject: [PATCH] 4.1: MIPS example updated --- examples/MIPS/example1.s | 36 ++++++++++++----- mk_test.sh | 4 +- run_test.sh | 4 +- .../examples/test_mips_example_001.out | 5 +++ .../correct/examples/test_mips_example_001.s | 40 ++++++++++++++----- .../examples/test_riscv_example_001.out | 5 +++ 6 files changed, 70 insertions(+), 24 deletions(-) create mode 100644 test/mips/correct/examples/test_mips_example_001.out create mode 100644 test/riscv/correct/examples/test_riscv_example_001.out diff --git a/examples/MIPS/example1.s b/examples/MIPS/example1.s index decf668a..818163d4 100644 --- a/examples/MIPS/example1.s +++ b/examples/MIPS/example1.s @@ -3,17 +3,35 @@ # Creator (https://creatorsim.github.io/creator/) # - .data +.data - byte: .byte 12 + byte: .byte 12 .align 1 - half: .half 34 + half: .half 34 .align 2 - word: .word -5678 - float: .float 456.322 - double: .double 9741.34 - stringZ: .asciiz "This is a string" - string: .ascii "This is another string" - space: .space 32 + word: .word -5678 + float: .float 456.322 + double: .double 9741.34 + stringZ: .asciiz "This is a string" + string: .ascii "This is another string" + space: .space 32 + +.text + main: + + # print byte value + la $a0, byte + lb $a0, 0($a0) + li $v0, 1 + syscall + + # print half value + la $a0, half + lh $a0, 0($a0) + li $v0, 1 + syscall + + #return + jr $ra \ No newline at end of file diff --git a/mk_test.sh b/mk_test.sh index f53e6f29..cbcdbf32 100755 --- a/mk_test.sh +++ b/mk_test.sh @@ -6,7 +6,7 @@ # echo " MIPS examples:" -MIPS_TEST="002 003 004 005 006 007 008 011 012" +MIPS_TEST="001 002 003 004 005 006 007 008 011 012" for I in $MIPS_TEST; do echo " * ./test/mips/correct/examples/test_mips_example_$I..." @@ -68,7 +68,7 @@ done # echo " RISC-V examples:" -RV_TEST="002 003 004 005 006 007 008 011 012" +RV_TEST="001 002 003 004 005 006 007 008 011 012" for I in $RV_TEST; do echo " * ./test/riscv/correct/examples/test_riscv_example_$I... " diff --git a/run_test.sh b/run_test.sh index be68c2d3..b1a8d621 100755 --- a/run_test.sh +++ b/run_test.sh @@ -7,7 +7,7 @@ echo "" echo " MIPS: examples" -MIPS_TEST="002 003 004 005 006 007 008 011 012" +MIPS_TEST="001 002 003 004 005 006 007 008 011 012" for I in $MIPS_TEST; do echo -n " * ./test/mips/correct/examples/test_mips_example_$I..." @@ -141,7 +141,7 @@ done echo "" echo " RISC-V examples:" -RV_TEST="002 003 004 005 006 007 008 011 012" +RV_TEST="001 002 003 004 005 006 007 008 011 012" for I in $RV_TEST; do echo -n " * ./test/riscv/correct/examples/test_riscv_example_$I: " diff --git a/test/mips/correct/examples/test_mips_example_001.out b/test/mips/correct/examples/test_mips_example_001.out new file mode 100644 index 00000000..b48eb737 --- /dev/null +++ b/test/mips/correct/examples/test_mips_example_001.out @@ -0,0 +1,5 @@ + +12 +34 +cr[PC]:0xffffffff; ir[1,at]:0x200002; ir[2,v0]:0x1; ir[4,a0]:0x22; keyboard[0x0]:''; display[0x0]:'1234'; + diff --git a/test/mips/correct/examples/test_mips_example_001.s b/test/mips/correct/examples/test_mips_example_001.s index 7961619d..818163d4 100644 --- a/test/mips/correct/examples/test_mips_example_001.s +++ b/test/mips/correct/examples/test_mips_example_001.s @@ -3,17 +3,35 @@ # Creator (https://creatorsim.github.io/creator/) # - .data +.data - byte: .byte 12 + byte: .byte 12 - .align 1 - half: .half 34 + .align 1 + half: .half 34 - .align 2 - word: .word -5678 - float: .float 456.322 - double: .double 9741.34 - stringZ: .asciiz "This is a string" - string: .ascii "This is another string" - space: .space 32 + .align 2 + word: .word -5678 + float: .float 456.322 + double: .double 9741.34 + stringZ: .asciiz "This is a string" + string: .ascii "This is another string" + space: .space 32 + +.text + main: + + # print byte value + la $a0, byte + lb $a0, 0($a0) + li $v0, 1 + syscall + + # print half value + la $a0, half + lh $a0, 0($a0) + li $v0, 1 + syscall + + #return + jr $ra \ No newline at end of file diff --git a/test/riscv/correct/examples/test_riscv_example_001.out b/test/riscv/correct/examples/test_riscv_example_001.out new file mode 100644 index 00000000..b813595e --- /dev/null +++ b/test/riscv/correct/examples/test_riscv_example_001.out @@ -0,0 +1,5 @@ + +12 +34 +cr[PC]:0xfffffffe; ir[x10,a0]:0x22; ir[x17,a7]:0x1; keyboard[0x0]:''; display[0x0]:'1234'; +