From 53e76592361df8c33a6d9580f0170a335c1a15fd Mon Sep 17 00:00:00 2001 From: Kevin Petit Date: Thu, 27 Apr 2023 17:28:16 +0100 Subject: Fix resize_t enum name resize_t is already used in the type support table for RESIZE, rename the mode enum to resize_mode_t. Also add a python function to get an enum object by name to the spec object. Change-Id: Id12c10929beda469c6e3714518d6e26f18ddd440 Signed-off-by: Kevin Petit --- tools/tosa.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/tosa.py b/tools/tosa.py index 52fda3e..bc6faa6 100644 --- a/tools/tosa.py +++ b/tools/tosa.py @@ -66,7 +66,7 @@ class TOSASpec: for group in self.xmlroot.findall("./operators/operatorgroup"): self.operatorgroups.append(self.__load_operator_group(group)) for enum in self.xmlroot.findall("./enum"): - self.enums.append(self.load_enum(enum)) + self.enums.append(self.__load_enum(enum)) def __load_version(self): version = self.xmlroot.find("./version") @@ -142,10 +142,15 @@ class TOSASpec: return TOSAOperatorArgument(name, desc, argcats, argtype, shape, levellimits) - def load_enum(self, arg): + def __load_enum(self, arg): name = arg.get("name") desc = arg.get("description").strip() values = [] for val in arg.findall("enumval"): values.append((val.get("name"), val.get("value"), val.get("description"))) return TOSAEnum(name, desc, values) + + def get_enum_by_name(self, name): + for e in self.enums: + if e.name == name: + return e -- cgit v1.2.1