fhdl: fix implicit slice index
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Wed, 7 Dec 2011 21:21:30 +0000 (22:21 +0100)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Wed, 7 Dec 2011 21:21:30 +0000 (22:21 +0100)
migen/fhdl/structure.py

index 16fa1ee81e5805972be1dbe8e84c5a3845fcdb99..4116c889297bede7873ccc586ab2f4d502296e24 100644 (file)
@@ -72,6 +72,8 @@ class Value:
                elif isinstance(key, slice):
                        start = key.start or 0
                        stop = key.stop or self.bv.width
+                       if stop > self.bv.width:
+                               stop = self.bv.width
                        if key.step != None:
                                raise KeyError
                        return Slice(self, start, stop)