summaryrefslogtreecommitdiffstats
path: root/libtoprammer/top853/vpp_layouts.py
blob: 94d05d8ee1a7ce7d24c27a1a5b6cc21de6325b05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
"""
#    TOP Open Source programming suite
#
#    TOP853 VPP layout definitions
#
#    Copyright (c) 2022 Michael Buesch <m@bues.ch>
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License along
#    with this program; if not, write to the Free Software Foundation, Inc.,
#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
"""

import sys
if __name__ == "__main__":
	sys.path.insert(0, sys.path[0] + "/../..")
from libtoprammer.shiftreg_layout import *


class VPPLayout(ShiftregLayout):
	# "shiftreg_masks" is a dump of the VPP shiftregister states.
	# The array index is the layout ID.
	# The array entries are the inverted shift register VPP control outputs.
	# All non-VPP control outputs are zero.
	# The least significant byte is the first shift register in the chain.
	shiftreg_masks = (
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2000, 0x0000, 0x1000, # 0x00
		0x0000, 0x0800, 0x0400, 0x0200, 0x0100, 0x0000, 0x0000, 0x0000, # 0x08
		0x0000, 0x0000, 0x0000, 0x0000, 0x0004, 0x0000, 0x0000, 0x0000, # 0x10
		0x0000, 0x0000, 0x0001, 0x0000, 0x0002, 0x0008, 0x0010, 0x0080, # 0x18
		0x0000, 0x0000, 0x0000, 0x4000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x20
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x28
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x30
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x38
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x40
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x48
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x50
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x58
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x60
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x68
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x70
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x78
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x80
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x88
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x90
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0x98
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xA0
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xA8
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xB0
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xB8
		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xC0
		0x8000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xC8
		#0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xD0
		#0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xD8
		#0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xE0
		#0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xE8
		#0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xF0
		#0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, # 0xF8
	)
	# "shreg2zif_map" is a mapping of the shift register outputs
	# to the ZIF socket pins
	shreg2zif_map = {
		# SHREG.PIN  :  ZIF_PIN
		"0.0" : 26, # QP9
		"0.1" : 28, # QP10
		"0.2" : 20, # QP11
		"0.3" : 29, # QP12
		"0.4" : 30, # QP13
		"0.7" : 31, # QP40
		"1.0" : 12, # QP1
		"1.1" : 11, # QP2
		"1.2" : 10, # QP3
		"1.3" : 9, # QP4
		"1.4" : 7, # QP5
		"1.5" : 5, # QP6
		"1.6" : 35, # QP7
		"1.7" : 40, # QP8 + D200
	}

	def __init__(self, top=None):
		ShiftregLayout.__init__(self, nrZifPins=40, nrShiftRegs=2)
		self.top = top

	def minVoltage(self):
		#TODO
		"Get the min supported voltage"
		return 5

	def maxVoltage(self):
		#TODO
		"Get the max supported voltage"
		return 21

	def setLayoutID(self, id):
		self.top.cmdLoadVPPLayout(id)

if __name__ == "__main__":
	print("ZIF socket VPP layouts")
	print(VPPLayout(None))
bues.ch cgit interface