5 Multiply accumulate
5.7 Data formats
This section gives details of the data formats used by the smacloop and biquad
instructions.
A signed fractional number of N bits is characterized as x.y, where x+y=N. This means
the number is made up from x bits before the binary point, an implied binary point, and
y fractional bits. Some examples are listed in Table 5.7.
Total bits
32
16
16
Range
-1 ≤ n < 1
-1 ≤ n < 1
-2 ≤ n < 2
Format
1.31
1.15
2.14
Short name
Q31
Q15
Q14
Table 5.7 Example data formats
5.7.1 Range
A value n in x.y format has a range -2x-1 ≤ n < 2x-1.
For example, a value in the format 1.15 has range -1 ≤ n < 1, and the format 2.14 has
range -2 ≤ n < 2.
5.7.2 Multiplication
The characteristic of the product of two fractional values is given by:
a.b * c.d = a+c.b+d
5.7.3 Supported formats
Table 5.8 shows the data formats for multiply-accumulate operations supported by the
ST20-C1.
Description
Name
Format
Signed 16-bit fractional
Q14
14 significant fr actional bits
Signed 16-bit fractional
Q15
15 significant fr actional bits
Signed 16-bit fractional
Q31
31 significant fr actional bits
Table 5.8 Supported multiply accumulate data formats
Note that a Q15 value may be (optimally) stored in a 16-bit field, or a wider (>16-bit)
field with redundant sign bits. The two storage methods are described below.
5.7.4 Q15 in 16 bits
Q15 format is a 16-bit signed fractional value in the range -1 ≤ n < 1. The value is
stored in two’s-complement form with a sign bit (bit 15), an implied binary point
between bits 15 and 14, and 15 significant fractional bits (bit 14 to bit 0).
65/205
®