Test jal and jr

This commit is contained in:
unlockable
2024-07-11 01:12:24 +08:00
parent 3f024edfb5
commit 535b256653
3 changed files with 45 additions and 0 deletions

17
09test_jal_jr.asm Normal file
View File

@@ -0,0 +1,17 @@
main:
addi $s1, $zero, 1
nop
nop
nop
nop
jal func
end:
j end
func:
addi $s2, $zero, 2
nop
nop
nop
nop
jr $ra

15
09test_jal_jr.txt Normal file
View File

@@ -0,0 +1,15 @@
20'd0: instruction <= 32'h20110001; // addi $s1, $zero, 1
20'd1: instruction <= 32'h00000000;
20'd2: instruction <= 32'h00000000;
20'd3: instruction <= 32'h00000000;
20'd4: instruction <= 32'h00000000;
20'd5: instruction <= 32'h0c000007; // jal func
// end:
20'd6: instruction <= 32'h08000006; // j end
// func:
20'd7: instruction <= 32'h20120002; // addi $s2, $zero, 2
20'd8: instruction <= 32'h00000000;
20'd9: instruction <= 32'h00000000;
20'd10: instruction <= 32'h00000000;
20'd11: instruction <= 32'h00000000;
20'd12: instruction <= 32'h03e00008; // jr $ra

13
09test_jal_jr_mars.txt Normal file
View File

@@ -0,0 +1,13 @@
20110001
00000000
00000000
00000000
00000000
0c000007
08000006
20120002
00000000
00000000
00000000
00000000
03e00008