AN 755: Implementing JESD204B IP Core System Reference Design with ARM HPS As Control Unit (Baremetal Flow)
Implementing JESD204B IP Core System Reference Design with ARM HPS As Control Unit (Baremetal Flow)
The Altera® JESD204B IP core is a high-speed point-to-point serial interface for digital-to-analog (DAC) or analog-to-digital (ADC) converters to transfer data to or from the FPGA devices.
The JESD204B IP core is part of the IP Catalog library, which is distributed with the software and downloadable from the Altera® website.
This reference design demonstrates the JESD204B IP core operating as part of a system that includes:
- Altera JESD204B transport layer (assembler and deassembler)
- test pattern generator and checker
- core PLL
- Serial Parallel Interface (SPI) – Master module
- reset sequencer
- various dynamic reconfiguration controllers
- ARM® hard processor subsystem (HPS) as the control unit
The key feature of this reference design is the software-based control flow that utilizes the ARM® HPS control unit.
The reference design utilizes the Arria V SoC Development Kit to interoperate with the Analog Devices (ADI) AD9680 ADC daughter card that connects to the development board.
Reference Design Overview
This reference design is implemented on the Arria V SoC development board interoperating with the ADI AD9680 ADC converter card.
The reference design consists of these components and sub components:
- Qsys system:
- ARM® HPS control unit and various processor peripherals
- JESD204B subsystem
- SPI master module
- Top level HDL:
- Core PLL
- In-system source and probes (ISSP)
- Edge detectors
- Altera transport layer (assembler and deassembler)
- Test pattern generator and checker
- ARM® HPS control unit—generates a one-shot SYSREF pulse for the JESD204B IP core and the AD9680 module (for Subclass 1 mode compliance).
- device_clk (153.6 MHz) clock signal sourced from the AD9516 external clock module—acts as the reference clock for the on-chip core PLL and transceiver PHY PLL.
- Core PLL module—generates the link clock (link_clk) and frame clock (frame_clk).
- Oscillator on-board the Arria V SoC development board—supplies a 50 MHz clock (fpga_clk_50) to clock the control plane.
-
Altera In-System Source and Probes (ISSP) module instantiated in
the top level HDL—generates the following resets for the ARM HPS control unit:
- Cold reset
- Warm reset
- Debug reset
- Edge detect module instantiated in the top level HDL—shapes the reset pulses generated by the ISSP module to meet the ARM HPS reset pulse width requirements.
- AD9516 external clock
module
- Supplies a 614.4 MHz clock to the ADCs on the AD9680 module via an SMA connector.
- Supplies a 153.6 MHz reference clock to the FPGA via an SMA connector on the AD9680 module. The reference clock is passed through from the AD9680 module to the FPGA via the FMC connector.
- You can replace this module with any external clock module that supplies a 614.4 MHz and 153.6 MHz reference clock.
- AD9680 module
- Configuration of the AD9680 converter parameters is through a 4-wire SPI master module via FMC connector.
- Configured to transmit on 4 high-speed transceiver lanes (L=4) to the FPGA.
- Each lane is configured to 6.144 Gbps data rate.
- Passes through the FPGA reference clock (device_clk) from the AD9516 clock module to the FPGA via the FMC connector.
Clocks |
Description |
Source |
Modules Clocked |
---|---|---|---|
device_clk |
Reference clock for the data path |
External |
Core PLL, transceiver PHY PLL |
link_clk |
Link layer clock |
device_clk |
JESD204B IP core link layer, transport layer link interface |
frame_clk |
Frame layer clock |
device_clk |
Transport layer, test pattern generator and checker, downstream modules |
fpga_clk_50 |
Control plane clock |
External |
ARM HPS control unit and any peripherals connected to ARM HPS via Avalon-MM/AXI bus interconnect |
Getting Started
Hardware and Software Requirements
This reference design uses the following hardware and software tools:
- Arria V SoC development kit
- ADI AD9680 ADC converter card
- ADI AD9516 clock module
- Quartus® Prime software version 15.1
- Altera SoC Embedded Design Suite (EDS) with ARM® DS-5 Altera Edition tool
Hardware Setup
- Install the ADI AD9680 converter card module to the FMC port A (J26) on the Arria V SoC development board.
- Connect the USB cable to the USB-Blaster® II connector on the development board.
- Connect the power adapter shipped with the development board to the power supply jack (J34).
- Connect the AD9516 power adapter to the power supply jack on the AD9516 clock module card.
- Connect the USB cable from your workstation to the USB connector on the AD9516 card.
- Connect the AD9516 clock module OUT0 SMA connector (J0A) to the CLKIN SMA connector (J801) on the AD9680 card.
- Connect the AD9516 clock module OUT8 SMA connector (J8A) to the Refclk to FPGA SMA connector (J804) on the AD9680 card.
- Turn on the power for the AD9516 clock module card.
- Configure the clock settings of the AD9516 to output 614.4 MHz clock for the ADCs at OUT0 SMA connector and 153.6 MHz for the FPGA at OUT8 SMA connector. Refer to the AD9516 documentation for more information on configuring the AD9516 clock module.
- Turn on the power for the Arria V SoC development board.
The hardware system is now ready for programming.
Compiling the HDL and Programming the Board
- Extract the reference design from the reference design ZIP file (jesd204b_av_soc_ref_design.zip).
- Launch the Quartus® Prime software.
- On the File menu, click Open Project.
- Navigate to your project directory and select the Quartus project archive file (jesd204b_ed.qar). Click Open.
- In the Restore Archived Project window, verify that the archive file name is jesd204b_ed.qar and set the destination folder to the destination folder of your choice. Click OK. The Quartus project opens in the Quartus window.
- To compile the HDL, navigate to the Processing menu and select Start Compilation. The Quartus software compiles the design and indicates the compilation status in the Tasks panel.
- After compilation is done, you are ready to program the FPGA device with the programming file. Navigate to the Tools menu and click Programmer.
- In the Programmer window, click Add File.
- In the Select Programming File window, navigate to <your project directory> /output_files/jesd204b_ed.sof and click Open.
- Verify that all the hardware setup options are set correctly to your system configurations.
- Click Start to download the file into the Arria V SoC device on the development board. Alternatively, if you want to use the pre-generated golden programming file, skip the Quartus compilation in step 6. In step 9, select <your project directory> output_files/jesd204b_ed_golden.sof and proceed accordingly.
After programming the Arria V SoC device on the development board, the system needs to be initialized via software before the JESD204B link can be fully active.
Setting up the Software Command Line Environment
- Create a software workspace in a project directory of your choice. For ease of reference, this document will assume the software workspace name of <your project directory> /software.
- Launch the SoC EDS ARM® DS-5 Altera Edition tool.
- In the Select a workspace dialog box, navigate to the software workspace, <your project directory> /software and click OK.
- Import the software archive project into your workspace. On the File menu, click Import.
- In the Import/Select window, select General > Existing Projects into Workspace and click Next >.
- In the Import/Import Projects window, check the Select archive file radio button.
- Browse to the software archive project location, select the archive project file, jesd204b_soc_baremetal_gnu.tar.gz and click OK. The software archive project file is in the location where you unzipped the reference design, jesd204b_av_soc_ref_design.zip.
- Verify that the jesd204b_soc_baremetal_gnu check box is checked in the Projects panel and click Finish. The ARM® DS-5 tool restores the archived software project into your workspace.
- In the Project Explorer tab of the main Eclipse window, expand the jesd204b_soc_baremetal_gnu project file list and verify that you see all the files listed in the Reference Design Files section.
- To compile the source code, right-click on the jesd204b_soc_baremetal_gnu project in the Project Explorer tab and select Build Project. This action executes the software build project Makefile.
- When recompiling the source code after the first compile, right-click on the jesd204b_soc_baremetal_gnu project and select Clean Project before building the project. This clears the project workspace of object files and other project executables from the previous project build.
- Whenever you add or remove any *.c source files from the project, in addition to adding or removing the file from the Project Explorer window, you must update the source file list in the software build project Makefile accordingly. To update the source file list in the Makefile, double-click the Makefile file under the jesd204b_soc_baremetal_gnu project in the Project Explorer tab. In the Makefile editor window, locate the 'EXAMPLE_SRC' variable and add or remove your *.c source file from the list. Save the file and proceed to build the project.
- View the build project log in the Console tab and verify that there are no errors during the build project operation.
- To download the project executable file to the ARM® HPS and execute the code in semi-hosting debug mode, right-click on the jesd204b_soc_baremetal_gnu project in the Project Explorer tab and select Debug As > Debug Configurations.
- In the Debug Configurations window, on the left panel, select DS-5 Debugger > jesd204b_soc_baremetal_gnu. On the right panel, under the Connection tab, in the Select target panel, select Arria V SoC > Bare Metal Debug > Debug Cortex-A9_0. Ensure that all the other connections settings in the Connection tab are set according to your system configurations.
- Click Debug. The tool downloads the executable code onto the ARM® HPS and launches the Debugger interface.
- Execution of the code is halted on the first executable line of the main.c code. To continue execution without interruption until the end of the code, click the Continue button in the Debug Control window. To step through the code line by line, use the stepping buttons in the Debug Control window.
The App Console window is the main user interface portal that you can view printed messages and enter commands to the main execution code.
The main execution code executes the JESD204B link initialization sequence and prints a command prompt for you to enter commands to the ARM® HPS. View the printed messages from the JESD204B link initialization sequence in the App Console window. Verify that the link is initialized successfully and the TX/RX status registers display the expected values. Tables below describe the expected values of the link status register report.
Bit |
Name |
Description |
Expected Binary Value |
---|---|---|---|
[0] |
SYNC_N value |
0: Receiver is not in sync 1: Link is in sync |
1 |
[2:1] |
Data Link Layer (DLL) state |
00: Code Group Synchronization (CGS) 01: Initial Lane Alignment Sequence (ILAS) 10: User data mode 11: D21.5 test mode |
10 |
Bit |
Name |
Description |
Expected Binary Value |
---|---|---|---|
[0] |
SYNC_N value |
0: Receiver is not in sync 1: Link is in sync |
1 |
Others |
— |
— |
Don’t care |
The code also reports the status of the pattern checker comparison. Any pattern checker errors that occur during the initialization period is flagged to the console window. Verify that the console displays this message to indicate no pattern checker errors were detected:
INFO: No pattern checker error detected on link 0
Reference Design Components
The reference design consists of the following components:
- Qsys system
- ARM HPS control unit and supporting processor peripherals
- JESD204B subsystem
- Core PLL
- Assembler and deassembler (in the transport layer)
- Test pattern generator
- Test pattern checker
Qsys System
The top level Qsys system (jesd204b_ed_soc.qsys) instantiates the following key components:
- ARM® HPS control unit and supporting processor peripherals
- JESD204B subsystem
The main data path flows through the JESD204B subsystem. In this reference design, the JESD204B IP core is configured in duplex mode with both TX and RX data paths. On the TX data path, user data flows from the transport layer through the JESD204B IP core base module via a 32-bit per transceiver lane Avalon® Streaming (Avalon-ST) interface and out as serial data to either the external converters or the RX data path in internal serial loopback mode via the JESD204B IP core PHY module. On the RX data path, serial data flows from the external converters (or from the TX data path, in internal serial loopback mode) to the JESD204B IP core PHY module and out from the JESD204B IP core base module to the transport layer via a 32-bit per transceiver lane Avalon-ST interface. Since the system is configured to 4 transceiver lanes (L=4), the total bit width of the Avalon-ST interface for both the TX and RX data paths is 128 bits.
The control path is centered on the ARM® HPS control unit that connects to various peripherals via the Advanced Microcontroller Bus Architecture (AMBA) Advanced eXtensible Interface (AXI) bus protocol. Altera processor peripherals primarily use the Avalon® Memory-Mapped (Avalon-MM) protocol for bus connectivity. The Qsys tool automatically and seamlessly translates between the two protocols such that you can connect an Avalon-MM peripheral to the ARM® HPS interface directly. An Avalon-MM bridge module provides a single memory-mapped interface between the ARM® HPS lightweight HPS-to-FPGA bridge AXI interface and Avalon-MM peripherals implemented in the FPGA core fabric.
A secondary control path from the SPI master module links to the SPI configuration interface of the external converters via a 4-wire SPI interconnect. The configuration of the external converters is done by the ARM® HPS control unit writing configuration data to the SPI master module. The SPI master module handles the serial transfer of data to the SPI interface on the converter end via the 4-wire SPI interconnect.
To view the top level Qsys system in Qsys:
- Launch the Quartus® Prime software.
- On the File menu, click Open.
- Browse and select the jesd204b_ed_soc.qsys file located in the project directory.
- Click Open to view the Qsys system.
Top Level Qsys Address Map
You can access the address mapping of the submodules in the top level Qsys project by clicking on the Address Map tab in the Qsys window.
The Qsys system supports multi-link scenarios (up to 4 links) using the existing address map. To add more links to the system, add more jesd204b_system.qsys modules to the project, connect them to the Avalon-MM bridge, and adjust the address map accordingly. Bits 16-17 of the Avalon-MM bridge (0x0004_0000 base address) indicate the link number.
ARM HPS Control Unit and Supporting Processor Peripherals
This section describes the following components:
- ARM® HPS control unit
- On-chip memory—provides general purpose data memory to the ARM® HPS
- System ID (sysid)—a simple read-only device that provides the system with a unique identifier. The ARM® HPS uses this module to verify that an executable program is compiled targeting the actual hardware image configured in the target FPGA.
- JTAG UART—transmits information between the ARM® HPS and user console
- External ports parallel I/O (PIO)—provides
memory-mapped access to/from the
ARM®
HPS from/to external ports.
There are three external port PIO modules in the system:
- fpga_dipsw_pio—4-bit input from on-board DIP switches
- fpga_button_pio—4-bit input from on-board push buttons
- fpga_led_pio—4-bit output to on-board LEDs
- FPGA core control and status parallel I/O (PIO)
- SPI master module
- Interrupt latency counter (ILC)—measures in clock cycles the time taken from the moment an interrupt request (IRQ) signal is asserted until the interrupt service routine (ISR) begins
- Avalon-MM bridge—provides single memory-mapped interface between the ARM® HPS lightweight HPS-to-FPGA bridge AXI interface and Avalon-MM peripherals in the FPGA core
- JTAG-to-Avalon-Master bridge—facilitates System Console interface for debug purposes
ARM HPS Control Unit
The ARM® HPS is configured with the following input resets enabled:
- Cold reset
- Warm reset
- Debug reset
The reset pulses to the ARM® HPS are generated by the Altera In-System Sources and Probes (ISSP) module that is instantiated in the top level HDL file. The reset pulses are shaped by the edge detector unit (also instantiated in the top level HDL file) to meet the ARM® HPS reset pulse specifications. The ARM® HPS in turn generates an output reset signal to the FPGA core fabric via the HPS-to-FPGA external reset port (h2f_reset) and is used by the JESD204B subsystem reset sequencer.
The ARM® HPS communicates with the FPGA core fabric via a set of AXI bridges that are part of the HPS:
- HPS-to-FPGA bridge—64-bit master interface that interfaces to the on-chip memory
- FPGA-to-HPS bridge—64-bit general purpose slave interface from the FPGA core fabric to ARM® HPS
- Lightweight HPS-to-FPGA bridge—32-bit master interface that connects to all Avalon-MM peripherals that are implemented in the FPGA core fabric
The SDRAM interface protocol setting is configured to DDR3 operating at 533 MHz.
The following peripherals have their interrupt request (IRQ) output ports connected to the IRQ input port of the ARM® HPS (f2h_irq0):
- Push button input PIO module
- DIP switch input PIO module
- SPI master module
- JESD204B IP core TX base layer
- JESD204B IP core RX base layer
- Reset sequencer
FPGA Core Control and Status PIO
The FPGA core control and status PIO modules provide general purpose I/O access to and from the ARM® HPS for elements inside the FPGA core fabric. The FPGA control PIO is a 32-bit output signal from the ARM® HPS to the FPGA core fabric. The FPGA status PIO is a 32-bit input signal from the FPGA core fabric to the ARM® HPS. The signal connectivity is set at the top level HDL file. The tables below describe the signal connectivity for the FPGA control and status registers.
Bit |
Signal |
---|---|
0 |
RX serial loopback enable for lane 0 (Link 0) |
1 |
RX serial loopback enable for lane 1 (Link 0) |
2 |
RX serial loopback enable for lane 2 (Link 0) |
3 |
RX serial loopback enable for lane 3 (Link 0) |
4-30 |
RX serial loopback enable for subsequent links, if present |
31 |
Sysref |
Bit |
Signal |
---|---|
0 |
Core PLL locked |
1 |
TX transceiver ready (Link 0) |
2 |
RX transceiver ready (Link 0) |
3 |
Test pattern checker data error (Link 0) |
4-31 |
TX transceiver ready, RX transceiver ready, and test pattern checker data error signals for subsequent links, if present |
SPI Master Module
The SPI master module is a 4-wire, 24-bit width interface that uses the SPI protocol to facilitate the configuration of external converters (for example, ADC, DAC, and external clock modules) via a structured register space provided inside the converter device. The SPI master module connects to the ARM® HPS via the Avalon-MM bridge. The ARM® HPS sends the configuration instructions and data to external converters during the external converter configuration operation. The software instructions to execute external converter configuration via the SPI interface is described in the Reference Design Software section.
JESD204B Subsystem
The JESD204B subsystem Qsys project (jesd204b_system.qsys) instantiates these modules:
- JESD204B IP core configured in duplex (with TX and RX data paths), non-bonded mode
- Reset sequencer
- Transceiver PHY reset controller
- Avalon-MM bridge
The grouping of modules into a single Qsys subsystem project facilitates easy implementation of multi-link capabilities. For every link that you implement, a jesd204b_system.qsys project is instantiated in the top level Qsys project and assigned an address as described in the Top Level Address Map section. You can reset and dynamically reconfigure each link independently.
JESD204B IP Core
The JESD204B IP core is configured in duplex (with TX and RX data paths), non-bonded mode with the following parameter configuration:
Parameter |
Value |
Description |
---|---|---|
Subclass |
1 |
Subclass mode. |
L |
4 |
Number of lanes per converter device. |
M |
2 |
Number of converters per device. |
F |
1 |
Number of octets per frame. |
S |
1 |
Number of transmitted samples per converter per frame. |
N |
14 |
Number of conversion bits per converter. |
N’ |
16 |
Number of transmitted bits per sample. |
K |
32 |
Number of frames per multiframe. |
CS |
0 |
Number of control bits per conversion sample. |
CF |
0 |
Number of control words per frame clock period per link. |
HD |
0 |
High Density user data format. |
SCR |
Off |
Enable scramble. |
The JESD204B IP base core connects to the ARM HPS via the Avalon-MM bridge. There are two separate Avalon-MM ports for the JESD204B IP core:
- Base core TX data path—for dynamic reconfiguration of the TX CSR parameters.
- Base core RX data path—for dynamic reconfiguration of the RX CSR parameters.
The ARM® HPS writes to the JESD204B IP core CSR during a dynamic reconfiguration operation. The software instructions to execute dynamic reconfiguration of the JESD204B IP core are described in the User Commands section.
To customize the JESD204B IP core parameters to meet your specifications, follow the instructions in the Modifying JESD204B IP Core Parameters section.
Reset Sequencer
The reset sequencer is a standard Qsys component in the IP Catalog standard library. The reset sequencer generates the following system resets to reset various modules in the system:
- Core PLL reset—resets the core PLL.
- Transceiver reset—resets the JESD204B IP core PHY module.
- TX/RX JESD204B IP core CSR reset—resets the TX/RX JESD204B IP core CSRs.
- TX/RX link reset—resets the TX/RX JESD204B IP core base module and transport layer.
- TX/RX frame reset—resets the TX/RX transport layer, downstream modules.
The reset sequencer has hard and soft reset options. The hard reset port connects to the ARM® HPS-generated FPGA reset output signal (h2f_reset). The ARM® HPS executes a soft reset by issuing the reset command to the Avalon-MM interface of the reset sequencer. When you assert a hard reset or issue the full sequence reset command, the reset sequencer cycles through all the various module resets based on a pre-set sequence. The figure below illustrates the sequence and also shows how the reset sequencer output ports correspond to the modules that are being reset.
Transceiver PHY Reset Controller
The transceiver PHY reset controller is a standard Qsys component in the IP Catalog standard library. This module takes the transceiver PHY reset output from the reset sequencer and generates the proper analog and digital reset sequencing for the transceiver PHY module.
Avalon-MM Bridge
All the Avalon-MM peripherals in the JESD204B subsystem connect via the Avalon-MM interconnect to a single Avalon-MM bridge. This bridge is the single interface for Avalon-MM communications into and out of the subsystem. This Avalon-MM bridge connects to the main Avalon-MM bridge in the top level Qsys system to connect to the ARM® HPS control unit.
JESD204B Subsystem Address Map
You can access the address map of the peripherals in the JESD204B subsystem by clicking on the Address Map tab in the Qsys window when the jesd204b_system.qsys project is open.
Avalon-MM Peripheral |
Address Map |
---|---|
JESD204B IP core base CSR – TX |
0xC000 – 0xC3FF |
JESD204B IP core base CSR – RX |
0xD000 – 0xD3FF |
Reset sequencer |
0xE000 – 0xE0FF |
Core PLL
The core PLL generates clocks for the FPGA core fabric. The core PLL uses the device_clk external clock signal as its reference clock to generate two derivative clocks from a single VCO:
- Link clock—from output C0
- Frame clock—from output C1
Clock |
Formula |
Description |
---|---|---|
Link Clock |
Serial data rate/40 |
Clocks the JESD204B IP core link layer and the link interface of the transport layer. |
Frame Clock |
Serial data rate/(10 × F) |
Clocks the transport layer, test pattern generators and checkers, and any downstream modules in the FPGA core fabric. |
For the frame clock, when F=1 and F=2, the resulting frame clock value can easily exceed the capability of the core PLL to generate and close timing. The top level HDL file (jesd204b_ed.sv) defines the frame clock division factor parameters, F1_FRAMECLK_DIV (for cases with F = 1) and F2_FRAMECLK_DIV (for cases with F = 2). This factor enables the transport layer and test pattern generator to operate at a divided factor of the required frame clock rate by widening the data width accordingly. For this reference design, the F1_FRAMECLK_DIV is set to 4 and F2_FRAMECLK_DIV is set to 2. Based on the default settings of the reference design, the frame clock for a serial data rate of 6.144 Gbps and F = 1 equals to:
(6144/(10 × 1)) / F1_FRAMECLK_DIV = 614.4 / 4 = 153.6 MHz
Transport Layer
The transport layer in the reference design consists of an assembler at the TX path and a deassembler at the RX path. The transport layer for both the TX and RX path is implemented in the top level HDL file, not in the Qsys project.
The transport layer provides the following services to the application layer (AL) and the link layer:
- The assembler at the TX
path:
- maps the conversion samples from the AL (through the Avalon-ST interface) to a specific format of non-scrambled octets, before streaming them to the DLL.
- reports AL error to the DLL if it encounters a specific error condition on the Avalon-ST interface during TX data streaming.
- The deassembler at the RX
path:
- maps the descrambled octets from the DLL to a specific conversion sample format before streaming them to the AL (through the Avalon-ST interface).
- reports AL error to the DLL if it encounters a specific error condition on the Avalon-ST interface during RX data streaming.
The transport layer has many customization options and you can modify the transport layer HDL code to customize it to your specifications. Furthermore, for certain parameters like L, F, and N, the transport layer shares the CSR values with the JESD204B IP core. This means that any dynamic reconfiguration operation that affects those values for the JESD204B IP core will affect the transport layer in the same way.
The software instructions to execute dynamic reconfiguration of the transport layer are described in the User Commands section.
Test Pattern Generator
The test pattern generator generates one of three patterns—parallel PRBS, alternate checkerboard, or ramp wave—and sends the pattern along to the transport layer during test mode. The test pattern generator has many customization options and you can modify the test pattern generator HDL code to customize it to your specifications. Furthermore, for certain parameters like M, S, N, and test mode, the test pattern generator shares the CSR values with the JESD204B IP core. This means that any dynamic reconfiguration operation that affects those values for the JESD204B IP core will affect the test pattern generator in the same way. This includes the pattern type (PRBS, alternate checkerboard, ramp) which is controlled by the test mode CSR. The software instructions to execute dynamic reconfiguration of the test pattern generator are described in the User Commands section.
Test Pattern Checker
The test pattern checker checks one of three patterns—parallel PRBS, alternate checkerboard, or ramp wave—from the transport layer during test mode. The test pattern checker has many customization options and you can modify the test pattern checker HDL code to customize it to your specifications. Furthermore, for certain parameters like M, S, N, and test mode, the test pattern checker shares the CSR values with the JESD204B IP core. This means that any dynamic reconfiguration operation that affects those values for the JESD204B IP core will affect the test pattern checker in the same way. This includes the pattern type (PRBS, alternate checkerboard, ramp) which is controlled by the test mode CSR. The software instructions to execute dynamic reconfiguration of the test pattern checker are described in the User Commands section.
Reference Design Files
The reference design files are included in a ZIP file (jesd204b_av_soc_ref_design.zip). The ZIP file contains two key components:
- Quartus project archive file (jesd204b_ed.qar)
- Software project archive file (jesd204b_soc_baremetal_gnu.tar.gz)
File Type |
File/Folder |
Description |
---|---|---|
Quartus project files |
jesd204b_ed.qpf |
Quartus project file. |
jesd204b_ed.qsf |
Quartus settings file. |
|
output_files |
Folder containing output files from Quartus compilation (for example, reports or .sof). |
|
Verilog HDL design files |
jesd204b_ed.sv |
Top level HDL |
jesd204b_ed.sdc |
Synopsys Design Constraints (SDC) file containing all timing or placement constraints. |
|
ip | Folder containing Verilog HDL and source files of sub-modules instantiated in top level HDL file. | |
ip/altera_pll | Folder containing Verilog HDL and source files of core PLL module. | |
ip/altiobuf | Folder containing Verilog HDL and source files of output buffer module. | |
ip/spi_mosi_oe | Folder containing Verilog HDL and source files of output buffer module. | |
ip/debounce | Folder containing Verilog HDL and source files of switch debouncer module. | |
ip/issp | Folder containing Verilog HDL and source files of ISSP module. | |
ip/edge_detect | Folder containing Verilog HDL and source files of edge detector module. | |
ip/transport_layer |
Folder containing assembler and deassembler HDL. |
|
ip/pattern |
Folder containing the test pattern generator and checker HDL. |
|
Qsys Projects |
jesd204b_ed_soc.qsys |
Top level Qsys system project. |
jesd204b_system.qsys |
JESD204B subsystem |
After you have imported the software project archive file (jesd204b_soc_baremetal_gnu.tar.gz) into the SoC EDS ARM DS-5 tool (refer to Setting up the Software Command Line Environment section), verify that the software project contains the source and header files as shown in the table below.
File Type |
File |
Description |
---|---|---|
Makefiles |
Makefile |
Software project compilation Makefile. The ARM DS-5 tool executes this Makefile during build project operation. Whenever you add or remove any *.c source files to or from the project, you must manually update the source file list in this Makefile accordingly. See the Setting up the Software Command Line Environment section for more details. |
Header files |
system.h |
Contains base address definitions of the following Avalon-MM peripherals implemented in the FPGA core fabric:
The base addresses correspond to the address maps of the jesd204b_ed_soc.qsys and jesd204b_system.qsys projects in Qsys. Whenever you make any changes to the address maps in Qsys, you must manually update the base addresses in this file accordingly. |
altera_jesd204_regs.h |
Contains offsets, masks, and bit position definitions for peripherals in the QSYS system that do not have standard access libraries. This includes the following peripherals:
|
|
main.h |
General user parameter definitions. See Software Parameters section for detailed description of the user parameters. |
|
functions.h |
Contains function prototype definitions of sub-functions in main.c. |
|
rules.h |
Contains function prototype definitions of rule functions in rules.c. |
|
macros.h |
Contains function prototype definitions of macro functions in macros.c. |
|
Source files |
main.c |
Main C program. Also contain sub functions. |
rules.c |
Rule checking functions used by the dynamic reconfiguration functions. |
|
macros.c |
JESD204B Qsys system device access macros. |
FPGA Pin Assignments
The interface ports of the top level HDL file (jesd204b_ed.sv) with their corresponding FPGA pin assignments on the Arria V SoC development board are listed in the table below. The table only lists the JESD204B-related pin assignments. For all other board-related and ARM HPS-related pin assignments, refer to the Quartus settings file (jesd204b_ed.qsf).
Interface Port Name | FPGA Pin Number | I/O Standard | Direction | Board Source/Destination | Description |
---|---|---|---|---|---|
General Clocks | |||||
fpga_clk_50 | AU32 | 1.5 V | Input | 50 MHz on-board oscillator (X4) via SL18860DC clock distribution buffer (U30) | Reference clock for ARM HPS control unit and all peripherals connected via AXI/Avalon-MM interconnect. The clock frequency is 50 MHz. |
device_clk |
AC31 1 U31 2 |
LVDS | Input |
FMC Port A connector 1 Si571 Programmable Oscillator 2 |
Reference clock for JESD204B data path. The clock frequency is 153.6 MHz |
device_clk (n) |
AC32 1 U32 2 |
LVDS | Input |
FMC Port A connector 1 Si571 Programmable Oscillator 2 |
|
Serial Data | |||||
jesd204_rx_serial_data[3] | AB39 | 1.5 V PCML | Input |
FMC Port A connector |
Differential high speed serial input data. |
jesd204_rx_serial_data[3] (n) | AB38 | Input |
FMC Port A connector |
||
jesd204_rx_serial_data[2] | AF39 | Input |
FMC Port A connector |
||
jesd204_rx_serial_data[2] (n) | AF38 | Input |
FMC Port A connector |
||
jesd204_rx_serial_data[1] | Y39 | Input |
FMC Port A connector |
||
jesd204_rx_serial_data[1] (n) | Y38 | Input |
FMC Port A connector |
||
jesd204_rx_serial_data[0] | T39 | Input |
FMC Port A connector |
||
jesd204_rx_serial_data[0] (n) | T38 | Input | FMC Port A connector | ||
jesd204_tx_serial_data[3] | AA37 | 1.5 V PCML | Output |
FMC Port A connector |
Differential high speed serial output data. |
jesd204_tx_serial_data[3] (n) | AA36 | Output |
FMC Port A connector |
||
jesd204_tx_serial_data[2] | AE37 | Output |
FMC Port A connector |
||
jesd204_tx_serial_data[2] (n) | AE36 | Output |
FMC Port A connector |
||
jesd204_tx_serial_data[1] | W37 | Output |
FMC Port A connector |
||
jesd204_tx_serial_data[1] (n) | W36 | Output |
FMC Port A connector |
||
jesd204_tx_serial_data[0] | R37 | Output |
FMC Port A connector |
||
jesd204_tx_serial_data[0] (n) | R36 | Output |
FMC Port A connector |
||
JESD204B Control Signals | |||||
jesd204_sysref_out | E27 | LVDS | Output |
FMC Port A connector |
SYSREF signal for JESD204B Subclass 1 implementation. |
jesd204_sysref_out (n) | F27 | LVDS | Output |
FMC Port A connector |
|
jesd204_sync_n_out | J26 | LVDS | Output |
FMC Port A connector |
Indicates a SYNC_N from the receiver. This is an active low signal and is asserted 0 to indicate a synchronization request or error reporting. |
jesd204_sync_n_out (n) | K26 | LVDS | Output |
FMC Port A connector |
|
SPI | |||||
spi_MISO | H27 | 2.5 V | Input |
FMC Port A connector |
Output data from a slave to the input of the master |
spi_MOSI | N23 | 2.5 V | Output |
FMC Port A connector |
Output data from the master to the inputs of the slaves. |
spi_SCLK | M23 | 2.5 V | Output |
FMC Port A connector |
Clock driven by the master to slaves, to synchronize the data bits. |
spi_SS_n[0] | P27 | 2.5 V | Output |
FMC Port A connector |
Active low select signal driven by the master to individual slaves, to select the target slave. |
Interface Port Name | FPGA Pin Number | I/O Standard | Direction | Description |
---|---|---|---|---|
Avalon-ST User Data 3 | ||||
jesd204_avst_usr_din [LINK* TL_DATA_BUS_WIDTH-1:0] | — | — | Input | TX data from the Avalon-ST source interface. The
TL_DATA_BUS_WIDTH is determined by the following formulas:
|
jesd204_avst_usr_din_valid [LINK-1:0] | — | — | Input | Indicates whether data from the Avalon-ST source
interface to the transport layer is valid or invalid.
|
jesd204_avst_usr_din_ready [LINK-1:0] | — | — | Output | Indicates that the transport layer is ready to
accept data from the Avalon-ST source interface.
|
jesd204_avst_usr_dout [LINK*TL_DATA_BUS_WIDTH-1:0] | — | — | Output | RX data to the Avalon-ST sink interface. The
TL_DATA_BUS_WIDTH is determined by the following formulas:
|
jesd204_avst_usr_dout_valid [LINK-1:0] | — | — | Output | Indicates whether the data from the transport
layer to the Avalon-ST sink interface is valid or invalid.
|
jesd204_avst_usr_dout_ready [LINK-1:0] | — | — | Input | Indicates that the Avalon-ST sink interface is
ready to accept data from the transport layer.
|
jesd204_avst_patchk_data_error [LINK-1:0] | — | — | Output | Output signal from pattern checker indicating a pattern check error. |
System Parameters
The top level HDL file (jesd204b_ed.sv) includes system parameters that define the configuration of the reference design as a whole. The default values of the parameters are listed in the table below. You can change the values in the HDL file in order to customize the parameters to your system configuration but each parameter value must fall within the specified range as indicated in the table. When modifying the JESD204B IP core-related parameters (L, M, F, N, N_PRIME, S, CS), ensure that the corresponding parameter values in the JESD204B IP core located in the jesd204b_system.qsys Qsys project are set to match the values that you specified in the HDL file. See Modifying JESD204B IP Core Parameters section for more details.
Parameter |
Default Value |
Supported Values |
Description |
---|---|---|---|
LINK |
1 |
1, 2, …, n where n is any positive integer |
Number of JESD204B links. One link represents one JESD204B instance. |
L |
4 |
1, 2, 4, 8 |
Number of JESD204B lanes per converter device. |
M |
2 |
1, 2, 4, 8 |
Number of JESD204B converters per device. |
F |
1 |
1, 2, 4, 8 |
Number of JESD204B octets per frame. |
N |
14 |
12 – 16 |
Number of JESD204B conversion bits per converter device. |
N_PRIME |
16 |
16 |
Number of JESD204B transmitted bits per sample. |
S |
1 |
1, 2 |
Number of JESD204B transmitted samples per converter device per frame. |
CS |
0 |
0 - 3 |
Number of JESD204B control bits per conversion sample. |
F1_FRAMECLK_DIV |
4 |
1, 4 |
Divider ratio for frame_clk when F=1. Refer to Core PLL section for more details. |
F2_FRAMECLK_DIV |
2 |
1, 2 |
Divider ratio for frame_clk when F=2. Refer to Core PLL section for more details. |
POLYNOMIAL_LENGTH |
9 |
7, 9, 15, 23, 31 |
Defines the polynomial length for the PRBS pattern generator and checker, which is also the equivalent number of stages for the shift register.
This parameter value must not be larger than N, which is the output data width of the PRBS pattern generator or converter resolution. If an N value of 12-14 is required, PRBS-7 and PRBS-9 are the only feasible options. If an N value of 15-16 is required, PRBS-7, PRBS-9, and PRBS-15 are the only feasible options. |
FEEDBACK_TAP |
5 |
6, 5, 14, 18, 28 |
Defines the feedback tap for the PRBS pattern generator and checker. This is an intermediate stage that is XOR-ed with the last stage to generate to next PRBS bit.
|
Reference Design Software
The key feature of the reference design with ARM® HPS control unit is the ability to control certain aspects of the JESD204B system using a C-based, software control flow. Some of the capabilities enabled by the software control flow are:
- System reset—ability to reset individual modules (for example, core PLL, transceiver PHY, JESD204B base Avalon-MM interface, link clock domain, and frame clock domain) independently or in sequence.
- Initial and dynamic, real-time configuration of external converter devices via SPI interface.
- Dynamic reconfiguration of key modules in the reference design subsystem (for example, JESD204B IP core base layer, transceiver PHY, core PLL, and so forth).
- Error handling via interrupt service routines (ISR).
- Status register read back.
- Dynamic switching between real-time operation and test mode.
The software C code included as part of the reference design performs basic JESD204B link initialization and brings up the user command prompt, where you can enter commands to perform a wide variety of tasks. Modify the code as necessary to meet your system specifications.
User Commands
The steps in Setting up the Software Command Line Environment section show how you can compile and execute the software to bring up the App Console window in the SoC EDS tool. After executing the software, the App Console window displays a command prompt where you can enter commands to the ARM® HPS control unit to perform various tasks. The table below describes the commands that you can issue at the command prompt.
Type |
Command |
Description |
---|---|---|
Help |
h |
Display menu of available commands. |
Reset |
r [link select #] [p | x | c | l | f | h | r] |
Selective/global soft system reset. The [link select #] option selects the link that the command will take effect on. If no [link select #] option is indicated, the command will take effect on all links identically. The [p | x | c | l | f ] options indicate the specific submodule that the reset command will take effect on: [p] – Core PLL [x] – TX/RX Transceivers (JESD204B IP core PHY) [c] – TX/RX JESD204B IP core CSR [l] – TX/RX link reset [f] – TX/RX frame reset If none of the options above are indicated, all submodules are reset. You can indicate multiple options simultaneously to perform simultaneous submodule resets. The [h | r] options indicate if the reset is asserted and held or released from a hold: [h] – Assert and hold reset [r] – Release reset If none of the options above are indicated, the resets are pulsed (asserted and released automatically). When the [r] option is indicated, the reset is released immediately without checking for any qualifying conditions (for example, the PLL locked or transceiver ready signals). You are responsible to qualify the signals before holding or releasing the resets. |
Reset |
r [link select #] [p | x | c | l | f | h | r] |
(continued) Depending on the DATAPATH setting in the main.h file, the command takes effect on either the TX only datapath (if DATAPATH is set to TX only), the RX only datapath (if DATAPATH is set to RX only) or both TX and RX datapaths (if DATAPATH is set to duplex). Command examples:
|
Load SPI |
ls [slave select #] <offset> <value> |
Loads 8-bit value <value> (in C-style “0x” hexadecimal notation) into the register of external converter module connected to the SPI interface at offset <offset> (in C-style “0x” hexadecimal notation) indicated by [slave select #]. The maximum bit width of <offset> is 16 bits. |
Get SPI |
gs [slave select #] <offset> |
Gets the 8-bit value (in C-style “0x” hexadecimal notation) at the register of external converter module connected to SPI interface at offset <offset> (in C-style “0x” hexadecimal notation) indicated by [slave select #]. The maximum bit width of <offset> is 16 bits. |
Config SPI |
cs |
Configure external converter modules via SPI interface. |
Initialize |
i [link select #] [n] |
Initialize link indicated by [link select #]. The [link select #] option selects the link that the command will take effect on. If no [link select #] option is indicated, the command takes effect on all links identically. By default, the link is initialized to test mode (see ‘Test’ command). The optional [n] option initializes the link to user mode (see ‘Test’ command). Note: When setting to user mode, ensure that the user
input data valid signal (avst_usr_din_valid) is properly connected in the
top level HDL file (jesd204b_ed.sv). Failing to do so will result in
continuous error interrupts and may cause the system to hang.
The full sequence of steps executed by this command:
|
Status |
s [link select #] [t | r] |
Reports TX and/or RX link status of link indicated by [link select #]. Reads back tx_status0 and/or rx_status0 status registers from the JESD204B CSR identified by [link select #] and reports link status based on the values in those registers. For example, the command can report that the indicated link is not in sync or not in User Data Mode. In addition, the command reports the status of the pattern checker error signal. The [link select #] option selects the link that the command will take effect on. If no [link select #] option is indicated, the command takes effect on all links identically. The optional [t | r] options indicates the datapath to be reported: [t] – Report TX path status only [r] – Report RX path status only [no option] – Report default path status according to DATAPATH setting Depending on the DATAPATH setting in the main.h file, the command will take effect on either the TX only datapath (if DATAPATH is set to TX only), the RX only datapath (if DATAPATH is set to RX only) or both TX and RX datapaths (if DATAPATH is set to duplex). |
Loopback |
lb [link select #] [n] |
Puts the JESD204B IP core PHY indicated by [link select #] into transceiver serial loopback mode. This command is only applicable for links where the JESD204B IP core is configured in duplex mode (TX and RX datapaths present). The [link select #] option selects the link that the command will take effect on. If no [link select #] option is indicated, the command takes effect on all links identically. The optional [n] option sets the JESD204B IP core PHY indicated by [link select #] into non-serial loopback mode. |
Source/ Destination |
sd [link select #] [s | d] [u | a | r | p] |
Selects the source and destination datapath for the Avalon-ST interface of the link indicated by [link select #]. The [link select #] option selects the link that the command will take effect on. If no [link select #] option is indicated, the command takes effect on all links identically. The optional [s | d] option indicates whether the source (TX) or destination (RX) datapath is being selected: [s] – Source datapath (TX) [d] – Destination datapath (RX) [no option] – Default datapath according to DATAPATH setting Depending on the DATAPATH setting in the main.h file, the command will take effect on either the TX only datapath (if DATAPATH is set to TX only), the RX only datapath (if DATAPATH is set to RX only) or both TX and RX datapaths (if DATAPATH is set to duplex). The optional [u | a | r | p] option indicates the type of datapath to set to: Note: When setting to user mode, ensure that the user
input data valid signal (avst_usr_din_valid) is properly connected in the
top level HDL file (jesd204b_ed.sv). Failing to do so will result in
continuous error interrupts and may cause the system to hang.
[u] – User datapath (no test pattern generator and checker) [a] – Test pattern generator and checker set to alternate pattern [r] – Test pattern generator and checker set to ramp pattern [p] – Test pattern generator and checker set to PRBS pattern [no option] – Default to test pattern generator and checker set to PRBS pattern The test pattern generator and checker module has other configurable parameters that you can set. In particular, the pattern generator and checker derives its M and S values from the JESD204B IP core CSR. Also, there are other parameters such as POLYNOMIAL_LENGTH and FEEDBACK_TAP that are set during compile time. Refer to Chapter 5 of the JESD204B IP Core User Guide for more details. |
Test |
t [link select #] [n] |
Sets the link indicated by [link select #] to test mode. The [link select #] option selects the link that the command will take effect on. If no [link select #] option is indicated, the command takes effect on all links identically. The test mode is defined by:
The optional [n] option negates the test mode (set to user mode). User mode is defined as:
Note: When setting to user mode, ensure that the user
input data valid signal (avst_usr_din_valid) is properly connected in the
top level HDL file (jesd204b_ed.sv). Failing to do so will result in
continuous error interrupts and may cause the system to hang.
|
Reinitialization |
ri [link select #] [t | r] |
Trigger a link reinitialization on links indicated by [link select #]. The optional [link select #] option selects the link that the command will take effect on. If no [link select #] option is indicated, the command takes effect on all links identically. The optional [t | r] option indicates the type of reinitialization operation: [t] – TX link reinitialization; TX link transmits K28.5 packets continuously until link is out of CGS (Code Group Synchronization) phase [r] – RX link reinitialization; SYNC_N
signal is driven low until link is out of CGS (Code Group
Synchronization)
Note: Forcing RX link reinitialization will
trigger a TX SYNCN error
interrupt to the
processor.
The interrupt is automatically cleared by the software.
[no option] – For DATAPATH setting set to TX only or duplex, default to TX link reinitialization. For DATAPATH setting set to RX only, default to RX link reinitialization For more details on the reinitialization operation, refer to the JESD204B IP Core User Guide. |
Sysref |
sy |
Pulse SYSREF signal one time (“one-shot”) |
Reconfiguration |
rc [link select #] [l <value>] [m <value>] [f <value>] [s <value>] [n <value>] [np <value>] [cs <value>] [k <value>] [hd <value>] [scr <value>] [sub <value>] |
Dynamically reconfigure link indicated by [link select #] according to parameter-value pair option indicated. The optional [link select #] option selects the link that the command will take effect on. If no [link select #] option is indicated, the command takes effect on all links identically. The parameters that are dynamically configurable are as follows: [l] – Lanes per converter device [m] – Converters per device [f] – Octets per frame Note: The Altera test pattern generator and checker
do not support dynamic reconfiguration of F.
[s] – Samples per converter per frame [n] – Converter resolution [np] – Transmitted bits per sample [cs] – Control bits [k] – Frames per multi-frame [hd] – High density user data format [scr] – Enable scrambler [sub] – Subclass select The valid value ranges that can be entered for each parameter are governed by rules enforced by software. Refer to the Dynamic Reconfiguration section for more details. Command examples:
|
Dynamic Reconfiguration
One of the key features that the ARM® HPS enables is software-controlled dynamic reconfiguration of the JESD204B parameters. You can issue the reconfiguration command (rc) along with the parameters and values that you desire at the command prompt. The valid ranges for the values entered for each parameter are governed by certain rules. These rules are a function of:
- JESD204B IP core valid parameter ranges.
- JESD204B transport layer valid parameter ranges.
- Initially configured values for the JESD204B IP core.
The rule enforcement for valid ranges are implemented as discrete functions in the rules.c file (see Functions in rules.c Source File section) and are described in the table below. If you enter an invalid value, the software flags the error to the screen and disallows the change.
Command Options |
Parameters |
Rule |
---|---|---|
l |
L |
The value for L must be an integer within the range of 1-8. Returns 0 if valid, 1 if invalid. |
l |
L |
The value for L must not exceed the initially configured value. Returns 0 if valid, 1 if invalid. |
l |
L, F |
TL: The value for L must be an even number if F = 1. Returns 0 if valid, 1 if invalid. |
m |
M |
The value for M must be an integer within the range of 1-32. Returns 0 if valid, 1 if invalid. |
f |
F |
The value for F must be an integer within the range of 1,2, 4-256 (any integer value between 1-256 except 3) TL: The value for F must be an integer of the values 1, 2, 4, 8 Returns 0 if valid, 1 if invalid. Note: The Altera test pattern generator and checker
do not support dynamic reconfiguration of F.
|
f, m, s, np, l |
F, M, S, N’, L |
The values for M, S, N' and L must be such that the current value of F conforms to the formula F(current) = (M * S * N')/(8*L). If a new value of F is indicated, then F(current) = F(new). If not, then F(current) = F(initially configured). Returns 0 if valid, 1 if invalid. Note: The Altera test pattern generator and checker
do not support dynamic reconfiguration of F.
|
f, m, s, np, l |
F, M ,S, N’, L |
The value for F must not exceed the initially configured value. By extension, since F is defined by the formula F = (M * S * N')/(8*L), the values for M, S, N' and L must be such that the new value for F not exceed the initial configured value. Returns 0 if valid, 1 if invalid. Note: The Altera test pattern generator and checker
do not support dynamic reconfiguration of F.
|
s |
S |
The value for S must be an integer within the range of 1-32. Returns 0 if valid, 1 if invalid. |
n |
N |
The value for N must be an integer within the range of 1-32 TL: The value for N must be an integer within the range of 12-16. Returns 0 if valid, 1 if invalid. |
n, np |
N |
The value for N must adhere to the following range: N ≤ N'. Returns 0 if valid, 1 if invalid. |
np |
N’ |
The value for N' must be an integer within the range of 4-32. TL: Only N'=16 configuration is supported. Dynamic reconfiguration of N' parameter is not supported. Returns 0 if valid, 1 if invalid. |
cs |
CS |
The value for CS must be an integer within the range of 0-3. Returns 0 if valid, 1 if invalid. |
k |
K |
The value for K must be an integer within the range 17/F ≤ K ≤ min(32, floor(1024/F)). Returns 0 if valid, 1 if invalid. |
f, k |
F, K |
The value of F * K must be divisible by 4. Returns 0 if valid, 1 if invalid. |
hd |
High Density (HD) |
The value for HD must be either 0 or 1. Returns 0 if valid, 1 if invalid. |
hd, n |
HD, N |
TL: The value for HD can be 1 if and only if N=16. Returns 0 if valid, 1 if invalid. |
scr |
Scrambler Enable |
The value for SCR must be either 0 or 1. Returns 0 if valid, 1 if invalid. |
sub |
Subclass |
The value for subclass must be 0, 1 or 2. Returns 0 if valid, 1 if invalid. |
Software Interrupt Service Routines (ISR)
One key feature of the ARM® HPS control unit is the ability to handle interrupt requests (IRQ) from peripherals via ISR. The reference design main.c source code defines ISRs for the following peripherals:
- JESD204B IP core TX base layer
- JESD204B IP core RX base layer
- SPI master module
The ISRs in the reference design main.c source code is a very basic routine that performs these two tasks:
- Clear interrupt request (IRQ) error flag.
- Print error type and message (for JESD204B IP core TX and RX base layer ISR only).
The error types and messages printed by the JESD204B IP core TX and RX base layer ISRs respectively are listed below.
Error types printed by the JESD204B IP core TX base layer ISR:
- SYNC_N error
- SYSREF LMFC error
- DLL data invalid error
- Transport layer data invalid error
- SYNC_N link reinitialization request
- Transceiver PLL locked error
- Phase compensation FIFO full error
- Phase compensation FIFO empty error
Error types printed by the JESD204B IP core RX base layer ISR:
- SYSREF LMFC error
- DLL data ready error
- Transport layer data ready error
- Lane deskew error
- RX locked to data error
- Phase compensation FIFO full error
- Phase compensation FIFO empty error
- Code group synchronization error
- Frame alignment error
- Lane alignment error
- Unexpected K character
- Not in table error
- Running disparity error
- Initial Lane Alignment Sequence (ILAS) error
- DLL error reserve status
- ECC error corrected
- ECC error fatal
The error types correspond to the tx_err, rx_err0, and rx_err1 status registers in the JESD204B IP core TX and RX register maps respectively. The printing of interrupt error messages to the App Console window is controlled by the PRINT_INTERRUPT_MESSAGES parameter in the main.h header file. Set to ‘1’ (default) to print error messages, else set to ‘0’. Refer to the Software Parameters section for more details. Modify the ISRs in the source code to customize the interrupt handling response to your system specifications.
Software Parameters
Various behaviors of the main.c source code are controlled by software parameters defined in the main header file, main.h.
Parameter |
Description |
Default Value |
---|---|---|
DEBUG_MODE |
Set to 1 to print debug messages, else set to 0. |
0 |
PRINT_INTERRUPT_ MESSAGES |
Set to 1 to print JESD204B error interrupt messages, else set to 0. |
1 |
CONFIG_SPI |
Set to 1 to configure external converters via SPI interface at start of main.c execution, else set to 0. |
1 |
PATCHK_EN |
Set to 1 when test pattern checker is included in the initial design configuration, else set to 0. |
1 |
ALTERA_TRANSPORT_ LAYER |
Set to 1 when using Altera transport layer, else set to 0. |
1 |
BONDED |
Set to 1 when transceivers configured in bonded mode, set to 0 when transceivers configured in unbonded mode. |
0 |
DATAPATH |
Set to indicate JESD204B IP configuration:
|
3 |
DATA_RATE_LINK_n |
Set to indicate the initially configured serial data rate of link n in Mbps (for example, to set link 0 to 6144 Mbps, DATA_RATE_LINK_ 0=6144). For multi-link scenarios, add additional DATA_RATE_ LINK_n parameters to the DR_init[] array in main.c. Note: Data rate reconfiguration is not supported in this reference
design.
|
6144 |
DATA_RATE_MIN |
Set to indicate the minimum serial data rate (in Mbps) supported by the JESD204B IP core for the following device families:
Note: Data rate reconfiguration is not supported in this reference
design.
|
2000 |
MAX_LINKS |
Set to indicate the number of links in the design (for example, for dual link, set MAX_LINKS=2) Note: When using the design as-is, the maximum value
of MAX_ LINKS is
4.
To increase the limit, redesign the address map in QSYS.
|
1 |
LINE_BUFFER |
Sets the maximum number of characters that user can enter on command line. |
100 |
MAX_NUM_OPTIONS |
Sets the maximum number of options per command. |
20 |
MAX_OPTIONS_CHAR |
Sets the maximum number of characters per command option |
10 |
LOOPBACK_INIT |
Initial value of loopback. Set to 1 for internal serial loopback mode, else set to 0. |
1 |
SOURCEDEST_INIT |
Initial value of source/destination. Set to indicate test pattern generator/checker type or user mode:
|
PRBS |
F1_FRAMECLK_DIV |
Set to the F1_FRAMECLK_DIV parameter as defined in the top level HDL file (jesd204b_ed.sv). |
4 |
F2_FRAMECLK_DIV |
Set to the F2_FRAMECLK_DIV parameter as defined in the top level HDL file (jesd204b_ed.sv). |
2 |
SOC |
Set to 1 if source code is targeting ARM® HPS. Set to 0 if source code is targeting soft Nios II processor. |
1 |
Software Functions Description
This section describes the functions used in the main.c and rules.c source code and also the macros library in macros.c that facilitates access to the configuration and status registers (CSR) of the JESD204B system design. These functions and macros provide the building blocks for you to customize the software code to your system specifications.
Functions in main.c Source File
The function prototypes of the functions listed in the table below can be found in the functions.h header file.
Function Prototype | Description |
---|---|
void chomp (char * string) | Chomps trailing '\n' character from string. |
int StringIsNumeric (char * string) | Tests whether string is
numeric.
Returns 1 if true, 0 if false. |
int StringIsHex (char * string) | Tests whether string is a
hexadecimal number.
Returns 1 if true, 0 if false. |
void DelayCounter (alt_u32 count) | Delay counter. Counts up to count ticks, each tick is roughly 1 second (not accurate). |
void Get_L_Init (int * L_init) | Read initially configured value of L from each JESD204B IP core CSR in the design and store the value in L_init array. |
void Get_F_Init (int * F_init) | Read initially configured value of F from each JESD204B IP core CSR in the design and store the value in F_init array. |
void Get_FC_Init (int * FC_init , int * DR_init) | Calculate initially configured value of the frame rate by reading the relevant parameters from each JESD204B IP core CSR in the design and the serial data rate values stored in DR_init. Stores calculated value in FC_init array. |
int Initialize (char * options [][], int * held_resets) | Executes initialize command according to options. This function performs the
following actions:
|
void Help (void) | Prints menu of available commands. |
int Reset (char * options [][], int * held_resets) | Executes reset command according to options. This function calls two other
subfunctions depending on options:
|
int LoadSPI (char * options [][]) | Executes the load SPI command according to options.
Returns 0 if success, 1 if fail. |
int GetSPI (char * options [][]) | Executes get SPI command according to options.
Returns 0 if success, 1 if fail. |
int ConfigSPI (int * held_resets , int dnr) | Executes the configure SPI command according to
options.
Returns 0 if success, 1 if fail. |
int Status (char * options [][]) | Executes the report link status command
according to options.
Returns 0 if success, 1 if fail, 2 if sync errors found, 4 if pattern checker errors found, 6 if both sync errors and pattern checker errors found. |
int Loopback (char * options [][], int * held_resets , int dnr) | Executes the loopback command according to options.
Returns 0 if success, 1 if fail. |
int SourceDest (char * options [][], int * held_resets , int dnr) | Executes the source or destination datapath
selection command according to options.
Returns 0 if success, 1 if fail. |
int Test (char * options [][], int * held_resets) | Executes the test mode command according to options. Test mode:
|
int Reinit (char * options [][], int * held_resets) | Executes the reinit command according to options. This function performs the
following actions:
|
void Sysref (void) | Pulse SYSREF signal one time (that is in "one-shot"). |
int Reconfig (char * options [][], int * L_init , int * F_init , int * DR_init , int * FC_init , int * current_dr_div , unsigned int link_clk_pll_ counter_val_init , unsigned int frame_clk_pll_ counter_val_init , unsigned int * xcvr_native_ array_ptr [][], unsigned int * xcvr_pll_ array_ptr [][], int * held_resets) | Executes dynamic reconfiguration command. This
function performs three major tasks:
Returns 0 if success, 1 if fail. |
void ResetHard (void) | Triggers full hardware reset sequence via PIO control registers. |
int ResetSeq (int link , int * held) | Performs full hardware reset sequence on the indicated link via software interface .
Returns 0 if success, 1 if fail. |
int ResetForce (int link , int reset_val , int hold_release , int * held_resets) | Forces reset assertion or deassertion on
submodule resets for the link indicated by
reset_val. The function also decides
whether to assert and hold (hold_release
=2), deassert ( hold_release =1) or pulse (
hold_release =0) indicated resets. The
function has mechanisms (using the global held_resets flag) to ensure that held resets that are not
the target of the reset force function are not affected by it.
Returns 0 if success, 1 if fail. |
int Reset_PLL_Release (int link, int * held_resets) | Deassert the core PLL reset signal. Wait until
the core PLL locked signal assert before returning.
Returns 0 if success, 1 if fail. |
int Reset_X_L_F_Release (int link, int * held_resets) | Deassert the transceiver, link, and frame
resets. This function deasserts the TX transceiver reset first,
waits until the TX transceiver ready signal asserts, then deasserts
the TX link and TX frame resets. The function then repeats the above
actions with the RX data path.
Returns 0 if success, 1 if fail. |
void spiWrite (alt_u16 offset, alt_u8 m_data, alt_u8 slave) | Performs SPI write operation of m_data to SPI slave indicated by slave number at address offset offset. The maximum bit width of m_data is 8 bits while the maximum bit width of offset is 16 bits. |
alt_u8 spiRead (alt_u16 offset, alt_u8 slave) | Performs SPI read operation of SPI slave indicated by slave number at address offset offset. Returns 8-bit read value. The maximum bit width of offset is 16 bits. |
void spiVerify (alt_u16 offset , alt_u8 slave, alt_u8 data) | Performs SPI read operation of SPI slave indicated by slave number at address offset offset, compares the read data to data, then reports whether the read data matches the user-given data. The maximum bit width of data is 8 bits while the maximum bit width of offset is 16 bits. |
void Config_AD9680 (alt_u8 slave) | Executes a series of spiWrites to the AD9680 slave to configure it. |
void InitISR (void) | Initialize the interrupt controllers for the
following peripherals:
|
Functions in rules.c Source File
The rules enforced by the dynamic reconfiguration function to check validity of the reconfiguration values for each JESD204B parameter are coded as discrete functions in rules.c. In the table below, the transport layer rules are indicated by “TL:”. The function prototypes of the functions listed in the table below can be found in the rules.h header file.
Function Prototype | Parameters | Rule/Function Description |
---|---|---|
int Min (int val1 , int val2) | — | Returns the minimum of val1 and val2. |
int L_Range (int val) | L | The value for L must be an integer within the
range of 1-8.
Returns 0 if valid, 1 if invalid. |
int L_Max (int val, int init) | L | The value for L must not exceed the initially
configured value.
Returns 0 if valid, 1 if invalid. |
int L_Even (int L_val, int F_val) | L, F | The value for L must be an even number if F = 1.
Returns 0 if valid, 1 if invalid. |
int M_Range (int val) | M | The value for M must be an integer within the
range of 1-32.
Returns 0 if valid, 1 if invalid. |
int F_Range (int val) | F | The value for F must be an integer within the
range of 1,2, 4-256 (any integer value between 1-256 except 3)
TL: The value for F must be an integer of the values 1, 2, 4, 8. Returns 0 if valid, 1 if invalid. |
int F_Max (int val, int init) | F, M ,S, N', L | The value for F must not exceed the initially
configured value. By extension, since F is defined by the formula F
= (M * S * N')/(8*L), the values for M, S, N' and L must be such
that the new value for F not exceed the initial configured value.
Returns 0 if valid, 1 if invalid. |
int F_Equal (int M_val, int S_val, int NP_val, int L_val, int F_val) | F, M, S, N', L | The values for M, S, N' and L must be such that
the current value of F conforms to the formula F(current) = (M * S *
N')/(8*L). If a new value of F is indicated, then F(current) =
F(new). If not, then F(current) = F(initially configured).
Returns 0 if valid, 1 if invalid. |
int S_Range (int val) | S | The value for S must be an integer within the
range of 1-32.
Returns 0 if valid, 1 if invalid. |
int N_Range (int val) | N | The value for N must be an integer within the
range of 1-32.
TL: The value for N must be an integer within the range of 12-16. Returns 0 if valid, 1 if invalid. |
int N_Max (int val, int max) | N | The value for N must adhere to the range of N ≤
N'.
Returns 0 if valid, 1 if invalid. |
int NP_Range (int val) | N' | The value for N' must be an integer within the
range of 4-32.
Returns 0 if valid, 1 if invalid. |
int CS_Range (int val) | CS | The value for CS must be an integer within the
range of 0-3.
Returns 0 if valid, 1 if invalid. |
int K_Range (int K_val, int F_val) | K | The value for K must be an integer within the
range 17/F ≤ K ≤ min(32, floor(1024/F)).
Returns 0 if valid, 1 if invalid. |
int FxK_Div_4 (int FxK_val) | F, K | The value of F * K must be divisible by 4.
Returns 0 if valid, 1 if invalid. |
int HD_Range (int val) | High Density (HD) | The value for HD must be either 0 or 1.
Returns 0 if valid, 1 if invalid. |
int HD_Transport (int HD_val, int N_val) | HD, N | TL: The value for HD can be 1 if and only if
N=16.
Returns 0 if valid, 1 if invalid. |
int SCR_Range (int val) | Scrambler Enable | The value for SCR must be either 0 or 1.
Returns 0 if valid, 1 if invalid. |
int SUB_Range (int val) | Subclass | The value for subclass must be 0, 1 or 2.
Returns 0 if valid, 1 if invalid. |
int DR_Range (int val) | Serial Data Rate | The value for DR must be 1, 2, 4. DR value is
integer divisor of initially configured serial data rate. For
example, DR=2 means the initially configured data rate divided by 2.
Returns 0 if valid, 1 if invalid. |
int DR_Min (int dr_init, int val) | Serial Data Rate | The value for DR must not fall below the
minimum allowable range of the target device family. Minimum serial
data rate spec:
Returns 0 if valid, 1 if invalid. |
int FC_Range (int val) | Frame clock, serial data rate, M, S, N', L | The values of serial data rate, M, S, N' and L
must be such that the new frame clock value, FC(new) does not exceed
the initially configured frame clock value, FC(initially
configured). Furthermore, the ratio of FC(initially configured) to
FC(new) must be 1, 2, 4 only.
Returns 0 if valid, 1 if invalid. |
Custom Peripheral Access Macros in macros.c Source File
A set of peripheral access macros are provided for you to access specific information in the CSR of the following peripherals:
- Reset sequencer
- JESD204B IP core TX base layer
- JESD204B IP core RX base layer
- FPGA core control PIO
- FPGA core status PIO
The function prototypes of the macros listed in the table below can be found in the macros.h header file.
Function Prototype | Description |
---|---|
int CALC_BASE_ADDRESS_LINK (int base , int link) | Calculates and returns the base address based on the link provided. In the QSYS system (jesd204b_ed_soc.qsys) address map, bits 16-17 are reserved for multi-link addressing. The address map allocation allows for up to a maximum of 4 links to be supported using the existing address map. The number of multi-links in the design is defined by the MAX_LINKS parameter in the main.h header file. You are responsible to set the parameter correctly to reflect the system configuration. |
int CALC_BASE_ADDRESS_XCVR_PLL (int base , int instance) | Calculates and returns the base address of the TX transceiver PLL (ATX PLL) based on the instance number. In the JESD204B subsystem (jesd204b_system.qsys) address map, bits 12-13 are reserved for multi ATX PLL addressing. The address map allocation allows for up to a maximum of four ATX PLLs per link to be supported using the existing address map. The number of ATX PLLs per link in the design is defined by the XCVR_PLL_PER_LINK parameter in the main.h header file. You are responsible to set the parameter correctly to reflect the system configuration. |
int IORD_RESET_SEQUENCER_STATUS_REG (int link) | Read reset sequencer status register at link and return the value. |
int IORD_RESET_SEQUENCER_RESET_ACTIVE (int link) | Read reset sequencer status register at link and return 1 if the reset active signal is asserted, else return 0. |
void IOWR_RESET_SEQUENCER_INIT_RESET_SEQ (int link) | Write reset sequencer at link to trigger full hardware reset sequence. |
void IOWR_RESET_SEQUENCER_FORCE_RESET (int link , int val) | Write reset sequencer at link to force assert or deassert resets based on the val value. |
int IORD_JESD204_TX_STATUS0_REG (int link) | Read the JESD204B TX CSR tx_status0 register at link and return the value. |
int IORD_JESD204_TX_SYNCN_SYSREF_CTRL_REG (int link) | Read the JESD204B TX CSR syncn_sysref_ctrl register at link and return the value. |
void IOWR_JESD204_TX_SYNCN_SYSREF_CTRL_REG (int link , int val) | Write val value into the JESD204B TX CSR syncn_sysref_ctrl register at link link. |
int IORD_JESD204_RX_STATUS0_REG (int link) | Read JESD204B RX CSR rx_status0 register at link link and return value. |
int IORD_JESD204_RX_SYNCN_SYSREF_CTRL_REG (int link) | Read JESD204B RX CSR syncn_sysref_ctrl register at link link and return value. |
void IOWR_JESD204_RX_SYNCN_SYSREF_CTRL_REG (int link, int val) | Write val value into the JESD204B RX CSR syncn_sysref_ctrl register at link. |
int IORD_JESD204_TX_ILAS_DATA1_REG (int link) | Read the JESD204B TX CSR ilas_data1 register at link and return the value. |
int IORD_JESD204_RX_ILAS_DATA1_REG (int link) | Read the JESD204B RX CSR ilas_data1 register at link and return the value. |
void IOWR_JESD204_TX_ILAS_DATA1_REG (int link, int val) | Write val value into the JESD204B TX CSR ilas_data1 register at link. |
void IOWR_JESD204_RX_ILAS_DATA1_REG (int link, int val) | Write val value into the JESD204B RX CSR ilas_data1 register at link. |
int IORD_JESD204_TX_ILAS_DATA2_REG (int link) | Read the JESD204B TX CSR ilas_data2 register at link and return the value. |
int IORD_JESD204_RX_ILAS_DATA2_REG (int link) | Read the JESD204B RX CSR ilas_data2 register at link and return the value. |
void IOWR_JESD204_TX_ILAS_DATA2_REG (int link, int val) | Write val value into the JESD204B TX CSR ilas_data2 register at link. |
void IOWR_JESD204_RX_ILAS_DATA2_REG (int link, int val) | Write val value into the JESD204B RX CSR ilas_data2 register at link. |
int IORD_JESD204_TX_ILAS_DATA12_REG (int link) | Read the JESD204B TX CSR ilas_data12 register at link and return the value. |
int IORD_JESD204_RX_ILAS_DATA12_REG (int link) | Read the JESD204B RX CSR ilas_data12 register at link and return the value. |
void IOWR_JESD204_TX_ILAS_DATA12_REG (int link, int val) | Write val value into the JESD204B TX CSR ilas_data12 register at link. |
void IOWR_JESD204_RX_ILAS_DATA12_REG (int link, int val) | Write val value into the JESD204B RX CSR ilas_data12 register at link. |
int IORD_JESD204_TX_GET_L_VAL (int link) | Read the JESD204B TX CSR ilas_data1 register at link and return the L value. |
int IORD_JESD204_RX_GET_L_VAL (int link) | Read the JESD204B RX CSR ilas_data1 register at link and return the L value. |
int IORD_JESD204_TX_GET_F_VAL (int link) | Read the JESD204B TX CSR ilas_data1 register at link and return the F value. |
int IORD_JESD204_RX_GET_F_VAL (int link) | Read the JESD204B RX CSR ilas_data1 register at link and return the F value. |
int IORD_JESD204_TX_GET_K_VAL (int link) | Read the JESD204B TX CSR ilas_data1 register at link and return the K value. |
int IORD_JESD204_RX_GET_K_VAL (int link) | Read JESD204B RX CSR ilas_data1 register at link link and return K value. |
int IORD_JESD204_TX_GET_M_VAL (int link) | Read the JESD204B TX CSR ilas_data1 register at link and return the M value. |
int IORD_JESD204_RX_GET_M_VAL (int link) | Read the JESD204B RX CSR ilas_data1 register at link and return the M value. |
int IORD_JESD204_TX_GET_N_VAL (int link) | Read the JESD204B TX CSR ilas_data1 register at link and return the N value. |
int IORD_JESD204_RX_GET_N_VAL (int link) | Read the JESD204B RX CSR ilas_data1 register at link and return the N value. |
int IORD_JESD204_TX_GET_NP_VAL (int link) | Read the JESD204B TX CSR ilas_data1 register at link and return the NP value. |
int IORD_JESD204_RX_GET_NP_VAL (int link) | Read the JESD204B RX CSR ilas_data1 register at link and return the NP value. |
int IORD_JESD204_TX_GET_S_VAL (int link) | Read the JESD204B TX CSR ilas_data1 register at link and return the S value. |
int IORD_JESD204_RX_GET_S_VAL (int link) | Read theJESD204B RX CSR ilas_data1 register at link and return the S value. |
int IORD_JESD204_TX_GET_HD_VAL (int link) | Read the JESD204B TX CSR ilas_data1 register at link and return the HD value. |
int IORD_JESD204_RX_GET_HD_VAL (int link) | Read the JESD204B RX CSR ilas_data1 register at link and return the HD value. |
int IORD_JESD204_TX_LANE_CTRL_REG (int link, int offset) | Read the JESD204B TX CSR lane_ctrl_* register at link and return the value. |
int IORD_JESD204_RX_LANE_CTRL_REG (int link, int offset) | Read the JESD204B RX CSR lane_ctrl_* register at link and return the value. |
void IOWR_JESD204_TX_LANE_CTRL_REG (int link, int offset, int val) | Write val value into the JESD204B TX CSR lane_ctrl_* register at link. |
void IOWR_JESD204_RX_LANE_CTRL_REG (int link, int offset, int val) | Write val value into the JESD204B RX CSR lane_ctrl_* register at link. |
int IORD_PIO_CONTROL_REG (void) | Read the PIO control register and return the value. |
void IOWR_PIO_CONTROL_REG (int val) | Write val value into the PIO control register. |
int IORD_PIO_STATUS_REG (void) | Read the PIO status register and return thevalue. |
int IORD_JESD204_TX_TEST_MODE_REG (int link) | Read the JESD204B TX CSR tx_test register at link and return the value. |
int IORD_JESD204_RX_TEST_MODE_REG (int link) | Read the JESD204B RX CSR rx_test register at link and return the value. |
void IOWR_JESD204_TX_TEST_MODE_REG (int link, int val) | Write val value into the JESD204B TX CSR tx_test register at link. |
void IOWR_JESD204_RX_TEST_MODE_REG (int link, int val) | Write val value into the JESD204B RX CSR rx_test register at link. |
int IORD_JESD204_RX_ERR0_REG (int link) | Read the JESD204B RX CSR rx_err0 register at link and return the value. |
void IOWR_JESD204_RX_ERR0_REG (int link, int val) | Write val value into the JESD204B RX CSR rx_err0 register at link. |
int IORD_JESD204_RX_ERR1_REG (int link) | Read the JESD204B RX CSR rx_err1 register at link and return the value. |
void IOWR_JESD204_RX_ERR1_REG (int link, int val) | Write val value into the JESD204B RX CSR rx_err1 register at link. |
int IORD_JESD204_TX_ERR_REG (int link) | Read the JESD204B TX CSR tx_err register at link link and return the value. |
void IOWR_JESD204_TX_ERR_REG (int link, int val) | Write val value into the JESD204B TX CSR tx_err register at link. |
int IORD_XCVR_NATIVE_A10_REG (int link, int offset) | Read the transceiver reconfiguration register at link and address offset at offset and return the value. |
void IOWR_XCVR_NATIVE_A10_REG (int link, int offset, int val) | Write val value into the transceiver reconfiguration register at link and address offset at offset. |
int IORD_XCVR_ATX_PLL_A10_REG (int link, int instance, int offset) | Read the ATX PLL reconfiguration register indicated by the instance number instance at link and address offset at offset and return the value. |
void IOWR_XCVR_ATX_PLL_A10_REG (int link, int instance, int offset, int val) | Write val value into the ATX PLL reconfiguration register indicated by instance number instance at link and address offset at offset. |
int IORD_CORE_PLL_RECONFIG_C0_COUNTER_REG (void) | Read the core PLL reconfiguration C0 counter register and return the value. |
int IORD_CORE_PLL_RECONFIG_C1_COUNTER_REG (void) | Read the core PLL reconfiguration C1 counter register and return the value. |
void IOWR_CORE_PLL_RECONFIG_C0_COUNTER_REG (int val) | Write val value into the core PLL reconfiguration C0 counter register. |
void IOWR_CORE_PLL_RECONFIG_C1_COUNTER_REG (int val) | Write val value into the core PLL reconfiguration C1 counter register. |
Customizing the Reference Design
This section contains instructions on how to customize the reference design to various configurations.
Modifying JESD204B IP Core Parameters
To customize the JESD204B IP core parameters to meet your specifications, follow these steps:
- Launch the Quartus® Prime software.
- On the File menu, click Open.
- Browse and select the jesd204b_ed_soc.qsys file located in the project directory.
- Click Open to view the Qsys system in the System Contents window.
- Right-click on the jesd204b_subsystem_0 module and select the Drill into subsystem option. The jesd204b_system.qsys project opens in the System Contents window.
- In the System Contents window, locate the jesd204b module and double-click it to open the parameter editor. This brings up the Parameters tab that shows the current parameter settings of the JESD204B IP core.
- Modify the IP core parameters of the jesd204b module as necessary per your system specifications. When you are done, navigate to File and click Save.
- Click the Move to the top of hierarchy button to move back to the jesd204b_ed_soc.qsys view.
- Click Generate HDL to generate the HDL files needed for Quartus compilation.
- After the HDL generation completes, click Finish to save your Qsys settings and exit the Qsys window.
- You have to manually change the system parameters in the top level HDL file to match the parameters that you set in the Qsys project (if applicable). Open the top level HDL file (jesd204b_ed.sv) in any text editor of your choice.
- Modify the system parameters at the top of the file to match the new JESD204B IP core settings in the Qsys project, if applicable. Refer to the System Parameters section for more details on the system parameters.
- Save the file and compile the design in Quartus as per the instructions in the Compiling the HDL and Programming the Board section.
Modifying the Data Rate or Reference Clock Frequency
When changing the data rate or reference clock frequency, be aware of the relationships between the serial data rate, link clock, and frame clock as described in the Core PLL section. Change the PLL output clock settings accordingly to meet the clock frequency requirements. Also note the F1_FRAMECLK_DIV and F2_FRAMECLK_DIV frame clock division factor parameters for cases when F=1 or F=2. These parameters further divide down the frame clock frequency requirement so the resulting clock frequency is within bounds of timing closure for the FPGA core fabric. See the Core PLL section for more details on clocking requirements and the System Parameter section for more details on the frame clock division factor parameters. Follow the steps below when changing the serial data rate or reference clock frequency.
- Go through the steps in the Modifying JESD204B IP Core Parameters section to open the jesd204b_system.qsys project in the QSYS window.
- Double-click the jesd204b module to bring up the JESD204B IP core parameter editor.
- Change the Data rate and PLL/CDR Reference Clock Frequency values as necessary to meet your system requirements.
- If the clock frequency values for device_clk, link_clk, frame_clk, or mgmt_clk needs to be updated, double-click the relevant clock source module in the jesd204b_system.qsys System Contents tab and modify the clock frequency values accordingly.
- Navigate back to the top level jesd204b_ed_soc.qsys hierarchy.
- If the clock frequency values for device_clk, link_clk, frame_clk, or mgmt_clk needs to be updated, double-click the relevant clock source module in the jesd204b_ed_soc.qsys System Contents tab and modify the clock frequency value accordingly.
- Click Generate HDL to generate the HDL files needed for Quartus compilation.
- After the HDL generation completes, click Finish to save your settings and exit the Qsys window.
- Change the core PLL reference clock or output clock frequency values, if relevant, to match your system requirements. In the Quartus Project Navigator panel, select IP Components from the pull-down menu and double-click the core_pll entity. This brings up the Altera PLL parameter editor.
- In the Altera PLL parameter editor, modify the Reference Clock Frequency value under the General tab to meet your system requirements. Ensure that the reference clock frequency value matches the ones set for the jesd204b module in the Qsys project. Also, change the outclk0 group settings (which correspond to the link clock) and outclk1 group settings (which correspond to the frame clock) if necessary. Ensure that the link clock and frame clock values satisfy the frequency requirements as described in the Core PLL section.
- When you are done with the edits, click Finish to save your settings.
- If the frame clock settings (outclk1 of the core_pll module) are such that F1_FRAMECLK_DIV or F2_FRAMECLK_DIV values need to be changed, modify the relevant system parameters in the top level HDL file, jesd204b_ed.sv as described in the Modifying JESD204B IP Core Parameters section.
- Save the file and compile the design in Quartus as per the instructions in the Compiling the HDL and Programming the Board section.
Implementing a Multi-Link Design
The reference design Qsys projects, top level HDL, and software source code are designed for easy implementation of a JESD204B multi-link use case. In the Qsys project, each link in a JESD204B multi-link use case corresponds to a single instantiation of the jesd204b_subsystem module, which includes the JESD204B IP core and other support modules. This section assumes that each jesd204b_subsystem module in the multi-link design has identical parameter configurations. In the top level HDL, each link in a JESD204B multi-link use case corresponds to an instantiation of a transport layer TX and RX pair and a pattern generator and checker pair (assuming duplex data path configuration). The HDL uses the Verilog generate statement using the system parameter LINK as an index variable to generate the requisite number of instances for the multi-link use case (see System Parameters section for more details). This section assumes that each transport layer TX and RX pair and pattern generator and checker pair in the multi-link design has identical parameter configurations. In the software source code, all relevant software tasks are coded with multi-link capabilities. The software parameter that defines the number of links in the design is the MAX_LINKS parameter in the main.h header file (see Software Parameters section for more details). In a multi-link scenario, each software action performs an identical task on each link starting with link 0 and proceeding sequentially until the link indicated by the MAX_LINKS parameter.
To implement a multi-link design, perform these procedures:
- Edit the Qsys project.
- Edit the top level HDL file.
- Edit the software source code.
The following sections describe these procedures in detail.
Editing the Qsys Project
- Open the top level Qsys project (jesd204b_ed_soc.qsys) as per the instructions in the Qsys system section.
- Each JESD204B link is represented by a single jesd204b_subsystem instantiation. To implement multi-links in Qsys, duplicate the jesd204b_subsystem instantiations. In the System Contents tab, right-click on the jesd204b_subsystem_0 module and select Duplicate. This duplicates the jesd204b_subsystem_0 module to a new module called jesd204b_subsystem_1.
- Connect the jesd204b_subsystem_1 ports as shown in the table below. Any
ports not described in the table below should be exported. To export a port,
double-click on the Double-click to export label in the Export column of the System Contents
tab.
Table 20. Port Connections of jesd204b_subsystem_1 Module Ports of jesd204b_subsystem_1 Module
Connection
device_clk
device_clk.clk
do_not_connect_reset_0
mgmt_clk.clk_reset
do_not_connect_reset_1
mgmt_clk.clk_reset
do_not_connect_reset_2
mgmt_clk.clk_reset
frame_clk
frame_clk.clk
jesd204b_jesd204_rx_int
hps_0.f2h_irq0
ILC.irq
jesd204b_jesd204_tx_int
hps_0.f2h_irq0
ILC.irq
link_clk
link_clk.clk
mgmt_clk
mgmt_clk.clk
mgmt_reset
mgmt_clk.clk_reset
mm_bridge_s0
fpga_only_master.master
mm_bridge_0.m0
reset_seq_irq
hps_0.f2h_irq0
ILC.irq
reset_seq_pll_reset
Do not connect
reset_seq_reset_in0
mgmt_clk.clk_reset
- Adjust the IRQ port count of the ILC module to accommodate new interrupt ports of the jesd204b_subsystem_1 module. Double-click the ILC module in the System Contents tab. In the ILC module Parameters tab, adjust the IRQ_PORT_COUNT parameter to 9.
- Adjust the interrupt priorities of the interrupt ports (for example, jesd204b_jesd204_rx_int , jesd204b_jesd204_tx_int, reset_seq_irq) of the new jesd204b_subsystem_1 module as necessary to meet your system specifications. Click on the priority number of the relevant interrupt ports in the IRQ column of the System Contents tab and edit accordingly. The lower the number, the higher the priority.
- Assign the address map of
the jesd204b_subsystem_1 module. Refer to the Top Level Qsys Address Map section for more details on the
top level Qsys project address map.
Bits
16-17 of the Avalon-MM bridge (0x0004_0000 base address) indicate the link
number. Assign the address map of the jesd204b_subsystem_1 module as shown in
the
figure below.
Figure 8. Multi-Link Address Map
Notice that bits 16-17 of the address map denote the link indicator. For subsequent links, increment the link indicator accordingly. Up to 4 links can be supported in this manner.
Attention: Do not exceed the maximum number of links (4) that the address map can support. - Repeat steps 2 – 6 for subsequent links in your design.
- Click Generate HDL to generate the HDL files needed for Quartus compilation.
- After the HDL generation completes, click Finish to save your Qsys settings and exit the Qsys window.
Editing the Top Level HDL File
- Open the top level HDL file (jesd204b_ed.sv) in any text editor of your choice.
- Modify the LINK system parameter to reflect the number of links in your design.
- Replace the single-link jesd204b_ed_soc instance with the multi-link one generated from Editing the QSYS Project section above.
- Reconnect in a similar way all the ports that are similar between the single-link jesd204b_ed_soc instance and the multi-link one.
- The ports that are new in the
multi-link jesd204b_ed_soc
instance are the ports associated with the jesd204b_subsystem_1 module. Connect the ports that have jesd204b_subsystem_1_* prefix as shown in the example below:
.jesd204b_subsystem_1_jesd204b_txlink_rst_n_reset_n (tx_link_rst_n[1]),
- Repeat step 5 for subsequent links in your design.
- Save the file and compile the design in Quartus as per the instructions in the Compiling the HDL and Programming the Board section.
Ensure that any additional pins that are available from the addition of multi-links (for example, tx_serial_data and rx_serial_data pins) have the proper pin assignments in the Quartus settings file (jesd204b_ed.qsf).
Editing the Software Source Code
- Open the main.h header file in any text editor of your choice.
- Change the MAX_LINKS parameter to match the number of links implemented in your
design and save the file.
Attention: Do not exceed the maximum number of links (4) that the address map can support.
- Compile and execute the source code as per the instructions in the Setting up the Software Command Line Environment section.
AN 755 Document Revision History
Date | Version | Changes |
---|---|---|
December 2015 | 2015.12.30 | Initial release. |