Advertisement
Guest User

PRU Opcodes

a guest
Apr 17th, 2012
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.76 KB | None | 0 0
  1. Symbol Meanings
  2. ================
  3. <Rx>: Encoded register reference (8 bits)
  4. <IMMx>: Immediate value (8 bits)
  5. <IMM16_x>: Immediate value (16 bits)
  6.  
  7. "x" refers to the position of the operand in the textual representation of the assembly instruction.
  8.  
  9. Register References
  10. ====================
  11. Format: xxxyyyyy
  12. yyyyy: Register index (0-31)
  13. xxx: Sub byte selector
  14. 000 - b0 100 - w0
  15. 001 - b1 101 - w1
  16. 010 - b2 110 - w2
  17. 011 - b3 111 - (none)
  18.  
  19. Eg. r3.b1 will encode to 00100011 (0x23)
  20.  
  21. Multiple Encodings
  22. ===================
  23. Some instructions have multiple encodings depending on operands.
  24. Eg. add r0, r1, r2 will be encoded to 0x00e2e1e0 (opcode 00), while
  25. add r0, r1, #0x55 will be encoded to 0x0155e1e0 (opcode 01)
  26.  
  27. Opcode Table
  28. =============
  29. All instructions are 32-bit long, first byte is the opcode (usually).
  30. Row format:
  31. "ADD 00 <R2> <R1> <R0>" should be parsed as:
  32. ADD: Instruction name
  33. 00: First byte is the opcode byte (0x00)
  34. <R2>: Second byte holds a register reference to operand 3
  35. <R1>: Third byte holds a register reference to operand 2
  36. <R0>: Fourth byte holds a register reference to operand 1
  37.  
  38. ADD 00 <R2> <R1> <R0>
  39. ADD 01 <IMM2> <R1> <R0>
  40. ADC 02 <R2> <R1> <R0>
  41. ADC 03 <IMM2> <R1> <R0>
  42. SUB 04 <R2> <R1> <R0>
  43. SUB 05 <IMM2> <R1> <R0>
  44. SUC 06 <R2> <R1> <R0>
  45. SUC 07 <IMM2> <R1> <R0>
  46. LSL 08 <R2> <R1> <R0>
  47. LSL 09 <IMM2> <R1> <R0>
  48. LSR 0A <R2> <R1> <R0>
  49. LSR 0B <IMM2> <R1> <R0>
  50. RSB 0C <R2> <R1> <R0>
  51. RSB 0D <IMM2> <R1> <R0>
  52. RSC 0E <R2> <R1> <R0>
  53. RSC 0F <IMM2> <R1> <R0>
  54. AND 10 <R2> <R1> <R0>
  55. AND 11 <IMM2> <R1> <R0>
  56. OR 12 <R2> <R1> <R0>
  57. OR 13 <IMM2> <R1> <R0>
  58. XOR 14 <R2> <R1> <R0>
  59. XOR 15 <IMM2> <R1> <R0>
  60. ??? 16 Probably the same as 0x17 NOT
  61. NOT 17 00 <R1> <R0>
  62. MIN 18 <R2> <R1> <R0>
  63. MIN 19 <IMM2> <R1> <R0>
  64. MAX 1A <R2> <R1> <R0>
  65. MAX 1B <IMM2> <R1> <R0>
  66. CLR 1C <R2> <R1> <R0>
  67. CLR 1D <IMM2> <R1> <R0>
  68. SET 1E <R2> <R1> <R0>
  69. SET 1F <IMM2> <R1> <R0>
  70. JMP 20 <R0> 00 00
  71. JMP 21 <IMM16_0> 00
  72. JAL 22 <R1> 00 <R0>
  73. JAL 23 <IMM16_1> <R0>
  74. MOV 24 <IMM16_1> <R0>
  75. ??? 25 PRUSSv1: HALT (?)
  76. LMBD 26 <R2> <R1> <R0>
  77. LMBD 27 <IMM2> <R1> <R0>
  78. SCAN 28 <R1> <R0> <R0>
  79. SCAN 29 <IMM1> <R0> <R0>
  80. HALT 2A 00 00 00
  81. ??? 2B RESERVED HALT code
  82. ??? 2C-2D PRUSSv1: currently reserved for MVIx
  83. ??? 2E-2F See section "XIN/XOUT/XCHG Instructions"
  84. ??? 30-3B PRUSSv1: RESERVED
  85. ??? 3C-3D PRUSSv1: currently reserved for RFI – Return From Interrupt
  86. SLP 3E x0000000 00000000 00000000
  87. ??? 3F RESERVED SLP code
  88. QBN 40-47 See section "QBxx Instructions" - Unused instruction case, Quick Branch Never
  89. QBLT 48-4F See section "QBxx Instructions"
  90. QBEQ 50-57 See section "QBxx Instructions"
  91. QBLE 58-5F See section "QBxx Instructions"
  92. QBGT 60-67 See section "QBxx Instructions"
  93. QBNE 68-6F See section "QBxx Instructions"
  94. QBGE 70-77 See section "QBxx Instructions"
  95. QBA 78-7F See section "QBxx Instructions"
  96. SBCO 8x See section "LBCO/SBCO Instruction"
  97. LBCO 9x See section "LBCO/SBCO Instruction"
  98. LFC A0-A1 PRUSSv1: Load from Coprocessor, DEPRECATED
  99. ??? A2-AF
  100. STC B0-B1 PRUSSv1: Store to Coprocessor, DEPRECATED
  101. ??? B2-BF
  102. QBN C0-C7 See section "QBxx Instructions" - Unused instruction case, Quick Branch Never
  103. QBBC C8-CF See section "QBxx Instructions"
  104. QBBS D0-D7 See section "QBxx Instructions"
  105. QBA D7-DF See section "QBxx Instructions"
  106. SBBO Ex See section "LBBO/SBBO Instruction"
  107. LBBO Fx See section "LBBO/SBBO Instruction"
  108.  
  109. XIN/XOUT/XCHG Instructions
  110. ===========================
  111. Format: cccccccw rxxxxxxx xyzzzzzz zbbaaaaa
  112. c: Opcode
  113. w: If 1, do an XFR interface write
  114. r: If 1, do an XFR interface read
  115. x: XFR bus device ID
  116. y: Unknown, always 0
  117. z: Amount of bytes to copy - 1. z = 124,125,126,127 means b0,b1,b2,b3
  118. a: Base index of register to transfer (r0-r31)
  119. b: Byte offset in register (b0-b3)
  120.  
  121. QBxx Instructions
  122. ==================
  123. Format: cccccxx0 <R1> <R2> xxxxxxxx
  124. Format: cccccxx1 <R1> <IMM2> xxxxxxxx
  125. c: Opcode
  126. x: Signed immediate offset to jump to (first "x" is the sign bit),
  127. relative to the first byte of the instruction
  128. (last 2 bits are removed, as they would be always 0; so byte offset is xxx_offset << 2)
  129.  
  130. LBBO/SBBO Instruction
  131. ======================
  132. Format: ccccxxxt yyyyyyyy xxxbbbbb xaaaaaaa
  133. c: Opcode
  134. x: Length of copied data - 1 (IMM3 - 1). x = 124,125,126,127 means b0,b1,b2,b3
  135. y: R2, if t = 0. IMM2, if t = 1.
  136. b: R1
  137. a: Byte address of R0 in register file (eg. r1.b1 would be 5)
  138.  
  139. LBCO/SBCO Instruction
  140. ======================
  141. Format: ccccxxxt yyyyyyyy xxxbbbbb xaaaaaaa
  142. c: Opcode
  143. x: Length of copied data - 1 (IMM3 - 1). x = 124,125,126,127 means b0,b1,b2,b3
  144. y: R2, if t = 0. IMM2, if t = 1.
  145. b: C1 (constant table index)
  146. a: Byte address of R0 in register file (eg. r1.b1 would be 5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement