From: Dmitry Selyutin Date: Fri, 2 Sep 2022 15:04:32 +0000 (+0300) Subject: power_fields: create arrays from Array class X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d4c002b87caa4164c9a1d79529def4934df56731;p=openpower-isa.git power_fields: create arrays from Array class --- diff --git a/src/openpower/decoder/power_fields.py b/src/openpower/decoder/power_fields.py index f168cab8..4b7d0365 100644 --- a/src/openpower/decoder/power_fields.py +++ b/src/openpower/decoder/power_fields.py @@ -116,11 +116,6 @@ class FieldMeta(type): return super().__new__(metacls, clsname, bases, ns) - def __getitem__(cls, size): - clsname = f"{cls.__name__}[{size}]" - items = ((Field,) * size) - return ArrayMeta(clsname, (Array,), {}, items=items) - def __repr__(cls): if not cls.__members__: return cls.__name__ @@ -196,6 +191,11 @@ class ArrayMeta(type): length += len(field) return length + def __getitem__(cls, size): + clsname = f"{cls.__name__}[{size}]" + items = ((Field,) * size) + return ArrayMeta(clsname, (Array,), {}, items=items) + def remap(cls, scheme): scheme_md = [] scheme_sd = [] diff --git a/src/openpower/decoder/power_insn.py b/src/openpower/decoder/power_insn.py index a4407df2..3aabf111 100644 --- a/src/openpower/decoder/power_insn.py +++ b/src/openpower/decoder/power_insn.py @@ -40,6 +40,7 @@ from openpower.decoder.selectable_int import ( ) from openpower.decoder.power_fields import ( Field as _Field, + Array as _Array, Mapping as _Mapping, DecodeFields as _DecodeFields, ) @@ -731,14 +732,14 @@ class SVP64Instruction(PrefixedInstruction): subvl: _Field = range(8, 10) extra: _Field = range(10, 19) mode: _Field = range(19, 24) - extra2: _Field[4] = ( + extra2: _Array[4] = ( range(10, 12), range(12, 14), range(14, 16), range(16, 18), ) smask: _Field = range(16, 19) - extra3: _Field[3] = ( + extra3: _Array[3] = ( range(10, 13), range(13, 16), range(16, 19),