From e6c07c8f97f84706e0105ec659462d262283dd95 Mon Sep 17 00:00:00 2001 From: Eric Kunze Date: Tue, 16 Apr 2024 18:08:08 -0700 Subject: Add version_added to each op_profile Allows for future tools to take action on which version the operator/profile first appears. Signed-off-by: Eric Kunze Change-Id: If0358c8b189f8b2aa11cde3379076c0cc28bf17d --- tools/genspec.py | 13 +++++++++---- tools/tosa.py | 8 ++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 'tools') diff --git a/tools/genspec.py b/tools/genspec.py index 7710c07..38babec 100755 --- a/tools/genspec.py +++ b/tools/genspec.py @@ -188,12 +188,14 @@ class TOSASpecAsciidocGenerator: f.write(f"{profile.description}\n\n") f.write(f"Status: {profile.status}\n") f.write("|===\n") - f.write("|Operator|mode\n\n") + f.write("|Operator|Mode|Version Added\n\n") for op in sorted(all_operators, key=lambda o: o.name): if op.typesupports: for tysup in op.typesupports: if profile.name in tysup.profiles: - f.write(f"|{op.name}|{tysup.mode}\n") + f.write( + f"|{op.name}|{tysup.mode}|{tysup.version_added}\n" + ) f.write("|===\n") f.write("=== Profile Extensions\n") @@ -203,7 +205,7 @@ class TOSASpecAsciidocGenerator: f.write(f"Status: {pext.status}\n\n") f.write(f"Compatible profiles: {', '.join(pext.profiles)}\n\n") f.write("|===\n") - f.write("|Operator|mode|note\n\n") + f.write("|Operator|Mode|Version Added|Note\n\n") for op in sorted(all_operators, key=lambda o: o.name): if op.typesupports: for tysup in op.typesupports: @@ -216,7 +218,10 @@ class TOSASpecAsciidocGenerator: note = f"If {m[2]} is also supported" else: note = f"If {m[1]} is also supported" - f.write(f"|{op.name}|{tysup.mode}|{note}\n") + f.write( + f"|{op.name}|{tysup.mode}|" + f"{tysup.version_added}|{note}\n" + ) f.write("|===\n") diff --git a/tools/tosa.py b/tools/tosa.py index 016aba6..a0e4ddb 100644 --- a/tools/tosa.py +++ b/tools/tosa.py @@ -89,10 +89,11 @@ class TOSAOperatorArgument: class TOSAOperatorDataTypeSupport: - def __init__(self, mode, tymap, profiles=None): + def __init__(self, mode, tymap, version_added, profiles): self.mode = mode self.tymap = tymap self.profiles = profiles + self.version_added = version_added class TOSAOperator: @@ -195,6 +196,7 @@ class TOSASpec: for tysup in op.findall("typesupport"): tsmode = tysup.get("mode") tsmap = {} + version_added = tysup.get("version_added") profiles = tysup.findall("op_profile") tsprofiles = [] for p in profiles: @@ -208,7 +210,9 @@ class TOSASpec: tsprofiles.append(tsp_name) for ty in types: tsmap[ty] = tysup.get(ty) - typesupports.append(TOSAOperatorDataTypeSupport(tsmode, tsmap, tsprofiles)) + typesupports.append( + TOSAOperatorDataTypeSupport(tsmode, tsmap, version_added, tsprofiles) + ) return TOSAOperator(name, args, types, typesupports) def __load_operator_argument(self, arg, op_name): -- cgit v1.2.1