Add: branch source code test file | Fix: remove test source code test file
This commit is contained in:
parent
0cf217ff7b
commit
9750e1ab48
|
@ -1,18 +1,36 @@
|
||||||
/*
|
/*
|
||||||
* 0:zero, 1:ra, 2:sp, 3:gp, 4:tp, 5:t0-2, 8:s0/fp
|
* 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
|
* 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
|
* bgt, bge, beqz, bnez, blez, bgez, bltz, bgtz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addi a0, zero, 0 # R[10]=0
|
addi a0, zero, 0 # R[10]=0
|
||||||
start:
|
start:
|
||||||
beq a0, zero, second
|
beq a0, zero, first
|
||||||
addi a0, a0, 1 # R[10]=3
|
addi a0, a0, 1 # R[10]=3
|
||||||
second:
|
first:
|
||||||
bne a0, zero, end
|
bne a0, zero, second
|
||||||
addi a0, a0, 2 # R[10]=2
|
addi a0, a0, 2 # R[10]=2
|
||||||
j start
|
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:
|
end:
|
||||||
|
|
||||||
# R[10]=3
|
# R[10]=16
|
||||||
|
|
|
@ -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
|
|
Loading…
Reference in New Issue