Escolar Documentos
Profissional Documentos
Cultura Documentos
®
Floating-Point Multiplier
EXPONENT_WIDTH =
MANTISSA_WIDTH =
FP_MULT
SA
MA[MANTISSA_WIDTH..1] M_OUT[MANTISSA_WIDTH * 2..1]
EA[EXPONENT_WIDTH..1] E_OUT[EXPONENT_WIDTH..1]
SB S_OUT
MB[MANTISSA_WIDTH..1]
EB[EXPONENT_WIDTH..1]
Function Prototype
The AHDL Function Prototype for the fp_mult function is shown below:
Altera Corporation 1
A-FS-04-01
FS 4: fp_mult Floating-Point Multiplier
Parameters
Parameters for the fp_mult function are provided in Table 1.
Ports
Input and output ports for the fp_mult function are shown in Table 2.
In floating-point functions, the sign bit represents the sign of the mantissa:
1 for positive, 0 for negative. The mantissa is a positive number less than
1. A 0 is implied to the left of the binary point. After normalization, the
most significant bit (MSB) is always 1. The exponent is represented in
excess 2(n-1) notation, where n is the number of bits in the exponent.
2 Altera Corporation
FS 4: fp_mult Floating-Point Multiplier
S = 1, M = 11000000, E = 1000001
S = 1, M = 10100000, E = 0111111
m m n n
+ +
Fixed-Point
Multiplier
(LPM_MULT) EXPONENT_OFFSET = 2(n – 1)
+ –
m×2
Post-Normalizer
m×2 n
Altera Corporation 3
FS 4: fp_mult Floating-Point Multiplier
To normalize the mantissa, the mantissa is shifted left (i.e., the mantissa is
multiplied by powers of 2). For each bit shifted left, the exponent must be
reduced by 1. The following example shows a number before
normalization and its normalized equivalent:
4 Altera Corporation
FS 4: fp_mult Floating-Point Multiplier
Altera Corporation 5
FS 4: fp_mult Floating-Point Multiplier
Floating-Point The fp_mult function does not check for error conditions such as
overflow and underflow because implementing error detection and
Error Detection correction in a design can add significant delays to the circuit. Although
error detection can be implemented quickly, error correction causes long
delays because it requires the exponent and/or mantissa values to be
modified. Boundary conditions for the mantissa and exponent can also be
added by the designer. Error detection and correction, and boundary
conditions can be added to fp_mult by modifying the Logic Section of a
copy of the fp_mult.tdf file.
6 Altera Corporation
FS 4: fp_mult Floating-Point Multiplier
Underflow occurs when the MSB of the exponent is equal to 0 after the
exponents are added and 64 is subtracted from the result, but equal to 1
after the post-normalization correction. With a 7-bit exponent, underflow
occurs when the exponent is less than –64. The general AHDL equation
for underflow is as follows:
Boundary Conditions
The values of the mantissa and/or exponent can be used to set boundary
conditions or to indicate error conditions such as not-a-number (NaN).
The NaN condition occurs as a result of invalid operations, such as
zero × infinity. Infinity can be represented in several ways, such as setting
the exponent to its largest value. The largest exponent cannot be used to
represent other numbers if it is used to represent infinity. Therefore, some
dynamic range is lost.
Table 5 shows the mantissa and exponent values used to set boundary
conditions and the NaN error condition.
Altera Corporation 7
FS 4: fp_mult Floating-Point Multiplier
Altera, MAX, MAX+PLUS, and FLEX are registered trademarks of Altera Corporation. The following are
trademarks of Altera Corporation: MAX+PLUS II, AHDL, and FLEX 10K. Altera acknowledges the
® trademarks of other organizations for their respective products or services mentioned in this document,
specifically: Verilog and Verilog-XL are registered trademarks of Cadence Design Systems, Inc. Mentor
2610 Orchard Parkway Graphics is a registered trademark of Mentor Graphics Corporation. Synopsys is a registered trademark of
Synopsys, Inc. Viewlogic is a registered trademark of Viewlogic Systems, Inc. Altera products are protected
San Jose, CA 95134-2020 under numerous U.S. and foreign patents and pending applications, maskwork rights, and copyrights. Altera
(408) 894-7000 warrants performance of its semiconductor products to current specifications in accordance with Altera’s
Applications Hotline: standard warranty, but reserves the right to make changes to any products and services at any time without
notice. Altera assumes no responsibility or liability arising out of the application or use of
(800) 800-EPLD any information, product, or service described herein except as expressly agreed to in
Customer Marketing: writing by Altera Corporation. Altera customers are advised to obtain the latest version of
(408) 894-7104 device specifications before relying on any published information and before placing
orders for products or services.
Literature Services:
(408) 894-7144 Copyright 1996 Altera Corporation. All rights reserved.
8 Altera Corporation