mips exception handling beq not working

0

I am trying to find an exception by comparing the t0 value. I must have something wrong on the hex numbers that i compare the t0 value..do anyone know?

sw $v0 save0

mfc0 $t0 $13
srl $t0 $0 2
andi $t0 $t0 0x7c

beq $t0 0x00000008 bad_address_load
beq $t0 0x0000000a bad_address_store
beq $t0 0x00000012 break_instruction
beq $t0 0x00000014 bad_instruction
beq $t0 0000000018 overflow
beq $t0 0x0000001a trap_instruction
j else
exception
error-handling
exception-handling
mips

1 Answer

0

Since you've shifted $t0 2 bits to the right to get the ExcCode in bits 4:0, the mask you use for andi should be 0x1f. And the immediates you compare against in beq should be 4, 5, 9, ... instead of 8, 10, 18, ...

answered on Stack Overflow Mar 24, 2017 by Michael

User contributions licensed under CC BY-SA 3.0