IP Catalog and Parameter Editor...................................................................................................1-3
Specifying IP Core Parameters and Options................................................................................1-4
Specifying IP Core Parameters and Options (Legacy Parameter Editors)...............................1-8
Upgrading IP Cores.....................................................................................................................................1-9
Migrating IP Cores to a Different Device...................................................................................1-12
Floating-Point IP Cores General Features..............................................................................................1-12
IEEE-754 Standard for Floating-Point Arithmetic............................................................................... 1-13
The Altera® floating-point megafunction IP cores enable you to perform floating-point arithmetic in
FPGAs through optimized parameterizable functions for Altera device architectures.
You can customize the IP cores by configuring various parameters to accommodate your needs.
List of Floating-Point IP Cores
This table lists the Floating-Point IP cores.
Table 1-1: List of IP Cores
IP Core NameFunction Overview
Operator Functions
ALTFP_ADD_SUBAdder/Subtractor
ALTFP_DIVDivider
ALTFP_MULTMultiplier
ALTFP_SQRTSquare Root
Algebraic and Trancendental Functions
ALTFP_EXPExponential
ALTFP_INVInverse
ALTFP_INV_SQRTInverse Square Root
ALTFP_LOGNatural Logarithm
Trigonometric Functions
ALTFP_ATANArctangent
ALTFP_SINCOSTrigonometric Sine/Cosine
Other Functions
ALTFP_ABSAbsolute value
ALTFP_COMPAREComparator
ALTFP_CONVERTConverter
2014 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, ENPIRION, MAX, MEGACORE, NIOS, QUARTUS and STRATIX words and logos are
trademarks of Altera Corporation and registered in the U.S. Patent and Trademark Office and in other countries. All other words and logos identified as
trademarks or service marks are the property of their respective holders as described at www.altera.com/common/legal.html. Altera warrants performance
of its semiconductor products to current specifications in accordance with Altera's 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 any information,
product, or service described herein except as expressly agreed to in writing by Altera. Altera customers are advised to obtain the latest version of device
specifications before relying on any published information and before placing orders for products or services.
ISO
9001:2008
Registered
acds
quartus - Contains the Quartus II software
ip - Contains the Altera IP Library and third-party IP cores
altera - Contains the Altera IP Library source code
<IP core name> - Contains the IP core source files
1-2
Installing and Licensing IP Cores
IP Core NameFunction Overview
ALTERA_FP_ACC_CUSTOMAn Application Specific Accumulator
ALTERA_FP_FUNCTIONSA Collection of Floating-Point Functions
Complex Functions
ALTFP_MATRIX_INVMatrix Inverse
ALTFP_MATRIX_MULTMatrix Multiplier
Related Information
Introduction to Altera IP Cores
Provides general information about Altera IP cores
Installing and Licensing IP Cores
The Altera IP Library provides many useful IP core functions for production use without purchasing an
additional license. You can evaluate any Altera® IP core in simulation and compilation in the Quartus® II
software using the OpenCore® evaluation feature. Some Altera IP cores, such as MegaCore® functions,
require that you purchase a separate license for production use. You can use the OpenCore Plus feature to
evaluate IP that requires purchase of an additional license until you are satisfied with the functionality and
performance. After you purchase a license, visit the Self Service Licensing Center to obtain a license
number for any Altera product.
UG-01058
2014.12.19
Figure 1-1: IP Core Installation Path
The default IP installation directory on Windows is <drive>:\altera\<version number>; on Linux it is
Note:
<home directory>/altera/ <version number>.
Related Information
• Altera Licensing Site
• Altera Software Installation and Licensing Manual
Design Flow
Use the IP Catalog and parameter editor to define and instantiate complex IP cores. Using the GUI
ensures that you set all IP core ports and parameters properly.
If you are an expert user, and choose to configure the IP core directly through parameterized instantiation
in your design, refer to the port and parameter details. The details of these ports and parameters are
hidden in the parameter editor.
Altera Corporation
About Floating-Point IP Cores
Send Feedback
Search and filter IP for your target device
Double-click to customize, right-click for information
UG-01058
2014.12.19
IP Catalog and Parameter Editor
The Quartus II IP Catalog (Tools > IP Catalog) and parameter editor help you easily customize and
integrate IP cores into your project. You can use the IP Catalog and parameter editor to select, customize,
and generate files representing your custom IP variation.
Note: The IP Catalog (Tools > IP Catalog) and parameter editor replace the MegaWizard™ Plug-In
Manager for IP selection and parameterization, beginning in Quartus II software version 14.0. Use
the IP Catalog and parameter editor to locate and paramaterize Altera IP cores.
The IP Catalog lists IP cores available for your design. Double-click any IP core to launch the parameter
editor and generate files representing your IP variation. The parameter editor prompts you to specify an
IP variation name, optional ports, and output file generation options. The parameter editor generates a
top-level Qsys system file (.qsys) or Quartus II IP file (.qip) representing the IP core in your project. You
can also parameterize an IP variation without an open project.
Use the following features to help you quickly locate and select an IP core:
• Filter IP Catalog to Show IP for active device family or Show IP for all device families.
• Search to locate any full or partial IP core name in IP Catalog. Click Search for Partner IP, to access
partner IP information on the Altera website.
• Right-click an IP core name in IP Catalog to display details about supported devices, open the IP core's
installation folder, andor view links to documentation.
IP Catalog and Parameter Editor
1-3
Figure 1-2: Quartus II IP Catalog
The IP Catalog is also available in Qsys (View > IP Catalog). The Qsys IP Catalog includes
Note:
exclusive system interconnect, video and image processing, and other system-level IP that are not
About Floating-Point IP Cores
Send Feedback
Altera Corporation
View IP port
and parameter
details
Apply preset parameters for
specific applications
Specify your IP variation name
and target device
Legacy parameter
editors
1-4
Using the Parameter Editor
available in the Quartus II IP Catalog. For more information about using the Qsys IP Catalog, refer
to Creating a System with Qsys in the Quartus II Handbook.
Using the Parameter Editor
The parameter editor helps you to configure IP core ports, parameters, and output file generation options.
• Use preset settings in the parameter editor (where provided) to instantly apply preset parameter values
for specific applications.
• View port and parameter descriptions, and links to documentation.
• Generate testbench systems or example designs (where provided).
Figure 1-3: IP Parameter Editors
UG-01058
2014.12.19
Specifying IP Core Parameters and Options
The parameter editor GUI allows you to quickly configure your custom IP variation. Use the following
steps to specify IP core options and parameters in the Quartus II software. Refer to Specifying IP CoreParameters and Options (Legacy Parameter Editors) for configuration of IP cores using the legacy
parameter editor.
1. In the IP Catalog (Tools > IP Catalog), locate and double-click the name of the IP core to customize.
The parameter editor appears.
2. Specify a top-level name for your custom IP variation. The parameter editor saves the IP variation
settings in a file named <your_ip>.qsys. Click OK.
3. Specify the parameters and options for your IP variation in the parameter editor, including one or
more of the following. Refer to your IP core user guide for information about specific IP core
parameters.
Altera Corporation
About Floating-Point IP Cores
Send Feedback
View IP port
and parameter
details
Apply preset parameters for
specific applications
Specify your IP variation name
and target device
UG-01058
2014.12.19
Files Generated for Altera IP Cores
• Optionally select preset parameter values if provided for your IP core. Presets specify initial
parameter values for specific applications.
• Specify parameters defining the IP core functionality, port configurations, and device-specific
features.
• Specify options for processing the IP core files in other EDA tools.
4. Click Generate HDL, the Generation dialog box appears.
5. Specify output file generation options, and then click Generate. The IP variation files generate
according to your specifications.
6. To generate a simulation testbench, click Generate > Generate Testbench System.
7. To generate an HDL instantiation template that you can copy and paste into your text editor, click
Generate > HDL Example.
8. Click Finish. The parameter editor adds the top-level .qsys file to the current project automatically. Ifyou are prompted to manually add the .qsys file to the project, click Project > Add/Remove Files in
Project to add the file.
9. After generating and instantiating your IP variation, make appropriate pin assignments to connect
ports.
Figure 1-4: IP Parameter Editor
1-5
Files Generated for Altera IP Cores
The Quartus software generates the following IP core output file structure.
About Floating-Point IP Cores
Send Feedback
Altera Corporation
<your_testbench>_tb.csv
<your_testbench>_tb.spd
<your_ip>.cmp - VHDL component declaration file
<your_ip>.ppf - XML I/O pin information file
<your_ip>.qip - Lists IP synthesis files
<your_ip>.sip - Lists files for simulation
<your_ip>.v or .vhd
Top-level IP synthesis file
<your_ip>.v or .vhd
Top-level simulation file
<simulator_setup_scripts>
<your_ip>.qsys - System or IP integration file
<your_ip>_bb.v - Verilog HDL black box EDA synthesis file
<your_ip>_inst.v or .vhd - Sample instantiation template
<your_ip>_generation.rpt - IP generation report
<your_ip>.debuginfo - Contains post-generation information
<your_ip>.html - Connection and memory map data
<your_ip>.bsf - Block symbol schematic
<your_ip>.spd - Combines individual simulation scripts
<system>.sopcinfoDescribes the connections and IP component parameterizations in
The Qsys system or top-level IP variation file. <my_ip> is the name
that you give your IP variation.
your Qsys system. You can parse its contents to get requirements
when you develop software drivers for IP components.
Downstream tools such as the Nios II tool chain use this file.
The .sopcinfo file and the system.h file generated for the Nios II tool
chain include address map information for each slave relative to each
master that accesses the slave. Different masters may have a different
address map to access a particular slave component.
About Floating-Point IP Cores
Send Feedback
UG-01058
2014.12.19
Files Generated for Altera IP Cores
File NameDescription
<my_ip>.cmpThe VHDL Component Declaration (.cmp) file is a text file that
contains local generic and port definitions that you can use in VHDL
design files.
1-7
<my_ip>.html
A report that contains connection information, a memory map
showing the address of each slave with respect to each master to
which it is connected, and parameter assignments.
<my_ip>_generation.rptIP or Qsys generation log file. A summary of the messages during IP
generation.
<my_ip>.debuginfoContains post-generation information. Used to pass System Console
and Bus Analyzer Toolkit information about the Qsys interconnect.
The Bus Analysis Toolkit uses this file to identify debug components
in the Qsys interconnect.
<my_ip>.qip
Contains all the required information about the IP component to
integrate and compile the IP component in the Quartus software.
<my_ip>.csvContains information about the upgrade status of the IP component.
<my_ip>.bsfA Block Symbol File (.bsf) representation of the IP variation for use
in Quartus Block Diagram Files (.bdf).
<my_ip>.spd
Required input file for ip-make-simscript to generate simulation
scripts for supported simulators. The .spd file contains a list of files
generated for simulation, along with information about memories
that you can initialize.
<my_ip>.ppfThe Pin Planner File (.ppf) stores the port and node assignments for
IP components created for use with the Pin Planner.
<my_ip>_bb.vYou can use the Verilog black-box (_bb.v) file as an empty module
declaration for use as a black box.
<my_ip>.sipContains information required for NativeLink simulation of IP
components. You must add the .sip file to your Quartus project.
<my_ip>_inst.v or _inst.vhdHDL example instantiation template. You can copy and paste the
contents of this file into your HDL file to instantiate the IP variation.
<my_ip>.regmapIf IP contains register information, .regmap file generates.
The .regmap file describes the register map information of master
and slave interfaces. This file complements the .sopcinfo file by
providing more detailed register information about the system. This
enables register display views and user customizable statistics in the
System Console.
About Floating-Point IP Cores
Send Feedback
Altera Corporation
1-8
Specifying IP Core Parameters and Options (Legacy Parameter Editors)
File NameDescription
UG-01058
2014.12.19
<my_ip>.svd
<my_ip>.v
or
<my_ip>.vhd
mentor/
aldec/
/synopsys/vcs
/synopsys/vcsmx
Allows HPS System Debug tools to view the register maps of
peripherals connected to HPS within a Qsys system.
During synthesis, the .svd files for slave interfaces visible to System
Console masters are stored in the .sof file in the debug section.
System Console reads this section, which Qsys can query for register
map information. For system slaves, Qsys can access the registers by
name.
HDL files that instantiate each submodule or child IP core for
synthesis or simulation.
Contains a ModelSim® script msim_setup.tcl to set up and run a
simulation.
Contains a Riviera-PRO script rivierapro_setup.tcl to setup and run a
simulation.
Contains a shell script vcs_setup.sh to set up and run a VCS
®
simulation.
Contains a shell script vcsmx_setup.sh and synopsys_ sim.setup file to
set up and run a VCS MX® simulation.
/cadence
Contains a shell script ncsim_setup.sh and other setup files to set up
and run an NCSIM simulation.
/submodulesContains HDL files for the IP core submodule.
<child IP cores>/For each generated child IP core directory, Qsys generates /synth and /
sim sub-directories.
Specifying IP Core Parameters and Options (Legacy Parameter Editors)
Some IP cores use a legacy version of the parameter editor for configuration and generation. Use the
following steps to configure and generate an IP variation using a legacy parameter editor.
The legacy parameter editor generates a different output file structure than the latest parameter
Note:
editor. Refer to Specifying IP Core Parameters and Options for configuration of IP cores that use the
latest parameter editor.
Altera Corporation
About Floating-Point IP Cores
Send Feedback
Legacy parameter
editors
UG-01058
2014.12.19
Figure 1-6: Legacy Parameter Editors
Upgrading IP Cores
1-9
1. In the IP Catalog (Tools > IP Catalog), locate and double-click the name of the IP core to customize.
The parameter editor appears.
2. Specify a top-level name and output HDL file type for your IP variation. This name identifies the IP
core variation files in your project. Click OK.
3. Specify the parameters and options for your IP variation in the parameter editor. Refer to your IP core
user guide for information about specific IP core parameters.
4. Click Finish or Generate (depending on the parameter editor version). The parameter editor generates
the files for your IP variation according to your specifications. Click Exit if prompted when generation
is complete. The parameter editor adds the top-level .qip file to the current project automatically.
Note:
Upgrading IP Cores
IP core variants generated with a previous version of the Quartus II software may require upgrading
before use in the current version of the Quartus II software. Click Project > Upgrade IP Components to
identify and upgrade IP core variants.
The Upgrade IP Components dialog box provides instructions when IP upgrade is required, optional, or
unsupported for specific IP cores in your design. You must upgrade IP cores that require it before you can
compile the IP variation in the current version of the Quartus II software. Many Altera IP cores support
automatic upgrade.
To manually add an IP variation generated with legacy parameter editor to a project, click
Project > Add/Remove Files in Project and add the IP variation .qip file.
About Floating-Point IP Cores
Send Feedback
Altera Corporation
1-10
Upgrading IP Cores
The upgrade process renames and preserves the existing variation file (.v, .sv, or .vhd) as <my_variant>_
BAK.v, .sv, .vhd in the project directory.
Table 1-3: IP Core Upgrade Status
IP Core StatusCorrective Action
UG-01058
2014.12.19
Required Upgrade IP
Components
Optional Upgrade IP
Components
You must upgrade the IP variation before compiling in the current version of
the Quartus II software.
Upgrade is optional for this IP variation in the current version of the Quartus
II software. You can upgrade this IP variation to take advantage of the latest
development of this IP core. Alternatively you can retain previous IP core
characteristics by declining to upgrade.
Upgrade UnsupportedUpgrade of the IP variation is not supported in the current version of the
Quartus II software due to IP core end of life or incompatibility with the
current version of the Quartus II software. You are prompted to replace the
obsolete IP core with a current equivalent IP core from the IP Catalog.
Before you begin
• Archive the Quartus II project containing outdated IP cores in the original version of the Quartus II
software: Click Project > Archive Project to save the project in your previous version of the Quartus II
software. This archive preserves your original design source and project files.
• Restore the archived project in the latest version of the Quartus II software: Click Project > RestoreArchived Project. Click OK if prompted to change to a supported device or overwrite the project
database. File paths in the archive must be relative to the project directory. File paths in the archive
must reference the IP variation .v or .vhd file or .qsys file (not the .qip file).
1. In the latest version of the Quartus II software, open the Quartus II project containing an outdated IP
core variation. The Upgrade IP Components dialog automatically displays the status of IP cores in
your project, along with instructions for upgrading each core. Click Project > Upgrade IP
Components to access this dialog box manually.
2. To simultaneously upgrade all IP cores that support automatic upgrade, click Perform Automatic
Altera Corporation
Upgrade. The Status and Version columns update when upgrade is complete. Example designs
provided with any Altera IP core regenerate automatically whenever you upgrade the IP core.
About Floating-Point IP Cores
Send Feedback
Displays upgrade
status for all IP cores
in the Project
Upgrades all IP core that support “Auto Upgrade”
Upgrades individual IP cores unsupported by “Auto Upgrade”
Checked IP cores
support “Auto Upgrade”
Successful
“Auto Upgrade”
Upgrade
unavailable
Double-click to
individually migrate
UG-01058
2014.12.19
Figure 1-7: Upgrading IP Cores
Upgrading IP Cores
1-11
Example 1-1: Upgrading IP Cores at the Command Line
You can upgrade IP cores that support auto upgrade at the command line. IP cores that do not
support automatic upgrade do not support command line upgrade.
• To upgrade a single IP core that supports auto-upgrade, type the following command:
IP cores older than Quartus II software version 12.0 do not support upgrade.
Note:
Altera verifies that the current version of the Quartus II software compiles the
previous version of each IP core. The Altera IP Release Notes reports any verifica‐
tion exceptions for Altera IP cores. Altera does not verify compilation for IP cores
older than the previous two releases.
About Floating-Point IP Cores
Send Feedback
Altera Corporation
1-12
Migrating IP Cores to a Different Device
Related Information
Altera IP Release Notes
Migrating IP Cores to a Different Device
IP migration allows you to target the latest device families with IP originally generated for a different
device. Some Altera IP cores require individual migration to upgrade. The Upgrade IP Components
dialog box prompts you to double-click IP cores that require individual migration.
1. To display IP cores requiring migration, click Project > Upgrade IP Components. The Description
field prompts you to double-click IP cores that require individual migration.
2. Double-click the IP core name, and then click OK after reading the information panel.
The parameter editor appears showing the original IP core parameters.
3. For the Currently selected device family, turn off Match project/default, and then select the new
target device family.
4. Click Finish, and then click Finish again to migrate the IP variation using best-effort mapping to new
parameters and settings. Click OK if you are prompted that the IP core is unsupported for the current
device. A new parameter editor opens displaying best-effort mapped parameters.
5. Click Generate HDL, and then confirm the Synthesis and Simulation file options. Verilog is the
parameter editor default HDL for synthesis files. If your original IP core was generated for VHDL,
select VHDL to retain the original output HDL format.
6. To regenerate the new IP variation for the new target device, click Generate. When generation is
complete, click Close.
7. Click Finish to complete migration of the IP core. Click OK if you are prompted to overwrite IP core
files. The Device Family column displays the migrated device support. The migration process replaces
<my_ip>.qip with the <my_ip>.qsys top-level IP file in your project.
UG-01058
2014.12.19
Note:
If migration does not replace <my_ip>.qip with <my_ip>.qsys, click Project > Add/Remove
Files in Project to replace the file in your project.
8. Review the latest parameters in the parameter editor or generated HDL for correctness. IP migration
may change ports, parameters, or functionality of the IP core. During migration, the IP core's HDL
generates into a library that is different from the original output location of the IP core. Update any
assignments that reference outdated locations. If your upgraded IP core is represented by a symbol in a
supporting Block Design File schematic, replace the symbol with the newly generated <my_ip>.bsf
after migration.
Note:
The migration process may change the IP variation interface, parameters, and functionality.
This may require you to change your design or to re-parameterize your variant after the
Upgrade IP Components dialog box indicates that migration is complete. The Description
field identifies IP cores that require design or parameter changes.
Related Information
Altera IP Release Notes
Floating-Point IP Cores General Features
All Altera floating-point IP cores offer the following features:
Altera Corporation
About Floating-Point IP Cores
Send Feedback
SEM
UG-01058
2014.12.19
IEEE-754 Standard for Floating-Point Arithmetic
• Support for floating-point formats.
• Input support for not-a-number (NaN), infinity, zero, and normal numbers.
• Optional asynchronous input ports including asynchronous clear (aclr) and clock enable (clk_en).
• Support for round-to-nearest-even rounding mode.
• Compute results of any mathematical operations according to the IEEE-754 standard compliance with
a maximum of 1 unit in the last place (u.l.p.) error. This assumption is applied to all floating-point IP
cores excluding complex matrix multiplication and inverse operations (for example,
ALTFP_MATRIX_MULTI and ALFP_MATRIX_INV), where a slight increase in errors is observed
due to the accumulation of errors during the mathematical operation.
Altera floating-point IP cores do not support denormal number inputs. If the input is a denormal value,
the IP core forces the value to zero and treats the value as a zero before going through any operation.
Related Information
FFT MegaCore Function User Guide
Altera also offers the single-precision floating-point option in the FFT MegaCore.
IEEE-754 Standard for Floating-Point Arithmetic
The floating-point IP cores implement the following representations in the IEEE-754 standard:
1-13
• Floating-point numbers
• Special values (zero, infinity, denormal numbers, and NaN bit combinations)
• Single-precision, double-precision, and single-extended precision formats for floating-point numbers
Floating-Point Formats
All floating-point formats have binary patterns. In Figure 1–1, S represents a sign bit, E represents an
exponent field, and M is the mantissa (part of a logarithm, or fraction) field.
For a normal floating-point number, a leading 1 is always implied, for example, binary 1.0011 or
decimal 1.1875 is stored as 0011 in the mantissa field. This format saves the mantissa field from using an
extra bit to represent the leading 1. However, the leading bit for a denormal number can be either 0 or 1.
For zero, infinity, and NaN, the mantissa field does not have an implied leading 1 nor any explicit leading
bit.
Figure 1-8: IEEE-754 Floating-Point Format
This figure shows a floating-point format.
Single-Precision Format
The single-precision format contains the following binary patterns:
• The MSB holds the sign bit.
• The next 8 bits hold the exponent bits.
• 23 LSBs hold the mantissa.
The total width of a floating-point number in the single-precision format is 32 bits. The bias for the
single-precision format is 127.
About Floating-Point IP Cores
Send Feedback
Altera Corporation
SEM
313023 220
SEM
636252 510
1-14
Double-Precision Format
Figure 1-9: Single-Precision Representation
This figure shows a single-precision representation.
Double-Precision Format
The double-precision format contains the following binary patterns:
• The MSB holds the sign bit.
• The next 11 bits hold the exponent bits.
• 52 LSBs hold the mantissa.
The total width of a floating-point number in the double-precision format is 64 bits. The bias for the
double-precision format is 1023.
Figure 1-10: Double-Precision Representation
This figure shows a double-precision representation.
UG-01058
2014.12.19
Single-Extended Precision Format
The single-extended precision format contains the following binary patterns:
• The MSB holds the sign bit.
• The exponent and mantissa fields do not have fixed widths.
• The minimum exponent field width is 11 bits and must be less than the width of the mantissa field.
• The width of the mantissa field must be a minimum of 31 bits.
The sum of the widths of the sign bit, exponent field, and mantissa field must be a minimum of 43 bits
and a maximum of 64 bits. The bias for the single-extended precision format is unspecified in the
IEEE-754 standard. In these IP cores, a bias of 2(WIDTH_EXP–1)–1 is assumed for the single-extended
precision format.
Special Case Numbers
The following table lists the special case numbers defined by the IEEE-754 standard and the data bit
representations.
Table 1-4: Special Case Numbers in IEEE-754 Representation
MeaningSign FieldExponent FieldMantissa Field
ZeroDon’t careAll 0’sAll 0’s
Positive Denormalized0All 0’sNon-zero
Altera Corporation
About Floating-Point IP Cores
Send Feedback
Sign
bit
Integer bits
310
UG-01058
2014.12.19
Rounding
Rounding
MeaningSign FieldExponent FieldMantissa Field
Negative Denormalized1All 0’sNon-zero
Positive Infinity0All 1’sAll 0’s
Negative Infinity1All 1’sAll 0’s
Not-a-Number (NaN)Don’t careAll 1’sNon-zero
The IEEE-754 standard defines four types of rounding modes, which are:
• round-to-nearest-even
• round-toward-zero
• round-toward-positive-infinity
• round-toward-negative-infinity
Altera floating-point IP cores support only the most commonly used rounding mode, which is the roundto-nearest-even mode (TO_NEAREST). With round-to-nearest-even, the IP core rounds the result to the
nearest floating-point number. If the result is exactly halfway between two floating-point numbers, the IP
core rounds the result so that the LSB becomes a zero, which is even.
1-15
Non-IEEE-754 Standard Format
Only the ALTFP_CONVERT and ALTERA_FP_FUNCTIONS (when the convert function is selected)
support the fixed point format.
The fixed-point data type is similar to the conventional integer data type, except that the fixed-point data
carries a predetermined number of fractional bits. If the width of the fraction is 0, the data becomes a
normal signed integer.
The notation for fixed-point format numbers in this user guide is Qm.f, where Q designates that the
number is in Q format notation, m is the number of bits used to indicate the integer portion of the
number, and f is the number of bits used to indicate the fractional portion of the number.
For example, Q4.12 describes a number with 4 integer bits and 12 fractional bits in a 16-bit word.
The following figures show the difference between the signed-integer format and the fixed-point format
for a 32-bit number.
Figure 1-11: Signed-Integer Format
About Floating-Point IP Cores
Send Feedback
Altera Corporation
Sign
bit
Integer bits
310
Fraction bits
1-16
Floating-Points IP Cores Output Latency
Figure 1-12: Fixed-Point Format
Floating-Points IP Cores Output Latency
The IP cores measure the output latency in clock cycles and is different for each IP core. In some IP cores,
the precision modes determine the number of clock cycles between the input and output result. When you
select a mode, the options for latency are fixed for that mode.
For specific details about latency options, refer to the Output Latency section of your selected IP core in
this user guide.
Floating-Point IP Cores Design Example Files
The design examples for each IP core in this user guide use the IP Catalog and parameter editor to define
custom IP variations.
UG-01058
2014.12.19
Simulate the designs in the ModelSim®-Altera software to generate a waveform display of the device
behavior. You must be familiar with the ModelSim-Altera software before trying out the design examples.
Table 1-5: Design Files for Floating-Point IP Cores
Floating-Point IP CoresDesign Files
ALTFP_ADD_SUB
ALTFP_DIV
ALTFP_MULT
ALTFP_SQRT
ALTFP_EXP
ALTFP_INV
• altfp_add_sub_DesignExample.zip (Quartus II design files)
• ALTERA_FP_MATRIX_INV Design Example: Matrix Inverse of Single-Precision Format
Numbers on page 2-6
• ALTFP_ADD_SUB Design Example: Addition of Double-Precision Format Numbers on page 53
• ALTFP_DIV Design Example: Division of Single-Precision on page 6-4
• ALTFP_MULT Design Example: Multiplication of Double-Precision Format Numbers on page 73
• ALTFP_SQRT Design Example: Square Root of Single-Precision Format Numbers on page 8-3
• ALTFP_EXP Design Example: Exponential of Single-Precision Format Numbers on page 9-2
• ALTFP_INV Design Example: Inverse of Single-Precision Format Numbers on page 10-2
This design example uses the ALTFP_INV IP core to compute the inverse of single-precision format
numbers. This example uses the parameter editor in the Quartus II software.
• ALTFP_INV_SQRT Design Example: Inverse Square Root of Single-Precision Format Numbers on
page 11-2
• ALTFP_LOG Design Example: Natural Logarithm of Single-Precision Format Numbers on page
12-2
• ALTFP_ABS Design Example: Absolute Value of Multiplication Results on page 15-2
About Floating-Point IP Cores
Send Feedback
Altera Corporation
1-18
VHDL Component Declaration
• ALTFP_COMPARE Design Example: Comparison of Single-Precision Format Numbers on page
16-2
• ALTFP_CONVERT Design Example: Convert Double-Precision Floating-Point Format Numbers
on page 17-6
• Floating-Point IP Cores Design Examples
Provides the design example files for the Floating-Point IP cores
• ModelSim-Altera Software Support
Provides information about installation, usage, and troubleshooting
VHDL Component Declaration
The VHDL component declaration is located in the <Quartus II installation directory>\libraries\vhdl\altera_mf\
altera_mf_components.vhd
VHDL LIBRARY-USE Declaration
The VHDL LIBRARY-USE declaration is not required if you use the VHDL Component Declaration.
LIBRARY altera_mf;
UG-01058
2014.12.19
USE altera_mf_altera_mf_components.all;
Altera Corporation
About Floating-Point IP Cores
Send Feedback
2014.12.19
www.altera.com
101 Innovation Drive, San Jose, CA 95134
ALTERA_FP_MATRIX_INV IP Core
2
UG-01058
Subscribe
Send Feedback
ALTERA_FP_MATRIX_INV Features
The ALTERA_FP_MATRIX_INV IP core offers the following features:
• Inversion of a matrix.
• Support for floating-point format in single precision.
• Support for VHDL and Verilog HDL languages.
• Support for matrix sizes up to are 4 × 4, 6 × 6, 8 × 8, 16 ×16, 32 × 32, and 64 × 64.
• Use of control signal, load.
• Use of handshaking signals: busy, outvalid, and done.
ALTERA_FP_MATRIX_INV Output Latency
The ALTERA_FP_MATRIX_INV IP core does not have a fixed output latency. Instead, it uses
handshaking signals to interface with external circuitry.
ALTERA_FP_MATRIX_INV Resource Utilization and Performance
This table lists the resource utilization and performance information for the ALTERA_FP_MATRIX_INV
IP core. The information was derived using the Quartus II software version 10.0
2014 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, ENPIRION, MAX, MEGACORE, NIOS, QUARTUS and STRATIX words and logos are
trademarks of Altera Corporation and registered in the U.S. Patent and Trademark Office and in other countries. All other words and logos identified as
trademarks or service marks are the property of their respective holders as described at www.altera.com/common/legal.html. Altera warrants performance
of its semiconductor products to current specifications in accordance with Altera's 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 any information,
product, or service described herein except as expressly agreed to in writing by Altera. Altera customers are advised to obtain the latest version of device
specifications before relying on any published information and before placing orders for products or services.
ISO
9001:2008
Registered
2-2
ALTERA_FP_MATRIX_INV Functional Description
UG-01058
2014.12.19
Table 2-1: ALTERA_FP_MATRIX_INV Resource Utilization and Performance for the Stratix IV Device Family
Precision
Single
Logic usage
Matrix
Size
Blocks
Adapti
ve
Logic
Modul
es
(ALMs)
DSP
Usage
(18 x
18
DSPs)
M9KM144K Memor
y (Bits)
Latenc
y
Throug
hput
(kb/s)
4× 4221159222139—19919 PendingPendingPendin
Giga
Floatin
g-
Point
Operat
ions
per
Secon
d
(GFLO
PS)
f
MAX
(MHz)
221
g
6 × 625982757490—15759 PendingPendingPendin
170
g
8 × 825,5386349—53,7362,5013,98715.26332
16 ×
48,8659580—138,05111,05785530.93329
16
32 ×
815,655159193—699,16452,62516555.12290
32
64 ×
1629,940287386224,770,369281,5052583.16218
64
ALTERA_FP_MATRIX_INV Functional Description
A matrix inversion function is composed of the following components:
• Cholesky decomposition function.
The Cholesky decomposition function generates a lower triangular matrix.
• Triangular matrix inversion function.
The triangular matrix inversion process then generates the inverse of the lower triangular using
backward substitution.
• Matrix multiplication function.
The matrix multiplier multiplies the transpose of the inverse triangular matrix with the inverse
triangular matrix.
In linear algebra, the Cholesky decomposition states that every positive definite matrix A is decomposed
as A = L×LT
where, L is a lower triangular matrix, and LT denotes the transpose of L.
The property of invertible matrices states that (X×Y)-1 = X-1×Y-1 and the property of transpose states
that (XT )-1 = (X-1)T. Combining these two properties, the following equation represents a derivation of
a matrix inversion using the Cholesky decomposition method:
A-1 = (L×LT)-1
Altera Corporation
ALTERA_FP_MATRIX_INV IP Core
Send Feedback
A
AL
L
-1
L
A(L )
Matrix A
Storage 1Storage 2
Cholesky
Decomposition
Triangular Matrix
Inversion
Matrix
Multiplication
-f
X
=
T-1
L
-1
UG-01058
2014.12.19
= (LT)-1 × L-1
= (L-1)T × L-1
where a Cholesky decomposition function is needed to obtain L, a triangular matrix inversion is needed to
obtain L-1, and a matrix multiplication is needed for (L-1)T × L-1.
Figure 2-1: Matrix Inversion Flow Diagram
Cholesky Decomposition Function
The functions consists of two memory and two processing blocks. One of the memory blocks is the input
matrix memory block and is loaded with the input matrix in a row order, one element at a time. However,
during processing, this block is read in a column order, one element at a time when required.
Cholesky Decomposition Function
2-3
The other memory block is the processing matrix block which consists of multiple column memories to
enable an entire row to be read at once. During the loading of the input memory, the FPC datapath
preprocesses the input elements to generate the first column of the resulting triangular matrix. The top
element of the first column, l00, is the square root of the input matrix value a00. The rest of the first
column, li0 is the input value ai0 divided by l00. This preprocessing step introduces latency into the
load, during which the INIT_BUSY signal is asserted. The CALCULATE signal initiates and starts processing
after the INIT_BUSY signal is deasserted.
This figure shows the top-level architecture of the Cholesky decomposition function, where the
monolithic input memory and the column-wise processing memory, also known as the vector matrix, are
shown. The gray block is the FPC datapath section.
ALTERA_FP_MATRIX_INV IP Core
Send Feedback
Altera Corporation
2-4
Cholesky Decomposition Function
Figure 2-2: Cholesky Decomposition Function Top-level Diagram
Although the Cholesky decomposition algorithm only operates on the lower triangular matrix, the core
requires the entire matrix to be loaded, during which the processing or vector memory is initialized.
UG-01058
2014.12.19
The FPC datapath is split into two sections. The first section, also known as the vector section, takes the
inner product of two vectors and subtracts it from the input matrix element, aij. The second section, also
known as the root section, calculates square roots and performs division by the square root. The first
element is loaded into both inputs of the root section and the outcome is its own square root. The first
element continues to stay latched in the left input field of the root section while all the other elements of
the first column are loaded into the right input field. The resulting output is the value of the respective
column element divided by the value of the first element of the Cholesky decomposition matrix.
During processing, two rows from the processing matrix are loaded. For the first element in each new
column, both rows have the same index; hence contain the same values. The first row is latched into the
input register of the vector section. For the rest of the column, the row index is increased, and a new a
ij
element and triangular matrix vector, Lj is loaded. The first result out of the vector section is latched onto
the left register of the root section. All results from the column, including the first result, are loaded into
the right register of the root section. The root section generates the square root of the first vector result,
while for the other results coming from the vector section, the number is divided by the square root of the
first result.
All calculated values are written to another memory block for further processing. The first column values
are output singly during preprocessing, while the values of other columns are burst out during processing.
There are only minor differences between the architectures for real and complex matrices. For the
complex matrix, both the input and processing memory blocks contain complex values. Similarly, all
values going into the vector section are complex numbers. The complex conjugate of the latched register
is obtained by simply inverting the sign bit. As for the root section, the structure is simplified by the
nature of the positive definite matrix. The diagonal value, which is the first value at the top of each
column in the decomposition, is always a real number so that the result from the inverse square root
calculation is always a real number. The complex multiplier in the root section is therefore a real scalar, so
only two real multipliers are required.
Altera Corporation
ALTERA_FP_MATRIX_INV IP Core
Send Feedback
UG-01058
2014.12.19
Triangular Matrix Inversion
The triangular matrix, L, obtained from the Cholesky decomposition function is computed using the
triangular matrix inversion algorithm to get its inversion. The following MatLab pseudo code shows how
the inversion is carried out:
for j = n:-1:1,
X(j,j) = 1/L(j, j);
for k = j+1:n
for i = j+1:n
X(k, j) = X(k, j) + X(k, i)*L(i, j);
end;
end;
for k = j+1:n
X(k, j) = -X(j, j)*X(k, j);
end;
Triangular Matrix Inversion
2-5
The pseudo code is converted into an RTL file. The result, L-1 is stored in the input matrix storage in the
Cholesky decomposition function.
Matrix Multiplication
The final stage of the matrix inversion process involves multiplying the transpose of the inverse triangular
matrix with the inverse triangular matrix using the Altera Floating-Point Matrix Multiplier. The original
version of the matrix multiplier is modified for this purpose. As there are memory blocks already available
for the storage of the input matrices in the Cholesky decomposition function, the memory blocks in the
matrix multiplier are redundant and can be removed. Data is instead fed directly from the results stored at
the end stage of the triangular matrix inversion algorithm.
Matrix Inversion Operation
ALTERA_FP_MATRIX_INV IP Core
Send Feedback
Altera Corporation
sysclk
enable
reset
load
datain
dataout
outvalid
busy
done
Loading StageProcessing StageOutput Stage
2-6
ALTERA_FP_MATRIX_INV Design Example: Matrix Inverse of Single-Precision Format
Numbers
Figure 2-3: Matrix Inversion Timing Diagram
The following sequence describes the matrix inversion operation:
UG-01058
2014.12.19
1. The operation begins when the enable signal is asserted and the reset signal is deasserted.
2. The load signal is asserted to load data from the loaddata[] port for the input matrix. As long as the
load signal is high, data is loaded continuously for the input matrix.
3. The busy signal is asserted and the done signal is deasserted for a few clock cycles after the datain[]
signal is asserted.
4. The outvalid signal is asserted multiple times to signify the availability of valid data on the dataout[]
port. The number of times this signal is asserted equals the number of rows found in the output
matrix.
5. The busy and done signals are asserted when the last row of the output matrix has been burst out. This
assertion signifies the end of the matrix inversion operation on the first set of data.
ALTERA_FP_MATRIX_INV Design Example: Matrix Inverse of SinglePrecision Format Numbers
This design example uses the ALTERA_FP_MATRIX_INV IP core to show the matrix inversion
operation. The input matrix applied is an 8 × 8 matrix with a block size of 2. This example uses the
parameter editor GUI to define the core.
Related Information
• Floating-Point IP Cores Design Example Files on page 1-16
• Floating-Point IP Cores Design Examples
Provides the design example files for the Floating-Point IP cores
• ModelSim-Altera Software Support
Provides information about installation, usage, and troubleshooting
Altera Corporation
ALTERA_FP_MATRIX_INV IP Core
Send Feedback
UG-01058
2014.12.19
ALTERA_FP_MATRIX_INV Design Example: Understanding the Simulation Results
ALTERA_FP_MATRIX_INV Design Example: Understanding the Simulation Results
The simulation waveform in this design example is not shown in its entirety. Run the design example files
in the ModelSim-Altera software to see the complete simulation waveforms.
This figure shows the expected simulation results in the ModelSim-Altera software.
This design example implements a floating-point matrix inversion to calculate the inverse value of
matrices in single-precision formats. The optional input ports (enable and reset) are enabled.
Table 2-2: Summary of Input Values and Corresponding Outputs
2-7
This table lists the inputs and corresponding outputs obtained from the simulation waveform. The number of
clock cycles obtained for each stage is based on the particular matrix size and parameter settings used in this
design example.
TimeEvent
0 ns – 10 nsStart sequence:
• The reset signal deasserts.
• The enable signal asserts.
19.86 ns – 340 nsMatrix input data load:
• The load signal asserts and remains high for 80 clock cycles.
• As long as the load signal is high, data for the input matrix is loaded
row by row.
• Input data is burst in regularly, one at every clock cycle.
• The load signal deasserts at 340 ns. The deassertion of the load signal
signifies the completion of the data load operation for the matrix.
27.5 nsProcessing stage:
• The busy signal asserts while the done signal deasserts.
• The assertion of the busy signal and the deassertion of the done signal
indicate that the matrix inversion core is processing the input data.
• There are about 2500 clock cycles between the beginning of the
processing stage and the first available output value.
ALTERA_FP_MATRIX_INV IP Core
Send Feedback
Altera Corporation
2-8
Sample Matrix Data
TimeEvent
UG-01058
2014.12.19
12527.5 –
12922.5 ns
Output stage:
• The outvalid signal asserts in intervals of 8 clock cycles. These series
• The output is an 8 x 8 matrix. Data is burst out regularly, row by row.
• At 12922.5 ns, the busy signal is asserted and the done signal is
• The assertion of the busy signal and the deassertion of the done signal
Sample Matrix Data
This section shows the random test data assigned to the input matrices and the results obtained from the
matrix inversion operation.
The following two sets of results are computed:
• PC-based results—these are results obtained from running the simulation in Matlab.
• FPGA-based results—these are results obtained from running the simulation in ModelSim.
This table lists the input and output data values presented in IEEE-754 Floating-point format.
of assertions signify the availability of valid data for the output matrix
on the outdata[] port.
deasserted.
indicate that the final output is written and a new matrix can be
processed.
The difference between each result element of the PC-based and FPGA-based output matrices are as
shown:
Result differences (in decimal)
253 529 304 259 431 431 439 523
529 534 315 537 455 452 450 531
304 315 359 309 256 257 524 311
259 537 309 264 220 441 448 532
431 455 256 220 361 364 376 449
431 452 257 441 364 366 375 447
439 450 524 448 376 375 377 447
523 531 311 532 449 447 447 527
The difference between the two output matrices are due to the following reasons:
• Method of processing—Matlab uses sequential processing while Modelsim uses parallel processing.
• Method of conversion—Matlab first computes in double-precision format, and then only converts the
result into single-precision format. During this conversion, some units in the last place (ulp) are
expected to be lost.
ALTERA_FP_MATRIX_INV IP Core
Send Feedback
Altera Corporation
datain
sysclk
reset
inst
ALTERA_FP_MATRIX_INV
dataout[]
busy
outvalid
done
load
enable
2-10
ALTERA_FP_MATRIX_INV Signals
ALTERA_FP_MATRIX_INV Signals
Figure 2-5: ALTERA_FP_MATRIX_INV Signals
UG-01058
2014.12.19
Table 2-4: ALTERA_FP_MATRIX_INV Input Signals
Port NameRequiredDescription
sysclkYesThe clock input to the ALTERA_FP_MATRIX_INV IP core. This is
enableNoOptional port. Allow calculation to take place when asserted. When
resetNoOptional port. The core resets asynchronously when the reset signal
loadYesWhen asserted, loads the LOADDATA bus into the memory.
loaddataYesSingle-precision 32-bit matrix input value. Matrices load row by row.
Table 2-5: ALTERA_FP_MATRIX_INV Output Signals
Port NameRequiredDescription
readyYesWhen asserted, the core preprocesses the input data. The calculate
outdataYesSingle-precision 32-bit matrix result value. The matrix result value is
outvalidYesWhen asserted, a valid output data is available. An entire row of the
the main system clock. All operations occur on the rising edge.
deasserted, no operation will take place and the outputs are
unchanged.
is asserted.
signal cannot be asserted until the ready signal is low.
written out row by row.
result matrix is written out as a burst. There is a gap between row
outputs, which will depend on the parameters.
Altera Corporation
ALTERA_FP_MATRIX_INV IP Core
Send Feedback
UG-01058
2014.12.19
Port NameRequiredDescription
doneYesWhen asserted, the last output has been written. A new matrix
multiply can be started with calculate. done will follow ready by
some fixed amount, depending on the parameters.
ALTERA_FP_MATRIX_INV Parameters
Table 2-6: ALTERA_FP_MATRIX_INV Parameters
Port NameTypeRequiredDescription
BLOCKSIntegerNoThe number of memory blocks for the double-buffered
storage of matrix multiplication. The allowable range is
from 2 to 16.
DIMENSIONIntegerYesThe number of rows in the matrix. As the matrix is
square, this is also the number of columns in the matrix.
The supported dimensions are 4 x 4, 6 x 6, 8 x 8, 16 x 16,
32 x 32, and 64 x 64. The maximum supported input
dimension is 64 × 64.
ALTERA_FP_MATRIX_INV Parameters
2-11
This parameter also acts as the VECTORSIZE when
calling the ALTERA_FP_MATRIX_MULT IP core
internally.
WIDTH_EXPIntegerYesSpecifies the precision of the exponent. The bias of the
exponent is always set to 2(WIDTH_EXP-1) -1 (that is,
127 for single-precision format). WIDTH_EXP must be 8 for
single-precision format and must be less than WIDTH_MAN.
The available value for WIDTH_EXP is 8.
WIDTH_MANIntegerYesSpecifies the precision of the mantissa. WIDTH_MAN must
be 23 when WIDTH_EXP is 8. Otherwise, WIDTH_MAN must
be a minimum of 31. WIDTH_MAN must be greater than
WIDTH_EXP. The sum of WIDTH_EXP and WIDTH_MAN must
be less than 64. Current available value for WIDTH_MAN is
only 23 for single precision.
ALTERA_FP_MATRIX_INV IP Core
Send Feedback
Altera Corporation
2014.12.19
www.altera.com
101 Innovation Drive, San Jose, CA 95134
ALTERA_FP_MATRIX_MULT IP Core
3
UG-01058
Subscribe
Send Feedback
ALTERA_FP_MATRIX_MULT Features
The ALTERA_FP_MATRIX_MULT IP core offers the following features:
• Multiplication of two matrices.
• Support for floating-point formats in single and double precisions.
• Support for configurable performance and resource usage.
• Avalon streaming interfaces and full QSys compliance.
ALTERA_FP_MATRIX_MULT Output Latency
The ALTERA_FP_MATRIX_MULT IP core does not have a fixed output latency. Instead, the IP core
uses Avalon streaming interfaces and the c_valid signal on the output interface to indicate when output
data is available.
ALTERA_FP_MATRIX_MULT Resource Utilization and Performance
These tables list the resource utilization and performance information for the
ALTERA_FP_MATRIX_MULT IP core. The information was derived using the Quartus II software
version 14.1.
2014 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, ENPIRION, MAX, MEGACORE, NIOS, QUARTUS and STRATIX words and logos are
trademarks of Altera Corporation and registered in the U.S. Patent and Trademark Office and in other countries. All other words and logos identified as
trademarks or service marks are the property of their respective holders as described at www.altera.com/common/legal.html. Altera warrants performance
of its semiconductor products to current specifications in accordance with Altera's 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 any information,
product, or service described herein except as expressly agreed to in writing by Altera. Altera customers are advised to obtain the latest version of device
specifications before relying on any published information and before placing orders for products or services.
ISO
9001:2008
Registered
A.BC
=
3-2
ALTERA_FP_MATRIX_MULT Functional Description
UG-01058
2014.12.19
Table 3-1: ALTERA_FP_MATRIX_MULT Resource Utilization and Performance for the Arria 10 and Stratix V
Devices
The matrix multiplier in the ALTERA_FP_MATRIX_MULT IP core multiplies matrix A and matrix B to
generate the output matrix C.
Blocks
FMax
(MHz)
Latency
(cycles)
(1)
The following figure shows the equation:
Figure 3-1: ALTERA_FP_MATRIX_MULT Equation
The matrix A and B can be loaded when the ready signal on their respective interfaces are asserted. When
the input matrices are loaded, the core will start computing the output. Valid signal on the output
interface will be asserted to indicate valid output data. The input data may be loaded at any time the ready
signal is asserted even when the previously loaded data is still being computed.
(1)
Latency is the time take to compute a dot product and does not include the time taken to load the input
matrices
Altera Corporation
ALTERA_FP_MATRIX_MULT IP Core
Send Feedback
Row 0
. . .N-10. . .
Row M-1
. . .N-10
Time
Matrix A
Memory
Matrix B
Memory
RegistersDot Product
Running Sums
+
UG-01058
2014.12.19
ALTERA_FP_MATRIX_MULT Functional Description
Figure 3-2: Matrix Serialization Format
An input matrix with M rows and N columns must be input as shown in this figure, where the Row 0 and
Column 0 element is first and Row M-1 and Column N-1 element is last. The result matrix will be output
in the same format.
The ALTERA_FP_MATRIX_MULT IP core consists of the following components:
• Memory blocks for the matrix A storage
• Memory blocks for the matrix B storage
• Dot product
• Accumulator
Figure 3-3: Top-Level View of the ALTERA_FP_MATRIX_MULT IP Core
This figure shows the top-level view of the ALTERA_FP_MATRIX_MULT IP core.
3-3
ALTERA_FP_MATRIX_MULT IP Core
Send Feedback
Altera Corporation
clk
reset_n
a_ready
a_valid
a_data
inst
ALTERA_FP_MATRIX_MULT
c_valid
c_ready
c_data
b_ready
b_valid
b_data
3-4
ALTERA_FP_MATRIX_MULT Signals
The following lists the key features of the architecture:
• Matrix A and B storage are double buffered to allow processing to happen in parallel with data loading.
• Where the number of columns of A (A_COLUMNS) and rows of B (same as A_COLUMNS) are greater than
the size of the dot product (VECTOR_SIZE), the rows of A and columns of B are divided into sub rows
and sub columns respectively, each containing VECTOR_SIZE elements. In this case, A_COLUMNS/
VECTOR_SIZE iterations are needed to compute a full dot product corresponding to a single output
element.
• Matrix B memory has sufficient bandwidth so that all the data needed for the dot product can be
loaded at once.
• Matrix A memory is allocated with less bandwidth. The bandwidth of the matrix A is a parameter
(NUM_BLOCKS) that you can control. A sub row of matrix A is loaded into local registers over a number
of cycles before an iteration of the dot product. Once a sub row of Matrix A has been loaded into local
registers, all partial dot products involving that sub row are computed before another sub row is
loaded.
• For Arria 10 devices, where hardened single precision floating-point DSP blocks exist, those will be
used for single precision floating point arithmetic.
The matrix multiply architecture is not optimized for sparse matrices and constant matrices.
UG-01058
2014.12.19
ALTERA_FP_MATRIX_MULT Signals
Figure 3-4: ALTERA_FP_MATRIX_MULT Signals
This figure shows the signals for the ALTERA_FP_MATRIX_MULT IP core.
Table 3-2: ALTERA_FP_MATRIX_MULT Input Signals
These tables list the signals for the ALTERA_FP_MATRIX_MULT IP core.
Port NameRequiredDescription
clkYesThe clock input port for the IP core.
Altera Corporation
ALTERA_FP_MATRIX_MULT IP Core
Send Feedback
UG-01058
2014.12.19
Port NameRequiredDescription
reset_nNoAsynchronous active low reset port.
a_dataYesMatrix A input data.
a_validYesMatrix A Avalon streaming valid signal. When this signal is
asserted, data on a_data is valid.
b_dataYesMatrix B input data.
b_validYesMatrix B Avalon streaming valid signal. When this signal is asserted,
data on b_data is valid.
c_readyYesMatrix C Avalon streaming ready signal. Ready latency is 0.
Table 3-3: ALTERA_FP_MATRIX_MULT Output Signals
Port NameRequiredDescription
a_readyYesMatrix A Avalon streaming ready signal. Ready latency is 0.
b_readyYesMatrix B Avalon streaming ready signal. Ready latency is 0.
c_dataYesMatrix C input data.
ALTERA_FP_MATRIX_MULT Parameters
3-5
c_validYesMatrix C Avalon streaming valid signal. When this signal is asserted,
data on c_data is valid.
ALTERA_FP_MATRIX_MULT Parameters
This table lists the parameters for the ALTERA_FP_MATRIX_MULT IP core.
Table 3-4: ALTERA_FP_MATRIX_MULT IP Core Parameters
ParameterValueDescription
FormatSingle (32 bit) or Double
(64 bit)
Rows in Matrix A2-256Number of rows in matrix A.
Columns in Matrix A8-256 Integer multiples of
vector size. (Integer
multiples of Memory
Blocks.)
Rows in Matrix B8-256Number of rows in matrix B.
Columns of matrix B2-256Number of columns in matrix B.
The format of the input data.
Number of columns in matrix A. This
is also the number of rows in matrix
B.
ALTERA_FP_MATRIX_MULT IP Core
Send Feedback
Altera Corporation
3-6
ALTERA_FP_MATRIX_MULT Parameters
ParameterValueDescription
UG-01058
2014.12.19
Vector SizeAllowed values are 8,16,
32, 64, 96, and 128.
Memory Blocks
The Vector Size must be
an integer multiple of
Memory Blocks. The
number of memory blocks
must be smaller than the
vector size.
The number of memory
blocks must be greater
than or equals to the ratio
of vector size divided by
the number of columns of
matrix B.
The size of the dot product which can
be computed in parallel. Where the
number of columns of matrix A and
rows of matrix B are greater than
Vector Size a number of iterations are
required to compute a full dot
product.
Vector Size also controls the matrix B
memory configuration. Increasing
the “Vector Size” increases the matrix
B memory bandwidth and the
number of memory blocks used.
Controls the memory configuration
of the matrix A storage. Increasing
this number increases the memory
bandwidth and the number of
memory blocks used.
Altera Corporation
ALTERA_FP_MATRIX_MULT IP Core
Send Feedback
2014.12.19
www.altera.com
101 Innovation Drive, San Jose, CA 95134
ALTERA_FP_ACC_CUSTOM IP Core
4
UG-01058
Subscribe
Send Feedback
ALTERA_FP_ACC_CUSTOM Features
The ALTERA_FP_ACC_CUSTOM IP core offers the following features:
• Supports frequency driven cores.
• Supports VHDL RTL generation.
• Supports customization of the required range of the input and output values.
ALTERA_FP_ACC_CUSTOM Output Latency
The amount of latency is driven by the target frequency and the selected device family. You must set the
desired frequency and the target device before generating the IP core. The IP core reports the latency
when you set the parameters and when you generate the IP core. Then, use the reported latency to
incorporate the IP core into your design.
ALTERA_FP_ACC_CUSTOM Resource Utilization and Performance
2014 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, ENPIRION, MAX, MEGACORE, NIOS, QUARTUS and STRATIX words and logos are
trademarks of Altera Corporation and registered in the U.S. Patent and Trademark Office and in other countries. All other words and logos identified as
trademarks or service marks are the property of their respective holders as described at www.altera.com/common/legal.html. Altera warrants performance
of its semiconductor products to current specifications in accordance with Altera's 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 any information,
product, or service described herein except as expressly agreed to in writing by Altera. Altera customers are advised to obtain the latest version of device
specifications before relying on any published information and before placing orders for products or services.
ISO
9001:2008
Registered
4-2
ALTERA_FP_ACC_CUSTOM Resource Utilization and Performance
Table 4-1: ALTERA_FP_ACC_CUSTOM Resource Utilization and Performance
This table lists the resource utilization and performance information for the ALTERA_FP_ACC_CUSTOM IP
core. The information was derived using the Quartus II software version 13.1.
Device
Family
Input DataAccumulator
Size
Floati
Point
Form
ng
at
MaxM
SBX
MSBA LSBAPrimarySecon
Targe
t
Frequ
ency
(MHz)
Laten
cy
ALMs
DSP
Block
s
Logic
Registers
dary
M10K M20Kf
UG-01058
2014.12.19
MAX
Arria
V
(5AG
XFB3
H4F4
0C5)
Cyclo
ne V
(5CG
XFC7
D6F3
1C7)
Stratix
V
(5SG
XEA7
K2F40
C2)
Arria
V
(5AG
XFB3
H4F4
0C5)
Double2440-522701586601,1661060--265
Double2440-522301583001,102320--198
Double2440-524001596801,65527--0426
Single1220-26270123370588520--309
Cyclo
ne V
(5CG
XFC7
D6F3
1C7)
Stratix
V
(5SG
XEA7
K2F40
C2)
Altera Corporation
Single1220-26230123830494280--225
Single1220-2640013475090320--0450
ALTERA_FP_ACC_CUSTOM IP Core
Send Feedback
clk
n
ALTERA_FP_ACC_CUSTOM
r
x
areset
en
xo
xu
ao
UG-01058
2014.12.19
Related Information
Fitter Resources Reports
Provides information about Quartus II resource utilization
ALTERA_FP_ACC_CUSTOM Signals
Figure 4-1: ALTERA_FP_ACC_CUSTOM
ALTERA_FP_ACC_CUSTOM Signals
4-3
Table 4-2: ALTERA_FP_ACC_CUSTOM Input Ports
Port NameRequiredDescription
clkYesAll input signals, otherwise explicitly stated, must be synchronous to
aresetYesAsynchronous active-high reset. Deassert this signal synchronously to
enNoGlobal enable signal. This port is optional.
xYesData input port.
nYesBoolean port which signals the beginning of a new data set to be
Table 4-3: ALTERA_FP_ACC_CUSTOM Output Ports
Port NameRequiredDescription
rYesThe running value of the accumulation.
this clock
the input clock to avoid metastability issues.
accumulated. This should go high together with the first element in the
new data set and should go low the next cycle. The data sets may be of
variable length and a new data set may be started at any time. The
accumulation result for an input will be available after the reported
latency.
ALTERA_FP_ACC_CUSTOM IP Core
Send Feedback
Altera Corporation
4-4
ALTERA_FP_ACC_CUSTOM Parameters
Port NameRequiredDescription
xoYesThe overflow flag for port x. The signal goes high when the exponent of
the input x is larger than maxMSBX. The signal remains high for the
entire data set. This flag invalidates port r. You should consider
increasing maxMSBX. This flag also indicate infinity and NaN.
xuYesThe underflow flag for port x. The signal goes high when the exponent
of the input x is smaller than LSBA. The signal remains high for the
entire data set. This flag does not invalidate port r. You should consider
lowering LSBA.
aoYesThe overflow flag for Accumulator. The signal goes high when the
exponent of the accumulated value is larger than MSBA. The signal
remains high for the entire data set. This flag invalidates port r. You
should consider increasing MSBA.
ALTERA_FP_ACC_CUSTOM Parameters
UG-01058
2014.12.19
Table 4-4: ALTERA_FP_ACC_CUSTOM Parameters
CategoryParameterValuesDescription
Floating point
format
single,
double
Choose the floating point format of the input
data values. The output data values of the
accumulator is in the same format.
The default is single.
maxMSBX—The maximum weight of the MSB of an input.
For example, when adding probabilities in the 0
to 1 range set this weight to ceil(log2(1))=0. The
Input Data
xo output signal goes high when the MSB of an
input value has a weight larger than maxMSBX.
The result of the accumulation is then invalid. If
you are unsure about the range of the inputs,
then set the maxMSBX parameter to MSBA, at
the possible expense of increased resource
usage.
The default value is 12.
Altera Corporation
ALTERA_FP_ACC_CUSTOM IP Core
Send Feedback
UG-01058
2014.12.19
ALTERA_FP_ACC_CUSTOM Parameters
CategoryParameterValuesDescription
MSBA—The weight of the MSB of the accumulator. For
example, in a financial simulation, if the value of
a stock cannot exceed 100,000 dollars, use a
value of ceil(log2(100000))=17.
In a circuit simulation where the circuit adds
numbers in the 0 to 1 range, for one year, at 400
MHz, use a value of
ceil(log2(365 x 60 x 60 x 24 x 400 x 106))=54.
The ao output signal goes high when the MSB of
the accumulated value has a weight larger than
MSBA. The result of the accumulation is then
invalid. Altera recommends adding a few guard
bits to avoid possible accumulator overflow. A
few guard bits have little impact on the
accumulator size.
4-5
Accumulat
or Size
Required
Perform‐
ance
The default value is 20.
LSBA—The weight of the LSB of the accumulator and
the accuracy of the accumulator. Because an N
term accumulation can invalidate the log2(N)
LSBs of the accumulator, you must consider the
length of the accumulation and the range of the
inputs when setting this parameter.
For example, if a 2
-30
accuracy is required over
an accumulation of 1024 numbers, then set the
LSBA to:
(-30 - log2(1024)) = -40.
Any input 2e×1.F, where F is the mantissa and e
is less than the LSBA will be shifted out of the
accumulator. The au output signal goes high to
indicate this situation.
The default value is -26.
Target frequencyAny positive
integer value.
Choose the frequency in MHz at which this core
is expected to run. This together with the target
device family will determine the amount of
pipelining in the core.
OptionalGenerate an enable
ALTERA_FP_ACC_CUSTOM IP Core
Send Feedback
port
The default value is 200 MHz.
—Choose if the accumulator should have an
enable signal.
This parameter is disabled by default.
Altera Corporation
4-6
ALTERA_FP_ACC_CUSTOM Parameters
CategoryParameterValuesDescription
Report——Reports the latency of the device, which is the
number of cycles it takes for an accumulation to
propagate through the block from input to
output.
UG-01058
2014.12.19
Altera Corporation
ALTERA_FP_ACC_CUSTOM IP Core
Send Feedback
2014.12.19
www.altera.com
101 Innovation Drive, San Jose, CA 95134
ALTFP_ADD_SUB IP Core
5
UG-01058
Subscribe
Send Feedback
ALTFP_ADD_SUB Features
The ALTFP_ADD_SUB IP core offers the following features:
• Dynamically configurable adder and subtracter functions.
• Optional exception handling output ports such as zero, overflow, underflow, and nan.
• Optimization of speed and area.
ALTFP_ADD_SUB Output Latency
The output latency options for the ALTFP_ADD_SUB IP core are the same for all three precision formats
—single, double, and single-extended. The options available are 7, 8, 9, 10, 11, 12, 13, and 14 clock cycles.
ALTFP_ADD_SUB Truth Table
Table 5-1: Truth Table for Addition/Subtraction Operations
2014 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, ENPIRION, MAX, MEGACORE, NIOS, QUARTUS and STRATIX words and logos are
trademarks of Altera Corporation and registered in the U.S. Patent and Trademark Office and in other countries. All other words and logos identified as
trademarks or service marks are the property of their respective holders as described at www.altera.com/common/legal.html. Altera warrants performance
of its semiconductor products to current specifications in accordance with Altera's 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 any information,
product, or service described herein except as expressly agreed to in writing by Altera. Altera customers are advised to obtain the latest version of device
specifications before relying on any published information and before placing orders for products or services.
ISO
9001:2008
Registered
5-2
ALTFP_ADD_SUB Resource Utilization and Performance
ALTFP_ADD_SUB Resource Utilization and Performance
The following lists the resource utilization and performance information for the ALTFP_ADD_SUB IP
core. The information was derived using the Quartus II software version 10.0.
Altera Corporation
ALTFP_ADD_SUB IP Core
Send Feedback
UG-01058
2014.12.19
ALTFP_ADD_SUB Design Example: Addition of Double-Precision Format Numbers
Table 5-2: ALTFP_ADD_SUB Resource Utilization and Performance for the Stratix Series of Devices
5-3
Device FamilyPrecisionOptimiza‐
tion
Output
latency
Adaptive
Look-Up
Tables
(ALUTs)
Dedicated
Logic
Registers
(DLRs)
Adaptive
Logic
Modules
(ALMs)
f
MAX
(MHz)
7594376385228
speed
14674686498495
single
7576345375227
area
14596603421484
Stratix IV
71,198687824187
speed
149971,6071,080398
double
71,106630762189
area
149041,5181,013265
ALTFP_ADD_SUB Design Example: Addition of Double-Precision Format
Numbers
This design example uses the ALTFP_ADD_SUB IP core to perform the addition of double-precision
format numbers using the parameter editor in the Quartus II software.
Related Information
• Floating-Point IP Cores Design Example Files on page 1-16
• Floating-Point IP Cores Design Examples
Provides the design example files for the Floating-Point IP cores
• ModelSim-Altera Software Support
Provides information about installation, usage, and troubleshooting
ALTFP_ADD_SUM Design Example: Understanding the Simulation Results
The simulation waveform in this design example is not shown in its entirety. Run the design example files
in the ModelSim-Altera software to see the complete simulation waveforms.
Figure 5-1: ALTFP_ADD_SUB Simulation Waveform
ALTFP_ADD_SUB IP Core
Send Feedback
Altera Corporation
5-4
ALTFP_ADD_SUB Signals
This design example implements a floating-point adder for the addition of double-precision format
numbers. All the optional input ports (clk_en and aclr) and optional output ports (overflow,
underflow, zero, and nan) are enabled.
In this example, the output latency of the multiplier is set to 7 clock cycles. Every addition result appears
at the result[] port 7 clock cycles after the input values are captured on the dataa[] and datab[] ports.
The following lists the inputs and corresponding outputs obtained from the simulation waveform.
Table 5-3: Summary of Input Values and Corresponding Outputs
TimeEvent
0 ns, start-updataa[] value: 0000 0000 0000 0000h
datab[] value: 7FF0 0000 0000 0000h
Output value: All values seen on the output port before
the 7th clock cycle are merely due to the behavior of
the system during startup and should be disregarded.
4250 nsOutput value: 7FF0 0000 0000 0000h
Exception handling ports: overflow asserts
The addition of zero at the input port dataa[], and
infinity value at the input port datab[] results in
infinity value.
UG-01058
2014.12.19
40,511 nsdataa[] value: 0000 0000 0000 0000h
datab[] value: 0000 0000 1000 0123h
The is the addition of a zero and a denormal value.
43,750 nsOutput value: 0000 0000 0000 0000h
Exception handling ports: zero remains asserted.
Denormal inputs are not supported and are forced to
zero before addition takes place.This results in a zero.
ALTFP_ADD_SUB Signals
Altera Corporation
ALTFP_ADD_SUB IP Core
Send Feedback
dataa[]
datab[]
add_sub
clock
clk_en
inst
ALTFP_ADD_SUB
result[]
overflow
nan
underflow
zero
aclr
UG-01058
2014.12.19
Figure 5-2: ALTFP_ADD_SUB
Table 5-4: ALTFP_ADD_SUB Input Ports
Port NameRequiredDescription
ALTFP_ADD_SUB Signals
5-5
aclrNoAsynchronous clear input for floating-point adder or subtractor. The
source is asynchronously reset when the aclr signal is asserted high.
add_subNoOptional input port to enable dynamic switching between the adder
and subtractor functions. The add_sub port must be used when the
DIRECTION parameter is set to VARIABLE. When the add_sub port is
clk_enNoClock enable to the floating-point adder or subtractor. This port allows
addition or subtraction to occur when asserted high. When asserted
low, no operations occur and the outputs are unchanged.
clockYesClock input to the IP core.
dataa[]YesData input to the floating-point adder or subtractor. The MSB is the
sign bit, the next MSBs are the exponent, and the LSBs are the
mantissa bits. The size of this port is the total width of the sign bit, the
exponent bits, and the mantissa bits.
datab[]YesData input to the floating-point adder or subtractor. This port is
configured in the same way as dataa[].
Table 5-5: ALTFP_ADD_SUB Output Ports
Port NameRequiredDescription
nanYesNaN exception output. Asserted when an illegal addition or subtraction
occurs, such as infinity minus infinity. When an invalid addition or
subtraction occurs, a NaN value is output to the result[] port. Any
adding or subtracting involving NaN values also produces a NaN value.
ALTFP_ADD_SUB IP Core
Altera Corporation
Send Feedback
5-6
ALTFP_ADD_SUB Parameters
Port NameRequiredDescription
overflowYesOverflow exception port. Asserted when the result of the addition or
subtraction, after rounding, exceeds or reaches infinity. Infinity is
defined as a number in which the exponent exceeds 2
result[]YesFloating-point output result. Like the input values, the MSB is the sign,
WIDTH_EXP
the next MSBs are the exponent, and the LSBs are the mantissa. The size
of this port is the total width of the sign bit, exponent bits, and mantissa
bits.
underflowYesUnderflow port for the adder or subtractor. Asserted when the result of
the addition or subtraction, after rounding, the value is zero and the
inputs are not equal. The underflow port is also asserted when the
result is a denormalized number.
zeroNoZero port for the adder or subtractor. Asserted when the result[] port
is zero.
ALTFP_ADD_SUB Parameters
UG-01058
2014.12.19
-1.
Table 5-6: ALTFP_ADD_SUB Parameters
Parameter NameTypeRequiredDescription
DIRECTIONStringYesSpecifies addition or subtraction operations. Values
are ADD, SUB, or VARIABLE. If this parameter is not
specified, the default is ADD. When the value is
VARIABLE, the add_sub port determines whether the
operation is addition or subtraction. The add_sub
port must be connected if the DIRECTION parameter
is set to VARIABLE. If the value is ADD or SUB, the add_
sub port is ignored.
PIPELINEIntegerNoSpecifies the latency in clock cycles used in the
ALTFP_ADD_SUB IP core. The PIPELINE
parameter supports values of 7 through 14. If this
parameter is not specified, the default value is 11. In
general, a higher pipeline value produces better f
performance.
ROUNDINGStringYesSpecifies the rounding mode. The default value is
TO_NEAREST. Other rounding modes are currently
not supported.
OPTIMIZEStringNoDefines the design preference, whether the design is
optimized for speed (faster f
), or optimized for
MAX
area (lower resource count). Values are SPEED and
AREA. If this parameter is not specified, the default is
SPEED.
MAX
Altera Corporation
ALTFP_ADD_SUB IP Core
Send Feedback
UG-01058
2014.12.19
ALTFP_ADD_SUB Parameters
Parameter NameTypeRequiredDescription
WIDTH_EXPIntegerNoSpecifies the precision of the exponent. The bias of
the exponent is always set to 2 (WIDTH_EXP-1) -1
(that is, 127 for single-precision format and 1023 for
double-precision format). The WIDTH_EXP parameter
must be 8 for the single-precision mode and 11 for
the double-precision mode, or a minimum of 11 for
the single-extended precision mode. The WIDTH_EXP
parameter must be less than the WIDTH_MAN
parameter. The sum of WIDTH_EXP and the WIDTH_
MAN parameters must be less than 64. If this
parameter is not specified, the default is 8.
WIDTH_MANIntegerNoSpecifies the precision of the mantissa. The WIDTH_
MAN parameter must be 23 (to comply with the IEEE-
754 standard for the single-precision mode) when
the WIDTH_EXP parameter is 8. Otherwise, the WIDTH_
MAN parameter must have a value that is greater than
or equal to 31. The WIDTH_MAN parameter must be
greater than the WIDTH_EXP parameter. The sum of
the WIDTH_EXP and WIDTH_MAN parameters must be
less than 64. If this parameter is not specified, the
default is 23.
5-7
ALTFP_ADD_SUB IP Core
Send Feedback
Altera Corporation
2014.12.19
www.altera.com
101 Innovation Drive, San Jose, CA 95134
ALTFP_DIV IP Core
6
UG-01058
Subscribe
Send Feedback
ALTFP_DIV Features
The ALTFP_DIV IP core offers the following features:
• Division functions.
• Optional exception handling output ports such as zero, division_by_zero, overflow, underflow,
and nan.
• Optimization of speed and area.
• Low latency option.
ALTFP_DIV Output Latency
The output latency options for the ALTFP_DIV IP core differs depending on the precision selected, the
width of the mantissa, or both. You have the choice of selecting the smaller figures of clock cycles delay in
your design if the low latency option is desired.
2014 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, ENPIRION, MAX, MEGACORE, NIOS, QUARTUS and STRATIX words and logos are
trademarks of Altera Corporation and registered in the U.S. Patent and Trademark Office and in other countries. All other words and logos identified as
trademarks or service marks are the property of their respective holders as described at www.altera.com/common/legal.html. Altera warrants performance
of its semiconductor products to current specifications in accordance with Altera's 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 any information,
product, or service described herein except as expressly agreed to in writing by Altera. Altera customers are advised to obtain the latest version of device
specifications before relying on any published information and before placing orders for products or services.
l
NaNZeroXNaN00011
NaNInfinityXNaN00001
NaNNaNXNaN00001
ALTFP_DIV Resource Utilization and Performance
This table lists the resource utilization and performance information for the ALTFP_DIV IP core. The
information was derived using the Quartus II software version 10.0.
Table 6-3: ALTFP_DIV Resource Utilization and Performance for Stratix IV Devices
Logic Usage
Device familyPrecision
Single
Stratix IV
Double
Optimiza‐
tion
Output
latency
Adaptive
Look-Up
Tables
(ALUTs)
Speed333,5933,3512,500—313
Area331,6462,0741,441—308
Speed6113,86713,14310,196—292
Area615,1257,3604,842—267
Dedicate
d Logic
Registers
(DLRs)
Adaptive
Logic
Modules
(ALMs)
18-bit
DSP
f
MAX
(MHz)
ALTFP_DIV IP Core
Send Feedback
Altera Corporation
6-4
ALTFP_DIV Design Example: Division of Single-Precision
UG-01058
2014.12.19
Logic Usage
Device familyPrecision
Optimiza‐
tion
Output
latency
Adaptive
Look-Up
Tables
(ALUTs)
Dedicate
d Logic
Registers
(DLRs)
Adaptive
Logic
Modules
(ALMs)
Low Latency Option
—620730421216154
Single
—1425363838516358
Stratix IV
—107141,07777944151
Double
—247652,4881,39744238
ALTFP_DIV Design Example: Division of Single-Precision
This design example uses the ALTFP_DIV IP core to implement a floating-point divider for the division
of single-precision format numbers with low latency. This example uses the parameter editor to define the
core.
Related Information
• Floating-Point IP Cores Design Example Files on page 1-16
• Floating-Point IP Cores Design Examples
Provides the design example files for the Floating-Point IP cores
• ModelSim-Altera Software Support
Provides information about installation, usage, and troubleshooting
18-bit
DSP
f
MAX
(MHz)
ALTFP_DIV Design Example: Understanding the Simulation Results
The simulation waveform in this design example is not shown in its entirety. Run the design example files
in the ModelSim-Altera software to see the complete simulation waveforms.
Figure 6-1: ALTFP_DIV Simulation Waveform
This figure shows the expected simulation results in the ModelSim-Altera software.
This design example implements a floating-point divider for the division of single-precision numbers
with a low latency option. The output latency is 6, hence every division generates the output result 6 clock
cycles later.
Altera Corporation
ALTFP_DIV IP Core
Send Feedback
UG-01058
2014.12.19
ALTFP_DIV Design Example: Understanding the Simulation Results
Table 6-4: Summary of Input Values and Corresponding Outputs
This table lists the inputs and corresponding outputs obtained from the simulation in the waveform.
TimeEvent
0 ns, start-updataa[] value: 0000 0000h
datab[] value: 0000 0000h
Output value: The undefined value is seen on the result[] port, which is ignored.
All values seen on the output port before the 6th clock cycle are merely due to the
behavior of the system during start-up and should be disregarded.
17600 nsOutput value: 7FC0 0000h
Exception handling ports: nan asserts
The division of zeros result in a NaN.
2000 nsdataa[] value: 2D0B 496Ah
datab[] value: 3A5A FC26h
Both inputs hold normal values.
6-5
20800 nsOutput result: 321F 6EC6h
Exception output ports: nan deasserts
The division of two normal value results in a normal value.
11000 nsdataa[] value: 046E 78BCh
datab[] value: 6798 698Bh
Both inputs hold normal values.
27200 nsOutput value: 0h
Exception handling ports: underflow and zero asserts
The division of the two normal values results in a denormal value. As denormal
values are not supported, the result is zero and the underflow port asserts. The zero
port is also asserted to indicate that the result is zero.
2600 nsdataa[] value: 0D72 54A8h
datab[] value: 0070 0000h
The input port dataa[] holds a normal value while the input port datab[] holds a
denormal value.
36800 nsOutput value: 7F80 0000h
ALTFP_DIV IP Core
Send Feedback
Exception handling ports: division_by_zero asserts
Denormal numbers are forced-zero values, therefore, attempts to divide a normal
value with a zero result in an infinity value.
Altera Corporation
dataa[]
datab[]
clk_en
clock
inst
ALTFP_DIV
result[]
overflow
underflow
zero
nan
division_by_zero
aclr
6-6
ALTFP_DIV Signals
ALTFP_DIV Signals
Figure 6-2: ALTFP_DIV Signals
UG-01058
2014.12.19
Table 6-5: ALTFP_DIV Input Signals
Port NameRequiredDescription
aclrNoAsynchronous clear input for the floating-point divider. The source is
asynchronously reset when the aclr signal is asserted high.
clockYesClock input to the IP core.
clk_enNoClock enable to the floating-point divider. This port enables division.
This signal is active high. When this signal is low, no division takes
place and the outputs remain the same.
dataa[]YesNumerator data input. The MSB is the sign bit, the next MSBs are the
exponent, and the LSBs are the mantissa. The size of this port is the
total width of the sign bit, exponent bits and mantissa bits.
datab[]YesDenominator data input.The MSB is the sign bit, the next MSBs are
the exponent, and the LSBs are the mantissa. The size of this port is
the total width of the sign bit, exponent bits and mantissa bits.
Table 6-6: ALTFP_DIV Output Signals
Port NameRequiredDescription
result[]YesDivider output port. The division result (after rounding). As with the
input values, the MSB is the sign, the next MSBs are the exponent,
and the LSBs are the mantissa. The size of this port is the total width
of the sign bit, exponent bits, and mantissa bits.
Altera Corporation
ALTFP_DIV IP Core
Send Feedback
UG-01058
2014.12.19
ALTFP_DIV Parameters
Port NameRequiredDescription
overflowNoOverflow port for the divider. Asserted when the result of the division
(after rounding) exceeds or reaches infinity. Infinity is defined as a
number in which the exponent exceeds 2WIDTH_EXP–1.
underflowNoUnderflow port for the divider. Asserted when the result of the
division (after rounding) is zero even though neither of the inputs to
the divider is zero, or when the result is a denormalized number.
zeroNoZero port for the divider. Asserted when the value of result[] is
zero.
6-7
division_by_
zero
nanNoNaN port. Asserted when an invalid division occurs, such as infinity
NoDivision-by-zero output port for the divider. Asserted when the value
of datab[] is a zero.
dividing infinity or zero dividing zero. A NaN value appears as
output at the result[] port. Any division of a NaN value causes the
nan output port to be asserted.
ALTFP_DIV Parameters
Table 6-7: ALTFP_DIV Parameters
Parameter NameTypeRequiredDescription
WIDTH_EXPIntegerYesSpecifies the precision of the exponent. If this
parameter is not specified, the default is 8. The bias of
the exponent is always set to (2 ^ (WIDTH_EXP - 1)) - 1,
that is, 127 for single precision and 1023 for double
precision. The value of WIDTH_EXP must be 8 for single
precision, 11 for double precision, and a minimum of
11 for single extended precision.
The value of WIDTH_EXP must be less than the value of
WIDTH_MAN, and the sum of WIDTH_EXP and WIDTH_MAN
must be less than 64.
WIDTH_MANIntegerYesSpecifies the precision of the mantissa. If this
ROUNDINGStringYesSpecifies the rounding mode. The default value is TO_
ALTFP_DIV IP Core
Send Feedback
parameter is not specified, the default is 23. When
WIDTH_EXP is 8 and the floating-point format is the
single-precision format, the WIDTH_MAN value must be
23. Otherwise, the value of WIDTH_MAN must be a
minimum of 31.
The value of WIDTH_MAN must be greater than the value
of WIDTH_EXP, and the sum of WIDTH_EXP and WIDTH_
MAN must be less than 64.
NEAREST. The floating-point divider does not support
other rounding modes.
Altera Corporation
6-8
ALTFP_DIV Parameters
Parameter NameTypeRequiredDescription
OPTIMIZEStringNoSpecifies whether to optimize for area or for speed.
Values are AREA and SPEED. A value of AREA optimizes
the design using less total logic utilization or resources.
A value of SPEED optimizes the design for better
performance. If this parameter is not specified, the
default value is SPEED.
PIPELINEIntegerNoSpecifies the number of clock cycles needed to produce
the result. For the single-precision format, the latency
options are 33, 14 or 6. For the double-precision
format, the latency options are 61, 24 or 10.
For the single-extended precision format, the value
ranges from a minimum of 41 to a maximum of 61.
For the low-latency option, the latency is determined
from the mantissa width. For a mantissa width of 31 to
40 bits, the value is 8 or 18. For a mantissa width of 41
bits or more, the value is 10 or 24.
UG-01058
2014.12.19
Altera Corporation
ALTFP_DIV IP Core
Send Feedback
2014.12.19
www.altera.com
101 Innovation Drive, San Jose, CA 95134
ALTFP_MULT IP Core
7
UG-01058
Subscribe
Send Feedback
ALTFP_MULT IP Core Features
The ALTFP_MULT IP core offers the following features:
• Multiplication functions.
• Optional exception handling output ports such as zero, overflow, underflow, and nan.
• Optional dedicated multiplier circuitries in Cyclone and Stratix series.
ALTFP_MULT Output Latency
The output latency options for the ALTFP_MULT IP core are similar for all precisions.
Table 7-1: Latency Options for Each Precision Format
2014 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, ENPIRION, MAX, MEGACORE, NIOS, QUARTUS and STRATIX words and logos are
trademarks of Altera Corporation and registered in the U.S. Patent and Trademark Office and in other countries. All other words and logos identified as
trademarks or service marks are the property of their respective holders as described at www.altera.com/common/legal.html. Altera warrants performance
of its semiconductor products to current specifications in accordance with Altera's 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 any information,
product, or service described herein except as expressly agreed to in writing by Altera. Altera customers are advised to obtain the latest version of device
specifications before relying on any published information and before placing orders for products or services.
The following tables list the resource utilization and performance information for the ALTFP_MULT IP
core. The information was derived using the Quartus II software version 10.0.
Altera Corporation
ALTFP_MULT IP Core
Send Feedback
UG-01058
2014.12.19
ALTFP_MULT Design Example: Multiplication of Double-Precision Format Numbers
Table 7-3: ALTFP_MULT Resource Utilization and Performance for Stratix IV Devices with Dedicated
Multiplier Circuitry
Logic usage
7-3
Device FamilyPrecision
Output
latency
Adaptive
Look-Up
Tables
(ALUTs)
Dedicated
Logic
Registers
(DLRs)
Adaptive
Logic
Modules
(ALMs)
18-bit DSP
f
MAX
(MHz)
51381481004274
Single
111853011904445
Stratix IV
530636727210255
Double
1141952334810395
ALTFP_MULT Design Example: Multiplication of Double-Precision Format
Numbers
This design example uses the ALTFP_MULT IP core to compute the multiplication results of two doubleprecision format numbers. This example uses the parameter editor GUI to define the core.
Related Information
• Floating-Point IP Cores Design Example Files on page 1-16
• Floating-Point IP Cores Design Examples
Provides the design example files for the Floating-Point IP cores
• ModelSim-Altera Software Support
Provides information about installation, usage, and troubleshooting
ALTFP_MULT Design Example: Understanding the Simulation Waveform
The simulation waveform in this design example is not shown in its entirety. Run the design example files
in the ModelSim-Altera software to see the complete simulation waveforms.
Figure 7-1: ALTFP_MULT Simulation Waveform
This figure shows the expected simulation results in the ModelSim-Altera software.
ALTFP_MULT IP Core
Send Feedback
Altera Corporation
7-4
Parameters
This design example implements a floating-point multiplier for the multiplication of double-precision
format numbers. All the optional input ports (clk_en and aclr) and output ports (overflow, underflow,
zero, and nan) are enabled.
In this example, the latency is set to 6 clock cycles. Therefore, every multiplication result appears at the
result port 6 clock cycles later.
Table 7-4: Summary of Input Values and Corresponding Outputs
This table lists the inputs and corresponding outputs obtained from the simulation in the waveform.
TimeEvent
UG-01058
2014.12.19
0 ns, start-updataa[] value: 0000 0000 0000 0000h
datab[] value: 4037 742C 3C9E ECC0h
Output value: All values seen on the output port before the 6th clock cycle are
merely due to the behavior of the system during start-up and should be disregarded.
110 nsOutput value: 0000 0000 0000 0000h
Exception handling ports: zero asserts
The multiplication of zero at the input port dataa[], and a non-zero value at the
input port datab[] results in a zero.
600 nsdataa[] value: 7FF0 0000 0000 0000h
datab[] value: 4037 742C 3C9E ECC0h
This is the multiplication of an infinity value and a normal value.
710 nsOutput value: 7FF0 0000 0000 0000h
Exception handling ports: overflow asserts
The multiplication of an infinity value and a normal value results in infinity. All
multiplications with an infinity value results in infinity except when infinity is
multiplied with a zero.
Parameters
Altera Corporation
ALTFP_MULT IP Core
Send Feedback
UG-01058
2014.12.19
Table 7-5: ALTFP_MULT Megafunction Parameters
Parameter NameTypeRequiredDescription
WIDTH_EXPIntegerNoSpecifies the value of the exponent. If this
ALTFP_MULT Signals
parameter is not specified, the default is 8.
The bias of the exponent is always 2
EXP - 1)
-1 (that is, 127 for the single-
(WIDTH_
precision format and 1023 for the doubleprecision format). WIDTH_EXP must be 8
for the single-precision format or a
minimum of 11 for the double-precision
format and the single-extended precision
format. WIDTH_EXP must less than WIDTH_
MAN. The sum of WIDTH_EXP and WIDTH_
MAN must be less than 64.
7-5
WIDTH_MAN
IntegerNoSpecifies the value of the mantissa. If this
parameter is not specified, the default is
23. When WIDTH_EXP is 8 and the floating-
point format is single-precision, the
WIDTH_MAN value must be 23; otherwise,
the value of WIDTH_MAN must be a
minimum of 31. The WIDTH_MAN value
must always be greater than the WIDTH_
EXP value. The sum of WIDTH_EXP and
WIDTH_MAN must be less than 64.
DEDICATED_MULTIPLIER_ CIRCUITRY StringNoSpecifies whether to use dedicated
multiplier circuitry. Values are AUTO, YES,
or NO. If this parameter is not specified, the
default is AUTO. If a device does not have
dedicated multiplier circuitry, the
DEDICATED_MULTIPLIER_CIRCUITRY
parameter has no effect and defaults to NO.
PIPELINEIntegerNoSpecifies the number of clock cycles
needed to produce the multiplied result.
Values are 5, 6, 10, and 11. If this
parameter is not specified, the default is 5.
ALTFP_MULT Signals
Table 7-6: ALTFP_MULT IP Core Input Signals
Port NameRequiredDescription
clockYesClock input to the IP core.
clk_enNoClock enable. Allows multiplication to take place when asserted high.
ALTFP_MULT IP Core
Send Feedback
When signal is asserted low, no multiplication occurs and the outputs
remain unchanged.
Altera Corporation
7-6
ALTFP_MULT Signals
Port NameRequiredDescription
aclrNoSynchronous clear. Source is asynchronously reset when asserted
high.
dataa[]YesFloating-point input data input to the multiplier. The MSB is the sign,
the next MSBs are the exponent, and the LSBs are the mantissa. This
input port size is the total width of sign bit, exponent bits, and
mantissa bits.
datab[]YesFloating-point input data to the multiplier. The MSB is the sign, the
next MSBs are the exponent, and the LSBs are the mantissa. This
input port size is the total width of sign bit, exponent bits, and
mantissa bits.
Table 7-7: ALTFP_MULT IP Core Output Signals
Port NameRequiredDescription
result[]YesOutput port for the multiplier. The floating-point result after
rounding. The MSB is the sign, the next MSBs are the exponent, and
the LSBs are the mantissa.
overflowNoOverflow port for the multiplier. Asserted when the result of the
multiplication, after rounding, exceeds or reaches infinity. Infinity is
defined as a number in which the exponent exceeds 2
WIDTH_EXP
UG-01058
2014.12.19
-1.
underflowNoUnderflow port for the multiplier. Asserted when the result of the
multiplication (after rounding) is 0 while none of the inputs to the
multiplication is 0, or asserted when the result is a denormalized
number.
zeroNoZero port for the multiplier. Asserted when the value of result[] is
0.
nanNoNaN port for the multiplier. This port is asserted when an invalid
multiplication occurs, such as the multiplication of infinity and zero.
In this case, a NaN value is the output generated at the result[]
port. The multiplication of any value and NaN produces NaN.
Altera Corporation
ALTFP_MULT IP Core
Send Feedback
2014.12.19
www.altera.com
101 Innovation Drive, San Jose, CA 95134
ALTFP_SQRT
8
UG-01058
Subscribe
Send Feedback
You can use the ports and parameters available to customize the ALTFP_SQRT IP core according to your
application.
ALTFP_SQRT Features
The ALTFP_SQRT IP core offers the following features:
• Square root functions.
• Optional exception handling output ports such as zero, overflow, and nan.
Output Latency
The output latency options for the ALTFP_SQRT megafunction differs depending on the precision
selected, the width of the mantissa, or both.
Table 8-1: Latency Options for Each Precision Format
2014 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, ENPIRION, MAX, MEGACORE, NIOS, QUARTUS and STRATIX words and logos are
trademarks of Altera Corporation and registered in the U.S. Patent and Trademark Office and in other countries. All other words and logos identified as
trademarks or service marks are the property of their respective holders as described at www.altera.com/common/legal.html. Altera warrants performance
of its semiconductor products to current specifications in accordance with Altera's 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 any information,
product, or service described herein except as expressly agreed to in writing by Altera. Altera customers are advised to obtain the latest version of device
specifications before relying on any published information and before placing orders for products or services.
This table lists the resource utilization and performance information for the ALTFP_SQRT IP core. The
information was derived using the Quartus II software version 10.0.
Table 8-2: ALTFP_SQRT Resource Utilization and Performance for Stratix IV Devices
Logic usage
8-3
Device FamilyPrecision
Output
latency
Adaptive
Look-Up
Tables
(ALUTs)
Dedicated
Login
Registers
(DLRs)
Adaptive
Logic
Modules
(ALMs)
f
MAX
(MHz)
Single28502932528472
Stratix IV
Double572,1773,7252,202366
ALTFP_SQRT Design Example: Square Root of Single-Precision Format
Numbers
This design example uses the ALTFP_SQRT IP core to compute the square root of single-precision format
numbers. This example uses the MegaWizard Plug-In Manager in the Quartus II software.
Related Information
• Floating-Point IP Cores Design Example Files on page 1-16
• Floating-Point IP Cores Design Examples
Provides the design example files for the Floating-Point IP cores
• ModelSim-Altera Software Support
Provides information about installation, usage, and troubleshooting
ALTFP_SQRT Design Example: Understanding the Simulation Results
The simulation waveform in this design example is not shown in its entirety. Run the design example files
in the ModelSim-Altera software to see the complete simulation waveforms.
These figures show the expected simulation results in the ModelSim-Altera software.
This design example implements a floating-point square root function for single-precision format
numbers with all the exception output ports instantiated. The output ports include overflow, zero, and
nan.
The output latency is 28 clock cycles. Every square root computation generates the output result 28 clock
cycles later.
Table 8-3: Summary of Input Values and Corresponding Outputs
This table lists the inputs and corresponding outputs obtained from the simulation in the waveforms.
TimeEvent
UG-01058
2014.12.19
0 ns, start-upOutput value: All values seen on the output port before the 28th clock cycle are merely
due to the behavior of the system during start-up and should be disregarded.
2 000 nsdata[] value: 2D0B 496Ah
The data input is a normal number.
84 000 nsOutput value: 363C D4EBh
The square root computation of a normal input results in a normal output.
Exception handling ports: zero asserts
The square root computation of zero results in a zero.
23 000 nsdata[] value: 7F80 0000h
The input is infinity.
105 000 nsOutput value: 7F80 0000h
Exception handling ports: overflow asserts
ALTFP_SQRT Signals
Altera Corporation
ALTFP_SQRT
Send Feedback
data[]
clock
clk_en
inst
ALTFP_SQRT
result[]
overflow
nan
zero
aclr
UG-01058
2014.12.19
Figure 8-3: ALTFP_SQRT Signals
Table 8-4: ALTFP_SQRT IP Core Input Signals
Port NameRequiredDescription
ALTFP_SQRT Signals
8-5
clockYesClock input to the IP core.
clk_enNoClock enable that allows square root operations when the port is
asserted high. When the port is asserted low, no operation occurs and
the outputs remain unchanged.
aclrNoAsynchronous clear. When the aclr port is asserted high, the function
is asynchronously reset.
YesFloating-point input data. The MSB is the sign, the next MSBs are the
exponent, and the LSBs are the mantissa. This input port size is the
total width of sign bit, exponent bits, and mantissa bits.
Table 8-5: ALTFP_SQRT IP Core Output Signals
Port NameRequiredDescription
result[]YesSquare root output port for the floating-point result. The MSB is the
sign, the next MSBs are the exponent, and the LSBs are the mantissa.
The size of this port is the total width of the sign bit, exponent bits,
and mantissa bits.
overflowYesOverflow port. Asserted when the result of the square root (after
rounding) exceeds or reaches infinity. Infinity is defined as a number
in which the exponent exceeds 2
zeroYesZero port. Asserted when the value of the result[] port is 0.
nanYesNaN port. Asserted when an invalid square root occurs, such as
WIDTH_EXP
-1.
negative numbers or NaN inputs.
ALTFP_SQRT
Altera Corporation
Send Feedback
8-6
ALTFP_SQRT Parameters
ALTFP_SQRT Parameters
Table 8-6: ALTFP_SQRT Parameters
Parameter NameTypeRequiredDescription
WIDTH_EXPIntegerYesSpecifies the precision of the exponent. If this
parameter is not specified, the default is 8. The bias of
the exponent is always set to 2 (WIDTH_EXP -1) -1, that
is, 127 for the single-precision format and 1023 for the
double-precision format. The value of the WIDTH_EXP
parameter must be 8 for the single-precision format,
11 for the double-precision format, and a minimum of
11 for the single-extended precision format. The value
of the WIDTH_EXP parameter must be less than the
value of the WIDTH_MAN parameter, and the sum of the
WIDTH_EXP and WIDTH_MAN parameters must be less
than 64.
UG-01058
2014.12.19
WIDTH_MANIntegerYesSpecifies the value of the mantissa. If this parameter is
not specified, the default is 23. When the WIDTH_EXP
parameter is 8 and the floating-point format is singleprecision, the WIDTH_MAN parameter value must be 23.
Otherwise, the value of the WIDTH_MAN parameter must
be a minimum of 31. The value of the WIDTH_MAN
parameter must be greater than the value of the
WIDTH_EXP parameter. The sum of the WIDTH_EXP and
WIDTH_MAN parameters must be less than 64.
ROUNDINGStringYesSpecifies the rounding mode. The default value is TO_
NEAREST. Other rounding modes are not supported.
PIPELINEIntegerYesSpecifies the number of clock cycles for the square
root results of the result[] port. Values are WIDTH_
MAN + 5 and ((WIDTH_MAN + 5/2)+2) as specified by
truncating the radix point.
Altera Corporation
ALTFP_SQRT
Send Feedback
2014.12.19
www.altera.com
101 Innovation Drive, San Jose, CA 95134
ALTFP_EXP IP Core
9
UG-01058
Subscribe
Send Feedback
You can use the ports and parameters available to customize the ALTFP_EXP IP core according to your
application.
ALTFP_EXP Features
The ALTFP_EXP IP core offers the following features:
• Exponential value of a given input.
• Optional exception handling output ports such as zero, overflow, underflow, and nan.
Output Latency
The output latency options for the ALTFP_EXP megafunction differs depending on the precision
selected, the width of the mantissa, or both.
2014 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, ENPIRION, MAX, MEGACORE, NIOS, QUARTUS and STRATIX words and logos are
trademarks of Altera Corporation and registered in the U.S. Patent and Trademark Office and in other countries. All other words and logos identified as
trademarks or service marks are the property of their respective holders as described at www.altera.com/common/legal.html. Altera warrants performance
of its semiconductor products to current specifications in accordance with Altera's 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 any information,
product, or service described herein except as expressly agreed to in writing by Altera. Altera customers are advised to obtain the latest version of device
specifications before relying on any published information and before placing orders for products or services.
This table lists the resource utilization and performance information for the ALTFP_EXP IP core. The
information was derived using the Quartus II software version 10.0.
Table 9-2: ALTFP_EXP Resource Utilization and Performance for Stratix IV Devices
Logic usage
Device FamilyPrecision
Output
Latency
Adaptive
Look-Up
Tables
(ALUTs)
Dedicated
Logic
Registers
(DLRs)
Adaptive
Logic
Modules
(ALMs)
18-bit DSP
f
MAX
(MHz)
Single1763152144819284
Stratix IV
Double254,1042,0072,93946279
ALTFP_EXP Design Example: Exponential of Single-Precision Format
Numbers
This design example uses the ALTFP_EXP IP core to compute the exponential value of single-precision
format numbers. This example uses the MegaWizard Plug-In Manager in the Quartus II software.
Related Information
• Floating-Point IP Cores Design Example Files on page 1-16
• Floating-Point IP Cores Design Examples
Provides the design example files for the Floating-Point IP cores
• ModelSim-Altera Software Support
Provides information about installation, usage, and troubleshooting
(2)
Any denormal input is treated as a zero before going through the exponential process.
Altera Corporation
ALTFP_EXP IP Core
Send Feedback
UG-01058
2014.12.19
ALTFP_EXP Design Example: Understanding the Simulation Results
ALTFP_EXP Design Example: Understanding the Simulation Results
The simulation waveform in this design example is not shown in its entirety. Run the design example files
in the ModelSim-Altera software to see the complete simulation waveforms.
These figures show the expected simulation results in the ModelSim-Altera software.
This design example implements a floating-point exponential for the single-precision format numbers.
The optional input ports (clk_en and aclr) and all four exception handling output ports (nan, overflow,
underflow, and zero) are enabled.
For single-precision format numbers, the latency is fixed at 17 clock cycles. Therefore, every exponential
operation outputs the results 17 clock cycles later.
Table 9-3: Summary of Input Values and Corresponding Outputs
This table lists the inputs and corresponding outputs obtained from the simulation in the waveforms.
TimeEvent
0 ns, start-updata[] value: 1A03 568Ch
Output value: An undefined value is seen on the result[] port, which is ignored. All
values seen on the output port before the 17th clock cycle are merely due to the
behavior of the system during start-up and should be disregarded.
ALTFP_EXP IP Core
Send Feedback
Altera Corporation
9-4
ALTFP_EXP Signals
TimeEvent
82.5 nsOutput value: 3F80 0000h
As the input value of 1A03568Ch is a very small number, it is seen as a value that is
approaching zero, and the result approaches 1 (which is represented by 3F800000).
Exponential operations carried out on numbers of very small magnitudes result in a
1 and assert the underflow flag.
Exception handling ports: underflow asserts
30 nsdata[] value: F3FC DEFFh
This is a normal negative value of a very large magnitude.
112.5 nsOutput value: 0000 0000h
The outcome of exponential operations on negative numbers of very large
142.5 nsOutput value: 7F80 0000h
The operation on positive infinite values results in infinity.
Exception handling ports: underflow deasserts, overflow asserts
90 nsdata[] value: 7FC0 0000h
This is a NaN.
172.5 nsOutput value: 7FC0 0000h
The exponential of a NaN results in a NaN.
Exception handling ports: nan asserts
120 nsdata[] value: C1D4 49BAh
This is a normal value.
202.5 nsOutput value: 2C52 5981h
The result is a normal value.
Exception handling ports: nan deasserts
ALTFP_EXP Signals
Altera Corporation
ALTFP_EXP IP Core
Send Feedback
data[]
clk_en
clock
inst
ALTFP_EXP
result[]
underflow
zero
nan
underflow
aclr
UG-01058
2014.12.19
Figure 9-3: ALTFP_EXP Signals
Table 9-4: ALTFP_EXP IP Core Input Signals
Port NameRequiredDescription
ALTFP_EXP Signals
9-5
aclrNoAsynchronous clear. When the aclr port is asserted high the function
is asynchronously reset.
clk_enNoClock enable. When the clk_en port is asserted high, an exponential
value operation takes place. When this signal is asserted low, no
operation occurs and the outputs remain unchanged.
clockYesClock input to the IP core.
data[]YesFloating-point input data. The MSB is the sign, the next MSBs are the
exponent, and the LSBs are the mantissa. This input port size is the
total width of the sign bit, exponent bits, and mantissa bits.
Table 9-5: ALTFP_EXP IP Core Output Signals
Port NameRequiredDescription
result[]YesThe floating-point exponential result of the value at data[]. The MSB
is the sign, the next MSBs are the exponent, and the LSBs are the
mantissa. The size of this port is the total width of the sign bit,
exponent bits, and mantissa bits.
overflowNoOverflow exception output. Asserted when the result of the operation
(after rounding) is infinite.
underflowNoUnderflow exception output. Asserted when the result of the exponen‐
tial approaches 1 (from numbers of very small magnitude), or when
the result approaches 0 (from negative numbers of very large
magnitudes).
ALTFP_EXP IP Core
zeroNoZero exception output. Asserted when the value in the result[] port
is zero.
Send Feedback
Altera Corporation
9-6
ALTFP_EXP Parameters
Port NameRequiredDescription
nanNoNaN exception output. Asserted when an invalid operation occurs.
Any operation involving NaN also asserts the nan port.
ALTFP_EXP Parameters
Table 9-6: ALTFP_EXP IP Core Parameters
Parameter NameTypeRequiredDescription
WIDTH_EXPIntegerYesSpecifies the precision of the exponent. If this
parameter is not specified, the default is 8. The bias
of the exponent is always set to 2
that is, 127 for the single-precision format and 1023
for the double-precision format. The value of the
WIDTH_EXP parameter must be 8 for the single-
precision format, 11 for the double-precision
format, and a minimum of 11 for the singleextended precision format. The value of the WIDTH_
EXP parameter must be less than the value of the
WIDTH_MAN parameter, and the sum of the WIDTH_
EXP and WIDTH_MAN parameters must be less than
64.
(WIDTH_EXP -1)
UG-01058
2014.12.19
-1,
WIDTH_MAN
IntegerYesSpecifies the value of the mantissa. If this parameter
is not specified, the default is 23. When the WIDTH_
EXP parameter is 8 and the floating-point format is
single-precision, the WIDTH_MAN parameter value
must be 23. Otherwise, the value of the WIDTH_MAN
parameter must be a minimum of 31. The value of
the WIDTH_MAN parameter must be greater than the
value of the WIDTH_EXP parameter. The sum of the
WIDTH_EXP and WIDTH_MAN parameters must be less
than 64.
PIPELINEIntegerYesSpecifies the amount of latency, expressed in clock
cycles, used in the ALTFP_EXP IP core. Acceptable
pipeline values are 17, 22, and 25 cycles of latency.
Create the ALTFP_EXP IP core with the
MegaWizard Plug-In Manager to calculate the value
for this parameter.
ROUNDINGStringYesSpecifies the rounding mode. The default value is
TO_NEAREST. Other rounding modes are not
supported.
Altera Corporation
ALTFP_EXP IP Core
Send Feedback
2014.12.19
www.altera.com
101 Innovation Drive, San Jose, CA 95134
ALTFP_INV IP Core
10
UG-01058
Subscribe
You can use the ports and parameters available to customize the ALTFP_INV IP core according to your
application.
ALTFP_INV Features
The ALTFP_INV IP core offers the following features:
• Inverse value of a given input.
• Optional exception handling output ports such as zero, division_by_zero, underflow, and nan.
Output Latency
The output latency options for the ALTFP_INV megafunction differs depending on the precision
selected, the width of the mantissa, or both.
2014 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, ENPIRION, MAX, MEGACORE, NIOS, QUARTUS and STRATIX words and logos are
trademarks of Altera Corporation and registered in the U.S. Patent and Trademark Office and in other countries. All other words and logos identified as
trademarks or service marks are the property of their respective holders as described at www.altera.com/common/legal.html. Altera warrants performance
of its semiconductor products to current specifications in accordance with Altera's 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 any information,
product, or service described herein except as expressly agreed to in writing by Altera. Altera customers are advised to obtain the latest version of device
specifications before relying on any published information and before placing orders for products or services.
This table lists the resource utilization and performance information for the ALTFP_INV IP core. The
information was derived using the Quartus II software version 10.0.
Table 10-2: ALTFP_INV Resource Utilization and Performance for Stratix IV Devices
Logic usage
NaN
Device FamilyPrecision
Output
Latency
Adaptive
Look-Up
Tables
(ALUTs)
Dedicated
Logic
Registers
(DLRs)
Adaptive
Logic
Modules
(ALMs)
18-Bit DSP
f
MAX
(MHz)
Single2040161637316412
Stratix IV
Double279391,38691248203
ALTFP_INV Design Example: Inverse of Single-Precision Format Numbers
This design example uses the ALTFP_INV IP core to compute the inverse of single-precision format
numbers. This example uses the parameter editor in the Quartus II software.
Related Information
• Floating-Point IP Cores Design Example Files on page 1-16
• Floating-Point IP Cores Design Examples
Provides the design example files for the Floating-Point IP cores
• ModelSim-Altera Software Support
Provides information about installation, usage, and troubleshooting
(3)
Any calculated or computed denormal output is replaced by a zero and asserts the zero and underflow flags.
(4)
Any denormal input is treated as a zero before going through the inverse process.
Altera Corporation
ALTFP_INV IP Core
Send Feedback
UG-01058
2014.12.19
ALTFP_INV Design Example: Understanding the Simulation Results
ALTFP_INV Design Example: Understanding the Simulation Results
The simulation waveform in this design example is not shown in its entirety. Run the design example files
in the ModelSim-Altera software to see the complete simulation waveforms.
These figures show the expected simulation results in the ModelSim-Altera software.
This design example implements a floating-point inverse for single-precision format numbers. The
optional input ports (clk_en and aclr) and all four exception handling output ports (division_by_zero,
nan, zero, and underflow) are enabled.
The latency is fixed at 20 clock cycles; therefore, every inverse operation outputs results 20 clock cycles
later.
This table lists the inputs and corresponding outputs obtained from the simulation in the waveforms.
Table 10-3: Summary of Input Values and Corresponding Outputs
TimeEvent
0 ns, start-updata[] value: 34A2 E42Fh
Output value: An undefined value is seen on the result[] port, which is ignored.
All values seen on the output port before the 20th clock cycle are merely due to the
behavior of the system during start-up and should be disregarded.
97.5 nsOutput value: 4A49 2A2Fh
Exception handling ports: division_by_zero deasserts
The inverse of a normal number results in a normal value.
ALTFP_INV IP Core
Send Feedback
Altera Corporation
10-4
Ports
TimeEvent
10 nsdata[] value: 7F80 0000h
This is an infinity value.
107.5 nsOutput value: 0000 0000h
Exception handling ports: zero asserts
The inverse of an infinity value produces a zero.
60 nsdata[] value: 7FC0 0000h
This is a NaN.
157.5 nsOutput value: 7FC0 0000h
Exception handling ports: nan asserts
The inverse of a NaN results in a NaN
70 nsdata[] value: 0000 1000h
This is a denormal number.
UG-01058
2014.12.19
167.5 nsOutput value: 7F80 0000h
Exception handling ports: nan deasserts, division_by_zero asserts
Denormal numbers are forced-zero values, therefore, the inverse of a zero results in
infinity.
Ports
Table 10-4: ALTFP_INV Megafunction Input Ports
Port NameRequiredDescription
aclrNoAsynchronous clear. When the aclr port is asserted high, the
function is asynchronously cleared.
clk_enNoClock enable. When the clk_en port is asserted high, an
inversion value operation takes place. When signal is asserted
low, no operation occurs and the outputs remain unchanged.
clockYesClock input to the megafunction.
data[]YesFloating-point input data. The MSB is the sign, the next MSBs
are the exponent, and the LSBs are the mantissa. This input port
size is the total width of the sign bit, exponent bits, and mantissa
bits.
Altera Corporation
ALTFP_INV IP Core
Send Feedback
UG-01058
2014.12.19
Table 10-5: ALTFP_INV Megafunction Output Ports
Port NameRequiredDescription
result[]YesThe floating-point inverse result of the value at the
underflowNoUnderflow exception output. Asserted when the result of
zeroNoZero exception output. Asserted when the value at the
division_by_zeroNoDivision-by-zero exception output. Asserted when the
nanNoNaN exception output. Asserted when an invalid inversion
Parameters
data[]input port. The MSB is the sign, the next MSBs are
the exponent, and the LSBs are the mantissa. The size of
this port is the total width of the sign bit, exponent bits,
and mantissa bits.
the inversion (after rounding) is a denormalized number.
result[] port is a zero.
denominator input is a zero.
occurs, such as the inversion of NaN. In this case, a NaN
value is output to the result[] port. Any operation
involving NaN also asserts the nan port.
10-5
Parameters
Table 10-6: ALTFP_INV Megafunction Parameters
Parameter NameTypeRequiredDescription
WIDTH_EXPIntegerYesSpecifies the precision of the exponent. If this
parameter is not specified, the default is 8. The bias
of the exponent is always set to 2
that is, 127 for the single-precision format and 1023
for the double-precision format. The value of the
WIDTH_EXP parameter must be 8 for the single-
precision format, 11 for the double-precision
format, and a minimum of 11 for the singleextended precision format. The value of the WIDTH_
EXP parameter must be less than the value of the
WIDTH_MAN parameter, and the sum of the WIDTH_
EXP and WIDTH_MAN parameters must be less than
64.
(WIDTH_EXP -1)
-1,
ALTFP_INV IP Core
Send Feedback
Altera Corporation
10-6
Parameters
Parameter NameTypeRequiredDescription
WIDTH_MANIntegerYesSpecifies the value of the mantissa. If this parameter
is not specified, the default is 23. When the WIDTH_
EXP parameter is 8 and the floating-point format is
single-precision, the WIDTH_MAN parameter value
must be 23. Otherwise, the value of the WIDTH_MAN
parameter must be a minimum of 31. The value of
the WIDTH_MAN parameter must be greater than the
value of the WIDTH_EXP parameter. The sum of the
WIDTH_EXP and WIDTH_MAN parameters must be less
than 64.
PIPELINEIntegerYesSpecifies the amount of latency in clock cycles used
in the ALTFP_INV megafunction. Create the
ALTFP_INV megafunction with the MegaWizard
Plug-In Manager to calculate the value for this
parameter.
ROUNDINGStringNoSpecifies the rounding mode. The default value is
TO_NEAREST. Other rounding modes are not
supported.
UG-01058
2014.12.19
Altera Corporation
ALTFP_INV IP Core
Send Feedback
2014.12.19
www.altera.com
101 Innovation Drive, San Jose, CA 95134
ALTFP_INV_SQRT IP Core
11
UG-01058
Subscribe
Send Feedback
You can use the ports and parameters available to customize the ALTFP_INV_SQRT IP core according to
your application.
ALTFP_INV_SQRT Features
The ALTFP_INV_SQRT IP core offers the following features:
• Inverse square root value of a given input.
• Optional exception handling output ports such as zero, division_by_zero, and nan.
Output Latency
The output latency options for the ALTFP_INV_SQRT megafunction differs depending on the precision
selected, the width of the mantissa, or both.
Table 11-1: Latency Options for Each Precision Format
2014 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, ENPIRION, MAX, MEGACORE, NIOS, QUARTUS and STRATIX words and logos are
trademarks of Altera Corporation and registered in the U.S. Patent and Trademark Office and in other countries. All other words and logos identified as
trademarks or service marks are the property of their respective holders as described at www.altera.com/common/legal.html. Altera warrants performance
of its semiconductor products to current specifications in accordance with Altera's 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 any information,
product, or service described herein except as expressly agreed to in writing by Altera. Altera customers are advised to obtain the latest version of device
specifications before relying on any published information and before placing orders for products or services.
ISO
9001:2008
Registered
11-2
ALTFP_INV_SQRT Resource Utilization and Performance
Table 11-2: Truth Table for Inverse Square Root Operations
UG-01058
2014.12.19
DATA[]SIGN BITRESULT[]ZeroDivision_by_
zero
Normal0Normal000
Normal1NaN001
Denormal 0/1Infinity010
Zero0/1Infinity010
Infinity0/1Zero100
NaNXNaN001
ALTFP_INV_SQRT Resource Utilization and Performance
This table lists the resource utilization and performance information for the ALTFP_INV_SQRT IP core.
The information was derived using the Quartus II software version 10.0.
Table 11-3: ALTFP_INV_SQRT Resource Utilization and Performance forStratix IV Devices
Logic usage
Device FamilyPrecision
Output
Latency
Adaptive
Look-up
Tables
(ALUTs)
Dedicated
Logic
Registers
(DLRs)
Adaptive
Logic
Modules
(ALMs)
18-Bit DSP
NaN
f
MAX
(MHz)
Stratix IV
Single2650265843022413
Double361,3241,8551,20978209
ALTFP_INV_SQRT Design Example: Inverse Square Root of SinglePrecision Format Numbers
This design example uses the ALTFP_INV_SQRT IP core to compute the inverse square root of singleprecision format numbers. This example uses the parameter editor GUI to define the core.
Related Information
• Floating-Point IP Cores Design Example Files on page 1-16
• Floating-Point IP Cores Design Examples
Provides the design example files for the Floating-Point IP cores
• ModelSim-Altera Software Support
Provides information about installation, usage, and troubleshooting
(5)
Any denormal input is treated as a zero before going through the inverse process.
Altera Corporation
ALTFP_INV_SQRT IP Core
Send Feedback
UG-01058
2014.12.19
ALTFP_INV_SQRT Design Example: Understanding the Simulation Results
ALTFP_INV_SQRT Design Example: Understanding the Simulation Results
The simulation waveform in this design example is not shown in its entirety. Run the design example files
in the ModelSim-Altera software to see the complete simulation waveforms.
These figures show the expected simulation results in the ModelSim-Altera software.
This design example implements a floating-point inverse square root for single-precision format
numbers. The optional input ports (clk_en and aclr) and all three exception handling output ports
(division_by_zero, nan, and zero) are enabled.
The latency is fixed at 26 clock cycles. Therefore, every inverse square root operation outputs the results
26 clock cycles later.
This table lists the inputs and corresponding outputs obtained from the simulation in the waveforms.
Table 11-4: Summary of Input Values and Corresponding Outputs
TimeEvent
0 ns, start-updata[] value: 05AE 470Bh
Output value: An undefined value is seen on the result[] port, which can be
ignored. All values seen on the output port before the 26th clock cycle are merely
due to the behavior of the system during start-up and should be disregarded.
127.5 nsOutput value: 5C5B 64CEh
The inverse square root of a normal number results in a normal value.
10 nsdata[] value: E8A7 E93Dh
This is a negative normal value.
ALTFP_INV_SQRT IP Core
Send Feedback
Altera Corporation
data[]
clk_en
clock
inst
ALTFP_INV_SQRT
result[]
zero
nan
division_by_zero
aclr
11-4
Ports
TimeEvent
137.5 nsOutput value: FFC0 0000h
Exception handling ports: nan asserts
The inverse square root of a negative value produces a NaN.
20 nsdata[] value: 0000 0004h
The is a denormal value.
147.5 nsOutput value: 7F80 0000h
Denormal numbers are forced-zero values, therefore the inverse square root of zero
results in infinity.
Exception handling ports: nan deasserts, division_by_zero asserts
50 nsdata[] value: 7F80 0000h
This is an infinity value.
177.5 nsOutput value: 0000 0000h
UG-01058
2014.12.19
The inverse square root of an infinity value produces a zero.
Exception handling ports: zero asserts
Ports
Figure 11-3: ALTFP_INV_SQRT Signals
Altera Corporation
ALTFP_INV_SQRT IP Core
Send Feedback
UG-01058
2014.12.19
Table 11-5: ALTFP_INV_SQRT IP Core Input Signals
Port NameRequiredDescription
aclrNoAsynchronous clear. When the aclr port is asserted high, the
clk_enNoClock enable. When the clk_en port is asserted high, an
clockYesClock input to the megafunction.
data[]YesFloating-point input data. The MSB is the sign bit, the next
Table 11-6: ALTFP_INV_SQRT IP Core Output Signals
Port NameRequiredDescription
result[]YesThe floating-point inverse result of the value at the data[]
Parameters
function is asynchronously cleared.
inversion value operation takes place. When signal is asserted
low, no operation occurs and the outputs remain unchanged.
MSBs are the exponent, and the LSBs are the mantissa. This
input port size is the total width of the sign bit, exponent bits,
and mantissa bits.
input port. The MSB is the sign bit, the next MSBs are the
exponent, and the LSBs are the mantissa. The size of this port is
the total width of the sign bit, exponent bits, and mantissa bits.
11-5
zeroNoZero exception output. Asserted when the value at the
result[] port is a zero.
division_by_zeroNoDivision-by-zero exception output. Asserted when the
denominator input is a zero.
nanNoNaN exception output. Asserted when an invalid inversion of
square root occurs, such as the square root of a negative
number. In this case, a NaN value is output to the result[]
output port. Any operation involving a NaN will also produce a
NaN.
WIDTH_EXPIntegerYesSpecifies the precision of the exponent. If this
parameter is not specified, the default is 8. The bias
of the exponent is always set to 2
that is, 127 for the single-precision format and 1023
for the double-precision format. The value of the
WIDTH_EXP parameter must be 8 for the single-
precision format, 11 for the double-precision
format, and a minimum of 11 for the singleextended precision format. The value of the WIDTH_
EXP parameter must be less than the value of the
WIDTH_MAN parameter, and the sum of the WIDTH_
EXP and WIDTH_MAN parameters must be less than
64.
(WIDTH_EXP -1)
UG-01058
2014.12.19
-1,
WIDTH_MAN
IntegerYesSpecifies the value of the mantissa. If this parameter
is not specified, the default is 23. When the WIDTH_
EXP parameter is 8 and the floating-point format is
single-precision, the WIDTH_MAN parameter value
must be 23. Otherwise, the value of the WIDTH_MAN
parameter must be a minimum of 31. The value of
the WIDTH_MAN parameter must be greater than the
value of the WIDTH_EXP parameter. The sum of the
WIDTH_EXP and WIDTH_MAN parameters must be less
than 64.
PIPELINEIntegerYesSpecifies the amount of latency, expressed in clock
cycles, used in the ALTFP_INV_SQRT megafunc‐
tion. Create the ALTFP_INV_SQRT megafunction
with the MegaWizard Plug-In Manager to calculate
the value for this parameter.
ROUNDINGStringNoSpecifies the rounding mode. The default value is
TO_NEAREST. Other rounding modes are not
supported.
Altera Corporation
ALTFP_INV_SQRT IP Core
Send Feedback
2014.12.19
www.altera.com
101 Innovation Drive, San Jose, CA 95134
ALTFP_LOG
12
UG-01058
Subscribe
Send Feedback
You can use the ports and parameters available to customize the ALTFP_LOG IP core according to your
application.
ALTFP_LOG Features
The ALTFP_LOG IP core offers the following features:
• Natural logarithm functions.
• Optional exception handling output ports such as zero and nan.
Output Latency
The output latency options for the ALTFP_LOG megafunction differs depending on the precision
selected, the width of the mantissa, or both.
Table 12-1: Latency Options for Each Precision Format
PrecisionMantissa WidthLatency (in clock cycles)
Single2321
Double5234
31–3625
37–4228
Single Extended
43–4831
49–5234
ALTFP_LOG Truth Table
This table lists the truth table for the natural logarithm operation.
2014 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, ENPIRION, MAX, MEGACORE, NIOS, QUARTUS and STRATIX words and logos are
trademarks of Altera Corporation and registered in the U.S. Patent and Trademark Office and in other countries. All other words and logos identified as
trademarks or service marks are the property of their respective holders as described at www.altera.com/common/legal.html. Altera warrants performance
of its semiconductor products to current specifications in accordance with Altera's 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 any information,
product, or service described herein except as expressly agreed to in writing by Altera. Altera customers are advised to obtain the latest version of device
specifications before relying on any published information and before placing orders for products or services.
ISO
9001:2008
Registered
12-2
ALTFP_LOG Resource Utilization and Performance
Table 12-2: Truth Table for Natural Logarithm Operations
DATA[]SIGN BITRESULT[]ZeroNaN
Normal0Normal00
Normal1NaN
(7)
1
Denormal
(9)
Zero
(8)
0Zero10
0Negative Infinity00
0/1Negative Infinity00
(6)
Infinity0Positive Infinity10
NaNXNaN01
ALTFP_LOG Resource Utilization and Performance
This table lists the resource utilization and performance information for the ALTFP_LOG IP core. The
information was derived using the Quartus II software version 10.0.
UG-01058
2014.12.19
01
Table 12-3: ALTFP_LOG Resource Utilization and Performance for Stratix IV Devices
Logic usage
Device FamilyPrecision
Output
Latency
Adaptive
Look-Up
Tables
(ALUTs)
Dedicated
Logic
Registers
(DLRs)
Adaptive
Logic
Modules
(ALMs)
18-Bit DSP
f
MAX
Single211,9501,8641,3788385
Stratix IV
Double345,4516,0314,15164211
ALTFP_LOG Design Example: Natural Logarithm of Single-Precision
Format Numbers
This design example uses the ALTFP_LOG IP core to compute the natural logarithm of single-precision
format numbers. This example uses the parameter editor GUI to define the core.
(6)
The natural logarithm of a negative value is invalid. Therefore, the output produced is a NaN.
(7)
The “1” in this case is equivalent to In 1.
(8)
The value of positive denormalized numbers is a value that approximates zero, and the output produced is a
negative infinity number.
(9)
The zero in this case represents zero special case of the IEEE standard. It is not equivalent to In 0, but
instead approximates to it.
(MHz)
Altera Corporation
ALTFP_LOG
Send Feedback
UG-01058
2014.12.19
Related Information
ALTFP_LOG Design Example: Understanding the Simulation Results
• Floating-Point IP Cores Design Example Files on page 1-16
• Floating-Point IP Cores Design Examples
Provides the design example files for the Floating-Point IP cores
• ModelSim-Altera Software Support
Provides information about installation, usage, and troubleshooting
ALTFP_LOG Design Example: Understanding the Simulation Results
The simulation waveform in this design example is not shown in its entirety. Run the design example files
in the ModelSim-Altera software to see the complete simulation waveforms.
These figures show the expected simulation results in the ModelSim-Altera software.
This design example includes the input of special cases to show the exception handling of the IP core,
such as the smallest valid input and the input value of “1”.
In this example, the output delay is set to 21 clock cycles. Therefore, the result is only shown at the output
port after the 21st clock cycle at 102.5 ns.
Table 12-4: Summary of Input Values and Corresponding Outputs
This table lists the inputs and corresponding outputs obtained from the simulation in the waveforms.
TimeEvent
0 ns, start-updata[] value: 0000 0000h
ALTFP_LOG
Send Feedback
Output value: An undefined value is seen on the result[] port, which is ignored.
All values seen on the output port before the 21st clock cycle are merely due to the
behavior of the system during start-up and should be disregarded.
Altera Corporation
12-4
Signals
TimeEvent
102.5 nsOutput value: FF80 0000h
The natural logarithm of zero is negative infinity.
5 nsdata[] value: 8000 0000h
This is a negative number.
107.5 nsOutput value: FFC0 0000h
Exception handling ports: nan asserts
The natural logarithm of a negative value is invalid. Therefore, the output produced
is a NaN.
30 nsdata[] value: 0040 0000h
The is a denormal value.
132.5 nsOutput value: FF80 0000h
As denormal numbers are not supported, the input is forced to zero before going
through the logarithm function. The natural logarithm of zero is negative infinity.
UG-01058
2014.12.19
45 nsdata[] value: 0080 0000h
This is the smallest valid input. All the input bits are 0 except the LSB of the
exponent field.
147.5 nsOutput value: C2AE AC50h
60 nsdata[] value: 3F80 0000h
The input value 3F80 0000h is equivalent to the actual value,
1.0 × 20 = 1.
152.5 nsOutput value: 0000 0000h
Exception handling ports: zero asserts
Since In 1 results in zero, it produces an output of zero.
Signals
Altera Corporation
ALTFP_LOG
Send Feedback
data[]
clk_en
clock
inst
ALTFP_LOG
result[]
zero
nan
aclr
UG-01058
2014.12.19
Figure 12-3: ALTFP_LOG Signals
Table 12-5: ALTFP_LOG IP Core Input Signals
Port NameRequiredDescription
Signals
12-5
aclrNoAsynchronous clear. When the aclr port is asserted high, the
function is asynchronously cleared.
clk_enNo
Clock enable. When the clk_en port is asserted high, a natural
logarithm operation takes place. When signal is asserted low, no
operation occurs and the outputs remain unchanged.
Deasserting clk_en halts operation until it is asserted again. Assert
the clk_en signal for the number of clock cycles equivalent to the
required output latency (PIPELINE parameter value) for the results
to be shown at the output.
clockYesClock input to the IP core.
data[]Yes
Floating-point input data. The MSB is the sign bit, the next MSBs
are the exponent, and the LSBs are the mantissa. This input port size
is the total width of the sign bit, exponent bits, and mantissa bits.
For single precision, the width is fixed to 32 bits. For double
precision, the width is fixed to 64 bits. For single extended
precision, you can choose a width in the range from 43 to 64 bits.
Table 12-6: ALTFP_LOG IP Core Output Signals
Port NameRequiredDescription
result[]YesThe natural logarithm of the value on input data. The natural
logarithm of the data[] input port, shown in floating-point format.
The widths of the result[] output port and data[] input port are
the same.
ALTFP_LOG
Altera Corporation
Send Feedback
12-6
Parameters
Port NameRequiredDescription
zeroNoZero exception output. Asserted when the exponent and mantissa
of the output port are zero. This occurs when the actual input value
is 1 because ln1 = 0.
nanNoNaN exception output. Asserted when the exponent and mantissa
of the output port are all 1’s and non-zero, respectively. This occurs
when the input is a negative number or NaN.
Parameters
Table 12-7: ALTFP_LOG Megafunction Parameters
Parameter NameTypeRequiredDescription
WIDTH_EXPIntegerYesSpecifies the precision of the exponent. If this
parameter is not specified, the default is 8. The bias
of the exponent is always set to 2
that is, 127 for the single-precision format and 1023
for the double-precision format. The value of the
WIDTH_EXP parameter must be 8 for the single-
precision format, 11 for the double-precision
format, and a minimum of 11 for the singleextended precision format. The value of the WIDTH_
EXP parameter must be less than the value of the
WIDTH_MAN parameter, and the sum of the WIDTH_
EXP and WIDTH_MAN parameters must be less than
64.
(WIDTH_EXP -1)
UG-01058
2014.12.19
-1,
WIDTH_MAN
PIPELINEIntegerYesSpecifies the amount of latency in clock cycles used
Altera Corporation
IntegerYesSpecifies the precision of the mantissa. If this
parameter is not specified, the default is 23. The
value of WIDTH_MAN must be 23 for the singleprecision format, and 52 for the double-precision
format. For the single-extended precision format,
the valid value ranges from 31 to 52. The value of
WIDTH_MAN must be greater than the value of WIDTH_
EXP, and the sum of WIDTH_EXP and WIDTH_MAN
must be less than 64.
in the ALTFP_LOG megafunction. Create the
ALTFP_LOG megafunction with the MegaWizard
Plug-In Manager to calculate the value for this
parameter.
ALTFP_LOG
Send Feedback
2014.12.19
www.altera.com
101 Innovation Drive, San Jose, CA 95134
ALTFP_ATAN IP Core
13
UG-01058
Subscribe
You can use the ports and parameters available to customize the ALTFP_ATAN megafunction according
to your application.
Output Latency
The output latency option for the ALTFP_ATAN megafunction have a fixed latency level for singleprecision format.
Table 13-1: Latency Option
Trigonometric FunctionPrecisionMantissa WidthLatency (in clock cycles)
ArctangentSingle2334
ALTFP_ATAN Features
The ALTFP_ATAN IP core offers the following features:
Send Feedback
• Arctangent value of a given angle, θ in unit radian.
• Support for single-precision floating point format.
• Support for optional input ports such as asynchronous clear (aclr) and clock enable (clk_en) ports.
ALTFP_ATAN Resource Utilization and Performance
This table lists the resource utilization and performance information for the ALTFP_ATAN IP core. The
information was derived using the Quartus II software version 11.0.
2014 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, ENPIRION, MAX, MEGACORE, NIOS, QUARTUS and STRATIX words and logos are
trademarks of Altera Corporation and registered in the U.S. Patent and Trademark Office and in other countries. All other words and logos identified as
trademarks or service marks are the property of their respective holders as described at www.altera.com/common/legal.html. Altera warrants performance
of its semiconductor products to current specifications in accordance with Altera's 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 any information,
product, or service described herein except as expressly agreed to in writing by Altera. Altera customers are advised to obtain the latest version of device
specifications before relying on any published information and before placing orders for products or services.
ISO
9001:2008
Registered
13-2
Ports
Table 13-2: ALTFP_ATAN Resource Utilization and Performance