Site Search

* Please see below for the contents up to this point.
Beryll's FPGA flashes by clock synchronization! [#1/3]

ALTCLKCTRL supports Cyclone® V GX, so let's create one in Quartus® Prime's IP Catalog (Tools menu)!

Article header ip catalog 0 1


Set the function of ALTCLKCTRL on the parameter screen. In pattern B of this demo, we select two clock inputs, so “How many clock inputs would you like?” = 2. (others default)

Article header ip catalog 2 1


Click the Generate HDL button and select the HDL language type to generate in the Synthesis section (“Create HDL design files for synthesis:”) and Simulation section (“Create simulation model:”) respectively.

Article header ip catalog 3 1

Click the Generate button, and when "Generate: completed successfully." is displayed, click the Finish button to complete ALTCLKCTRL. Incorporate this into your top-level design.

Article header cb line top 8

When you generate a core with IP Catalog, a folder with the IP name is created in the folder specified as the save destination, and there are auxiliary files (*_inst.vhd/*_inst.v) for instantiation in the upper hierarchy. there is. It is easy to utilize these and connect them to the user circuit.

For more information on ALTCLKCTRL please see this user guide
ClockControl Block (ALTCLKCTRL) IP Core User Guide

 

Article header cb line btm 14

Now let's get back to the topic.
Here are the results of compiling the two designs (fixed pin layout).

  Circuit of pattern A Circuit of pattern B
Number of registers (flip-flops) 83 48
ALMs (Adaptive Logic Modules) 48 30
Fmax: CLK0 (50MHz) 236.74MHz 173.88MHz
Fmax: CLK1 (125MHz) 223.46MHz 249.69MHz

 

As you can see, even designs that can achieve the same behavior logically will have differences in resources and speed when implemented in an FPGA depending on the logic configuration and description method. In this case, the clocks in both patterns meet the required value by a large margin, and the circuit scale is not expanded any further, so either pattern is fine. It also affects power consumption, so if it can be realized with less resources, it can be said to be a good design.
As in pattern B this time, not only the user-made logic circuit, but also the functions of the target device (DSP block, memory block, PLL, transceiver, ARM, etc.) should be understood and used effectively. You can aim for efficient development.

2. Do logic simulation

I will write a test bench to verify the operation of the logic circuits I have written myself.
Next, run a simulation using ModelSim* - Altera® FPGA Edition (Starter Edition is also acceptable).

Article header wave2 4


Reference technical content
Let's start! Test bench

3. Set constraints

Quartus® Prime again.



3-1. Set pin layout and I/Ostandard


Specify pin numbers on the device for the input and output pins on the logic circuit. At the same time, it also sets the I/O standard for those pins.

Article header cb line top 9

Cyclone® V GX devices have separate power supplies for the transceiver block and the FPGA.

The power supply on the FPGA side is divided into eight blocks, which Altera® FPGAs refer to as I/O banks.

Article header iobank2 2

Each I/O pin belongs to one of the I/O banks and is powered for that I/O bank.

The power supplies for each I/O bank can supply different voltages, allowing a single device to support different I/O standards and interface with different ICs.
The user may ask, “What I/O standard should be concentrated in which I/O bank?” or “This I/O bank will be powered by △ volts, so we can lay out this I/O pin.” layout can be freely configured.

Article header beryll iobank2 1

How many/how the banks are divided depends on the device family, so be sure to check the device handbook, pinout file, etc.
Since this Beryll board is an evaluation board, the power supply configuration and pin layout have been decided.

Article header cb line btm 15

Let's set the pin numbers and I/O standards according to the Beryll board specifications as shown in the table below.

Article header pin planner 2

In addition, FPGA user I/O pins have selectable output current values, which can also be set in the Quartus® Prime Pin Planner (option name: Current Strength). The output current affects the FPGA's power consumption and noise during signal output, so it's nice to be able to control it.
The current value that can be set differs depending on the target device and the I/O standard to be set, so be sure to check the handbook for the device you are using.
In this demonstration, there is only one output pin that drives the LED, and if you look closely at the board diagram, the H19 pin is designed to light up the LED when it outputs GND. Since there is no drive purpose when outputting High, the current is set to 4mA, which is the smallest, but there is no problem with the default.

 

3-2. Reserve unused user I/O pins for specific attributes

 

Typically for user-built boards, Quartus® Prime also programs each unused user I/O pin with appropriate attributes for that pin, depending on how it is handled on the board. set as follows.

For example, if an unused user I/O pin is not connected to anything on the board (unconnected), Quartus® Prime will specify an “input with internal weak pull-up” or “output” for that pin. ” will be booked as

For details on setting methods and setting items, refer to "Quartus® Prime Getting Started Guide - How to Set Device Options" and "Quartus® Prime Getting Started Guide - How to Assign Pins".
In the case of Beryll, all user I/O pins except for the 8 user I/O pins (AC10/T11/W11/Y11/AE10/AE13/Y15/G7) are somehow connected, so they are reserved for tri-state inputs. To do.

Article header dev opt unused pin 1


The 8 unused and unconnected user I/O pins (AC10/T11/W11/Y11/AE10/AE13/Y15/G7) are now reserved for GND output and I/O standards according to Beryll's power specifications set.
Also, Flash ROM/SRAM/DDR3 SDRAM is not used in this demo, so to disable the chip select (CS) pin of each memory device, reserve the pin on the Cyclone® VGX side for VCC output and set the I /O Sets the standard and output current value.

Article header pin rsv 2


3-3.Set device pin options

 

The INIT_DONE pin (Pin U19) is boarded for use as an option pin, so enable the option.
From the Assignments menu > Device > Device and Pin Options > General category
Enable INIT_DONE output = On

Article header dev opt gen 1


3-4.Select configuration mode

 

Beryll has an EPCS128SI16N as the Cyclone® V GX configuration ROM, and the Cyclone® V GX MSEL pins are connected to MSEL[4:0]=10011.

In other words, the data transfer method is the specification of the active serial configuration mode (AS mode).
This time,

  • Configuration scheme: Active Serial x1 (can use Configuration Device)
  • Configuration mode: Standard
  • Use configuration device = On / EPCS128
  • Leave everything else as default.
Article header dev opt 1


3-5. For logic circuitsCreate and Register Timing Constraints

 

This time it is the clock control circuit. Create an SDC file for timing constraints.

Article header sdc 2

The first and second lines are clock definitions.
The third line is the constraint command for the clock multiplexer configuration.
The circuit configuration of this demo (Pattern B) is a configuration that selects two clocks with different frequencies. It is necessary to perform timing analysis to see if it works with both 50MHz and 125MHz clocks. However, after the clock is selected, the 50MHz and 125MHz clocks will not be valid at the same time, so constrain them with the -exclusive option of the set_clock_groups command.
The fifth line is a command to automatically calculate clock variations and reflect them in timing analysis.
Lines 7 to 9 are commands for excluding from timing analysis targets.
The reset signal (ACLR) and clock switching signal (BUTTON) are controlled by pushing a push button. Considering the fact that it is an asynchronous input and the speed at which a person presses, there is no need for timing analysis, so I excluded it.

After creating the timing constraints, register the SDC file in the Quartus® Prime Assignments menu > Settings > TimeQuest Timing Analyzer.


4. Compile

To execute compilation, click the Start Compilation button♪

Article header start compile 2

Logic synthesis and place-and-route are now executed, and the program data to be executed inside the FPGA is also generated at the same time.

5. Verify timing

In the compilation report generated after compilation, check the TimeQuest Timing Analyzer report section and verify that the result satisfies the conditions given by the timing constraints.

Article header tmg rpt 1

In the case of Cyclone® V GX, there are four timing models used for timing analysis (worst-case/maximum operating temperature, worst-case/minimum operating temperature, fastest-case/maximum operating temperature, and fastest-case/minimum operating temperature), and the timing must meet the desired values in all models.
The results calculated for each model and compared to the requirements of the created SDC are saved in their respective folders. If any item does not meet the requirements, the item name will be displayed in red, but since everything is in black text, you can see at a glance that the requirements have been met.
If there are timing violations, please use Timing Aligner to analyze and improve the situation.

Finally, let's write the design we've created onto the Beryll board and run it.
Blinking an LED with clock synchronization using Beryll FPGA! [#3/3] (continued)



Beryll's FPGA flashes by clock synchronization! series

Beryll's FPGA flashes by clock synchronization! [#1/3]
Beryll's FPGA flashes by clock synchronization! [#2/3]
Beryll's FPGA flashes by clock synchronization! [#3/3]

Related products