diff --git a/migen/fhdl/structure.py b/migen/fhdl/structure.py index 16fa1ee81..4116c8892 100644 --- a/migen/fhdl/structure.py +++ b/migen/fhdl/structure.py @@ -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)