summaryrefslogtreecommitdiffstats
path: root/libtoprammer/top2049
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2010-02-25 20:10:10 +0100
committerMichael Buesch <mb@bu3sch.de>2010-02-25 20:10:10 +0100
commitce2db44d9846adf13b5477a3cfa714b6eb17d3d1 (patch)
treecd73d1fc797c3ddfaf97654985b2c78f68c553aa /libtoprammer/top2049
parentcc806778791b530e131035e72fd3832ac3f753e3 (diff)
downloadtoprammer-ce2db44d9846adf13b5477a3cfa714b6eb17d3d1.tar.xz
toprammer-ce2db44d9846adf13b5477a3cfa714b6eb17d3d1.zip
Better error messages for impossible layouts
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Diffstat (limited to 'libtoprammer/top2049')
-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