From: Michael Nolan Date: Mon, 18 May 2020 17:53:48 +0000 (-0400) Subject: Fix error with selecting a selectableint using a selectableint X-Git-Tag: div_pipeline~1086 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7a85c902182aa61a2a4cc922f898c44d172aa464;p=soc.git Fix error with selecting a selectableint using a selectableint --- diff --git a/src/soc/decoder/selectable_int.py b/src/soc/decoder/selectable_int.py index 522f6516..02f0ca83 100644 --- a/src/soc/decoder/selectable_int.py +++ b/src/soc/decoder/selectable_int.py @@ -235,6 +235,8 @@ class SelectableInt: return SelectableInt(self.value >> b.value, self.bits) def __getitem__(self, key): + if isinstance(key, SelectableInt): + key = key.value if isinstance(key, int): assert key < self.bits, "key %d accessing %d" % (key, self.bits) assert key >= 0 @@ -260,6 +262,8 @@ class SelectableInt: return SelectableInt(value, bits) def __setitem__(self, key, value): + if isinstance(key, SelectableInt): + key = key.value if isinstance(key, int): assert key < self.bits assert key >= 0