aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDominic Symes <dominic.symes@arm.com>2022-11-04 18:00:03 +0000
committerEric Kunze <eric.kunze@arm.com>2022-12-05 19:18:51 +0000
commite4d6a1b99337f33cfaf343005e355ef7a68b2be9 (patch)
tree32ae772f418c53ad90e7f069caf59f51dfb7b6f0 /tools
parent1cf84e95f85d510f55720fb98694530923ba9a1c (diff)
downloadspecification-e4d6a1b99337f33cfaf343005e355ef7a68b2be9.tar.gz
Add Levels defintion
Add definition of Level 1.0. Signed-off-by: Dominic Symes <dominic.symes@arm.com> Change-Id: I1b34ae22396f273cc5ecdf99198fdbece6e2809c
Diffstat (limited to 'tools')
-rwxr-xr-xtools/genspec.py10
-rw-r--r--tools/tosa.py10
2 files changed, 18 insertions, 2 deletions
diff --git a/tools/genspec.py b/tools/genspec.py
index c871b75..33e8e35 100755
--- a/tools/genspec.py
+++ b/tools/genspec.py
@@ -44,6 +44,16 @@ class TOSASpecAsciidocGenerator:
entry += "\n"
file.write(entry)
file.write("|===\n")
+ file.write("\n*Operation Function:*\n\n")
+ leveltext = ""
+ for arg in op.arguments:
+ if (len(arg.levellimits) > 0):
+ for limit in arg.levellimits:
+ leveltext += " LEVEL_CHECK(" + limit[0] + " <= " + limit[1] + ");\n"
+ if (len(leveltext) > 0):
+ file.write(
+ f"[source,c++]\n----\nif (level != tosa_level_none) {{\n{leveltext}}}\n----\n"
+ )
def generate(self, outdir):
opdir = os.path.join(outdir, "operators")
diff --git a/tools/tosa.py b/tools/tosa.py
index 87b4f1a..2c2f8ec 100644
--- a/tools/tosa.py
+++ b/tools/tosa.py
@@ -9,12 +9,13 @@ class TOSAOperatorArgumentCategory:
class TOSAOperatorArgument:
- def __init__(self, name, description, categories, ty, shape):
+ def __init__(self, name, description, categories, ty, shape, levellimits):
self.name = name
self.description = description
self.categories = categories
self.type = ty
self.shape = shape
+ self.levellimits = levellimits
class TOSAOperatorDataTypeSupport:
@@ -87,6 +88,11 @@ class TOSASpec:
argcats = []
argtype = arg.get("type")
shape = arg.get("shape")
+ levellimits = []
+ for levellimit in arg.findall("levellimit"):
+ value = levellimit.get("value")
+ limit = levellimit.get("limit")
+ levellimits.append([value, limit])
cats = re.findall(
r"(input|output|attribute)\(?([A-Z,]+)?\)?", arg.get("category")
@@ -94,4 +100,4 @@ class TOSASpec:
for cat in cats:
argcats.append(TOSAOperatorArgumentCategory(cat[0], cat[1].split(",")))
- return TOSAOperatorArgument(name, desc, argcats, argtype, shape)
+ return TOSAOperatorArgument(name, desc, argcats, argtype, shape, levellimits)