From 535b256653d9bfdc304afef14a4b6153c3d6f096 Mon Sep 17 00:00:00 2001 From: unlockable Date: Thu, 11 Jul 2024 01:12:24 +0800 Subject: [PATCH] Test jal and jr --- 09test_jal_jr.asm | 17 +++++++++++++++++ 09test_jal_jr.txt | 15 +++++++++++++++ 09test_jal_jr_mars.txt | 13 +++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 09test_jal_jr.asm create mode 100644 09test_jal_jr.txt create mode 100644 09test_jal_jr_mars.txt diff --git a/09test_jal_jr.asm b/09test_jal_jr.asm new file mode 100644 index 0000000..5b5304f --- /dev/null +++ b/09test_jal_jr.asm @@ -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 diff --git a/09test_jal_jr.txt b/09test_jal_jr.txt new file mode 100644 index 0000000..6ea66d6 --- /dev/null +++ b/09test_jal_jr.txt @@ -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 \ No newline at end of file diff --git a/09test_jal_jr_mars.txt b/09test_jal_jr_mars.txt new file mode 100644 index 0000000..9fdf5a1 --- /dev/null +++ b/09test_jal_jr_mars.txt @@ -0,0 +1,13 @@ +20110001 +00000000 +00000000 +00000000 +00000000 +0c000007 +08000006 +20120002 +00000000 +00000000 +00000000 +00000000 +03e00008