vpp_layouts.py 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. """
  2. # TOP Open Source programming suite
  3. #
  4. # TOP853 VPP layout definitions
  5. #
  6. # Copyright (c) 2022 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.
  28. # The array index is the layout ID.
  29. # The array entries are the inverted shift register VPP control outputs.
  30. # All non-VPP control outputs are zero.
  31. # The least significant byte is the first shift register in the chain.
  32. shiftreg_masks = (
  33. 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2000, 0x0000, 0x1000, # 0x00
  34. 0x0000, 0x0800, 0x0400, 0x0200, 0x0100, 0x0000, 0x0000, 0x0000, # 0x08
  35. 0x0000, 0x0000, 0x0000, 0x0000, 0x0004, 0x0000, 0x0000, 0x0000, # 0x10
  36. 0x0000, 0x0000, 0x0001, 0x0000, 0x0002, 0x0008, 0x0010, 0x0080, # 0x18
  37. 0x0000, 0x0000, 0x0000, 0x4000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x20
  38. 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x28
  39. 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x30
  40. 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x38
  41. 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x40
  42. 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x48
  43. 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x50
  44. 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x58
  45. 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x60
  46. 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x68
  47. 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x70
  48. 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x78
  49. 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x80
  50. 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x88
  51. 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x90
  52. 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x98
  53. 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xA0
  54. 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xA8
  55. 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xB0
  56. 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xB8
  57. 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xC0
  58. 0x8000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xC8
  59. #0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xD0
  60. #0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xD8
  61. #0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xE0
  62. #0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xE8
  63. #0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xF0
  64. #0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xF8
  65. )
  66. # "shreg2zif_map" is a mapping of the shift register outputs
  67. # to the ZIF socket pins
  68. shreg2zif_map = {
  69. # SHREG.PIN : ZIF_PIN
  70. "0.0" : 26, # QP9
  71. "0.1" : 28, # QP10
  72. "0.2" : 20, # QP11
  73. "0.3" : 29, # QP12
  74. "0.4" : 30, # QP13
  75. "0.7" : 31, # QP40
  76. "1.0" : 12, # QP1
  77. "1.1" : 11, # QP2
  78. "1.2" : 10, # QP3
  79. "1.3" : 9, # QP4
  80. "1.4" : 7, # QP5
  81. "1.5" : 5, # QP6
  82. "1.6" : 35, # QP7
  83. "1.7" : 40, # QP8 + D200
  84. }
  85. def __init__(self, top=None):
  86. ShiftregLayout.__init__(self, nrZifPins=40, nrShiftRegs=2)
  87. self.top = top
  88. def minVoltage(self):
  89. #TODO
  90. "Get the min supported voltage"
  91. return 5
  92. def maxVoltage(self):
  93. #TODO
  94. "Get the max supported voltage"
  95. return 21
  96. def setLayoutID(self, id):
  97. self.top.cmdLoadVPPLayout(id)
  98. if __name__ == "__main__":
  99. print("ZIF socket VPP layouts")
  100. print(VPPLayout(None))