From 9750e1ab48d662dda195e8710f02af9462426ecc Mon Sep 17 00:00:00 2001 From: "brice.boisson" Date: Mon, 27 Nov 2023 09:35:14 +0900 Subject: [PATCH] Add: branch source code test file | Fix: remove test source code test file --- .../tb_risc_v_cpu/branch_instruction.S | 28 +++++++++++++++---- tb/test_source_code/tb_risc_v_cpu/test.S | 10 ------- 2 files changed, 23 insertions(+), 15 deletions(-) delete mode 100644 tb/test_source_code/tb_risc_v_cpu/test.S diff --git a/tb/test_source_code/tb_risc_v_cpu/branch_instruction.S b/tb/test_source_code/tb_risc_v_cpu/branch_instruction.S index e474390..de99e7f 100644 --- a/tb/test_source_code/tb_risc_v_cpu/branch_instruction.S +++ b/tb/test_source_code/tb_risc_v_cpu/branch_instruction.S @@ -1,18 +1,36 @@ /* * 0:zero, 1:ra, 2:sp, 3:gp, 4:tp, 5:t0-2, 8:s0/fp * 9:s1, 10:a0-7, 18:s2-11, 28:t3-6 - * beq, bne, blt, ble, bltu, bgeu + * beq, bne, blt, ble, bltu, bleu * bgt, bge, beqz, bnez, blez, bgez, bltz, bgtz */ addi a0, zero, 0 # R[10]=0 start: -beq a0, zero, second +beq a0, zero, first addi a0, a0, 1 # R[10]=3 -second: -bne a0, zero, end +first: +bne a0, zero, second addi a0, a0, 2 # R[10]=2 j start +second: +addi a1, zero, 4 # R[11]=4 +blt a0, a1, third +addi a0, a0, 3 # R[10]=10 +third: +addi a1, zero, 7 # R[11]=7 +ble a1, a0, forth +add a0, a0, 4 # R[10]=7 +j second +forth: +addi a1, zero, 4294967295 # R[11]=4294967295 +bltu a0, a1, fifth +addi a0, a0, 5 +fifth: +addi a1, zero, 16 # R[11]=16 +bleu a1, a0, end +add a0, a0, 6 # R[10]=16 +j forth end: -# R[10]=3 +# R[10]=16 diff --git a/tb/test_source_code/tb_risc_v_cpu/test.S b/tb/test_source_code/tb_risc_v_cpu/test.S deleted file mode 100644 index bf7c7e1..0000000 --- a/tb/test_source_code/tb_risc_v_cpu/test.S +++ /dev/null @@ -1,10 +0,0 @@ -# t0 = 0 -li t0, 0 # R[5]=0 -li t2, 10 # R[7]=10 -loop_head: -bge t0, t2, loop_end -# Repeated code goes here -addi t0, t0, 1 # PC=16 -j loop_head -loop_end: -# R[0]=0