fhdl: support len() on signals
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Sun, 8 Apr 2012 16:06:22 +0000 (18:06 +0200)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Sun, 8 Apr 2012 16:06:22 +0000 (18:06 +0200)
migen/fhdl/structure.py

index c8517270eab1bf5cb422591d68e5d34181492715..b4fb44afda4732ddb9dcd7eeccbbeff59c5c4ffb 100644 (file)
@@ -157,6 +157,9 @@ class Signal(Value):
                self.reset = Constant(reset, bv)
                self.name_override = name_override
                self.backtrace = tracer.trace_back(name)
+       
+       def __len__(self):
+               return self.bv.width
 
        def __hash__(self):
                return id(self)