Added BLT unit test

master
vhaudiquet 1 year ago
parent 72dda9aaeb
commit e7b521c589
  1. 31
      tests/blt.s
  2. 1
      tests/test.sh

@ -0,0 +1,31 @@
.global _start
_start:
# Set base value of a0 to 'test failed'
addi a0, zero, 1
# Set A, B values of t0/t1, to test less than
addi t0, zero, 1
addi t1, zero, 2
blt t1, t0, lt0
# Inequality passed, now test with jump
blt t0, t1, lt1
# On failure, return
ebreak
ltNeg:
# All passed
addi a0, zero, 0
ebreak
lt0:
# Inequality failed
ebreak
lt1:
# Inequality passed ; now try with negative numbers
addi t0, zero, -1
addi t1, zero, -2
blt t1, t0, ltNeg
ebreak

@ -25,6 +25,7 @@ test() {
test "ADDI : Add Immediate " "../build/tests/addi " 186
test "MV : Move registers " "../build/tests/mv " 186
test "BEQ : Branch EQual " "../build/tests/beq " 0
test "BLT : Branch Less Than " "../build/tests/blt " 0
test "JAL : Jump And Link " "../build/tests/jal " 0
test "SWLW : Store Word Load Word " "../build/tests/swlw " 0
test "JALR : Jump And Link Register " "../build/tests/jalr " 0

Loading…
Cancel
Save