; ###----------------------------------------------------------------### ; # file : exc001.u # ; # date : Mar 26 1996 # ; # descr. : functional test for mips # ; ###----------------------------------------------------------------### ; ###--------------------------------------------------------### ; # exceptions : # ; # - data address miss alignment (when storing a word) # ; ###--------------------------------------------------------### adr .equ 0x40000050 data .equ 0x9043ad6b ; data .org 0x00400000 .start init init: loadi r31, back_from_exception loadi r1 , adr ; word's address in r1 loadi r2 , data ; data in r2 loadi r3 , data ; same data in r3 loadi r4 , data ^ 0xffffffff ; complemented data in r4 ; ###--------------------------------------------------------### ; # store the word to initialize the memory location # ; ###--------------------------------------------------------### sw r2, 0 (r1 ) sw r2, 4 (r1 ) ; ###--------------------------------------------------------### ; # store word at a miss aligned address # ; ###--------------------------------------------------------### sw r4, 1 (r1 ) ; EXCEPTION (alignment) ; ###--------------------------------------------------------### ; # after returning from exception, read the memory location # ; # and check that the faulty store word has not modified the # ; # memory # ; ###--------------------------------------------------------### back_from_exception: lw r5 , 0 (r1 ) bne r5,r3, bad nop lw r5 , 4 (r1 ) bne r5,r3, bad nop j good nop .org 0x004000d0 good: j good nop bad: j bad nop .end