f Pga Programming Block Set Getting Started
f Pga Programming Block Set Getting Started
Getting Started
For FPGA Programming Blockset 2024-A
If possible, always provide the serial number of the hardware, the relevant dSPACE License
ID, or the serial number of the CmContainer in your support request.
Important Notice
This publication contains proprietary information that is protected by copyright. All rights
are reserved. The publication may be printed for personal or internal use provided all the
proprietary markings are retained on all printed copies. In all other cases, the publication
must not be copied, photocopied, reproduced, translated, or reduced to any electronic
medium or machine-readable form, in whole or in part, without the prior written consent
of dSPACE GmbH.
This publication and the contents hereof are subject to change without notice.
Contents
Lesson 3: Building the FPGA Application and Using the Build Results in
ConfigurationDesk................................................................................................. 37
Overview of Lesson 3.................................................................................... 37
Step 1: How to Build the FPGA Application................................................... 38
Step 2: How to Prepare the Processor Model Separation................................ 39
Step 3: How to Continue the Development Process in
ConfigurationDesk........................................................................................ 42
Result of Lesson 3......................................................................................... 43
3
May 2024 FPGA Programming Blockset Getting Started
Contents
4
FPGA Programming Blockset Getting Started May 2024
About This Document
Content This guide introduces you to the first steps of graphically implementing an FPGA
application when using a MicroLabBox II, MicroAutoBox III, or SCALEXIO.
Audience profile It is recommended that you have a basic working knowledge of the following:
§ Modeling with Simulink®.
§ Using the AMD® design tools for simulation and debugging.
Symbol Description
Indicates a hazardous situation that, if not avoided,
V DANGER
will result in death or serious injury.
Indicates a hazardous situation that, if not avoided,
V WARNING could result in death or serious injury.
Indicates a hazardous situation that, if not avoided,
V CAUTION could result in minor or moderate injury.
Indicates a hazard that, if not avoided, could result in
NOTICE
property damage.
Indicates important information that you should take
Note
into account to avoid malfunctions.
Indicates tips that can make your work easier.
Tip
Indicates a link that refers to a definition in the
glossary, which you can find at the end of the
document unless stated otherwise.
Follows the document title in a link that refers to
another document.
Naming conventions dSPACE user documentation uses the following naming conventions:
5
May 2024 FPGA Programming Blockset Getting Started
About This Document
Special Windows folders Windows‑based software products use the following special folders:
Accessing dSPACE Help and After you install and decrypt Windows‑based dSPACE software, the
PDF files documentation for the installed products is available in dSPACE Help and as PDF
files.
dSPACE Help (local) You can open your local installation of dSPACE Help:
§ On its home page via Windows Start Menu
§ On specific content using context-sensitive help via F1
PDF files You can access PDF files via the icon in dSPACE Help. The PDF
opens on the first page.
6
FPGA Programming Blockset Getting Started May 2024
Brief Introduction to FPGA Programming
The basic difference A processor application is mainly a sequence of instructions that is processed
by the central processing unit (CPU) in a sequential manner. In contrast to the
sequential processing of instructions, an FPGA application programs a series of
logic blocks to perform different tasks in parallel. The following illustration shows
the difference.
7
May 2024 FPGA Programming Blockset Getting Started
Brief Introduction to FPGA Programming
5 instructions to be looped
are loaded to the RAM
time
The CPU executes one instruction after the other.
After last task is executed, the CPU can output the result.
5 logical functions
instantiated on the FPGA
time
The FPGA can execute all logical functions in parallel.
After all functions have been executed for the first time,
the FPGA can output a result in each step.
Fields of FPGA applications FPGAs are used for the following applications:
§ Applications that require low latencies, for example, digital signal processing or
electric motor control.
§ Flexible hardware interfaces.
Introduction These are the basic features of the FPGA Programming Blockset to support
MicroLabBox II, MicroAutoBox III, and SCALEXIO systems:
§ Blockset to access the I/O channels and to exchange data with the real-time
processor.
§ Utilities to support the modeling and build workflow.
FPGA modeling The FPGA Programming Blockset is a Simulink blockset for integrating an FPGA
application into a dSPACE system. The blockset is used to model the interfaces of
an FPGA application for the following tasks:
§ Accessing I/O channels to generate and measure external signals.
§ Accessing the internal bus to exchange data with the real-time processor.
8
FPGA Programming Blockset Getting Started May 2024
Software Tools for Working with the FPGA Programming Blockset
The FPGA Programming Blockset does not provide a blockset to model the FPGA
functionality. You model the FPGA functionality with the HDL block library of the
AMD Vitis Model Composer.
FPGA
FPGA Setup
FPGA functionality
Modeling and build support With the FPGA Programming Blockset, you can synthesize and build FPGA
applications directly from Simulink.
To program the FPGA, the FPGA Programming Blockset makes the build results
available in ConfigurationDesk. ConfigurationDesk is the dSPACE software
product for integrating the FPGA application and processor functionality into
an executable real-time application.
Introduction To model and build an FPGA application for dSPACE hardware, several software
tools are necessary.
Tools from The MathWorks® MATLAB®, Simulink® and Simulink® CoderTM are required for modeling and
simulating the application.
9
May 2024 FPGA Programming Blockset Getting Started
Brief Introduction to FPGA Programming
Tools from AMD AMD provides several tools for designing applications for AMD FPGAs. The
Vivado® Design Suite covers all the aspects of designing FPGAs. Working with
the FPGA Programming Blockset requires the following products:
Vivado Design Suite The Vivado Design Suite provides a logic design
environment for AMD FPGAs. It contains tools and wizards, for example, for I/O
assignment, power analysis, timing-driven design closure, and HDL simulation.
With the Vivado software, you can build the FPGA application according to the
implemented FPGA model.
The FPGA Programming Blockset uses the Vivado software in the background
without the GUI.
AMD Vitis Model Composer AMD® VitisTM Model Composer for modeling
FPGA applications with Simulink is the unified AMD add-on for MATLAB
Simulink.
The following items of the AMD Vitis Model Composer are required for modeling
and generating the FPGA application:
§ The AMD Vitis Model Composer Blockset.
The AMD Vitis Model Composer Blockset is a Simulink block library that lets
you graphically model FPGA applications. The AMD Vitis Model Composer
Blockset requires a separate license.
The FPGA Programming Blockset supports only the HDL library of the AMD
Vitis Model Composer.
§ The code generator that is included in the AMD Vitis Model Composer.
The code generator is used to generate the HDL code based on blocks of the
FPGA Programming Blockset and the AMD Vitis Model Composer Blockset.
Tip
To use the AMD Vitis Model Composer with a specific MATLAB version, the
-matlab "<matlabdir>" parameter must be specified. You can add this
parameter to the Vitis Model Composer icon on the desktop, for example.
10
FPGA Programming Blockset Getting Started May 2024
Software Tools for Working with the FPGA Programming Blockset
Ordering AMD software Currently, you cannot order the AMD software
from dSPACE.
Supported software versions The following table shows you the supported products and their software
versions for the current version of the FPGA Programming Blockset.
For software versions that are compatible with older versions of the FPGA
Programming Blockset, refer to https://www.dspace.com/faq?295.
Required blocksets for the The MicroLabBox II, MicroAutoBox III, and SCALEXIO require the dSPACE Model
processor model Interface Package for Simulink to implement the interface between the real-
time processor and the FPGA. The Model Interface Package for Simulink is the
blockset for specifying all interfaces of processor models (behavior models) used
in ConfigurationDesk.
ControlDesk ControlDesk is the dSPACE software tool for experimenting with a dSPACE
system. It can be used to register the connected hardware, to manage the
11
May 2024 FPGA Programming Blockset Getting Started
Brief Introduction to FPGA Programming
12
FPGA Programming Blockset Getting Started May 2024
FPGA Programming Blockset Tutorial
13
May 2024 FPGA Programming Blockset Getting Started
FPGA Programming Blockset Tutorial
Overview of Lessons................................................................................ 15
Overview of the learning objectives.
Purpose This tutorial will help you learn the following basic workflows:
§ Modeling the FPGA functionality.
§ Modeling the data exchange between the processor functionality and the
FPGA functionality.
§ Exporting the results to ConfigurationDesk to develop the application further
in ConfigurationDesk.
ConfigurationDesk is the dSPACE software tool to configure and build
applications for the MicroLabBox II, MicroAutoBox III, and SCALEXIO.
Use scenario The tutorial use scenario is a closed-loop system. The controller is implemented
in an FPGA application. The setpoint value is provided by a processor application.
The following illustration shows the signal flow of the use scenario.
14
FPGA Programming Blockset Getting Started May 2024
Introduction to the Tutorial
Analog Digital to
to digital FPGA analog
converter converter
Controlled
device
Order of processing Work through the tutorial sequentially in the specified order. Start with
Preparatory Steps to Work with the FPGA Programming Blockset.
Software requirements The FPGA Programming Blockset and the tools from the MathWorks and AMD
are required. The installation of the required software is part of the tutorial.
For an overview on the required software, refer to Software Tools for Working
with the FPGA Programming Blockset on page 9.
Overview of Lessons
Overview The following table gives an overview of lessons. Work through the tutorial
sequentially in the specified order.
Content Lesson
§ Installing the software products required to model and execute an FPGA Preparatory Steps to Work
application on a MicroLabBox II, a MicroAutoBox III, or a SCALEXIO system. with the FPGA Programming
§ Opening the demo model for copying parts of the model used in the tutorial. Blockset
§ Selecting the correct FPGA framework for the dSPACE platform you are using. Lesson 1: Modeling the FPGA
§ Modeling the FPGA functionality in Simulink. Functionality
§ Simulating the FPGA functionality with simulated I/O functionality to detect
modeling errors at an early stage.
15
May 2024 FPGA Programming Blockset Getting Started
FPGA Programming Blockset Tutorial
Content Lesson
§ Providing one subsystem for the processor model and one for the FPGA model. Lesson 2: Adding the Processor
§ Modeling the communication within the dSPACE hardware between the real- Functionality
time processor and the FPGA.
§ Verifying the functional behavior of the entire model, including the
communication between the processor model and the FPGA model.
§ Building the FPGA application that programs the FPGA with the specified Lesson 3: Building the FPGA
functionality. Application and Using the Build
§ Preparing the Simulink model so that the framework can separate the processor Results in ConfigurationDesk
model from the FPGA model. The separation is required to use the processor
model with ConfigurationDesk.
§ Exporting the build result to develop the application further in
ConfigurationDesk.
16
FPGA Programming Blockset Getting Started May 2024
Preparatory Steps to Work with the FPGA Programming Blockset
Objective Installing the software products required to model and execute an FPGA
application on a MicroLabBox II, a MicroAutoBox III, or a SCALEXIO system.
Supported software versions The FPGA Programming Blockset supports the following versions of the third-
party software products:
More information on the For more information on the dSPACE Installation Manager, refer to What Do You
dSPACE Installation Manager Want To Do? (Installing dSPACE Software ).
17
May 2024 FPGA Programming Blockset Getting Started
FPGA Programming Blockset Tutorial
2 Install the Vivado ML Enterprise edition and the AMD Vitis Model Composer
from AMD.
During the installation, select the following content on the Select Extra
Content page of the Vivado Installer dialog:
18
FPGA Programming Blockset Getting Started May 2024
Preparatory Steps to Work with the FPGA Programming Blockset
The FPGA Programming Blockset and the Model Interface Package for
Simulink are part of this product set.
For instructions, refer to How to Install dSPACE Software (Installing dSPACE
Software ).
4 Open the dSPACE Installation Manager and activate the licenses for the
FPGA Programming Blockset, Model Interface Package for Simulink, and
ConfigurationDesk.
19
May 2024 FPGA Programming Blockset Getting Started
FPGA Programming Blockset Tutorial
Result You installed the software required to model and execute an FPGA application
on dSPACE hardware.
20
FPGA Programming Blockset Getting Started May 2024
Preparatory Steps to Work with the FPGA Programming Blockset
Objective Opening the demo model for copying parts of the model used in the tutorial.
If the FPGA Interface is not available, the FPGA license is not activated.
Refer to Step 1: How to Install the Required Software on page 17.
A dialog opens.
3 Click Yes to copy the demo model file to the current MATLAB folder.
The demo model opens and another dialog opens.
4 Click Yes to copy the ControlDesk experiment to the current folder.
After all files have been copied, the demo model opens.
Result You copied demo model to the current MATLAB folder and opened the model.
You can now copy parts of the demo to use in the tutorial.
21
May 2024 FPGA Programming Blockset Getting Started
FPGA Programming Blockset Tutorial
Step 1: How to Select the Framework for the dSPACE Platform..... .......... 22
Selecting the correct FPGA framework for the dSPACE platform you are
using.
Overview of Lesson 1
Task to be performed This lesson describes how to model the FPGA functionalities, including the
simulation of the modeled functionalities.
What you will learn The lesson includes the following steps:
§ Selecting the correct FPGA framework for the dSPACE platform you are using.
§ Modeling the FPGA functionality in Simulink.
§ Simulating the FPGA functionality with simulated I/O functionality to detect
modeling errors at an early stage.
Objective Selecting the correct FPGA framework for the dSPACE platform you are using.
22
FPGA Programming Blockset Getting Started May 2024
Lesson 1: Modeling the FPGA Functionality
If the FPGA Interface is not available, the FPGA license is not activated.
Refer to Step 1: How to Install the Required Software on page 17.
2 Open the FPGA Interface sublibrary.
23
May 2024 FPGA Programming Blockset Getting Started
FPGA Programming Blockset Tutorial
6 On the Unit page, select the following settings for the framework:
Note
The tutorial uses the framework for the DS6601 FPGA Base Board.
Complete the tutorial using the DS6601 FPGA Base Board framework
before using the framework that matches your dSPACE hardware.
The framework you use does not affect the steps for programming a
dSPACE FPGA board.
7 Click OK.
8 Save the Simulink model as FPGAGettingStarted_Lesson01.slx.
Result You selected the FPGA framework for the DS6601 FPGA Base Board with an
DS6651 Multi-I/O Module inserted to module slot 1.
The System Generator block is added next to the FPGA Setup block.
24
FPGA Programming Blockset Getting Started May 2024
Lesson 1: Modeling the FPGA Functionality
Note
Do not open and update the System Generator block added by the
FPGA Programming Blockset. The update process will migrate the System
Generator block to the Vitis Model Composer Hub block that is not
compatible to the FPGA Programming Blockset.
For measures if the System Generator block is migrated to the Vitis
Model Composer Hub block, refer to General modeling issues (FPGA
Programming Blockset Guide ).
1 Implement the PI-controlled system with blocks from the HDL library of the
AMD Vitis Model Composer.
The following table shows the the blocks used and the specified values of
their block properties. The same controller is used in the DemoFPGApipt1
demo model.
25
May 2024 FPGA Programming Blockset Getting Started
FPGA Programming Blockset Tutorial
Tip
Press Ctrl + D from time to time to update the diagram. This helps you
to detect modeling errors early.
Check if the messages are plausible. Error messages due to open inputs
at the AddSub blocks can be ignored, for example.
The FPGA_IO_WRITE_BL block lets you access an I/O channel to output the
controlled variable.
26
FPGA Programming Blockset Getting Started May 2024
Lesson 1: Modeling the FPGA Functionality
27
May 2024 FPGA Programming Blockset Getting Started
FPGA Programming Blockset Tutorial
To keep the model clear, you can place the controller in a subsystem:
§ Select all AMD blocks.
§ Press Ctrl+G to create a subsystem from the selection.
§ Open the subsystem and rename the inports and outports.
§ Press Ctrl+S to save the model.
28
FPGA Programming Blockset Getting Started May 2024
Lesson 1: Modeling the FPGA Functionality
Objective Simulating the FPGA functionality with simulated I/O functionality to detect
modeling errors at an early stage.
2 Copy the First Order 1 subsystem to your FPGA model and press Ctrl + I
to flip the block.
29
May 2024 FPGA Programming Blockset Getting Started
FPGA Programming Blockset Tutorial
30
FPGA Programming Blockset Getting Started May 2024
Lesson 1: Modeling the FPGA Functionality
7 In the SIMULATION pane of Simulink, set the Stop Time for a Simulink
simulation to 0.01.
Result You added sinks and sources to the interfaces of the FPGA to simulate the FPGA
functionality. This lets you validate the FPGA functionality and eliminate errors in
an early stage.
Result of Lesson 1
Results You specified the FPGA model for a specific FPGA base board and simulated its
behavior to detect modeling errors at an early stage.
31
May 2024 FPGA Programming Blockset Getting Started
FPGA Programming Blockset Tutorial
Overview of Lesson 2
Task to be performed This lesson describes how to model the processor functionalities including the
simulation of the entire model.
What you will learn The lesson includes the following steps:
§ Providing one subsystem for the processor model and one for the FPGA
model.
§ Modeling the communication within the dSPACE hardware between the real-
time processor and the FPGA.
§ Verifying the functional behavior of the entire model, including the
communication between the processor model and the FPGA model.
Objective Providing one subsystem for the processor model and one for the FPGA model.
32
FPGA Programming Blockset Getting Started May 2024
Lesson 2: Adding the Processor Functionality
Result You created one Simulink model that includes a subsystem for the processor
functionality and a subsystem for the FPGA functionality.
Objective Modeling the communication within the dSPACE hardware between the real-
time processor and the FPGA.
33
May 2024 FPGA Programming Blockset Getting Started
FPGA Programming Blockset Tutorial
34
FPGA Programming Blockset Getting Started May 2024
Lesson 2: Adding the Processor Functionality
Result You modeled the interface to the FPGA and added the signal generation to the
processor model.
Tip
The dialogs of the interface blocks let you show the corresponding interface
block in the other subsystem.
§ In the Processor model subsystem, open the dialog of the of
the Register Out processor interface block. On the FPGA Block
Connections page of the dialog, the dialog provides a link to the
corresponding interface block in the FPGA model after you clicked the
update button.
§ In the FPGA model subsystem, right-click on the Register In block and
select dSPACE FPGA - Show Corresponding Block.
Objective Verifying the functional behavior of the entire model, including the
communication between the processor model and the FPGA model.
35
May 2024 FPGA Programming Blockset Getting Started
FPGA Programming Blockset Tutorial
2 Remove the Simulink Signal Generator block that was connected to the
simulation port.
3 Press Ctrl+S to save the model.
4 Press Ctrl+T to start the simulation.
Result You simulate the FPGA functionality, the processor communication, and the
processor functionality.
Result of Lesson 2
Results You specified the processor model for the real-time processor of the dSPACE
hardware and simulated the behavior of the entire model to detect modeling
errors at an early stage.
36
FPGA Programming Blockset Getting Started May 2024
Lesson 3: Building the FPGA Application and Using the Build Results in ConfigurationDesk
Overview of Lesson 3
Task to be performed This lesson describes how to build the FPGA application to use the build results
in ConfigurationDesk.
What you will learn The lesson includes the following steps:
§ Building the FPGA application that programs the FPGA with the specified
functionality.
§ Preparing the Simulink model so that the framework can separate the
processor model from the FPGA model. The separation is required to use the
processor model with ConfigurationDesk.
§ Exporting the build result to develop the application further in
ConfigurationDesk.
37
May 2024 FPGA Programming Blockset Getting Started
FPGA Programming Blockset Tutorial
Objective Building the FPGA application that programs the FPGA with the specified
functionality.
Result The build process starts and the FPGA Build Monitor opens. The FPGA Build
Monitor displays status information and the build progress.
38
FPGA Programming Blockset Getting Started May 2024
Lesson 3: Building the FPGA Application and Using the Build Results in ConfigurationDesk
The following illustration shows the basic elements of the FPGA Build Monitor
user interface.
1 2
5 4
Objective Preparing the Simulink model so that the framework can separate the processor
model from the FPGA model. The separation is required to use the processor
model with ConfigurationDesk.
39
May 2024 FPGA Programming Blockset Getting Started
FPGA Programming Blockset Tutorial
40
FPGA Programming Blockset Getting Started May 2024
Lesson 3: Building the FPGA Application and Using the Build Results in ConfigurationDesk
4 Select model.
5 In the Model Name edit field, enter TutorialProcessorModel as the
name for the processor model to be separated.
6 Clear the Model Folder edit field.
The framework saves the separated processor model to the folder of the
entire model.
7 From the Available Subsystems list, select the Processor model
Result You prepared the separation of the processor model from the entire model.
41
May 2024 FPGA Programming Blockset Getting Started
FPGA Programming Blockset Tutorial
Result The framework mainly performs the following steps when it exports the build
results and the processor model to ConfigurationDesk:
§ Opens ConfigurationDesk.
§ Creates a new project in ConfigurationDesk.
§ Adds the file path of the current build results to the global user location file.
The global user location file is located at
%LOCALAPPDATA%\dSPACE\ConfigurationDesk\Settings\<ReleaseVersion>
(<ProductVersion>)
When you add the file paths to the global user location file, the
FPGA application is available as FPGA custom function block types in all
ConfigurationDesk projects.
Different versions of FPGAC files differ only in the application ID
(<FPGAApplicationName>_<ApplicationID>.fpgac). When updating the
FPGAC file, the FPGA Programming Blockset adds an application ID so that
ConfigurationDesk can find the latest version first and ignores the other
FPGAC files. In ConfigurationDesk, the Message Viewer displays the found
FPGAC files and the ignored FPGAC files.
The following illustration shows messages of the Message Viewer concerning
the registration of FPGA custom function block types.
§ Adds instances of the added custom function block types to the signal chain.
42
FPGA Programming Blockset Getting Started May 2024
Lesson 3: Building the FPGA Application and Using the Build Results in ConfigurationDesk
The framework performs the following steps only if the processor model can be
separated and the processor interface is implemented:
§ Separates and saves the processor models according to the settings of the
Model Separation Setup block.
In ConfigurationDesk, the processor models are implemented outside
ConfigurationDesk in Simulink models.
§ Exports the model interface of the processor models to ConfigurationDesk.
§ Maps the function ports of the added FPGA custom function blocks to the
model ports of the processor model (behavior model).
After the export process has been finished, you can display the resulting signal
chain in ConfigurationDesk.
Next steps In ConfigurationDesk, you configure the hardware assignment and you can build
the real-time application that runs on the dSPACE hardware to execute the
specified functionality.
Result of Lesson 3
Results You built the FPGA application and you made the build results and the processor
model available in ConfigurationDesk. In ConfigurationDesk, you can implement
the application on dSPACE hardware and build the the real-time application.
ConfigurationDesk lets you download and run the real-time application on the
dSPACE hardware.
Next steps The following tutorials make you familiar with the dSPACE tools for building and
downloading real-time applications and experimenting with them.
§ To familiarize with the basic steps in ConfigurationDesk, refer to
ConfigurationDesk Tutorial Starting with Simulink .
43
May 2024 FPGA Programming Blockset Getting Started
FPGA Programming Blockset Tutorial
Tip
44
FPGA Programming Blockset Getting Started May 2024
FPGA-Specific Modeling Aspects
45
May 2024 FPGA Programming Blockset Getting Started
FPGA-Specific Modeling Aspects
Introduction An FPGA processes signals in parallel, so timing is critical for the reliable
processing of signals. To be able to control the timing of a signal, the FPGA
uses flip-flops to hold the state of signals. Flip-flops are also known as registers.
Basic information on flip-flops The following illustration shows a D-flip-flop (DFF) and its signals as an example.
D Q Clk
CE D
Clk
Q
DFF
Port Description
D Data input
Q Data output
Clk Clock input
CE Chip enable
The state of the data output changes synchronously to the clock input: With the
rising edge of the clock, the flip-flop outputs the state of the data input. The
chip enable port enables the chip.
The following terms are important for the timing of FPGA designs.
Setup time This is the time for which the data input signal must be stable
before the clock signal rises from low to high.
Hold time This is the time for which the data input signal must be stable
after the clock signal rises from low to high.
46
FPGA Programming Blockset Getting Started May 2024
Timing in FPGA Designs
Propagation delay The propagation delay is the time a signals requires from
one flip-flop to the next.
The propagation delay depends on the used logic levels and the routing of the
signals.
Metastability FPGA signals are electrical signals that take time to change
their state. This is critical when the data input signal changes close to a rising
edge of the clock signal. To have a reliable output stage, the data input signal
must be stable when the clock signal rises from low to high. Otherwise, the state
of the data output is unknown or can even oscillate.
FPGA timing In FPGA logic, timing is always measured between two flip-flops. If a signal does
not make its way through the combinatorial logic (i.e., all operations with latency
0) in the clock period, a timing error occurs.
C Q C Q
12 ns
D D
DFF Combinatorial logic DFF
10 ns
For a reliable transmission, the data signal must reach the data input of the
receiving flip-flop early enough and with a stable signal level.
Introduction The build process automatically starts a timing analysis of the entire FPGA
application including the framework for the used platform. In the MATLAB
Command Window, the build process outputs links to the results of the analysis.
Depending on your preferences and the build FPGA model, click one of the
following links to the results of the timing analysis:
§ Show Timing Report of complete FPGA:
Opens the Vivado Timing Analyzer to show the results. The Vivado Timing
Analyzer shows only the signal paths that are modeled with the HDL library of
the AMD Vitis Model Composer. The Vivado Timing Analyzer does not show
signal paths that are modeled with Simulink blocks.
§ dSPACE Timing Analyzer:
Opens the dSPACE Timing Analyzer to show FPGA timing failures
independently of the used blockset, including FPGA subsystems based
on Simulink blocks (HDL coder subsystems). For more information, refer
to Features of the dSPACE Timing Analyzer (FPGA Programming Blockset
Guide ).
47
May 2024 FPGA Programming Blockset Getting Started
FPGA-Specific Modeling Aspects
dSPACE Timing Analyzer The dSPACE Timing Analyzer has the following elements.
48
FPGA Programming Blockset Getting Started May 2024
Timing in FPGA Designs
Vivado Timing Analyzer The timing analyzer shows the timing paths. The timing analyzer starts with the
slowest timing path.
The table shows the 50 signal paths where timing is tightest. To avoid timing
errors, you must ensure that the timing is not too tight. If a path delay is greater
than the FPGA sample time, the actual path is marked in red.
Column Description
Slack Timing reserve.
Delay Sum of logic delay and routing delay.
Logic Delay Delay caused by the logic.
Routing Delay Delay caused by routing.
Levels of Logic Number of serial logic operations on the timing path
between the source and destination flip-flop.
Source Flip-flop at the starting point of the timing path.
Destination Flip-flop at the end point of the timing path.
Source Clock Clock of the source flip-flop.
Destination Clock Clock of the destination flip-flop.
Path Constraints Specifies the clock period in ns.
If the Source and Destination blocks of the signal path are <…
>/FPGA_SETUP_BL1, the path is in the dSPACE framework. Paths with little slack
49
May 2024 FPGA Programming Blockset Getting Started
FPGA-Specific Modeling Aspects
can be located there. However, the framework should not generate timing errors
(Slack < 0 ns) below 70% FPGA utilization.
Fixing timing problems Too many levels of logic in a signal path result in long propagation delays, which
causes timing problems.
C Q C Q
12 ns
D D
DFF Combinatorial logic DFF
10 ns
Adding additional latency Most blocks of the HDL library of the AMD Vitis
Model Composer let you add additional latency in the block parameters dialog.
The Model Composer usually implements additional latency by adding a shift
register at the output of the block. The added shift register is based on flip-flops
and breaks up the logic in two timing paths.
100 MHz
C Q C Q C Q
6 ns 6 ns
D D D
DFF Combinatorial logic DFF Combinatorial logic DFF
10 ns
50
FPGA Programming Blockset Getting Started May 2024
Timing in FPGA Designs
Downsampling The following illustration shows the usual mechanism of downsampled paths.
As an example, the combinatorial logic has a latency of 42 ns. The signal path
is downsampled from 100 MHz to 20 MHz. You can do this, for example, by
adding a AMD Down Sample block at the beginning of the path and an Up
Sample block at the end. The added AMD blocks are based on D flip-flops.
100 MHz
C Q C Q
CE 42 ns CE
D D
DFF Combinatorial logic DFF
50 ns
For the sampling rate, follow generally accepted FPGA design rules to ensure a
stable and reliable FPGA application.
Verifying the measures To verify the measures, you can execute the timing analysis from the
FPGA_Setup_BL block dialog before you build the FPGA application. This timing
analysis considers only the signal paths that you model with the HDL library of
the AMD Vitis Model Composer. If you fix timing errors in these signal paths, you
can check if the measures to avoid timing errors are effective.
If you fix timing errors in a signal path using Simulink blocks, you have to build
the FPGA application to check if the measures are effective.
More information For more information on timing analysis and fixing timing problems,
refer to https://www.xilinx.com/support/documentation-navigation/design-
hubs/dh0006-vivado-design-analysis-and-timing-closure-hub.html.
51
May 2024 FPGA Programming Blockset Getting Started
FPGA-Specific Modeling Aspects
Introduction If different signal paths have different lengths, the resulting signals are available
at different points in time. Synchronous signals become asynchronous due to
different signal paths. This might cause unexpected behavior of your application.
For example: The values of three signals are processed to one signal as shown in
the following illustration.
A
3-cycle
delay
B
3-cycle
Logic delay Out
C
Logic
Detecting asynchronous paths If synchronous signals are required for the application, ensure that the signal
paths are synchronized. You can do this, for example, by executing an offline
simulation to visualize the signals and detect asynchronous paths. Refer to
Step 3: How to Simulate the FPGA Functionality in Simulink (Offline Simulation)
on page 29.
Synchronizing signal paths To synchronize the length of the signal paths of different signals, you can add
delay blocks. With delay blocks, you can extend shorter signal paths to the
length of the longest signal path.
A
3-cycle
delay
B
Logic
Out
3-cycle
C delay Logic
Delay
52
FPGA Programming Blockset Getting Started May 2024