I am writing simple SMIPS assembly tests to be run on HDL-defined processors.
For instance I have the following code that should generate an overflow exception:
main:
#Test Overflow Exception
addi $2, $0, 0xffffffff
addi $3, $2, 0x1
I know that if the processor is doing the right thing, it should redirect to the handler which is placed at address 0xdeadbeef
. I know only to add labels for jumps as in adding the following code to the above:
overflowHandler:
addiu $5 $0, 1
bne $0, $5, pass
Is there a way to make the overflowHandler code start at the correct 0xdeadbeef address? Does main start at address 0 ?
EDIT : (I have control over jump address from processor described in HDL)
Since I have control over processor jump address from the description of processor design in Bluespec , I can change that to be divisible by 4 and jump to a closer more convenient location. So my question is: does the address start counting from address 0x0 at the beginning of main?? What is the best solution? : change the address jump, or the label to correspond to it?
Thanks in advance,