vcc_layouts.py 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. """
  2. # TOP2049 Open Source programming suite
  3. #
  4. # TOP2049 VCC 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 VCCLayout(ShiftregLayout):
  27. # "shiftreg_masks" is a dump of the VCC 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. 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  33. 0x000000, 0x000000, 0x000001, 0x000000, 0x000000, 0x002000,
  34. 0x000000, 0x000002, 0x000000, 0x000000, 0x080000, 0x000004,
  35. 0x000000, 0x000000, 0x010000, 0x004000, 0x000000, 0x000000,
  36. 0x000008, 0x000010, 0x000020, 0x000040, 0x000080, 0x000000,
  37. 0x000100, 0x000000, 0x000200, 0x000000, 0x000400, 0x000000,
  38. 0x000800, 0x000000, 0x008000, 0x000000, 0x001000, 0x000000,
  39. 0x020000, 0x000000, 0x040000, #0x000000, 0x000000, 0x000000,
  40. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  41. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  42. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  43. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  44. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  45. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  46. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  47. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  48. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x012000,
  49. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  50. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  51. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  52. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  53. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  54. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  55. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  56. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  57. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  58. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  59. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  60. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  61. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  62. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  63. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  64. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  65. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  66. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  67. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  68. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  69. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  70. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  71. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  72. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  73. #0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  74. #0x000000, 0x000000, 0x000000, 0x000000,
  75. )
  76. # "shreg2zif_map" is a mapping of the shift register outputs
  77. # to the ZIF socket pins
  78. shreg2zif_map = {
  79. # SHREG.PIN : ZIF_PIN
  80. # left side
  81. # 1
  82. # 2
  83. # 3
  84. # 4
  85. # 5
  86. # 6
  87. # 7
  88. # 8
  89. # 9
  90. # 10
  91. # 11
  92. "0.0" : 12, # Q8C
  93. # 13
  94. # 14
  95. "1.5" : 15, # Q11C
  96. # 16
  97. "0.1" : 17, # Q13C
  98. # 18
  99. # 19
  100. "2.3" : 20, # Q16C
  101. "0.2" : 21, # Q17C
  102. # 22
  103. # 23
  104. "2.0" : 24, # Q20C
  105. # right side
  106. "2.2" : 48, # Q44C
  107. # 47
  108. "2.1" : 46, # Q42C
  109. # 45
  110. "1.4" : 44, # Q40C
  111. # 43
  112. "1.7" : 42, # Q38C
  113. # 41
  114. "1.3" : 40, # Q36C
  115. # 39
  116. "1.2" : 38, # Q34C
  117. # 37
  118. "1.1" : 36, # Q32C
  119. # 35
  120. "1.0" : 34, # Q30C
  121. # 33
  122. "0.7" : 32, # Q28C
  123. "0.6" : 31, # Q27C
  124. "0.5" : 30, # Q26C
  125. "0.4" : 29, # Q25C
  126. "0.3" : 28, # Q24C
  127. # 27
  128. # 26
  129. "1.6" : 25, # Q21C
  130. }
  131. def __init__(self, top=None):
  132. ShiftregLayout.__init__(self, nrZifPins=48, nrShiftRegs=3)
  133. self.top = top
  134. def minVoltage(self):
  135. "Get the min supported voltage"
  136. return 3
  137. def maxVoltage(self):
  138. "Get the max supported voltage"
  139. return 5
  140. def setLayoutID(self, id):
  141. self.top.cmdLoadVCCLayout(id)
  142. if __name__ == "__main__":
  143. print("ZIF socket VCC layouts")
  144. print(VCCLayout())