Advertisement
foreverfugazi

lab 3 stuff

Sep 12th, 2024
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. .data
  2. num: .word 0xabcdeff, 0x11223344, 0xaabbccdd, 0x12345678,0x12345678, 0x11aa22bb
  3.  
  4. .text
  5. la x1, num
  6. li x4, 5
  7. addi x3, x0, 0
  8. rpt:
  9. lw x2, 0(x1)
  10. add x3, x3, x2
  11. addi x1, x1, 4
  12. addi x4, x4, -1
  13. bne x4, x0, rpt
  14. sw x3, 4(x1)
  15. nop
  16. ===================================================
  17. .data
  18. num: .half 0xabcd, 0xeeff, 0x1122, 0x3344, 0xaabb, 0xccdd, 0x1234, 0x5678, 0x11aa, 0x22bb
  19.  
  20. .text
  21. la x1, num
  22. li x4, 5
  23. addi x4, x4, -1
  24. rpt:
  25. lhu x2, 0(x1)
  26. add x3, x3, x2
  27. addi x1, x1, 4
  28. addi x4, x4, -1
  29. bne x4, x0, rpt
  30. sw x3, 4(x1)
  31. nop
  32. ===================================================
  33. .data
  34. num: .byte 0xab, 0xcd, 0xee, 0xff, 0x11, 0x22, 0x33, 0x44, 0xaa, 0xbb, 0xcc, 0xdd, 0x12, 0x34, 0x56, 0x78, 0x11, 0xaa, 0x22, 0xbb
  35.  
  36. .text
  37. la x1, num
  38. li x4, 5
  39. addi x3, x0, 0
  40. rpt:
  41. lbu x2, 0(x1)
  42. add x3, x3, x2
  43. addi x1, x1, 4
  44. addi x4, x4, -1
  45. bne x4, x0, rpt
  46. sw x3, 4(x1)
  47. nop
  48. ===================endianness======================
  49. .data
  50.  
  51. num: .word 0xabcdeeff, 0x11223344, 0xaabbccdd, 0x12345678, 0x11aa22bb
  52.  
  53. .text
  54. li x4, 0x300
  55. li x2, 6
  56. la x3, num
  57.  
  58. next: addi x7, x0, 4
  59. back: lbu x6, 3(x3)
  60. sb x6, 0(x4)
  61. addi x3, x3, -1
  62. addi x4, x4, 1
  63. addi x7, x7, 01
  64. bne x7, x0, back
  65. addi x3, x3, 8
  66. addi x2, x2, -1
  67. bne x2, x0, next
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement