Raise exception when not using correct boolean operators
authorYann Sionneau <ys@m-labs.hk>
Mon, 27 Oct 2014 11:41:17 +0000 (12:41 +0100)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Mon, 27 Oct 2014 11:40:22 +0000 (19:40 +0800)
migen/fhdl/structure.py

index 2859345d812356323aed765ec3f3d4078151bc73..071ae23c6ebddb01b638a0ebe453f81a217ea5d3 100644 (file)
@@ -24,6 +24,9 @@ class Value(HUID):
        Values created from integers have the minimum bit width to necessary to
        represent the integer.
        """
+       def __bool__(self):
+               raise NotImplementedError("For boolean operations between expressions: use '&'/'|' instead of 'and'/'or'")
+
        def __invert__(self):
                return _Operator("~", [self])
        def __neg__(self):