From 7a85c902182aa61a2a4cc922f898c44d172aa464 Mon Sep 17 00:00:00 2001 From: Michael Nolan Date: Mon, 18 May 2020 13:53:48 -0400 Subject: [PATCH] Fix error with selecting a selectableint using a selectableint --- src/soc/decoder/selectable_int.py | 4 ++++ 1 file changed, 4 insertions(+) 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 -- 2.30.2