From b650b32b48b36dbcb92ac380f76f0ec698a42341 Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Tue, 30 Aug 2022 11:47:16 +0300 Subject: [PATCH] selectable_int: support slicing by iterable --- src/openpower/decoder/selectable_int.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/openpower/decoder/selectable_int.py b/src/openpower/decoder/selectable_int.py index 36d30689..55f5e6c8 100644 --- a/src/openpower/decoder/selectable_int.py +++ b/src/openpower/decoder/selectable_int.py @@ -385,7 +385,13 @@ class SelectableInt: log("getitem", stop, start, self.bits, hex(self.value), value) return SelectableInt(value, bits) else: - raise ValueError(value) + bits = [] + key = tuple(key) + for bit in key: + if not isinstance(bit, (int, SelectableInt)): + raise ValueError(key) + bits.append(self[bit]) + return selectconcat(*bits) def __setitem__(self, key, value): if isinstance(key, SelectableInt): -- 2.30.2