summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libtoprammer/top2049/gnd_layouts.py10
-rw-r--r--libtoprammer/top2049/shiftreg_layout.py10
2 files changed, 12 insertions, 8 deletions
diff --git a/libtoprammer/top2049/gnd_layouts.py b/libtoprammer/top2049/gnd_layouts.py
index 6afd48d..5a3d6b5 100644
--- a/libtoprammer/top2049/gnd_layouts.py
+++ b/libtoprammer/top2049/gnd_layouts.py
@@ -20,6 +20,9 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
"""
+from libtoprammer.util import *
+
+
class GNDLayout:
# A list of valid ZIF GND pins (0=none)
validPins = (0, 5, 14, 15, 16, 17, 18, 19, 20, 24, 26, 27,
@@ -50,16 +53,15 @@ class GNDLayout:
for zifPin in zifPinsList:
assert(zifPin >= 1)
zifMask |= (1 << (zifPin - 1))
- return self.setLayoutMask(zifMask)
+ self.setLayoutMask(zifMask)
def setLayoutMask(self, zifMask):
"Load a ZIF mask."
for (layoutId, layoutMask) in self.layouts:
if layoutMask == zifMask:
self.setLayoutID(layoutId)
- return True
- raise Exception()
- #return False
+ return
+ raise TOPException("GND layout mask impossible due to hardware constraints")
def setLayoutID(self, id):
"Load a specific layout ID."
diff --git a/libtoprammer/top2049/shiftreg_layout.py b/libtoprammer/top2049/shiftreg_layout.py
index d5a06de..edf839c 100644
--- a/libtoprammer/top2049/shiftreg_layout.py
+++ b/libtoprammer/top2049/shiftreg_layout.py
@@ -20,6 +20,9 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
"""
+from libtoprammer.util import *
+
+
class ShiftregLayout:
def __init__(self, nrShiftRegs):
assert(nrShiftRegs <= 4)
@@ -81,16 +84,15 @@ class ShiftregLayout:
for zifPin in zifPinsList:
assert(zifPin >= 1)
zifMask |= (1 << (zifPin - 1))
- return self.setLayoutMask(zifMask)
+ self.setLayoutMask(zifMask)
def setLayoutMask(self, zifMask):
"Load a ZIF mask."
for (layoutId, layoutMask) in self.layouts:
if layoutMask == zifMask:
self.setLayoutID(layoutId)
- return True
- raise Exception()
- #return False
+ return
+ raise TOPException("Layout mask impossible due to hardware constraints")
def setLayoutID(self, id):
"Load a specific layout ID."
bues.ch cgit interface