From: Dmitry Selyutin Date: Wed, 20 Apr 2022 11:45:30 +0000 (+0000) Subject: sv_binutils: introduce Enum c_name property X-Git-Tag: sv_maxu_works-initial~472 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=06da19f8904a8b5939dbc74f042a88e9dd2f22cc;p=openpower-isa.git sv_binutils: introduce Enum c_name property --- diff --git a/src/openpower/sv/sv_binutils.py b/src/openpower/sv/sv_binutils.py index 73669963..9d9ce41c 100644 --- a/src/openpower/sv/sv_binutils.py +++ b/src/openpower/sv/sv_binutils.py @@ -123,6 +123,10 @@ class EnumMeta(_enum.EnumMeta, CTypeMeta): class Enum(CType, _enum.Enum, metaclass=EnumMeta): + @property + def c_name(self): + return f"{self.__class__.c_tag.upper()}_{self.name.upper()}" + @classmethod def c_decl(cls): yield f"{cls.c_typedef} {{" @@ -131,7 +135,7 @@ class Enum(CType, _enum.Enum, metaclass=EnumMeta): yield f"}};" def c_value(self, prefix="", suffix=""): - yield f"{prefix}{self.__class__.c_tag.upper()}_{self.name.upper()}{suffix}" + yield f"{prefix}{self.c_name}{suffix}" In1Sel = Enum("In1Sel", _In1Sel)