aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Petit <kevin.petit@arm.com>2022-12-06 11:56:15 +0000
committerEric Kunze <eric.kunze@arm.com>2022-12-09 15:51:46 +0000
commit36f2d64e38467dc02c632951ce564a35abcaa268 (patch)
treee5f45741865b2fa248173101c35fd9cdc519d701
parentd19f7ff9bf440bfe27d92efd7bfa32a76ab706f3 (diff)
downloadspecification-36f2d64e38467dc02c632951ce564a35abcaa268.tar.gz
Use XML as source for specification version
Also update to version 0.51.0 draft Signed-off-by: Kevin Petit <kevin.petit@arm.com> Change-Id: Ib0754169b96d2f3110067e0bdc0bb3f309ec1951
-rw-r--r--Makefile3
-rwxr-xr-xtools/genspec.py13
-rw-r--r--tools/tosa.py11
-rw-r--r--tosa.xml1
-rw-r--r--tosa.xsd10
-rw-r--r--tosa_spec.adoc4
6 files changed, 39 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index a0d1056..c294fbb 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,6 @@
# by a licensing agreement from ARM Limited.
#
-TOSAREVISION=0.50.0
MKDIR=mkdir -p
ASCIIDOC=asciidoctor
ASPELL=aspell
@@ -19,7 +18,7 @@ HTMLDIR=out/html
PDFDIR=out/pdf
GENDIR=out/gen
-COMMON_ARGS= -a revnumber="$(TOSAREVISION)" -a generated="$(abspath $(GENDIR))"
+COMMON_ARGS= -a generated="$(abspath $(GENDIR))"
SPECSRC := tosa_spec.adoc
ADOCFILES = $(wildcard chapters/[A-Za-z]*.adoc) $(wildcard $(GENDIR)/*/*.adoc)
diff --git a/tools/genspec.py b/tools/genspec.py
index 33e8e35..38ae6e3 100755
--- a/tools/genspec.py
+++ b/tools/genspec.py
@@ -56,6 +56,19 @@ class TOSASpecAsciidocGenerator:
)
def generate(self, outdir):
+ os.makedirs(outdir, exist_ok=True)
+
+ # Generate version information
+ major = self.spec.version_major
+ minor = self.spec.version_minor
+ patch = self.spec.version_patch
+ with open(os.path.join(outdir, "version.adoc"), 'w') as f:
+ f.write(':tosa-version-string: {}.{}.{}'.format(major, minor, patch))
+ if self.spec.version_is_draft:
+ f.write(' draft')
+ f.write('\n')
+
+ # Generator operators
opdir = os.path.join(outdir, "operators")
os.makedirs(opdir, exist_ok=True)
for group in self.spec.operatorgroups:
diff --git a/tools/tosa.py b/tools/tosa.py
index 2c2f8ec..74d43d6 100644
--- a/tools/tosa.py
+++ b/tools/tosa.py
@@ -47,9 +47,20 @@ class TOSASpec:
self.__load_spec()
def __load_spec(self):
+ self.__load_version()
for group in self.xmlroot.findall("./operators/operatorgroup"):
self.operatorgroups.append(self.__load_operator_group(group))
+ def __load_version(self):
+ version = self.xmlroot.find("./version")
+ self.version_major = int(version.get("major"))
+ self.version_minor = int(version.get("minor"))
+ self.version_patch = int(version.get("patch"))
+ if version.get("draft") == "true":
+ self.version_is_draft = True
+ else:
+ self.version_is_draft = False
+
def __load_operator_group(self, group):
name = group.get("name")
operators = []
diff --git a/tosa.xml b/tosa.xml
index fcd3597..f3f77a7 100644
--- a/tosa.xml
+++ b/tosa.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tosa SYSTEM "tosa.dtd">
<tosa>
+ <version major="0" minor="51" patch="0" draft="true"/>
<profiles>
<profile name="BI">Base Inference</profile>
<profile name="MI">Main Inference</profile>
diff --git a/tosa.xsd b/tosa.xsd
index 1a37bc4..1409c28 100644
--- a/tosa.xsd
+++ b/tosa.xsd
@@ -70,6 +70,15 @@
<!-- Element definitions -->
+<xs:element name="version">
+ <xs:complexType>
+ <xs:attribute name="major" type="xs:int" use="required"/>
+ <xs:attribute name="minor" type="xs:int" use="required"/>
+ <xs:attribute name="patch" type="xs:int" use="required"/>
+ <xs:attribute name="draft" type="xs:boolean" use="required"/>
+ </xs:complexType>
+</xs:element>
+
<xs:element name="profile">
<xs:complexType>
<xs:simpleContent>
@@ -206,6 +215,7 @@
<xs:element name="tosa">
<xs:complexType>
<xs:sequence>
+ <xs:element ref="version" minOccurs="1" maxOccurs="1"/>
<xs:element ref="profiles"/>
<xs:element ref="levels"/>
<xs:element ref="operators"/>
diff --git a/tosa_spec.adoc b/tosa_spec.adoc
index 1b4eecd..15a74d3 100644
--- a/tosa_spec.adoc
+++ b/tosa_spec.adoc
@@ -7,7 +7,9 @@
// copies and copies may only be made to the extent permitted
// by a licensing agreement from ARM Limited.
-= TOSA {revnumber} specification
+include::{generated}/version.adoc[]
+
+= TOSA {tosa-version-string} specification
:numbered:
:toc: left
:toclevels: 3