projects
/
openpower-isa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ee92239
)
power_fields: allow getting individual field bits
author
Dmitry Selyutin
<ghostmansd@gmail.com>
Tue, 6 Sep 2022 18:26:53 +0000
(21:26 +0300)
committer
Dmitry Selyutin
<ghostmansd@gmail.com>
Tue, 6 Sep 2022 19:53:05 +0000
(22:53 +0300)
src/openpower/decoder/power_fields.py
patch
|
blob
|
history
diff --git
a/src/openpower/decoder/power_fields.py
b/src/openpower/decoder/power_fields.py
index 48cd23d45dd2f8f02fd265462a76ac1f31ff8278..fe2713d2de1f4938c1b1537f965ecf64a4a1c95a 100644
(file)
--- a/
src/openpower/decoder/power_fields.py
+++ b/
src/openpower/decoder/power_fields.py
@@
-175,6
+175,13
@@
class Field(Reference, metaclass=FieldMeta):
for bit in self.__class__:
yield self.storage[bit]
+ def __getitem__(self, key):
+ if isinstance(key, int):
+ bit = self.storage[self.__class__.__members__[key]]
+ return _SelectableInt(value=bit, bits=1)
+
+ return _selectconcat(*(self[bit] for bit in tuple(key)))
+
class ArrayMeta(type):
def __new__(metacls, clsname, bases, ns, items=()):