power_fields: create arrays from Array class
authorDmitry Selyutin <ghostmansd@gmail.com>
Fri, 2 Sep 2022 15:04:32 +0000 (18:04 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Sat, 3 Sep 2022 18:41:28 +0000 (21:41 +0300)
src/openpower/decoder/power_fields.py
src/openpower/decoder/power_insn.py

index f168cab8f52a76301e5972cb5279ddf9bf259af0..4b7d03654713d518c74ac131d77de7ccd75d9658 100644 (file)
@@ -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 = []
index a4407df2c6809183b746c9b0a3862536fca1014e..3aabf1116ffe8ce4337540a021108a739c591668 100644 (file)
@@ -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),