diff options
-rw-r--r-- | Makefile | 3 | ||||
-rwxr-xr-x | tools/genspec.py | 13 | ||||
-rw-r--r-- | tools/tosa.py | 11 | ||||
-rw-r--r-- | tosa.xml | 1 | ||||
-rw-r--r-- | tosa.xsd | 10 | ||||
-rw-r--r-- | tosa_spec.adoc | 4 |
6 files changed, 39 insertions, 3 deletions
@@ -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 = [] @@ -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> @@ -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 |