fhdl: forbid zero-length signals
authorSebastien Bourdeauducq <sb@m-labs.hk>
Fri, 18 Apr 2014 13:01:50 +0000 (15:01 +0200)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Fri, 18 Apr 2014 13:01:50 +0000 (15:01 +0200)
migen/fhdl/structure.py

index c2268428d01c3117b9cf7d6e86cad7ebd651ecfd..7ab425456da257c4c9ee8e75f051487efbc752c8 100644 (file)
@@ -262,7 +262,8 @@ class Signal(Value):
                                self.nbits, self.signed = bits_sign
                        else:
                                self.nbits, self.signed = bits_sign, False
-               assert(isinstance(self.nbits, int))
+               if not isinstance(self.nbits, int) or self.nbits <= 0:
+                       raise ValueError("Signal width must be a strictly positive integer")
                
                self.variable = variable # deprecated
                self.reset = reset