summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Buesch <m@bues.ch>2013-10-14 23:05:06 +0200
committerMichael Buesch <m@bues.ch>2013-10-14 23:05:06 +0200
commit32eff3fc413da1be0082df093adb159ea252b1bc (patch)
tree213f03797d074062f396f69ecf73aa32b5486731
parent47c4b8692c369c9fa5fc1dba0c768e9098d82ad2 (diff)
downloadtoprammer-32eff3fc413da1be0082df093adb159ea252b1bc.tar.xz
toprammer-32eff3fc413da1be0082df093adb159ea252b1bc.zip
Check for duplicate chip-IDs on registration
Signed-off-by: Michael Buesch <m@bues.ch>
-rw-r--r--libtoprammer/chip.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/libtoprammer/chip.py b/libtoprammer/chip.py
index e564daa..fcf0b4c 100644
--- a/libtoprammer/chip.py
+++ b/libtoprammer/chip.py
@@ -276,6 +276,14 @@ def getRegisteredVendors():
vendors.setdefault(vendor, []).append(descriptor)
return vendors
+def _registerChip(chipDesc):
+ regList = getRegisteredChips()
+ if chipDesc.chipID in [ cd.chipID for cd in regList ]:
+ raise TOPException("Chip description registration: "
+ "The chipID '%s' is not unique." %\
+ chipDesc.chipID)
+ regList.append(chipDesc)
+
class BitDescription:
def __init__(self, bitNr, description):
self.bitNr = bitNr
@@ -424,7 +432,7 @@ class ChipDescription:
self.maintainer = maintainer
self.broken = broken
- getRegisteredChips().append(self)
+ _registerChip(self)
@classmethod
def findAll(cls, chipID, allowBroken=False):
bues.ch cgit interface