FPGA Flow
FPGA Flow
Contact Information
Gmail: [email protected]
LinkedIn: Mohamed Niazy
Contents
1 Create a project 1
2 Compilation of project 3
2.1 Configure compiler settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1.1 Using Quartus GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1.2 Using TCL command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 Compilation processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2.1 Analysis and Synthesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2.2 Fitter (Place & route) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.3 Assembler (Generate programming files) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.4 Timing Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.5 EDA Netlist Writer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3 Compile Design & Flow Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3 RTL Simulation 13
3.1 Add the path of the simulation tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.2 Add test bench files and set test settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.3 Run the Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
5 Feedback 16
Abstract
This document provides a comprehensive guide to the FPGA design flow using Quartus Prime software. The design
flow covers essential steps from creating the design in RTL to loading the final bitstream file onto the FPGA. It
includes detailed explanations of the key processes such as project creation, design entry, synthesis, RTL simulation,
and device programming. In addition, it outlines how to configure simulation tools, manage compilation results,
and understand programming vs configuration in FPGA systems. Through a series of practical illustrations and
step-by-step instructions, this guide aims to support digital designers in successfully implementing FPGA designs
using Quartus.
Introduction
FPGA (Field Programmable Gate Array) technology has revolutionized the field of digital design, allowing engineers
to create complex logic circuits that can be programmed and reprogrammed based on application needs. Quartus
Prime, developed by Intel, is a robust tool that enables designers to implement, simulate, and program FPGAs
efficiently.
This document serves as a practical guide to the design flow within Quartus, detailing each critical step from
project setup to programming the FPGA device. Designers new to FPGA development often face challenges
understanding the compilation process, simulation setup, and loading designs onto the hardware. This guide
simplifies these concepts, walking the user through creating a design, running RTL simulations, and programming
the final bitstream file into the FPGA.
By following this document, engineers will gain a solid understanding of the end-to-end design flow within
Quartus and acquire the practical knowledge needed to implement and test FPGA designs with confidence.
1 Create a project
Contents
1. open Quartus then press on ”New Project Wizard” then next
1
Figure 1: Create Project
2. write the name of project and the name of top module then next , note that the name of any RTL file must
be the same name of entire module name .
6. set all none (we will configure them later) then press finish
2
2 Compilation of project
In this chapter, we will cover several key steps in the compilation processes. First, we will discuss how to configure
compiler settings to achieve the desired results. Second, we will explain how to perform a full compilation. Third,
we will demonstrate how to examine the compilation results.
Settings: it contain all the Assignments we can config for our project like
– simulation -i will discuss later-
– compilation process setting -assign No. of processor used in compilation-
– compiler settings -assign the optimization mode of the compilation process-
3
Figure 6: contain of QSF file
2. TCL window
2. Search for what you need. In most cases, you need to insert clocks, so open the manual and search for
the term ”clock.” Press enter until you find the table that lists all clocks on the board. Note that not
4
Figure 9: Find clocks in user manual
all clocks in this table are connected to the FPGA; some may be connected to communication interfaces
or the HPS. Make sure that the chosen clock is connected to the FPGA, and take note of its period.
If we want to access any peripheral, go to the introduction chapter in manual and look up the layout of
the board. Get the name of the desired peripheral, then search for it until you find the table containing
the pin names. An important note: when dealing with 7-segment displays or LEDs, check whether they
are connected to a common anode or cathode. Similarly, when working with keys, check if they are
connected with pull-up or pull-down resistors.
1. From the Analysis & Synthesis section, run ”Analysis & Elaboration.” Now all the ports in your
design will be recognized by Quartus. Then, double-click on Pin Planner.
5
2. Enter the pin name in the Location field (change the I/O standard if necessary), then double-click on
Run I/O Assignments to check for any issues.
1. Download the System Builder for your board, then run BoardName SystemBuilder.exe. Select the
name of your project, then select the peripherals for which you want to assign pins, and click Generate.
Open the directory of generated project , then open the file.qsf.
2. Open the file.qsf for your project and copy the peripheral assignments from the file sb.qsf generated
by the System Builder into the file.qsf for your project (make sure Quartus is closed while doing this).
3. Finally, make sure the port names in your design match the names used in the pin assignments.
6
Figure 15: Use assigned pins in design
7
Figure 17: Create Time Netlist
(b) Update the timing netlist: Double-click Update Timing Netlist in the Task Window. In general,
after making any changes to the constraints, update the timing netlist to reflect these changes.
8
(c) Review the clock constraints from Report Clock in the Task Pane.
(d) View unconstrained paths: From task Pin, select Report unconstrained paths. (Since we only set
constraints for the clock, all I/O ports are unconstrained.)
(e) Set I/O delay constraints: The timing analyzer knows all the internal timing delays, but it does not
have any information about timing delays external to the device. Therefore, we need to define the input
delay and the output delay. The input delay is the net sum of all external delays, typically consisting
of the delay from the common clock source to the external device flip-flop, plus the flip-flop clock-to-out
delay, plus the delay in the PCB traces to the FPGA input, minus the delay from the common clock
source to the FPGA clock input. To be accurate, you’ll need measurements or models of the PCB delay
and data sheet information for the external device that drives the inputs. Typically, the input delay is
a few nanoseconds, although it can be negative. The maximum delay is usually slightly more than the
minimum delay.
Input delay: From the Constraints menu, select Create Clock, then:
9
i.Select the clock name.
ii.Choose Maximum in the Input Delay Options.
iii.Enter the delay value.
iv. Select the target port.
v. Choose the port name, then add it. (Repeat this step until all input ports are added.)
vi. After pressing ”OK” and ”Run,” you will see the background turn yellow, indicating that the netlist
needs to be updated. Press Update Timing Netlist.
vii. Now, repeat the previous steps for the minimum input delay options, or take the last command in
the TCL window, change max to min, and then update the delay value.
(a) set maximum input delay (b) Tcl command / update netlist
We can repeat the previous steps for the output delay. After setting the constraints, you can review
them from SDC Assignments in the Report Pin section.
(a) View the report: All paths should be displayed, indicating whether they are constrained. You should
notice that some input paths are unconstrained. In the Report pane, click on Summary Setup. The
summary setup report shows the negative slack, which indicates a setup violation.
10
(b) Get the maximum frequency: From the Task Pane, go to Data Sheet and double-click on Report
Fmax Summary. This will show you the maximum frequency according to your design.
Note that the name of the constraints file must be the same as the project name because when you run
Timing Analysis, Quartus executes the commands in the file named ”PROJECT NAME.sdc”.
11
Figure 27: Open constraints file
Monitor the progress of each compilation process in the Task window or in the bottom right corner.
View the results of the running processes in the Message window. If any errors occur, read the messages and
try to resolve them.
12
3 RTL Simulation
We need to test our RTL to ensure the correctness of its functionality. Quartus provides the ability to test your
RTL. In the following, we will explain the steps to run a simulation in Quartus.
Select EDA Tool Options, then add the paths of the tool as shown in the figures below:
From the Tool Name dropdown, choose the simulation tool you want to use.
Press New.
Enter the name of the test module (it must match the name in the test file).
Figure 31: Add test bench files and set test settings
13
3.3 Run the Simulation
From Tools, select Run Simulation Tool, then press RTL Simulation.
Make sure all simulation tools like ModelSim and QuestaSim are closed before running the simulation.If they
are not closed, you will encounter an error.
SRAM memory (volatile): Directly connected to the programmable logic, any change in the SRAM imme-
diately affects the logic. However, changes in flash memory only take effect when the device powers up, as
the configuration is loaded into SRAM from flash memory at that time.
14
4.3 Compilation and Bitstream Files
We can load our design into either type of memory. In safety-critical scenarios, we typically load the design into
non-volatile memory, not into flash, to preserve the default configurations stored in the flash memory. This allows
us to recover them when the system powers up again.
After writing the design, we test it and then compile it. After compilation, Quartus generates two types of bitstream
files:
.pof (Programming Object File): Used to load the design into flash memory.
.sof (SRAM Object File): Used to load the design into SRAM memory (recommended for use).
3. Press Auto Detect, then select the first device and press ”OK”.
4. Right-click on the added device, then from the ”Edit” menu, select Change File.
15
Figure 37: Add file.sof
5. Browse the project directory, navigate to the ./output files folder, and choose project name.sof.
6. Check the box next to the selected file, then press Start.
5 Feedback
If you find any errors or have any questions regarding this document, please feel free to get in touch with me. My
contact information is provided on the cover page. I would appreciate any feedback or corrections to ensure the
accuracy and clarity of the content.
16