Permalink
Browse files

update

  • Loading branch information...
0 parents commit 748b2202f1a155cf7595229dce2442e503c1ae07 @chadmdalton committed Oct 3, 2012
Showing with 2,504 additions and 0 deletions.
  1. +61 −0 MA/addArray.asm
  2. +102 −0 MA/addArray.hex
  3. +33 −0 MA/arrayCopy.asm
  4. +58 −0 MA/arrayCopy.hex
  5. +4 −0 MA/branch1.asm
  6. +4 −0 MA/branch1.hex
  7. +5 −0 MA/branch2.asm
  8. +5 −0 MA/branch2.hex
  9. +24 −0 MA/daddiu.asm
  10. +21 −0 MA/daddiu.hex
  11. +15 −0 MA/decrement.asm
  12. +10 −0 MA/decrement.hex
  13. +12 −0 MA/dump.asm
  14. +12 −0 MA/dump.hex
  15. +8 −0 MA/error1.asm
  16. +9 −0 MA/error2.asm
  17. +9 −0 MA/error3.asm
  18. +9 −0 MA/error4.asm
  19. +9 −0 MA/error5.asm
  20. +9 −0 MA/error6.asm
  21. +9 −0 MA/error7.asm
  22. +9 −0 MA/error8.asm
  23. +42 −0 MA/factorial.asm
  24. +58 −0 MA/factorial.hex
  25. +55 −0 MA/fibo.asm
  26. +66 −0 MA/fibo.hex
  27. +18 −0 MA/fiboLoop.asm
  28. +20 −0 MA/fiboLoop.hex
  29. +17 −0 MA/iterate.asm
  30. +14 −0 MA/iterate.hex
  31. +15 −0 MA/iterate2.asm
  32. +14 −0 MA/iterate2.hex
  33. +37 −0 MA/loadsDaddiStores.asm
  34. +44 −0 MA/loadsDaddiStores.hex
  35. +37 −0 MA/loadsDaddiuStores.asm
  36. +44 −0 MA/loadsDaddiuStores.hex
  37. +49 −0 MA/loadsDaddsStores.asm
  38. +62 −0 MA/loadsDaddsStores.hex
  39. +49 −0 MA/loadsDsubsStores.asm
  40. +62 −0 MA/loadsDsubsStores.hex
  41. +49 −0 MA/loadsFPAddsStores.asm
  42. +62 −0 MA/loadsFPAddsStores.hex
  43. +49 −0 MA/loadsFPDivsStores.asm
  44. +62 −0 MA/loadsFPDivsStores.hex
  45. +49 −0 MA/loadsFPMultsStores.asm
  46. +62 −0 MA/loadsFPMultsStores.hex
  47. +23 −0 MA/loadsStores1.asm
  48. +28 −0 MA/loadsStores1.hex
  49. +23 −0 MA/loadsStores2.asm
  50. +34 −0 MA/loadsStores2.hex
  51. +88 −0 MA/loop10times.asm
  52. +98 −0 MA/loop10times.hex
  53. BIN MA/ma.jar
  54. +61 −0 MA/matrixMult.asm
  55. +84 −0 MA/matrixMult.hex
  56. +35 −0 MA/multiply.asm
  57. +48 −0 MA/multiply.hex
  58. +45 −0 MA/mydiff
  59. +13 −0 MA/negbranch.asm
  60. +10 −0 MA/negbranch.hex
  61. +37 −0 MA/powers.asm
  62. +52 −0 MA/powers.hex
  63. +89 −0 MA/run.pl
  64. +39 −0 MA/vectorDiv.asm
  65. +58 −0 MA/vectorDiv.hex
  66. +35 −0 MA/vectorSub.asm
  67. +54 −0 MA/vectorSub.hex
  68. 0 README
  69. BIN ma.class
  70. +77 −0 ma.java
@@ -0,0 +1,61 @@
+#add two arrays and store results
+ daddi r1 r0 first # r1 = addr of a[0]
+ daddi r2 r0 second #r2 = addr of b[0]
+ daddi r3 r0 4 #r3 = 4
+ daddi r7 r0 8 #r7 = 8
+ daddi r8 r0 sum #write results here
+loop ld r4 0 r1 # r4 = a[first + i]
+ ld r5 0 r2 # r5 = b[second + i]
+ dadd r6 r4 r5 #r6 = a[i] + b[i]
+ sd r6 0 r8 #store results
+ daddi r1 r1 4 #r1 += 4
+ daddi r2 r2 4 #r2 += 4
+ dadd r4 r4 r3 #r4 += 4
+ dadd r5 r5 r3 #rt += 4
+ dadd r8 r8 r7 # step to next place to store
+ beq r4 r2 end # a's pointer has reached b so stop
+ nop
+ j loop
+ nop
+end halt
+first .dfill 1
+ .dfill 2
+ .dfill 3
+ .dfill 4
+ .dfill 5
+ .dfill 6
+ .dfill 7
+ .dfill 8
+ .dfill 9
+ .dfill 10
+ .dfill 11
+ .dfill 12
+ .dfill 13
+ .dfill 14
+ .dfill 15
+ .dfill 16
+ .dfill 17
+ .dfill 18
+ .dfill 19
+ .dfill 20
+second .dfill 1
+ .dfill 2
+ .dfill 3
+ .dfill 4
+ .dfill 5
+ .dfill 6
+ .dfill 7
+ .dfill 8
+ .dfill 9
+ .dfill 10
+ .dfill 11
+ .dfill 12
+ .dfill 13
+ .dfill 14
+ .dfill 15
+ .dfill 16
+ .dfill 17
+ .dfill 18
+ .dfill 19
+ .dfill 20
+sum .dfill 0
@@ -0,0 +1,102 @@
+60010050 # daddi r1 r0 first
+600200f0 # daddi r2 r0 second
+60030004 # daddi r3 r0 4
+60070008 # daddi r7 r0 8
+60080190 # daddi r8 r0 sum
+dc240000 # loop ld r4 0 r1
+dc450000 # ld r5 0 r2
+0085302c # dadd r6 r4 r5
+fd060000 # sd r6 0 r8
+60210004 # daddi r1 r1 4
+60420004 # daddi r2 r2 4
+0083202c # dadd r4 r4 r3
+00a3282c # dadd r5 r5 r3
+0107402c # dadd r8 r8 r7
+10440003 # beq r4 r2 end
+0c000000 # nop
+08000005 # j loop
+0c000000 # nop
+04000000 # end halt
+00000000
+00000001 # first .dfill 1
+00000000
+00000002 # .dfill 2
+00000000
+00000003 # .dfill 3
+00000000
+00000004 # .dfill 4
+00000000
+00000005 # .dfill 5
+00000000
+00000006 # .dfill 6
+00000000
+00000007 # .dfill 7
+00000000
+00000008 # .dfill 8
+00000000
+00000009 # .dfill 9
+00000000
+0000000a # .dfill 10
+00000000
+0000000b # .dfill 11
+00000000
+0000000c # .dfill 12
+00000000
+0000000d # .dfill 13
+00000000
+0000000e # .dfill 14
+00000000
+0000000f # .dfill 15
+00000000
+00000010 # .dfill 16
+00000000
+00000011 # .dfill 17
+00000000
+00000012 # .dfill 18
+00000000
+00000013 # .dfill 19
+00000000
+00000014 # .dfill 20
+00000000
+00000001 # second .dfill 1
+00000000
+00000002 # .dfill 2
+00000000
+00000003 # .dfill 3
+00000000
+00000004 # .dfill 4
+00000000
+00000005 # .dfill 5
+00000000
+00000006 # .dfill 6
+00000000
+00000007 # .dfill 7
+00000000
+00000008 # .dfill 8
+00000000
+00000009 # .dfill 9
+00000000
+0000000a # .dfill 10
+00000000
+0000000b # .dfill 11
+00000000
+0000000c # .dfill 12
+00000000
+0000000d # .dfill 13
+00000000
+0000000e # .dfill 14
+00000000
+0000000f # .dfill 15
+00000000
+00000010 # .dfill 16
+00000000
+00000011 # .dfill 17
+00000000
+00000012 # .dfill 18
+00000000
+00000013 # .dfill 19
+00000000
+00000014 # .dfill 20
+00000000
+00000000 # sum .dfill 0
+00000000
@@ -0,0 +1,33 @@
+ daddi r1 r0 20
+ daddi r2 r0 0
+loop ld r3 array1 r2
+ sd r3 array2 r2
+ daddi r2 r2 8
+ daddi r1 r1 -1
+ bne r0 r1 loop
+ halt
+array1 .dfill 1
+ .dfill 2
+ .dfill 3
+ .dfill 4
+ .dfill 5
+ .dfill 6
+ .dfill 7
+ .dfill 8
+ .dfill 9
+ .dfill 10
+ .dfill 11
+ .dfill 12
+ .dfill 13
+ .dfill 14
+ .dfill 15
+ .dfill 16
+ .dfill 17
+ .dfill 18
+ .dfill 19
+ .dfill 20
+array2 .dfill -1
+ .dfill -1
+ .dfill -1
+ .dfill -1
+ .dfill -1
@@ -0,0 +1,58 @@
+60010014 # daddi r1 r0 20
+60020000 # daddi r2 r0 0
+dc430020 # loop ld r3 array1 r2
+fc4300c0 # sd r3 array2 r2
+60420008 # daddi r2 r2 8
+6021ffff # daddi r1 r1 -1
+1420fffb # bne r0 r1 loop
+04000000 # halt
+00000001 # array1 .dfill 1
+00000000
+00000002 # .dfill 2
+00000000
+00000003 # .dfill 3
+00000000
+00000004 # .dfill 4
+00000000
+00000005 # .dfill 5
+00000000
+00000006 # .dfill 6
+00000000
+00000007 # .dfill 7
+00000000
+00000008 # .dfill 8
+00000000
+00000009 # .dfill 9
+00000000
+0000000a # .dfill 10
+00000000
+0000000b # .dfill 11
+00000000
+0000000c # .dfill 12
+00000000
+0000000d # .dfill 13
+00000000
+0000000e # .dfill 14
+00000000
+0000000f # .dfill 15
+00000000
+00000010 # .dfill 16
+00000000
+00000011 # .dfill 17
+00000000
+00000012 # .dfill 18
+00000000
+00000013 # .dfill 19
+00000000
+00000014 # .dfill 20
+00000000
+ffffffff # array2 .dfill -1
+ffffffff
+ffffffff # .dfill -1
+ffffffff
+ffffffff # .dfill -1
+ffffffff
+ffffffff # .dfill -1
+ffffffff
+ffffffff # .dfill -1
+ffffffff
@@ -0,0 +1,4 @@
+ beq r0 r1 target
+ dump 1
+target dump 2 # should only see dump of GPRs
+ halt
@@ -0,0 +1,4 @@
+10200001 # beq r0 r1 target
+b0000001 # dump 1
+b0000002 # target dump 2
+04000000 # halt
@@ -0,0 +1,5 @@
+ bne r0 r1 target
+ dump 2 # should see this dump (GPRs)
+ j done
+target dump 1 # should not see this dump
+done halt
@@ -0,0 +1,5 @@
+14200002 # bne r0 r1 target
+b0000002 # dump 2
+08000004 # j done
+b0000001 # target dump 1
+04000000 # done halt
@@ -0,0 +1,24 @@
+#
+# To test stalling when Int RS becomes full
+#
+ daddiu r1 r1 10
+ daddiu r2 r2 20
+ daddiu r3 r3 30
+ daddiu r4 r4 40
+ daddiu r5 r5 50
+ daddiu r6 r6 60
+ daddiu r7 r7 70
+ daddiu r8 r8 80
+ daddiu r9 r9 90
+ daddiu r10 r10 100
+ daddiu r11 r11 200
+ daddiu r12 r12 300
+ daddiu r13 r13 400
+ daddiu r14 r14 500
+ daddiu r15 r15 600
+ daddiu r16 r16 700
+ daddiu r17 r17 800
+ daddiu r18 r18 900
+ daddiu r19 r19 1000
+ daddiu r20 r20 2000
+ halt
@@ -0,0 +1,21 @@
+6421000a # daddiu r1 r1 10
+64420014 # daddiu r2 r2 20
+6463001e # daddiu r3 r3 30
+64840028 # daddiu r4 r4 40
+64a50032 # daddiu r5 r5 50
+64c6003c # daddiu r6 r6 60
+64e70046 # daddiu r7 r7 70
+65080050 # daddiu r8 r8 80
+6529005a # daddiu r9 r9 90
+654a0064 # daddiu r10 r10 100
+656b00c8 # daddiu r11 r11 200
+658c012c # daddiu r12 r12 300
+65ad0190 # daddiu r13 r13 400
+65ce01f4 # daddiu r14 r14 500
+65ef0258 # daddiu r15 r15 600
+661002bc # daddiu r16 r16 700
+66310320 # daddiu r17 r17 800
+66520384 # daddiu r18 r18 900
+667303e8 # daddiu r19 r19 1000
+669407d0 # daddiu r20 r20 2000
+04000000 # halt
@@ -0,0 +1,15 @@
+# code equivalent to:
+# num = 10;
+# while (num != 0)
+# num = num - 1;
+#
+# specifically tests to see if negative value can be handled in daddi
+#
+ ld r2 num r0 # r2 = 10
+loop daddi r2 r2 -1 # r2 = r2 - 1
+ beq r2 r0 end # if r2 == 0 goto end
+ nop
+ j loop # goto loop
+ nop
+end halt
+num .dfill 10
@@ -0,0 +1,10 @@
+dc020020 # ld r2 num r0
+6042ffff # loop daddi r2 r2 -1
+10020003 # beq r2 r0 end
+0c000000 # nop
+08000001 # j loop
+0c000000 # nop
+04000000 # end halt
+00000000
+0000000a # num .dfill 10
+00000000
@@ -0,0 +1,12 @@
+ dump 1 # dump Memory
+ dump 2 # dump GPR
+ dump 4 # dump FPR
+ dump 8 # dump FP Adder RS
+ dump 16 # dump FP Mult RS
+ dump 32 # dump FP Div RS
+ dump 64 # dump Integer RS
+ dump 128 # dump load/store buffer
+ dump 256 # dump Status Table
+ dump 7 # dump Memory, GPR, FPR
+ dump 36 # dump FPR, FP Div RS
+ halt
@@ -0,0 +1,12 @@
+b0000001 # dump 1
+b0000002 # dump 2
+b0000004 # dump 4
+b0000008 # dump 8
+b0000010 # dump 16
+b0000020 # dump 32
+b0000040 # dump 64
+b0000080 # dump 128
+b0000100 # dump 256
+b0000007 # dump 7
+b0000024 # dump 36
+04000000 # halt
@@ -0,0 +1,8 @@
+# tests to see if assembler handles illegal labels
+ ld r1 negone r0 # r1 = -1
+loopestloopest daddi r1 r1 1 # r1 = r1 + 1 (label too long)
+ beq r1 r0 loopestloopest # if r1 == 0 goto loopestloopest
+ sd r1 32 r0 # m[32] = r1
+ halt
+negone .dfill -1
+result .dfill 0
@@ -0,0 +1,9 @@
+# tests to see if assembler handles illegal labels
+ ld r1 negone r0 # r1 = -1
+loop: daddi r1 r1 1 # r1 = r1 + 1 (label has a colon)
+ beq r1 r0 loop # if r1 == 0 goto loop
+ nop
+ sd r1 32 r0 # m[32] = r1
+ halt
+negone .dfill -1
+result .dfill 0
Oops, something went wrong.

0 comments on commit 748b220

Please sign in to comment.