gnd_layouts.py 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. """
  2. # TOP Open Source programming suite
  3. #
  4. # TOP853 GND 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 GNDLayout(ShiftregLayout):
  27. # "shiftreg_masks" is a dump of the GND shiftregister states.
  28. # The array index is the layout ID.
  29. # The array entries are the shift register GND control outputs.
  30. # All non-GND 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, 0x0000, 0x0000, 0x0000, # 0x00
  34. 0x0000, 0x0000, 0x4000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x08
  35. 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x0000, 0x0000, 0x0000, # 0x10
  36. #0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x18
  37. #0x0000, 0x0000, 0x0000, 0x0000, 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, 0x4000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x88
  51. #0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 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. #0x0000, 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. "1.6" : 10, # Q1G
  71. "1.7" : 20, # Q2G
  72. }
  73. def __init__(self, top=None):
  74. ShiftregLayout.__init__(self, nrZifPins=40, nrShiftRegs=2)
  75. self.top = top
  76. def setLayoutID(self, id):
  77. self.top.cmdLoadGNDLayout(id)
  78. if __name__ == "__main__":
  79. print("ZIF socket GND layouts")
  80. print(GNDLayout())