#include <asm.h>
#include <regdef.h>
#include <inst_test.h>

LEAF(n48_mfhi_test)
    .set noreorder
    addiu s0, s0 ,1
    li  s2, 0x0
###test inst
    TEST_MFHI(0xbd5972d1, 0xbd5972d1)
    TEST_MFHI(0xb63e63e4, 0xb63e63e4)
    TEST_MFHI(0xc2902fdc, 0xc2902fdc)
    TEST_MFHI(0x72617ff5, 0x72617ff5)
    TEST_MFHI(0x3ea91bf2, 0x3ea91bf2)
    TEST_MFHI(0xdab0b4f0, 0xdab0b4f0)
    TEST_MFHI(0x8ceeaa08, 0x8ceeaa08)
    TEST_MFHI(0x3ee644c0, 0x3ee644c0)
    TEST_MFHI(0x9a5d6fe0, 0x9a5d6fe0)
    TEST_MFHI(0x2eaf38e8, 0x2eaf38e8)
    TEST_MFHI(0xfd281a38, 0xfd281a38)
    TEST_MFHI(0x739922d0, 0x739922d0)
    TEST_MFHI(0x35e02b56, 0x35e02b56)
    TEST_MFHI(0xccf948ba, 0xccf948ba)
    TEST_MFHI(0x2cd206d8, 0x2cd206d8)
    TEST_MFHI(0x783cec40, 0x783cec40)
    TEST_MFHI(0x3711e200, 0x3711e200)
    TEST_MFHI(0x364eca6e, 0x364eca6e)
    TEST_MFHI(0x57b0d404, 0x57b0d404)
    TEST_MFHI(0x4e0a2670, 0x4e0a2670)
    TEST_MFHI(0x201ec750, 0x201ec750)
    TEST_MFHI(0x6ad84ba0, 0x6ad84ba0)
    TEST_MFHI(0x8607994c, 0x8607994c)
    TEST_MFHI(0xd81d41ea, 0xd81d41ea)
    TEST_MFHI(0x84284dc0, 0x84284dc0)
    TEST_MFHI(0xdbe9f33a, 0xdbe9f33a)
    TEST_MFHI(0x71780f80, 0x71780f80)
    TEST_MFHI(0x0d952de0, 0x0d952de0)
    TEST_MFHI(0x16ec4528, 0x16ec4528)
    TEST_MFHI(0x4776e0ae, 0x4776e0ae)
    TEST_MFHI(0x94087e02, 0x94087e02)
    TEST_MFHI(0xb36c9cfc, 0xb36c9cfc)
    TEST_MFHI(0x46587f08, 0x46587f08)
    TEST_MFHI(0x222545bc, 0x222545bc)
    TEST_MFHI(0xd3c617c0, 0xd3c617c0)
    TEST_MFHI(0x2e6bfd75, 0x2e6bfd75)
    TEST_MFHI(0x3130e930, 0x3130e930)
    TEST_MFHI(0xffca05f8, 0xffca05f8)
    TEST_MFHI(0x102693fa, 0x102693fa)
    TEST_MFHI(0xd3fe3f14, 0xd3fe3f14)
    TEST_MFHI(0x8b1de170, 0x8b1de170)
    TEST_MFHI(0x956a769b, 0x956a769b)
    TEST_MFHI(0xace66bcc, 0xace66bcc)
    TEST_MFHI(0xd0fd19f0, 0xd0fd19f0)
    TEST_MFHI(0xed13df18, 0xed13df18)
    TEST_MFHI(0xa1bad7a6, 0xa1bad7a6)
    TEST_MFHI(0x2ad714b0, 0x2ad714b0)
    TEST_MFHI(0x14172b70, 0x14172b70)
    TEST_MFHI(0x7cff4e80, 0x7cff4e80)
    TEST_MFHI(0x171f65d8, 0x171f65d8)
    TEST_MFHI(0xcb7c6c00, 0xcb7c6c00)
    TEST_MFHI(0x9d1b5482, 0x9d1b5482)
    TEST_MFHI(0x1445c71c, 0x1445c71c)
    TEST_MFHI(0x09610836, 0x09610836)
    TEST_MFHI(0x7815eb60, 0x7815eb60)
    TEST_MFHI(0x70fa2370, 0x70fa2370)
    TEST_MFHI(0x91304650, 0x91304650)
    TEST_MFHI(0x0182aca8, 0x0182aca8)
    TEST_MFHI(0xac519e50, 0xac519e50)
    TEST_MFHI(0xf2b18ec0, 0xf2b18ec0)
    TEST_MFHI(0xb2d17089, 0xb2d17089)
    TEST_MFHI(0x892afd04, 0x892afd04)
    TEST_MFHI(0x79f96348, 0x79f96348)
    TEST_MFHI(0xe4ad3ddd, 0xe4ad3ddd)
    TEST_MFHI(0x1508b690, 0x1508b690)
    TEST_MFHI(0xdcae5c80, 0xdcae5c80)
    TEST_MFHI(0x4d20d118, 0x4d20d118)
    TEST_MFHI(0x7c0db120, 0x7c0db120)
    TEST_MFHI(0x5064e560, 0x5064e560)
    TEST_MFHI(0x4c15f2d5, 0x4c15f2d5)
    TEST_MFHI(0xc46dac00, 0xc46dac00)
    TEST_MFHI(0x13bf78e0, 0x13bf78e0)
    TEST_MFHI(0x801da900, 0x801da900)
    TEST_MFHI(0x04617750, 0x04617750)
    TEST_MFHI(0xa564430b, 0xa564430b)
    TEST_MFHI(0x56662adc, 0x56662adc)
    TEST_MFHI(0x53317267, 0x53317267)
    TEST_MFHI(0xdcc2f8d6, 0xdcc2f8d6)
    TEST_MFHI(0x7f9b08c0, 0x7f9b08c0)
    TEST_MFHI(0x2aea842c, 0x2aea842c)
    TEST_MFHI(0x2b3e5458, 0x2b3e5458)
    TEST_MFHI(0xdf410fc0, 0xdf410fc0)
    TEST_MFHI(0xc20e5b9c, 0xc20e5b9c)
    TEST_MFHI(0x69b5f0d6, 0x69b5f0d6)
    TEST_MFHI(0x2bfd57a6, 0x2bfd57a6)
    TEST_MFHI(0xa9bc1acc, 0xa9bc1acc)
    TEST_MFHI(0xe8cdc640, 0xe8cdc640)
    TEST_MFHI(0x0ee2a818, 0x0ee2a818)
    TEST_MFHI(0xcb71a800, 0xcb71a800)
    TEST_MFHI(0x09edf428, 0x09edf428)
    TEST_MFHI(0xed823800, 0xed823800)
    TEST_MFHI(0xd93ab3f8, 0xd93ab3f8)
    TEST_MFHI(0xafb6e9c0, 0xafb6e9c0)
    TEST_MFHI(0xa2937eb0, 0xa2937eb0)
    TEST_MFHI(0xc36b4870, 0xc36b4870)
    TEST_MFHI(0xea8633d0, 0xea8633d0)
    TEST_MFHI(0x4f814438, 0x4f814438)
    TEST_MFHI(0x7ef598e8, 0x7ef598e8)
    TEST_MFHI(0x1c2de7d0, 0x1c2de7d0)
    TEST_MFHI(0xccfdfbc9, 0xccfdfbc9)
    TEST_MFHI(0xd9d2d81a, 0xd9d2d81a)
    TEST_MFHI(0x21fa397c, 0x21fa397c)
    TEST_MFHI(0x3d1cf92c, 0x3d1cf92c)
    TEST_MFHI(0x137af739, 0x137af739)
    TEST_MFHI(0x9d325d28, 0x9d325d28)
    TEST_MFHI(0x8bc784f8, 0x8bc784f8)
    TEST_MFHI(0x267eae80, 0x267eae80)
    TEST_MFHI(0xabfac0ca, 0xabfac0ca)
    TEST_MFHI(0x7a286b6c, 0x7a286b6c)
    TEST_MFHI(0x741ac718, 0x741ac718)
    TEST_MFHI(0x0a0d4930, 0x0a0d4930)
    TEST_MFHI(0xc86ec474, 0xc86ec474)
    TEST_MFHI(0x07fecfd8, 0x07fecfd8)
    TEST_MFHI(0x84747a80, 0x84747a80)
    TEST_MFHI(0x00000000, 0x00000000)
    
###detect exception
    bne s2, zero, inst_error
    nop
###score ++
    addiu s3, s3, 1
###output (s0<<24)|s3
inst_error:  
    sll t1, s0, 24
    or t0, t1, s3 
    sw t0, 0(s1)
    jr ra
    nop
END(n48_mfhi_test)
