Design Example Files...................................................................................................................................1-2
Installing and Licensing IP Cores..............................................................................................................1-2
Customizing and Generating IP Cores.....................................................................................................1-2
IP Catalog and Parameter Editor...............................................................................................................1-3
Using the Parameter Editor........................................................................................................................1-4
Specifying IP Core Parameters and Options............................................................................................1-4
Specifying IP Core Parameters and Options (Legacy Parameter Editors)...........................................1-6
Files Generated for Altera IP Cores (Legacy Parameter Editor)............................................... 1-7
Upgrading IP Cores.....................................................................................................................................1-8
Migrating IP Cores to a Different Device...............................................................................................1-11
Simulating Altera IP Cores in other EDA Tools................................................................................... 1-12
You can use Altera® integer megafunction IP cores to perform mathematical operations in your design.
These functions offer more efficient logic synthesis and device implementation than coding your own
functions. You can customize the IP cores to accommodate your design requirements.
Altera integer arithmetic megafunctions are divided into the following two categories:
• Library of parameterized modules (LPM) IP cores
• Altera-specific (ALT) IP cores
The following table lists the integer arithmetic IP cores.
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
Design Example Files
Altera also provides floating-point IP cores. For more information about the floating-point IP cores, refer
to the Floating-Point IP Cores User Guide.
Design Example Files
Altera provides design example files that are simulated in the ModelSim®-Altera software to generate a
waveform display of the device behavior.
You should be familiar with the ModelSim-Altera software before using the design examples. To get
started with the ModelSim-Altera software, refer to the ModelSim-Altera Software Support page on the
Altera website. The support page includes links to such topics as installation, usage, and troubleshooting.
For more details about the design example for a specific IP core, refer to the “Design Example” section for
that megafunction.
Design examples are provided only for some IP cores in this user guide.
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-01063
2014.12.19
Figure 1-1: IP Core Installation Path
Note:
The default IP installation directory on Windows is <drive>:\altera\<version number>; on Linux it is
<home directory>/altera/ <version number>.
Related Information
• Altera Licensing Site
• Altera Software Installation and Licensing Manual
Customizing and Generating IP Cores
You can customize IP cores to support a wide variety of applications. The Quartus II IP Catalog and
parameter editor allow you to quickly select and configure IP core ports, features, and output files.
Altera Corporation
Integer Arithmetic Megafunctions
Send Feedback
Search and filter IP for your target device
Double-click to customize, right-click for information
UG-01063
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
Integer Arithmetic Megafunctions
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
Note: The IP Catalog is also available in Qsys (View > IP Catalog). The Qsys IP Catalog includes
exclusive system interconnect, video and image processing, and other system-level IP that are not
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-01063
2014.12.19
Specifying IP Core Parameters and Options
Altera Corporation
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.
Integer Arithmetic Megafunctions
Send Feedback
UG-01063
2014.12.19
Specifying IP Core Parameters and Options
1-5
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.
• 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.
Integer Arithmetic Megafunctions
Send Feedback
Altera Corporation
View IP port
and parameter
details
Apply preset parameters for
specific applications
Specify your IP variation name
and target device
1-6
Specifying IP Core Parameters and Options (Legacy Parameter Editors)
Figure 1-4: IP Parameter Editor
UG-01063
2014.12.19
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.
Note:
The legacy parameter editor generates a different output file structure than the latest parameter
editor. Refer to Specifying IP Core Parameters and Options for configuration of IP cores that use the
latest parameter editor.
Altera Corporation
Integer Arithmetic Megafunctions
Send Feedback
Legacy parameter
editors
UG-01063
2014.12.19
Files Generated for Altera IP Cores (Legacy Parameter Editor)
Figure 1-5: Legacy Parameter Editors
1-7
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:
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.
Files Generated for Altera IP Cores (Legacy Parameter Editor)
The Quartus II software version generates the following output for your IP core that uses the legacy
parameter editor.
Integer Arithmetic Megafunctions
Send Feedback
Altera Corporation
Notes:
1. If supported and enabled for your IP variation
2. If functional simulation models are generated
<Project Directory>
<your_ip>_bb.v - Verilog HDL black box EDA synthesis file
<your_ip>_inst.v or .vhd - Sample instantiation template
synthesis - IP synthesis files
<your_ip>.qip - Lists files for synthesis
testbench - Simulation testbench files
1
<testbench_hdl_files>
<simulator_vendor> - Testbench for supported simulators
<simulation_testbench_files>
<your_ip>.v or .vhd - Top-level IP variation synthesis file
<your_ip>_syn.v or .vhd - Timing & resource estimation netlist
1
<your_ip>.debuginfo - Lists files for synthesis
<your_ip>.v, .vhd, .vo, .vho - HDL or IPFS models
2
<your_ip>_tb - Testbench for supported simulators
<your_ip>_tb.v or .vhd - Top-level HDL testbench file
1-8
Upgrading IP Cores
Figure 1-6: IP Core Generated Files
UG-01063
2014.12.19
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
Altera Corporation
Integer Arithmetic Megafunctions
Send Feedback
UG-01063
2014.12.19
compile the IP variation in the current version of the Quartus II software. Many Altera IP cores support
automatic upgrade.
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-2: IP Core Upgrade Status
IP Core StatusCorrective Action
Upgrading IP Cores
1-9
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
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.
Integer Arithmetic Megafunctions
Send Feedback
Altera Corporation
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
1-10
Upgrading IP Cores
Figure 1-7: Upgrading IP Cores
UG-01063
2014.12.19
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.
Altera Corporation
Integer Arithmetic Megafunctions
Send Feedback
UG-01063
2014.12.19
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.
Migrating IP Cores to a Different Device
1-11
If migration does not replace <my_ip>.qip with <my_ip>.qsys, click Project > Add/Remove
Note:
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.
The migration process may change the IP variation interface, parameters, and functionality.
Note:
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
Integer Arithmetic Megafunctions
Send Feedback
Altera Corporation
Post-fit timing
simulation netlist
Post-fit timing simulation (3)
Post-fit functional
simulation netlist
Post-fit functional
simulation
Analysis & Synthesis
Fitter
(place-and-route)
TimeQuest Timing Analyzer
Device Programmer
Quartus II
Design Flow
Gate-Level Simulation
Post-synthesis
functional
simulation
Post-synthesis functional
simulation netlist
(Optional) Post-fit
timing simulation
RTL Simulation
Design Entry
(HDL, Qsys, DSP Builder)
Altera Simulation
Models
EDA
Netlist
Writer
1-12
Simulating Altera IP Cores in other EDA Tools
Simulating Altera IP Cores in other EDA Tools
The Quartus II software supports RTL and gate-level design simulation of Altera IP cores in supported
EDA simulators. Simulation involves setting up your simulator working environment, compiling
simulation model libraries, and running your simulation.
You can use the functional simulation model and the testbench or example design generated with your IP
core for simulation. The functional simulation model and testbench files are generated in a project
subdirectory. This directory may also include scripts to compile and run the testbench. For a complete list
of models or libraries required to simulate your IP core, refer to the scripts generated with the testbench.
You can use the Quartus II NativeLink feature to automatically generate simulation files and scripts.
NativeLink launches your preferred simulator from within the Quartus II software.
Figure 1-8: Simulation in Quartus II Design Flow
UG-01063
2014.12.19
Altera Corporation
Note: Post-fit timing simulation is not supported for 28nm and later device archetectures. Altera IP
supports a variety of simulation models, including simulation-specific IP functional simulation
models and encrypted RTL models, and plain text RTL models. These are all cycle-accurate
models. The models support fast functional simulation of your IP core instance using industrystandard VHDL or Verilog HDL simulators. For some cores, only the plain text RTL model is
generated, and you can simulate that model. Use the simulation models only for simulation and
not for synthesis or any other purposes. Using these models for synthesis creates a nonfunctional
design.
Integer Arithmetic Megafunctions
Send Feedback
UG-01063
2014.12.19
Related Information
Simulating Altera Designs
Simulating Altera IP Cores in other EDA Tools
1-13
Integer Arithmetic Megafunctions
Send Feedback
Altera Corporation
2014.12.19
ssclr
sload
inst
LPM_COUNTER
q[]
sset
cout
data[]
clk_en
cnt_en
cin
aclr
aload
aset
updown
www.altera.com
101 Innovation Drive, San Jose, CA 95134
LPM_COUNTER (Counter)
2
UG-01063
Subscribe
Send Feedback
The LPM_COUNTER megafunction is a binary counter that creates up counters, down counters and up
or down counters with outputs of up to 256 bits wide.
The following figure shows the ports for the LPM_COUNTER megafunction.
Figure 2-1: LPM_COUNTER Ports
Features
The LPM_COUNTER megafunction offers the following features:
• Generates up, down, and up/down counters
• Generates the following counter types:
• Plain binary— the counter increments starting from zero or decrements starting from 255
• Modulus—the counter increments to or decrements from the modulus value specified by the user
• Supports optional synchronous clear, load, and set input ports
• Supports optional asynchronous clear, load, and set input ports
• Supports optional count enable and clock enable input ports
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.
• Supports optional carry-in and carry-out ports
2014 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, ENPIRION, MAX, MEGACORE, NIOS, QUARTUS and STRATIX words and logos are
and repeats
ISO
9001:2008
Registered
2-2
Resource Utilization and Performance
Resource Utilization and Performance
The following table provides resource utilization and performance information for the LPM_COUNTER
megafunction.
Table 2-1: LPM_COUNTER Resource Utilization and Performance
The following Verilog HDL prototype is located in the Verilog Design File (.v) lpm.v in the <Quartus II
installation directory>\eda\synthesis directory.
The performance of the megafunction is dependant on the value of the maximum allowable ceiling f
that the selected device can achieve. Therefore, results may vary from the numbers stated in this column.
The VHDL component declaration is located in the VHDL Design File (.vhd) LPM_PACK.vhd in the
<Quartus II installation directory>\libraries\vhdl\lpm directory.
component LPM_MULT
generic ( LPM_WIDTHA : natural;
LPM_WIDTHB : natural;
LPM_WIDTHS : natural := 1;
LPM_WIDTHP : natural;
LPM_REPRESENTATION : string := "UNSIGNED";
LPM_PIPELINE : natural := 0;
LPM_TYPE: string := L_MULT;
LPM_HINT : string := "UNUSED");
port ( DATAA : in std_logic_vector(LPM_WIDTHA-1 downto 0);
DATAB : in std_logic_vector(LPM_WIDTHB-1 downto 0);
ACLR : in std_logic := '0';
CLOCK : in std_logic := '0';
CLKEN : in std_logic := '1';
SUM : in std_logic_vector(LPM_WIDTHS-1 downto 0) := (OTHERS => '0');
RESULT : out std_logic_vector(LPM_WIDTHP-1 downto 0));
end component;
VHDL Component Declaration
2-3
VHDL LIBRARY_USE Declaration
The VHDL LIBRARY-USE declaration is not required if you use the VHDL Component Declaration.
LIBRARY lpm;
USE lpm.lpm_components.all;
Ports
The following tables list the input and output ports for the LPM_COUNTER megafunction.
Table 2-2: LPM_COUNTER Megafunction Input Ports
Port NameRequiredDescription
data[]NoParallel data input to the counter. The size of the input port
depends on the LPM_WIDTH parameter value.
clockYesPositive-edge-triggered clock input.
clk_enNoClock enable input to enable all synchronous activities. If omitted,
the default value is 1.
LPM_COUNTER (Counter)
Altera Corporation
Send Feedback
2-4
Ports
Port NameRequiredDescription
cnt_enNoCount enable input to disable the count when asserted low
without affecting sload, sset, or sclr. If omitted, the default
value is 1.
updownNoControls the direction of the count. When asserted high (1), the
count direction is up, and when asserted low (0), the count
direction is down. If the LPM_DIRECTION parameter is used, the
updown port cannot be connected. If LPM_DIRECTION is not used,
the updown port is optional. If omitted, the default value is up (1).
cinNoCarry-in to the low-order bit. For up counters, the behavior of the
cin input is identical to the behavior of the cnt_en input. If
omitted, the default value is 1 (VCC).
aclrNoAsynchronous clear input. If both aset and aclr are used and
asserted, aclr overrides aset. If omitted, the default value is 0
(disabled).
asetNoAsynchronous set input. Specifies the q[] outputs as all 1s, or to
the value specified by the LPM_AVALUE parameter. If both the aset
and aclr ports are used and asserted, the value of the aclr port
overrides the value of the aset port. If omitted, the default value is
0, disabled.
UG-01063
2014.12.19
aloadNoAsynchronous load input that asynchronously loads the counter
with the value on the data input. When the aload port is used, the
data[] port must be connected. If omitted, the default value is 0,
disabled.
sclrNoSynchronous clear input that clears the counter on the next active
clock edge. If both the sset and sclr ports are used and asserted,
the value of the sclr port overrides the value of the sset port. If
omitted, the default value is 0, disabled.
ssetNoSynchronous set input that sets the counter on the next active
clock edge. Specifies the value of the q outputs as all 1s, or to the
value specified by the LPM_SVALUE parameter. If both the sset and
sclr ports are used and asserted, the value of the sclr port
overrides the value of the sset port. If omitted, the default value is
0 (disabled).
sloadNoSynchronous load input that loads the counter with data[] on the
next active clock edge. When the sload port is used, the data[]
port must be connected. If omitted, the default value is 0
(disabled).
Table 2-3: LPM_COUNTER Megafunction Output Ports
Port NameRequiredDescription
q[]NoData output from the counter. The size of the output port
Altera Corporation
depends on the LPM_WIDTH parameter value. Either q[] or at least
one of the eq[15..0] ports must be connected.
LPM_COUNTER (Counter)
Send Feedback
UG-01063
2014.12.19
eq[15..0]NoCounter decode output. The eq[15..0] port is not accessible
coutNoCarry-out port of the counter's MSB bit. It can be used to connect
Parameters
Port NameRequiredDescription
using the MegaWizard Plug-In Manager as it is for AHDL use
only.
Either the q[] port or eq[] port must be connected. Up to c eq
ports can be used (0 <= c <= 15). Only the 16 lowest count values
are decoded. When the count value is c, the eqc output is asserted
high (1). For example, when the count is 0, eq0 = 1, when the
count is 1, eq1 = 1, and when the count is 15, eq 15 = 1. Decoded
output for count values of 16 or greater require external decoding.
The eq[15..0] outputs are asynchronous to the q[] output.
to another counter to create a larger counter.
The following table lists the parameters for the LPM_COUNTER megafunction.
Parameters
2-5
Table 2-4: LPM_COUNTER Megafunction Parameters
Parameter NameTypeRequiredDescription
LPM_WIDTHIntegerYesSpecifies the widths of the data[] and q[]
ports, if they are used.
LPM_DIRECTIONStringNoValues are UP, DOWN, and UNUSED. If the LPM_
DIRECTION parameter is used, the updown
port cannot be connected. When the
updown port is not connected, the LPM_
DIRECTION parameter default value is UP.
LPM_MODULUSIntegerNoThe maximum count, plus one. Number of
unique states in the counter's cycle. If the
load value is larger than the LPM_MODULUS
parameter, the behavior of the counter is
not specified.
LPM_AVALUEInteger/
String
NoConstant value that is loaded when aset is
asserted high. If the value specified is larger
than or equal to <modulus>, the behavior of
the counter is an undefined (X) logic level,
where <modulus> is LPM_MODULUS, if
present, or 2 ^ LPM_WIDTH. Altera
recommends that you specify this value as a
decimal number for AHDL designs.
LPM_SVALUEInteger/
LPM_COUNTER (Counter)
Send Feedback
String
NoConstant value that is loaded on the rising
edge of the clock port when the sset port is
asserted high. Altera recommends that you
specify this value as a decimal number for
AHDL designs.
Altera Corporation
2-6
Parameters
Parameter NameTypeRequiredDescription
UG-01063
2014.12.19
LPM_HINTStringNo
When you instantiate a library of
parameterized modules (LPM) function in a
VHDL Design File (.vhd), you must use the
LPM_HINT parameter to specify an Altera-
specific parameter. For example: LPM_HINT
= "CHAIN_SIZE = 8, ONE_INPUT_IS_
CONSTANT = YES"
The default value is UNUSED.
LPM_TYPEStringNoIdentifies the library of parameterized
modules (LPM) entity name in VHDL
design files.
INTENDED_DEVICE_FAMILYStringNoThis parameter is used for modeling and
behavioral simulation purposes. Create the
LPM_COUNTER megafunction with the
MegaWizard Plug-In Manager to calculate
the value for this parameter.
CARRY_CNT_ENStringNoAltera-specific parameter. You must use the
LPM_HINT parameter to specify the CARRY_
CNT_EN parameter in VHDL design files.
Values are SMART, ON, OFF, and UNUSED.
Enables the LPM_COUNTER function to
propagate the cnt_en signal through the
carry chain. In some cases, the CARRY_CNT_
EN parameter setting might have a slight
impact on the speed, so you might want to
turn it off. The default value is SMART, which
provides the best trade-off between size and
speed.
LABWIDE_SCLR
Altera Corporation
StringNoAltera-specific parameter. You must use the
LPM_HINT parameter to specify the
LABWIDE_SCLR parameter in VHDL design
files. Values are ON, OFF, or UNUSED. The
default value is ON. Allows you to disable the
use of the LAB-wide sclr feature found in
obsoleted device families. Turning this
option off increases the chances of fully
using the partially filled LABs, and thus may
allow higher logic density when SCLR does
not apply to a complete LAB. This
parameter is available for backward
compatibility, and Altera recommends you
not to use this parameter.
LPM_COUNTER (Counter)
Send Feedback
UG-01063
2014.12.19
Parameters
Parameter NameTypeRequiredDescription
LPM_PORT_UPDOWNStringNoSpecifies the usage of the updown input port.
If omitted the default value is PORT_
CONNECTIVITY. When the port value is set
to PORT_USED, the port is treated as used.
When the port value is set to PORT_UNUSED,
the port is treated as unused. When the port
value is set to PORT_CONNECTIVITY, the port
usage is determined by checking the port
connectivity.
2-7
LPM_COUNTER (Counter)
Send Feedback
Altera Corporation
2014.12.19
numer[]
denom[]
inst
LPM_DIVIDE
quotient[]
clken
clock
aclr
remain[]
www.altera.com
101 Innovation Drive, San Jose, CA 95134
LPM_DIVIDE (Divider)
3
UG-01063
Subscribe
The LPM_DIVIDE megafunction implements a divider to divide a numerator input value by a
denominator input value to produce a quotient and a remainder.
The following figure shows the ports for the LPM_DIVIDE megafunction.
Figure 3-1: LPM_DIVIDE Ports
Features
The LPM_DIVIDE megafunction offers the following features:
Send Feedback
• Generates a divider that divides a numerator input value by a denominator input value to produce a
• Supports data width of 1–256 bits.
• Supports signed and unsigned data representation format for both the numerator and denominator
• Supports area or speed optimization.
• Provides an option to specify a positive remainder output.
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.
quotient and a remainder.
values.
ISO
9001:2008
Registered
3-2
Verilog HDL Prototype
Table 3-1: LPM_DIVIDE Resource Utilization and Performance
UG-01063
2014.12.19
Logic Usage
Device family
Input data
width
101131070133
Stratix III
3051017063571
641043450262341
101131070138
Stratix IV
3051018064282
641043470263448
Verilog HDL Prototype
The following Verilog HDL prototype is located in the Verilog Design File (.v) lpm.v in the <Quartus II
installation directory>\eda\synthesis directory.
The VHDL component declaration is located in the VHDL Design File (.vhd) LPM_PACK.vhd in the
<Quartus II installation directory>\libraries\vhdl\lpm directory.
DENOM : in std_logic_vector(LPM_WIDTHD-1 downto 0);
ACLR : in std_logic := '0';
CLOCK : in std_logic := '0';
CLKEN : in std_logic := '1';
QUOTIENT : out std_logic_vector(LPM_WIDTHN-1 downto 0);
REMAIN : out std_logic_vector(LPM_WIDTHD-1 downto 0));
end component;
VHDL LIBRARY_USE Declaration
The VHDL LIBRARY-USE declaration is not required if you use the VHDL Component Declaration.
LIBRARY lpm;
USE lpm.lpm_components.all;
Ports
The following tables list the input and output ports for the LPM_DIVIDE megafunction.
Table 3-2: LPM_DIVIDE Megafunction Input Ports
VHDL LIBRARY_USE Declaration
3-3
Port NameRequiredDescription
numer[]YesNumerator data input. The size of the input port
depends on the LPM_WIDTHN parameter value.
denom[]YesDenominator data input. The size of the input port
depends on the LPM_WIDTHD parameter value.
clockNoClock input for pipelined usage. For LPM_PIPELINE
values other than 0 (default), the clock port must be
enabled.
clkenNoClock enable pipelined usage. When the clken port is
asserted high, the division operation takes place.
When the signal is low, no operation occurs. If
omitted, the default value is 1.
aclrNoAsynchronous clear port used at any time to reset the
pipeline to all '0's asynchronously to the clock input.
Table 3-3: LPM_DIVIDE Megafunction Output Ports
Port NameRequiredDescription
quotient[]YesData output. The size of the output port depends on
the LPM_WIDTHN parameter value.
remain[]YesData output. The size of the output port depends on
the LPM_WIDTHD parameter value.
Parameters
LPM_DIVIDE (Divider)
Send Feedback
Altera Corporation
3-4
Parameters
The following table lists the parameters for the LPM_DIVIDE megafunction.
Parameter NameTypeRequiredDescription
LPM_WIDTHNIntegerYesSpecifies the widths of the numer[]
and quotient[] ports. Values are 1 to
64.
LPM_WIDTHDIntegerYesSpecifies the widths of the denom[]
and remain[] ports. Values are 1 to
64.
LPM_NREPRESENTATIONStringNoSign representation of the numerator
input. Values are SIGNED and
UNSIGNED. When this parameter is set
to SIGNED, the divider interprets the
numer[] input as signed two's
complement.
LPM_DREPRESENTATIONStringNoSign representation of the
denominator input. Values are SIGNED
and UNSIGNED. When this parameter is
set to SIGNED, the divider interprets
the denom[] input as signed two's
complement.
UG-01063
2014.12.19
LPM_TYPEStringNoIdentifies the library of parameterized
modules (LPM) entity name in VHDL
design files (.vhd).
LPM_HINTStringNo
When you instantiate a library of
parameterized modules (LPM)
function in a VHDL Design File (.vhd)
, you must use the LPM_HINT
parameter to specify an Altera-specific
parameter. For example: LPM_HINT =
"CHAIN_SIZE = 8, ONE_INPUT_IS_
CONSTANT = YES"
The default value is UNUSED.
Altera Corporation
LPM_DIVIDE (Divider)
Send Feedback
UG-01063
2014.12.19
Parameters
Parameter NameTypeRequiredDescription
LPM_REMAINDERPOSITIVEStringNoAltera-specific parameter. You must
use the LPM_HINT parameter to specify
the LPM_REMAINDERPOSITIVE
parameter in VHDL design files.
Values are TRUE or FALSE. If this
parameter is set to TRUE, then the value
of the remain[] port must be greater
than or equal to zero. If this parameter
is set to TRUE, then the value of the
remain[] port is either zero, or the
value is the same sign, either positive
or negative, as the value of the numer
port. In order to reduce area and
improve speed, Altera recommends
setting this parameter to TRUE in
operations where the remainder must
be positive or where the remainder is
unimportant.
3-5
MAXIMIZE_SPEED
LPM_PIPELINE
IntegerNoAltera-specific parameter. You must
use the LPM_HINT parameter to specify
the MAXIMIZE_SPEED parameter in
VHDL design files. Values are [0..9].
If used, the Quartus II software
attempts to optimize a specific
instance of the LPM_DIVIDE function
for speed rather than routability, and
overrides the setting of the Optimiza‐
tion Technique logic option. If
MAXIMIZE_SPEED is unused, the value
of the Optimization Technique option
is used instead. If the value of
MAXIMIZE_SPEED is 6 or higher, the
Compiler optimizes the LPM_DIVIDE
megafunctions for higher speed by
using carry chains; if the value is 5 or
less, the compiler implements the
design without carry chains.
IntegerNoSpecifies the number of clock cycles of
latency associated with the
quotient[] and remain[] outputs. A
value of zero (0) indicates that no
latency exists, and that a purely
combinational function is instantiated.
If omitted, the default value is 0 (nonpipelined). You cannot specify a value
for the LPM_PIPELINE parameter that
is higher than LPM_WIDTHN.
LPM_DIVIDE (Divider)
Send Feedback
Altera Corporation
Loading...
+ 127 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.