From 06da19f8904a8b5939dbc74f042a88e9dd2f22cc Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Wed, 20 Apr 2022 11:45:30 +0000 Subject: [PATCH] sv_binutils: introduce Enum c_name property --- src/openpower/sv/sv_binutils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) -- 2.30.2