vpp_layouts.py 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. """
  2. # TOP2049 Open Source programming suite
  3. #
  4. # TOP2049 VPP layout definitions
  5. #
  6. # Copyright (c) 2010 Michael Buesch <m@bues.ch>
  7. #
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License along
  19. # with this program; if not, write to the Free Software Foundation, Inc.,
  20. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  21. """
  22. import sys
  23. if __name__ == "__main__":
  24. sys.path.insert(0, sys.path[0] + "/../..")
  25. from libtoprammer.shiftreg_layout import *
  26. class VPPLayout(ShiftregLayout):
  27. # "shiftreg_masks" is a dump of the VPP shiftregister states. The array index
  28. # is the layout ID and the array entries are the inverted shift
  29. # register outputs. The least significant byte is the first
  30. # shift register in the chain.
  31. shiftreg_masks = (
  32. 0x00000000, 0x02000000, 0x01000000, 0x00000008, 0x00000000,
  33. 0x00100000, 0x00000000, 0x00020000, 0x00010000, 0x00004000,
  34. 0x00002000, 0x00001000, 0x00000200, 0x00000000, 0x00000100,
  35. 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  36. 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
  37. 0x00000000, 0x00000004, 0x00000010, 0x00000040, 0x00000080,
  38. 0x00000400, 0x00000800, 0x00000000, 0x00008000, 0x00040000,
  39. 0x00080000, 0x00000000, 0x00200000, 0x00000000, 0x00400000,
  40. 0x00800000, 0x00000000, 0x04000000, 0x08000000, 0x80000000,
  41. 0x40000000, 0x20000000, 0x10000000, 0x00000000, 0x00000000,
  42. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  43. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  44. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  45. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  46. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  47. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  48. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  49. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  50. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  51. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  52. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  53. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  54. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  55. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  56. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  57. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  58. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  59. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  60. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  61. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  62. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  63. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  64. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  65. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  66. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  67. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  68. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  69. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  70. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  71. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  72. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  73. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  74. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  75. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  76. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  77. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  78. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  79. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  80. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  81. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  82. #0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  83. #0x00000000,
  84. )
  85. # "shreg2zif_map" is a mapping of the shift register outputs
  86. # to the ZIF socket pins
  87. shreg2zif_map = {
  88. # SHREG.PIN : ZIF_PIN
  89. # left side
  90. "3.6" : 1, # QP31
  91. "3.5" : 2, # QP30
  92. "3.4" : 3, # QP29
  93. # 4
  94. "3.1" : 5, # QP26
  95. "3.0" : 6, # QP25
  96. "0.3" : 7, # QP4
  97. # 8
  98. "2.4" : 9, # QP21
  99. # 10
  100. "2.1" : 11, # QP18
  101. "2.0" : 12, # QP17
  102. "1.6" : 13, # QP15
  103. "1.5" : 14, # QP14
  104. "1.4" : 15, # QP13
  105. "1.1" : 16, # QP10
  106. # 17
  107. "1.0" : 18, # QP9
  108. "0.5" : 19, # QP6
  109. # 20
  110. # 21
  111. # 22
  112. # 23
  113. "0.0" : 24, # QP1
  114. # right side
  115. "3.7" : 48, # QP32
  116. "3.3" : 47, # QP28
  117. "3.2" : 46, # QP27
  118. # 45
  119. "2.7" : 44, # QP24
  120. "2.6" : 43, # QP23
  121. # 42
  122. "2.5" : 41, # QP22
  123. # 40
  124. "2.3" : 39, # QP20
  125. "2.2" : 38, # QP19
  126. "1.7" : 37, # QP16
  127. # 36
  128. "1.3" : 35, # QP12
  129. "1.2" : 34, # QP11
  130. "0.7" : 33, # QP8
  131. "0.6" : 32, # QP7
  132. "0.4" : 31, # QP5
  133. "0.2" : 30, # QP3
  134. # 29
  135. # 28
  136. # 27
  137. "0.1" : 26, # QP2
  138. # 25
  139. }
  140. def __init__(self, top=None):
  141. ShiftregLayout.__init__(self, nrZifPins=48, nrShiftRegs=4)
  142. self.top = top
  143. def minVoltage(self):
  144. "Get the min supported voltage"
  145. return 5
  146. def maxVoltage(self):
  147. "Get the max supported voltage"
  148. return 21
  149. def setLayoutID(self, id):
  150. self.top.cmdLoadVPPLayout(id)
  151. if __name__ == "__main__":
  152. print("ZIF socket VPP layouts")
  153. print(VPPLayout(None))