Digital Signal Processing Reference
In-Depth Information
31 30 23 22
0
s
e
f
(
a
)
31 30
20 19
0 31
0
s
e
f
f
(
b
)
FIGURE 3.5.
Data format: (
a
) single precision; (
b
) double precision.
2.
int
or
signed int
: of size 32 bits represented as 2's complement with a
range from
2
31
to (2
31
1)
3.
float
: of size 32 bits represented as IEEE 32-bit with a range from 2
-126
-
-
=
10
38
4.
double
: of size 64 bits represented as IEEE 64-bit with a range from 2
-1022
10
-38
to 2
+128
1.175494
¥
=
3.40282346
¥
=
10
-308
to 2
+1024
10
+308
2.22507385
¥
=
1.79769313
¥
Data types such as
short
for fixed-point multiplication can be more efficient (fewer
cycles) than using
int
. Use of
const
can also increase code performance. Nota-
tions such as Uint16 and Uint32 are supported for casting 16- and 32-bit unsigned
integers, respectively.
3.18.2 Floating-Point Format
With a much wider dynamic range in a floating-point processor, scaling is not an
issue. A floating-point number can be represented using single precision with 32 bits
or double precision with 64 bits, as shown in Figure 3.5. In single-precision format,
bit 31 represents the sign bit, bits 23 through 30 represent the exponent bits, and
bits 0 through 22 represent the fractional bits, as shown in Figure 3.5
a
. Numbers as
small as 10
-38
and as large as 10
+38
can be represented. In double-precision format,
more exponent and fractional bits are available, as shown in Figure 3.5
b
. Since 64
bits are represented, a pair of registers is used. Bits 0 through 31 of the first regis-
ter pair represent the fractional bits. Bits 0 through 19 of the second register pair
also represent the fractional bits, with bits 20 through 30 representing the exponent
bits and bit 31 the sign bit. As a result, numbers as small as 10
-308
and as large as
10
+308
can be represented.
Instructions ending in either
SP
or
DP
represent single and double precision,
respectively. Some of the floating-point instructions (available on the C67x floating-
point processor) have more latencies than do fixed-point instructions. For example,
the fixed-point multiplication
MPY
requires one delay or
NOP
, whereas the single-
precision
MPYSP
requires three delays and the double-precision instruction
MPYDP
requires nine delays.
The single-precision floating-point instructions
ADDSP
and
MPYSP
have three
delay slots and take four cycles to complete execution. The double-precision instruc-
Search WWH ::
Custom Search