Skip to content

Commit

Permalink
4.1: MIPS example updated
Browse files Browse the repository at this point in the history
  • Loading branch information
dcamarmas committed Feb 8, 2025
1 parent 539bc69 commit 522571f
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 24 deletions.
36 changes: 27 additions & 9 deletions examples/MIPS/example1.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions mk_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down Expand Up @@ -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... "
Expand Down
4 changes: 2 additions & 2 deletions run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down Expand Up @@ -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: "
Expand Down
5 changes: 5 additions & 0 deletions test/mips/correct/examples/test_mips_example_001.out
Original file line number Diff line number Diff line change
@@ -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';

40 changes: 29 additions & 11 deletions test/mips/correct/examples/test_mips_example_001.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions test/riscv/correct/examples/test_riscv_example_001.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

12
34
cr[PC]:0xfffffffe; ir[x10,a0]:0x22; ir[x17,a7]:0x1; keyboard[0x0]:''; display[0x0]:'1234';

0 comments on commit 522571f

Please sign in to comment.