Skip to content

Commit

Permalink
Merge pull request #1 from cmuellner/initial-specification
Browse files Browse the repository at this point in the history
Initial specification
  • Loading branch information
Cooper-Qu authored Aug 30, 2022
2 parents a396ee0 + e90c8a5 commit 26280ad
Show file tree
Hide file tree
Showing 146 changed files with 6,697 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.pdf
.asciidoctor
images/diag-*
revision.adoc-snippet*

31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
SPEC=xthead
HEADER_SOURCE := $(SPEC).adoc
GITVER=$(shell git describe --tag --always --dirty)
GITDATE=$(shell git show -s --format=%ci | cut -d ' ' -f 1)

# e.g. "2022-07-29-d027732", or "2022-08-01-dbd4007-dirty"
VERSION="$(GITDATE)-$(GITVER)"

$(SPEC)-$(VERSION).pdf: *.adoc revision.adoc-snippet
@echo "Building asciidoc"
asciidoctor-pdf \
--attribute=mathematical-format=svg \
--attribute=pdf-fontsdir=resources/fonts \
--attribute=pdf-style=resources/themes/thead-pdf.yml \
--failure-level=ERROR \
--require=asciidoctor-diagram \
--require=asciidoctor-mathematical \
--out-file=$@ \
$(HEADER_SOURCE)

.PHONY: revision.adoc-snippet
revision.adoc-snippet:
echo ":revdate: ${GITDATE}" >> $@-tmp
echo ":revnumber: ${GITVER}" >> $@-tmp
diff $@ $@-tmp || mv $@-tmp $@

all: $(SPEC)-$(VERSION).pdf

clean:
rm -f $(SPEC)-*.pdf
rm -f revision.adoc-snippet*
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
# thead-extension-spec
T-head vendor extension Instruction Set spec
# T-Head ISA extensions (Xthead*)

This repository contains the T-Head RISC-V ISA extensions (Xthead*) specifications.

## Build instructions

The specification is written in AsciiDoc.
The following instructions can be used to generate a PDF containing
all specifications:

```
make
```
35 changes: 35 additions & 0 deletions docinfo.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
== Document information

=== Copyright and license information
This specification is licensed under the Apache License, Version 2.0
(Apache-2.0). The full license text is available at
https://www.apache.org/licenses/LICENSE-2.0.

Copyright 2022 T-Head Semiconductor Co., Ltd.

Copyright 2022 VRULL GmbH

=== Contributors

The list below includes all contributors to this document in alphabetical order:

[%hardbreaks]
* Christoph Müllner <christoph.muellner@vrull.eu>
* Cooper Qu <cooper.qu@linux.alibaba.com>
* Lifang Xia <lifang_xia@linux.alibaba.com>
* Philipp Tomsich <philipp.tomsich@vrull.eu>
* Yunhai Shang < yunhai@linux.alibaba.com>
* Zhiwei Liu <zhiwei_liu@linux.alibaba.com>

=== Changelog

* 2022-07-12: Initial draft with four CMO instructions
* 2022-07-16: Adding complete XTheadCmo extension
* 2022-07-20: Adding XTheadMemPair extension, adding HW requirements for XTheadCmo
* 2022-07-26: Adding XTheadCmo U mode permission, Adding XTHeadSync, XTheadFMemIdx
* 2022-07-27: Adding XTheadMemPair, XTheadMemIdx, XTheadMac, XThadCondMov, XTheadB[a,b,s]
* 2022-07-29: Adding XTheadEE (mxstatus.theadisaee) and mxstatus.ucme (as part of XTheadCmo)
* 2022-08-01: Remove XTheadEE and rework availability/permission documentation, adding lifecycle-states,
adding doc versioning and changelog
* 2022-08-10: *.adoc: Fix several formatting issues
* 2022-08-25: Adjusting contributors list
Binary file added images/t-head.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 82 additions & 0 deletions intro.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
== Introduction

The T-Head extension collection was created to augment
the RISC-V ISA by adding additional functionality
to enable faster and more energy-efficient solutions.

The RISC-V ISA and its standardized extensions provide a rich set of
instructions suitable for a wide range of applications, starting from
specialized microcontrollers to HPC systems.
The suitability for such a range of systems comes from the fact that
the RISC-V ISA is modularized with a base instruction set and a range
of extensions that target specific target applications and functionality.

The RISC-V ISA and its authors strongly advertise the ability
to create vendor extensions. Dedicated encoding spaces ensure,
that there are not conflicts with standard extensions.

This document specifies the T-Head extension collection,
a collection of vendor extensions that are implemented
in many T-Head processors.

=== Overview

The T-Head extension collection follows the principles of the RISC-V ISA.
The collection consists of the following ISA extensions:

* `XTheadCmo` provides instructions for cache management.
* `XTheadSync` provides instructions for multi-processor synchronization.
* `XTheadBa` provides instructions for address calculations.
* `XTheadBb` provides instructions for basic bit-manipulation.
* `XTheadBs` provides single-bit instructions.
* `XTheadCondMov` provides instructions for conditional moves.
* `XTheadMemIdx` provides GPR memory operations.
* `XTheadMemPair` provides two-GP-register memory operations.
* `XTheadFMemIdx` provides floating-point memory operations.
* `XTheadMac` provides multiply-accumulate instructions.

=== Dependencies to standard extensions

The T-Head extension collection is designed to be compatible
with RISC-V's base integer instruction sets RV32I and RV64I.

Some instructions are only available if the system's
`XLEN` is 64 (i.e. integer registers and supported user
address space is 64 bits).
To highlight the availability, each extension documents
this for each instruction.

Instruction that operate on floating-point registers can
be used in combination with `F` (32-bit floating-point register)
or `D` (64-bit floating-point registers).
Some instruction are only available if the system implements
the `D` extension. To highlight the availability, each
floating-point extension document this for each instruction.

=== Enablement of extensions and instructions

All extensions and instructions are expected to be enabled at all times.
The instructions can be used at any time when executing in the documented
privilege levels, that permit the execution of the instruction.

However, there might be SoC-specific mechanisms to ensure this behaviour.
E.g. the T-Head C906 requires the CSR field `mxstatus.theadisaee` to
be set to `1` to enable the ISA extensions.
Another example is the CSR field `mxstatus.ucme` of the T-Head C906,
that is required to be set to `1` in order to execute cache management
instructions in `U` mode (if the instruction is documented that this
is permitted).

=== Lifecycle

The lifecycle of the extensions included in this document is
defined on a per-extension base.

Possible states are:

* `Draft`: No guarantees (everything may change).
* `Stable`: No feature additions/removals/changes. Only clarifications.

A `draft` specification is expected to become `stable` in the future
(with exepcted changes until then). A `stable` extension remains in that
state for ever.
Binary file added resources/fonts/Montserrat-ExtraLight.ttf
Binary file not shown.
Binary file added resources/fonts/Montserrat-ExtraLightItalic.ttf
Binary file not shown.
Binary file added resources/fonts/Montserrat-Italic.ttf
Binary file not shown.
Binary file added resources/fonts/Montserrat-Light.ttf
Binary file not shown.
Binary file added resources/fonts/Montserrat-Medium.ttf
Binary file not shown.
Binary file added resources/fonts/Montserrat-MediumItalic.ttf
Binary file not shown.
Binary file added resources/fonts/Montserrat-Regular.ttf
Binary file not shown.
93 changes: 93 additions & 0 deletions resources/fonts/OFL-M.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Copyright 2011 The Montserrat Project Authors (https://github.com/JulietaUla/Montserrat)

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
93 changes: 93 additions & 0 deletions resources/fonts/OFL-P.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Copyright 2019 The Petrona Project Authors (https://github.com/RingoSeeber/Petrona)

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Loading

0 comments on commit 26280ad

Please sign in to comment.