sv_binutils: fix fields enum c_decl method
authorDmitry Selyutin <dmitry.selyutin@3mdeb.com>
Mon, 25 Apr 2022 20:28:08 +0000 (20:28 +0000)
committerDmitry Selyutin <dmitry.selyutin@3mdeb.com>
Mon, 25 Apr 2022 20:28:08 +0000 (20:28 +0000)
src/openpower/sv/sv_binutils.py

index 532056f233891e012b6a4d5c344482cb5dd4ad9f..42a03c2149fbb83ee7b298a3824709fa35b64630 100644 (file)
@@ -407,7 +407,11 @@ class FieldsMappingMeta(EnumMeta):
         return cls.__setter
 
     def c_decl(cls):
-        yield from super().c_decl()
+        yield f"{cls.c_typedef} {{"
+        for field_name in cls.__members__.keys():
+            short_c_tag = cls.c_tag[:-len("_field")]
+            yield from indent([f"{short_c_tag}_{field_name},".upper()])
+        yield f"}};"
         yield from cls.__struct.c_decl()
         yield cls.__getter.__class__.c_var(name=f"{cls.__tag}_get", suffix=";")
         yield cls.__setter.__class__.c_var(name=f"{cls.__tag}_set", suffix=";")