fhdl: fix implicit slice index

This commit is contained in:
Sebastien Bourdeauducq 2011-12-07 22:21:30 +01:00
parent 82f77180d5
commit fab02f84cb
1 changed files with 2 additions and 0 deletions

View File

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