Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. .include "runtime.s"
  2.  
  3. main:
  4. addi $sp,-32
  5. sw $ra, 28($sp)
  6. sw $fp, 24($sp)
  7. sw $s2, 20($sp)
  8. sw $s1, 16($sp)
  9. sw $s0, 12($sp)
  10. move $fp, $sp
  11.  
  12. println "Running test.."
  13. println "Ensuring cache control register.."
  14.  
  15. li $s0, 0x0001e988
  16. li $s1, 0xfffe0130
  17. sw $s0, 0x0($s1)
  18.  
  19. println "Enabling ISC, filling the data cache with incrementing values.."
  20.  
  21. li $s0, 0x10000
  22. mtc0 $s0, $12
  23. nop
  24.  
  25. li $s0, 0x3fc
  26. fill:
  27. sw $s0, 0x0($s0)
  28. bnez $s0, fill
  29. addi $s0,-0x4
  30.  
  31. li $s0, 0x0
  32. mtc0 $s0, $12
  33. nop
  34.  
  35. println "ISC disabled, verifying that incrementing values have appeared at 0x1f800000.."
  36.  
  37. li $s1, 0x1f8003fc
  38. li $s0, 0x3fc
  39. verify:
  40. lw $s2, 0x0($s1)
  41. la $a0, test_helper
  42. move $a1, $s1
  43. move $a2, $s2
  44. jal printf
  45. nop
  46. bne $s0, $s2, failed
  47. nop
  48. addi $s1,-0x4
  49. bnez $s0, verify
  50. addi $s0,-0x4
  51.  
  52. passed:
  53. println "Test passed."
  54. li $v0, 0x0
  55. b finish
  56. nop
  57.  
  58. failed:
  59. println "Test failed."
  60. li $v0, 0x1
  61.  
  62. finish:
  63. move $sp, $fp
  64. lw $ra, 28($sp)
  65. lw $fp, 24($sp)
  66. lw $s2, 20($sp)
  67. lw $s1, 16($sp)
  68. lw $s0, 12($sp)
  69. jr $ra
  70. addi $sp, 32
  71.  
  72.  
  73. .data
  74.  
  75. test_helper:
  76. .asciz "[%08x] = %08x\n"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement