aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Petit <kevin.petit@arm.com>2023-05-16 09:13:50 +0100
committerKevin Petit <kevin.petit@arm.com>2023-05-18 08:44:54 +0100
commit98b3e33a5590c3ff11f156997f8f2c45d8dc48e0 (patch)
tree5b550c8cdfc9ff887187d984a64f7c6c89485145
parentd7282186957676237717fbaadc4090a5af838cb3 (diff)
downloadspecification-98b3e33a5590c3ff11f156997f8f2c45d8dc48e0.tar.gz
Replace uint6_t with int8_t
Add REQUIRE statements to constrain the range where needed. Also fix a typo. Change-Id: I281e6249d8951b4cb3ff19eaf199660bed3feac9 Signed-off-by: Kevin Petit <kevin.petit@arm.com>
-rw-r--r--chapters/enumerations.adoc2
-rw-r--r--chapters/ewise_binary.adoc3
-rw-r--r--chapters/introduction.adoc8
-rw-r--r--tosa.xml4
4 files changed, 9 insertions, 8 deletions
diff --git a/chapters/enumerations.adoc b/chapters/enumerations.adoc
index 24a1708..9ef6dce 100644
--- a/chapters/enumerations.adoc
+++ b/chapters/enumerations.adoc
@@ -11,6 +11,6 @@
Where enumerated types are specified for an operator, the provided value must be a valid enumerant for that type.
The included tables provide reference values for the enumerations.
-Implementations do not need to use these values, they may subtitue other values as long as they are functionally equivalent.
+Implementations do not need to use these values, they may substitute other values as long as they are functionally equivalent.
include::{generated}/enums.adoc[]
diff --git a/chapters/ewise_binary.adoc b/chapters/ewise_binary.adoc
index 4af347a..864cf5b 100644
--- a/chapters/ewise_binary.adoc
+++ b/chapters/ewise_binary.adoc
@@ -297,8 +297,9 @@ include::{generated}/operators/MUL.adoc[]
[source,c++]
----
+REQUIRE(0 <= shift && shift <= 63);
+REQUIRE(in_t == int32_t || shift == 0);
ERROR_IF(shape != broadcast_shape(shape1, shape2));
-ERROR_IF(in_t != int32_t && shift > 0);
for_each(index in shape) {
dim_t index1 = apply_broadcast(shape, shape1, index);
dim_t index2 = apply_broadcast(shape, shape2, index);
diff --git a/chapters/introduction.adoc b/chapters/introduction.adoc
index 66bc9bf..c0b0874 100644
--- a/chapters/introduction.adoc
+++ b/chapters/introduction.adoc
@@ -544,7 +544,7 @@ The values to achieve a scaling of 1.0 are shift=30, multiplier=1<<30 for apply_
[source,c++]
----
-int32_t apply_scale_32(int32_t value, int32_t multiplier, uint6_t shift, bool_t double_round=false) {
+int32_t apply_scale_32(int32_t value, int32_t multiplier, int8_t shift, bool_t double_round=false) {
REQUIRE(multiplier >= 0);
REQUIRE(2 <= shift && shift <= 62);
REQUIRE(value >= (-1 << (shift - 1)) && value < (1 << (shift - 1));
@@ -559,7 +559,7 @@ int32_t apply_scale_32(int32_t value, int32_t multiplier, uint6_t shift, bool_t
return (int32_t)result;
}
-int32_t apply_scale_16(int48_t value, int16_t multipler, uint6_t shift) {
+int32_t apply_scale_16(int48_t value, int16_t multipler, int8_t shift) {
REQUIRE(multiplier >= 0);
REQUIRE(2 <= shift && shift <= 62);
int64_t round = (1 << (shift - 1));
@@ -576,7 +576,7 @@ In some functions, the multiplier and shift are combined into a scale_t structur
----
typedef struct {
int32_t multiplier;
- uint6_t shift;
+ int8_t shift;
} scale_t;
----
@@ -652,4 +652,4 @@ void generate_lookup_table(int16_t *table, int32_t (*reference)(int32_t))
The following publications are referred to in this specification, or provide more information:
-. IEEE Std 754-2008, _IEEE Standard for Floating-point Arithmetic_, August 2008. \ No newline at end of file
+. IEEE Std 754-2008, _IEEE Standard for Floating-point Arithmetic_, August 2008.
diff --git a/tosa.xml b/tosa.xml
index c11ad99..430f5fd 100644
--- a/tosa.xml
+++ b/tosa.xml
@@ -1052,7 +1052,7 @@
<description>Input tensor with the same rank as input1</description>
<rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input(MT)|attribute(BI,MI)" name="shift" type="uint6_t" shape="-">
+ <argument category="input(MT)|attribute(BI,MI)" name="shift" type="int8_t" shape="-">
<description>Result right shift (int32_t data type only)</description>
</argument>
<argument category="output" name="output" type="out_t*" shape="shape">
@@ -2338,7 +2338,7 @@ used.</description>
<description>Scaling multiplier array</description>
<rank min="1" max="1"/>
</argument>
- <argument category="input(MT)|attribute(BI,MI)" name="shift" type="uint6_t*" shape="[NC]">
+ <argument category="input(MT)|attribute(BI,MI)" name="shift" type="int8_t*" shape="[NC]">
<description>Scaling shift array</description>
<rank min="1" max="1"/>
</argument>