DSP Builder Handbook Volume 1: Introduction To DSP Builder
DSP Builder Handbook Volume 1: Introduction To DSP Builder
DSP Builder Handbook Volume 1: Introduction To DSP Builder
Builder
13.1
November 2013
Feedback Subscribe
2013 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, HARDCOPY, 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.
November 2013
Altera Corporation
ISO
9001:2008
Registered
Contents
Additional Information
Document Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Info1
How to Contact Altera . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Info1
Typographic Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Info2
November 2013
Altera Corporation
iv
Contents
This chapter introduces DSP Builder for implementing digital signal processing (DSP)
designs on AlteraFPGAs.
3G wireless
Multimedia systems
Medical systems
Image-processing applications
Consumer electronics.
November 2013
Altera Corporation
12
The embedded DSP blocks also provide other functionality such as addition,
subtraction, and multiplication, which are common arithmetic operations in DSP
functions. Altera FPGAs offer much more multiplier bandwidth than DSP processors,
which only offer a limited number of multipliers.
One determining factor of the overall DSP bandwidth is the multiplier bandwidth,
therefore the overall DSP bandwidth of FPGAs can be much higher using FPGAs than
with DSP processors.
Many DSP applications use external memory devices to manage large amounts of
data processing. The embedded memory in FPGAs meets these requirements and also
eliminates the need for external memory devices in some cases.
Embedded processors in FPGAs provide overall system integration and flexibility
while partitioning the system between hardware and software. You can implement
the systems software components in the embedded processors and implement the
hardware components in the FPGA's general logic resources. Altera devices provide a
choice between embedded soft core processors and embedded hard core processors.
You can implement soft core processors such as the Nios II embedded processor in
FPGAs and add multiple system peripherals. The Nios II processor supports a
user-determinable multi-master bus architecture that optimizes the bus bandwidth
and removes potential bottlenecks found in DSP processors. You can use multimaster
buses to define as many buses and as much performance as needed for a particular
application. Off-the-shelf DSP processors make compromises between size and
performance when they choose the number of data buses on the chip, potentially
limiting performance.
Soft embedded processors in FPGAs provide access to custom instructions such as the
MUL instruction in Nios II processors that can perform a multiplication operation in
two clock cycles using hardware multipliers. FPGA devices provide a flexible
platform to accelerate performance-critical functions in hardware because of the
configurability of the devices logic resources. DSP processors have predefined
hardware accelerator blocks, but FPGAs can implement hardware accelerators for
each application, allowing the best achievable performance from hardware
acceleration. You can implement hardware accelerator blocks with parameterizable IP
functions or from scratch using HDL.
f Altera offers many IP cores for DSP design, for more information about these IP cores,
refer to Chapter 2, Introducing DSP Builder.
You can parameterize Altera DSP IP cores for the most efficient hardware
implementation and to provide maximum flexibility. You can easily port the IP to new
FPGA families, leading to higher performance and lower cost. The flexibility of
programmable logic and soft IP cores allows you to quickly adapt your designs to
new standards without waiting for long lead times usually associated with DSP
processors.
13
Write Assembly
or C Code
Add DSP
Libraries
You can use algorithm development tools such as MATLAB to optimize DSP
algorithms and Simulink for system-level modeling. The algorithms and the
system-level models are then implemented in C/C++ or assembly code with an
integrated development environment that provides design, simulation, debug, and
real-time verification tools. You can use standard C-based DSP libraries to shorten
design cycles and derive the benefits of design re-use.
November 2013
Altera Corporation
14
The DSP Builder tool simplifies hardware implementation of DSP functions, provides
a system-level verification tool to the system engineer who is not necessarily familiar
with HDL design flow, and allows the system engineer to implement DSP functions in
FPGAs without learning HDL. DSP Builder provides an interface from Simulink
directly to the FPGA hardware (Figure 12). Additionally, you can incorporate the
designs created by DSP Builder into a Qsys system for a complete DSP system
implementation
.
Figure 12. DSP Builder General Design Flow for Altera FPGAs
Use
MATLAB or Simulink to
Design Algorithm
Add Functions
in DSP Builder
DSP
Libraries
Perform Synthesis,
Place-and-Route
(Quartus IISoftware)
Evaluate Hardware
in a DSP
Development Kit
Software Flow
Develop DSP
Algorithm
Model System
Build
System
Use
Software
Library
Develop
Software
Develop DSP
Algorithm
Model System
Design DSP
Hardware
Accelerator
Functions
Build
System
Configure FPGA
Use
Software
Library
Configure FPGA
Hardware Flow
Develop DSP
Algorithm
Model System
Translate
to HDL
Develop
Software
Configure FPGA
[
15
November 2013
Altera Corporation
16
DSP Builder shortens DSP design cycles by helping you create the hardware
representation of a DSP design in an algorithm-friendly development environment.
DSP Builder integrates the algorithm development, simulation, and verification
capabilities of MathWorks MATLAB and Simulink system-level design tools with the
Altera Quartus II software and third-party synthesis and simulation tools. You can
combine Simulink blocks with DSP Builder blocks to verify system level specifications
and perform simulation. Figure 21 shows the DSP Builder system-level design flow.
Figure 21. DSP Builder System-Level Design Flow
Create System in
MATLAB or Simulink
Simulate System
with Testbench
(ModelSim)
The DSP Builder standard blockset is a legacy product and Altera recommends you
do not use it for new designs, except as a wrapper for advanced blockset designs.
The DSP Builder advanced blockset does not interface directly with the DSP IP cores
but instead includes its own timing-driven IP blocks that can generate high
performance FIR, CIC, and NCO models.
The advanced blockset has the following features:
November 2013
Automatic pipelining to enable timing closure at clock rates of 300 to 400 MHz
Automatic folding
Altera Corporation
22
Advanced Blockset
The DSP Builder advanced blockset consists of several Simulink libraries that allow
you to implement DSP designs quickly and easily. The blockset is based on a
high-level synthesis technology that optimizes the untimed netlist into low-level,
pipelined hardware for the target FPGA device and clock rate. DSP Builder
implements the hardware as VHDL with scripts that integrate with the Quartus II
software and the ModelSim simulator.
The combination of these features allows you to create a design without intimate
device knowledge, which can run on a variety of FPGA families with different
hardware architectures.
After specifying the desired clock frequency, number of channels, and other top-level
design constraints, the generated RTL is automatically pipelined to achieve timing
closure. By analyzing the system-level constraints, DSP Builder also optimizes folding
to balance latency versus resources, with no need for manual RTL editing.
The advanced blockset includes the following two component librariesModelIP and
ModelPrim:
The ModelPrim library allows you to create fast efficient designs captured in the
behavioral domain rather than the implementation domain by combining zero
latency primitive blocks.
Standard Blockset
You can use blocks from the standard blockset to create a hardware implementation of
a system modeled in Simulink. DSP Builder contains bit- and cycle-accurate Simulink
blockswhich cover basic operations such as arithmetic or storage functionsand
takes advantage of key device features such as built-in PLLs, DSP blocks, and
embedded memory.
You can integrate complex functions by including IP cores in your DSP Builder model.
You can also use the faster performance and richer instrumentation of hardware
cosimulation by implementing parts of your design in an FPGA.
The standard blockset supports imported HDL subsystems including HDL defined in
a Quartus II project file.
f For more information about the standard blockset, refer to Volume 2: DSP Builder
Standard Blockset in the DSP Builder Handbook.
23
Tool Integration
DSP Builder works with Simulink, the ModelSim software, and the Quartus II
software (including Qsys).
Simulink
DSP Builder is interoperable with other Simulink blocksets. In particular, you can use
the basic Simulink blockset to create interactive testbenches. The testbench block
allows you to generate a VHDL model, so that you can compare Simulink simulation
results with the ModelSim simulator.
f For information about Simulink fixed point types, the signal processing blockset and
the communications blockset, refer to the MATLAB Help.
ModelSim
You can run the ModelSim simulator from within DSP Builder, if the ModelSim
executable is in your path. You can use a script to integrate between the DSP Builder
advanced blockset and the ModelSim simulator. The script runs the automatic
testbench flow for a block. It reads some stimulus files at run time to verify a
hardware block. The automatic testbench flow runs a rigorous test and returns a result
whether or not the outputs match.
Quartus II Software
The advanced blockset allows you to build high-speed, high-performance DSP
datapaths. In most production designs there is an RTL layer surrounding this
datapath to perform interfacing to processors, high speed I/O, memories, and so on.
To complete the design, use Qsys or RTL to assign board level components. The
Quartus II software can then complete the synthesis and place-and-route process.
You can automatically load a design into the Quartus II software by clicking on the
Run Quartus II block in the top-level model.
Qsys
DSP Builder creates a memory-mapped interface and hw.tcl file for each advanced
blockset design. This file can expose the processor bus for connection in Qsys. A DSP
Builder advanced blockset subsystem is available from the System Contents tab in
Qsys after you add the path to the hw.tcl file to the Qsys IP search path.
November 2013
Altera Corporation
24
System Requirements
DSP Builder integrates with the The MathWorks MATLAB and Simulink tools and
with the Altera Quartus II software.
f For Quartus II system requirements and installation instructions, refer to Altera
Software Installation and Licensing.
Ensure at least one version of The MathWorks MATLAB and Simulink tool is
available on your workstation before you install DSP Builder. Table 31 lists the tool
dependencies for DSP Builder.
1
You should use the same version of the Quartus II software and DSP Builder.
Table 31. DSP Builder Tool Dependencies
Tool
Software Version
DSP Builder
13.1
13.0
12.1
R2012a
R2012b
R2013a
R2013b
R2010a
R2010b
R2011a
R2011b
R2012a
R2012b
R2010a
R2010b
R2011a
R2011b
R2012a
November 2013
Altera Corporation
32
33
Figure 32 shows the DSP Builder directory structure, where <path> is the installation
directory that contains the Quartus II software. The default installation directory is
c:\altera\<version>\quartus on Windows or /opt/altera<version>/quartus on Linux.
Figure 32. DSP Builder Directory Structure
<path>
Installation directory containing the Quartus II software.
dsp_builder
Contains the DSP Builder standard blockset (legacy).
dspba
Contains the DSP Builder advanced blockset.
blocksets
Contains binary files and MATLAB scripts.
devices
Contains the device specifications.
docs
Contains the Simulink integrated help files.
dspba_cockpit
Contains GUI support files.
examples
Contains the design examples.
libraries
Contains extra HDL libraries.
messages
Contains error messages.
polycache
Contains floating-point support files.
SysConAPI
Contains the API fles.
After installing DSP Builder, the Altera DSP Builder standard blockset and the Altera
DSP Builder advanced blockset libraries are available in the Simulink library browser
in the MATLAB software.
To start DSP Builder, follow one of these steps:
On Windows OS, click on Start, point to All Programs, click Altera <version>,
click DSP Builder, and click Start in MATLAB version XX.
1
If you have multiple versions of MATLAB installed, you can start DSP
Builder in your desired version from this menu.
On Linux OS, use the following command, which automatically finds MATLAB.
<path to the Quartus II software>/dsp_builder/dsp_builder.sh
November 2013
You can use the following options after the dsp_builder.sh command:
Altera Corporation
34
Additional Information
This chapter provides additional information about the document and Altera.
Version
November 2013
13.1
May 2013
13.0
November 2012
12.1
June 2012
12.0
November 2011
April 2011
11.1
11.0
Changes Made
Contact Method
Address
Website
www.altera.com/support
Website
www.altera.com/training
Email
Website
custrain@altera.com
www.altera.com/literature
nacomp@altera.com
(software licensing)
authorization@altera.com
Note to Table:
(1) You can also contact your local Altera sales office or sales representative.
November 2013
Altera Corporation
Info2
Additional Information
Typographic Conventions
Typographic Conventions
The following table shows the typographic conventions this document uses.
Visual Cue
Meaning
Indicate command names, dialog box titles, dialog box options, and other GUI
labels. For example, Save As dialog box. For GUI elements, capitalization matches
the GUI.
bold type
Indicates directory names, project names, disk drive names, file names, file name
extensions, software utility names, and GUI labels. For example, \qdesigns
directory, D: drive, and chiptrip.gdf file.
italic type
Variable names are enclosed in angle brackets (< >). For example, <file name> and
<project name>.pof file.
Indicate keyboard keys and menu names. For example, the Delete key and the
Options menu.
Subheading Title
Courier type
Indicates command line commands and anything that must be typed exactly as it
appears. For example, c:\qdesigns\tutorial\chiptrip.gdf.
Also indicates sections of an actual file, such as a Report File, references to parts of
files (for example, the AHDL keyword SUBDESIGN), and logic function names (for
example, TRI).
Numbered steps indicate a list of items when the sequence of the items is important,
such as the steps listed in a procedure.
Bullets indicate a list of items when the sequence of the items is not important.
The question mark directs you to a software help system with related information.
The feet direct you to another document or website with related information.
A warning calls attention to a condition or possible situation that can cause you
injury.
The envelope links to the Email Subscription Management Center page of the Altera
website, where you can sign up to receive update notifications for Altera documents.
The feedback icon allows you to submit feedback to Altera about the document.
Methods for collecting feedback vary as appropriate for each document.